Lines Matching refs:CeedVector
11 mutable struct CeedVector <: AbstractCeedVector struct
12 ref::RefValue{C.CeedVector} argument
14 CeedVector(ref::Ref{C.CeedVector}) = new(ref, nothing) argument
18 CeedVector(c::Ceed, len::Integer; allocate::Bool=true)
20 Creates a `CeedVector` of given length. If `allocate` is false, then no memory is allocated.
24 function CeedVector(c::Ceed, len::Integer; allocate::Bool=true) function
25 ref = Ref{C.CeedVector}()
27 obj = CeedVector(ref)
37 destroy(v::CeedVector) = C.CeedVectorDestroy(v.ref) # COV_EXCL_LINE argument
38 Base.getindex(v::CeedVector) = v.ref[] argument
40 Base.summary(io::IO, v::CeedVector) = print(io, length(v), "-element CeedVector") argument
41 function Base.show(io::IO, ::MIME"text/plain", v::CeedVector) argument
48 Base.show(io::IO, v::CeedVector) = witharray_read(a -> show(io, a), v, MEM_HOST) argument
50 function Base.length(::Type{T}, v::CeedVector) where {T}
56 Base.ndims(::CeedVector) = 1 argument
57 Base.ndims(::Type{CeedVector}) = 1 argument
58 Base.axes(v::CeedVector) = (Base.OneTo(length(v)),) argument
59 Base.size(v::CeedVector) = (length(Int, v),) argument
60 Base.length(v::CeedVector) = length(Int, v) argument
63 setvalue!(v::CeedVector, val::Real)
65 Set the [`CeedVector`](@ref) to a constant value.
67 setvalue!(v::CeedVector, val::Real) = C.CeedVectorSetValue(v[], val) argument
69 setindex!(v::CeedVector, val::Real)
72 Set the [`CeedVector`](@ref) to a constant value, synonymous to [`setvalue!`](@ref).
74 Base.setindex!(v::CeedVector, val::Real) = setvalue!(v, val) argument
77 norm(v::CeedVector, ntype::NormType)
79 Return the norm of the given [`CeedVector`](@ref).
83 function norm(v::CeedVector, ntype::NormType) argument
90 norm(v::CeedVector, p::Real)
92 Return the norm of the given [`CeedVector`](@ref), see [`norm(::CeedVector,
98 function norm(v::CeedVector, p::Real) argument
106 error("norm(v::CeedVector, p): p must be 1, 2, or Inf")
112 reciprocal!(v::CeedVector)
116 reciprocal!(v::CeedVector) = C.CeedVectorReciprocal(v[]) argument
119 setarray!(v::CeedVector, mtype::MemType, cmode::CopyMode, arr)
121 Set the array used by a [`CeedVector`](@ref), freeing any previously allocated array if
129 function setarray!(v::CeedVector, mtype::MemType, cmode::CopyMode, arr) argument
137 syncarray!(v::CeedVector, mtype::MemType)
139 Sync the [`CeedVector`](@ref) to a specified [`MemType`](@ref). This function is used to
143 syncarray!(v::CeedVector, mtype::MemType) = C.CeedVectorSyncArray(v[], mtype) argument
146 takearray!(v::CeedVector, mtype::MemType)
148 Take ownership of the [`CeedVector`](@ref) array and remove the array from the
149 [`CeedVector`](@ref). The caller is responsible for managing and freeing the array. The
152 function takearray!(v::CeedVector, mtype::MemType) argument
186 Executes `body`, having extracted the contents of the [`CeedVector`](@ref) `v` as an array
191 Negate the contents of `CeedVector` `v`:
230 setindex!(v::CeedVector, v2::AbstractArray)
233 Sets the values of [`CeedVector`](@ref) `v` equal to those of `v2` using broadcasting.
235 Base.setindex!(v::CeedVector, v2::AbstractArray) = @witharray(a = v, a .= v2) argument
238 CeedVector(c::Ceed, v2::AbstractVector; mtype=MEM_HOST, cmode=COPY_VALUES)
240 Creates a new [`CeedVector`](@ref) using the contents of the given vector `v2`. By default,
241 the contents of `v2` will be copied to the new [`CeedVector`](@ref), but this behavior can
244 function CeedVector(c::Ceed, v2::AbstractVector; mtype=MEM_HOST, cmode=COPY_VALUES) function
245 v = CeedVector(c, length(v2); allocate=false)
251 Vector(v::CeedVector)
255 function Base.Vector(v::CeedVector) argument
261 witharray(f, v::CeedVector, mtype=MEM_HOST)
263 Calls `f` with an array containing the data of the `CeedVector` `v`, using [`memory
279 function witharray(f, v::CeedVector, mtype::MemType=MEM_HOST) argument
292 witharray_read(f, v::CeedVector, mtype::MemType=MEM_HOST)
303 function witharray_read(f, v::CeedVector, mtype::MemType=MEM_HOST) argument
316 scale!(v::CeedVector, a::Real)
320 function scale!(v::CeedVector, a::Real) argument
326 axpy!(a::Real, x::CeedVector, y::CeedVector)
334 function axpy!(a::Real, x::CeedVector, y::CeedVector) argument
340 pointwisemult!(w::CeedVector, x::CeedVector, y::CeedVector)
344 function pointwisemult!(w::CeedVector, x::CeedVector, y::CeedVector) argument