# CeedVector

LibCEED.CeedVectorType
CeedVector(c::Ceed, len::Integer)

Creates a CeedVector of given length.

source
CeedVector(c::Ceed, v2::AbstractVector; mtype=MEM_HOST, cmode=COPY_VALUES)

Creates a new CeedVector using the contents of the given vector v2. By default, the contents of v2 will be copied to the new CeedVector, but this behavior can be changed by specifying a different cmode.

source
Base.VectorMethod
Vector(v::CeedVector)

Create a new Vector by copying the contents of v.

source
LibCEED.@witharrayMacro
@witharray(v_arr=v, [size=(dims...)], [mtype=MEM_HOST], body)

Executes body, having extracted the contents of the CeedVector v as an array with name v_arr. If the memory type mtype is not provided, MEM_HOST will be used. If the size is not specified, a flat vector will be assumed.

Examples

Negate the contents of CeedVector v:

@witharray v_arr=v v_arr .*= -1.0
source
LibCEED.witharrayFunction
witharray(f, v::CeedVector, mtype=MEM_HOST)

Calls f with an array containing the data of the CeedVector v, using memory type mtype.

Because of performance issues involving closures, if f is a complex operation, it may be more efficient to use the macro version @witharray (cf. the section on "Performance of captured variable" in the Julia documentation and related GitHub issue.

Examples

Return the sum of a vector:

witharray(sum, v)
source
LibCEED.setarray!Function
setarray!(v::CeedVector, mtype::MemType, cmode::CopyMode, arr)

Set the array used by a CeedVector, freeing any previously allocated array if applicable. The backend may copy values to a different MemType. See also syncarray! and takearray!.

Avoid OWN_POINTER CopyMode

The CopyMode OWN_POINTER is not suitable for use with arrays that are allocated by Julia, since those cannot be properly freed from libCEED.

source
LibCEED.scale!Function
scale!(v::CeedVector, a::Real)

Overwrite v with a*v for scalar a. Returns v.

source
LinearAlgebra.axpy!Method
axpy!(a::Real, x::CeedVector, y::CeedVector)

Overwrite y with x*a + y, where a is a scalar. Returns y.

Different argument order

In order to be consistent with LinearAlgebra.axpy!, the arguments are passed in order: a, x, y. This is different than the order of arguments of the C function CeedVectorAXPY.

source
LibCEED.pointwisemult!Function
pointwisemult!(w::CeedVector, x::CeedVector, y::CeedVector)

Overwrite w with x .* y. Any subset of x, y, and w may be the same vector. Returns w.

source