CeedOperator
A CeedOperator defines the finite/spectral element operator associated to a CeedQFunction. A CeedOperator connects objects of the type CeedElemRestriction, CeedBasis, and CeedQFunction.
Discrete operators on user vectors
-
typedef struct CeedOperator_private *CeedOperator
Handle for object describing FE-type operators acting on vectors.
Given an element restriction \(E\), basis evaluator \(B\), and quadrature function \(f\), a
CeedOperator
expresses operations of the form \(E^T B^T f(B E u)\) acting on the vector \(u\).
-
int CeedOperatorCreate(Ceed ceed, CeedQFunction qf, CeedQFunction dqf, CeedQFunction dqfT, CeedOperator *op)
Create a
CeedOperator
and associate aCeedQFunction
.A
CeedBasis
andCeedElemRestriction
can be associated withCeedQFunction
fields with CeedOperatorSetField().User Functions
- Parameters:
ceed – [in]
Ceed
object used to create theCeedOperator
qf – [in]
CeedQFunction
defining the action of the operator at quadrature pointsdqf – [in]
CeedQFunction
defining the action of the Jacobian ofqf
(or CEED_QFUNCTION_NONE)dqfT – [in]
CeedQFunction
defining the action of the transpose of the Jacobian ofqf
(or CEED_QFUNCTION_NONE)op – [out] Address of the variable where the newly created
CeedOperator
will be stored
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCreateAtPoints(Ceed ceed, CeedQFunction qf, CeedQFunction dqf, CeedQFunction dqfT, CeedOperator *op)
Create a
CeedOperator
for evaluation at evaluation at arbitrary points in each element.A
CeedBasis
andCeedElemRestriction
can be associated withCeedQFunction
fields withCeedOperator
SetField. The locations of each point are set with CeedOperatorAtPointsSetPoints().User Functions
- Parameters:
ceed – [in]
Ceed
object used to create theCeedOperator
qf – [in]
CeedQFunction
defining the action of the operator at quadrature pointsdqf – [in]
CeedQFunction
defining the action of the Jacobian of qf (or CEED_QFUNCTION_NONE)dqfT – [in]
CeedQFunction
defining the action of the transpose of the Jacobian of qf (or CEED_QFUNCTION_NONE)op – [out] Address of the variable where the newly created CeedOperator will be stored
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedCompositeOperatorCreate(Ceed ceed, CeedOperator *op)
Create a composite
CeedOperator
that composes the action of severalCeedOperator
User Functions
- Parameters:
ceed – [in]
Ceed
object used to create theCeedOperator
op – [out] Address of the variable where the newly created composite
CeedOperator
will be stored
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorReferenceCopy(CeedOperator op, CeedOperator *op_copy)
Copy the pointer to a
CeedOperator
.Both pointers should be destroyed with CeedOperatorDestroy().
Note: If the value of
*op_copy
passed to this function is non-NULL
, then it is assumed that*op_copy
is a pointer to aCeedOperator
. ThisCeedOperator
will be destroyed if*op_copy
is the only reference to thisCeedOperator
.User Functions
- Parameters:
op – [in]
CeedOperator
to copy reference toop_copy – [inout] Variable to store copied reference
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorSetField(CeedOperator op, const char *field_name, CeedElemRestriction rstr, CeedBasis basis, CeedVector vec)
Provide a field to a
CeedOperator
for use by itsCeedQFunction
.This function is used to specify both active and passive fields to a
CeedOperator
. For passive fields, aCeedVector
vec
must be provided. Passive fields can inputs or outputs (updated in-place when operator is applied).Active fields must be specified using this function, but their data (in a
CeedVector
) is passed in CeedOperatorApply(). There can be at most one active inputCeedVector
and at most one active outputCeedVector: storing and manipulating vectors passed to CeedOperatorApply().The number of quadrature points must agree across all points. When using CEED_BASIS_NONE, the number of quadrature points is determined by the element size of
rstr
.User Functions
- Parameters:
op – [inout]
CeedOperator
on which to provide the fieldfield_name – [in] Name of the field (to be matched with the name used by
CeedQFunction
)rstr – [in]
CeedElemRestriction
basis – [in]
CeedBasis
in which the field resides or CEED_BASIS_NONE if collocated with quadrature pointsvec – [in]
CeedVector
to be used by CeedOperator or CEED_VECTOR_ACTIVE if field is active or CEED_VECTOR_NONE if using CEED_EVAL_WEIGHT in theCeedQFunction
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetFields(CeedOperator op, CeedInt *num_input_fields, CeedOperatorField **input_fields, CeedInt *num_output_fields, CeedOperatorField **output_fields)
Get the
CeedOperator
Field of aCeedOperator
.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.Advanced Functions
- Parameters:
op – [in]
CeedOperator
num_input_fields – [out] Variable to store number of input fields
input_fields – [out] Variable to store input fields
num_output_fields – [out] Variable to store number of output fields
output_fields – [out] Variable to store output fields
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorAtPointsSetPoints(CeedOperator op, CeedElemRestriction rstr_points, CeedVector point_coords)
Set the arbitrary points in each element for a
CeedOperator
at points.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.Advanced Functions
- Parameters:
op – [inout]
CeedOperator
at pointsrstr_points – [in]
CeedElemRestriction
for the coordinates of each point by elementpoint_coords – [in]
CeedVector
holding coordinates of each point
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorIsAtPoints(CeedOperator op, bool *is_at_points)
Get a boolean value indicating if the
CeedOperator
was created withCeedOperatorCreateAtPoints
User Functions
- Parameters:
op – [in]
CeedOperator
is_at_points – [out] Variable to store at points status
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorAtPointsGetPoints(CeedOperator op, CeedElemRestriction *rstr_points, CeedVector *point_coords)
Get the arbitrary points in each element for a
CeedOperator
at points.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.Advanced Functions
- Parameters:
op – [in]
CeedOperator
at pointsrstr_points – [out] Variable to hold
CeedElemRestriction
for the coordinates of each point by elementpoint_coords – [out] Variable to hold
CeedVector
holding coordinates of each point
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetFieldByName(CeedOperator op, const char *field_name, CeedOperatorField *op_field)
Get a
CeedOperator
Field of aCeedOperator
from its name.op_field
is set toNULL
if the field is not found.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.Advanced Functions
- Parameters:
op – [in]
CeedOperator
field_name – [in] Name of desired
CeedOperator
Fieldop_field – [out]
CeedOperator
Field corresponding to the name
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorFieldGetName(CeedOperatorField op_field, const char **field_name)
Get the name of a
CeedOperator
Field.Advanced Functions
- Parameters:
op_field – [in]
CeedOperator
Fieldfield_name – [out] Variable to store the field name
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorFieldGetElemRestriction(CeedOperatorField op_field, CeedElemRestriction *rstr)
Get the
CeedElemRestriction
of aCeedOperator
Field.Advanced Functions
- Parameters:
op_field – [in]
CeedOperator
Fieldrstr – [out] Variable to store
CeedElemRestriction
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorFieldGetBasis(CeedOperatorField op_field, CeedBasis *basis)
Get the
CeedBasis
of aCeedOperator
Field.Advanced Functions
- Parameters:
op_field – [in]
CeedOperator
Fieldbasis – [out] Variable to store
CeedBasis
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorFieldGetVector(CeedOperatorField op_field, CeedVector *vec)
Get the
CeedVector
of aCeedOperator
Field.Advanced Functions
- Parameters:
op_field – [in]
CeedOperator
Fieldvec – [out] Variable to store
CeedVector
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorFieldGetData(CeedOperatorField op_field, const char **field_name, CeedElemRestriction *rstr, CeedBasis *basis, CeedVector *vec)
Get the data of a
CeedOperator
Field.Any arguments set as
NULL
are ignored.Advanced Functions
- Parameters:
op_field – [in]
CeedOperator
Fieldfield_name – [out] Variable to store the field name
rstr – [out] Variable to store
CeedElemRestriction
basis – [out] Variable to store
CeedBasis
vec – [out] Variable to store
CeedVector
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedCompositeOperatorAddSub(CeedOperator composite_op, CeedOperator sub_op)
Add a sub-operator to a composite
CeedOperator
User Functions
- Parameters:
composite_op – [inout] Composite
CeedOperator
sub_op – [in] Sub-operator
CeedOperator
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedCompositeOperatorGetNumSub(CeedOperator op, CeedInt *num_suboperators)
Get the number of sub-operators associated with a
CeedOperator
Backend Developer Functions
- Parameters:
op – [in]
CeedOperator
num_suboperators – [out] Variable to store number of sub-operators
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedCompositeOperatorGetSubList(CeedOperator op, CeedOperator **sub_operators)
Get the list of sub-operators associated with a
CeedOperator
Backend Developer Functions
- Parameters:
op – [in]
CeedOperator
sub_operators – [out] Variable to store list of sub-operators
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCheckReady(CeedOperator op)
Check if a
CeedOperator
is ready to be used.User Functions
- Parameters:
op – [in]
CeedOperator
to check
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetActiveVectorLengths(CeedOperator op, CeedSize *input_size, CeedSize *output_size)
Get vector lengths for the active input and/or output
CeedVector
of aCeedOperator
.Note: Lengths of
-1
indicate that the CeedOperator does not have an active input and/or output.User Functions
- Parameters:
op – [in]
CeedOperator
input_size – [out] Variable to store active input vector length, or
NULL
output_size – [out] Variable to store active output vector length, or
NULL
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorSetQFunctionAssemblyReuse(CeedOperator op, bool reuse_assembly_data)
Set reuse of
CeedQFunction
data inCeedOperatorLinearAssemble*()
functions.When
reuse_assembly_data = false
(default), theCeedQFunction
associated with thisCeedOperator
is re-assembled every time aCeedOperatorLinearAssemble*()
function is called. Whenreuse_assembly_data = true
, theCeedQFunction
associated with thisCeedOperator
is reused between calls to CeedOperatorSetQFunctionAssemblyDataUpdateNeeded().Advanced Functions
- Parameters:
op – [in]
CeedOperator
reuse_assembly_data – [in] Boolean flag setting assembly data reuse
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorSetQFunctionAssemblyDataUpdateNeeded(CeedOperator op, bool needs_data_update)
Mark
CeedQFunction
data as updated and theCeedQFunction
as requiring re-assembly.Advanced Functions
- Parameters:
op – [in]
CeedOperator
needs_data_update – [in] Boolean flag setting assembly data reuse
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorSetName(CeedOperator op, const char *name)
Set name of
CeedOperator
for CeedOperatorView() output.User Functions
- Parameters:
op – [inout]
CeedOperator
name – [in] Name to set, or NULL to remove previously set name
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorView(CeedOperator op, FILE *stream)
View a
CeedOperator
User Functions
- Parameters:
op – [in]
CeedOperator
to viewstream – [in] Stream to write; typically
stdout
or a file
- Returns:
Error code: 0 - success, otherwise - failure
-
int CeedOperatorGetCeed(CeedOperator op, Ceed *ceed)
Get the
Ceed
associated with aCeedOperator
Advanced Functions
- Parameters:
op – [in]
CeedOperator
ceed – [out] Variable to store
Ceed
- Returns:
An error code: 0 - success, otherwise - failure
-
Ceed CeedOperatorReturnCeed(CeedOperator op)
Return the
Ceed
associated with aCeedOperator
Advanced Functions
- Parameters:
op – [in]
CeedOperator
- Returns:
Ceed
associated with theop
-
int CeedOperatorGetNumElements(CeedOperator op, CeedInt *num_elem)
Get the number of elements associated with a
CeedOperator
Advanced Functions
- Parameters:
op – [in]
CeedOperator
num_elem – [out] Variable to store number of elements
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetNumQuadraturePoints(CeedOperator op, CeedInt *num_qpts)
Get the number of quadrature points associated with a
CeedOperator
Advanced Functions
- Parameters:
op – [in]
CeedOperator
num_qpts – [out] Variable to store vector number of quadrature points
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetFlopsEstimate(CeedOperator op, CeedSize *flops)
Estimate number of FLOPs required to apply
CeedOperator
on the activeCeedVector
Backend Developer Functions
- Parameters:
op – [in]
CeedOperator
to estimate FLOPs forflops – [out] Address of variable to hold FLOPs estimate
-
int CeedOperatorGetContext(CeedOperator op, CeedQFunctionContext *ctx)
Get
CeedQFunction
global context for aCeedOperator
.The caller is responsible for destroying
ctx
returned from this function via CeedQFunctionContextDestroy().Note: If the value of
ctx
passed into this function is non-NULL
, then it is assumed thatctx
is a pointer to aCeedQFunctionContext
. ThisCeedQFunctionContext
will be destroyed ifctx
is the only reference to thisCeedQFunctionContext
.Advanced Functions
- Parameters:
op – [in]
CeedOperator
ctx – [out] Variable to store
CeedQFunctionContext
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetContextFieldLabel(CeedOperator op, const char *field_name, CeedContextFieldLabel *field_label)
Get label for a registered
CeedQFunctionContext
field, orNULL
if no field has been registered with thisfield_name
.Fields are registered via
CeedQFunctionContextRegister*()
functions (eg. CeedQFunctionContextRegisterDouble()).User Functions
- Parameters:
op – [in]
CeedOperator
field_name – [in] Name of field to retrieve label
field_label – [out] Variable to field label
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorSetContextDouble(CeedOperator op, CeedContextFieldLabel field_label, double *values)
Set
CeedQFunctionContext
field holding double precision values.For composite operators, the values are set in all sub-operator
CeedQFunctionContext
that have a matchingfield_name
.User Functions
- Parameters:
op – [inout]
CeedOperator
field_label – [in] Label of field to set
values – [in] Values to set
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const double **values)
Get
CeedQFunctionContext
field holding double precision values, read-only.For composite operators, the values correspond to the first sub-operator
CeedQFunctionContext
that has a matchingfield_name
.User Functions
- Parameters:
op – [in]
CeedOperator
field_label – [in] Label of field to get
num_values – [out] Number of values in the field label
values – [out] Pointer to context values
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorRestoreContextDoubleRead(CeedOperator op, CeedContextFieldLabel field_label, const double **values)
Restore
CeedQFunctionContext
field holding double precision values, read-only.User Functions
- Parameters:
op – [in]
CeedOperator
field_label – [in] Label of field to restore
values – [out] Pointer to context values
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorSetContextInt32(CeedOperator op, CeedContextFieldLabel field_label, int32_t *values)
Set
CeedQFunctionContext
field holdingint32
values.For composite operators, the values are set in all sub-operator
CeedQFunctionContext
that have a matchingfield_name
.User Functions
- Parameters:
op – [inout]
CeedOperator
field_label – [in] Label of field to set
values – [in] Values to set
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const int32_t **values)
Get
CeedQFunctionContext
field holdingint32
values, read-only.For composite operators, the values correspond to the first sub-operator
CeedQFunctionContext
that has a matchingfield_name
.User Functions
- Parameters:
op – [in]
CeedOperator
field_label – [in] Label of field to get
num_values – [out] Number of
int32
values invalues
values – [out] Pointer to context values
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorRestoreContextInt32Read(CeedOperator op, CeedContextFieldLabel field_label, const int32_t **values)
Restore
CeedQFunctionContext
field holdingint32
values, read-only.User Functions
- Parameters:
op – [in]
CeedOperator
field_label – [in] Label of field to get
values – [out] Pointer to context values
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorSetContextBoolean(CeedOperator op, CeedContextFieldLabel field_label, bool *values)
Set
CeedQFunctionContext
field holding boolean values.For composite operators, the values are set in all sub-operator
CeedQFunctionContext
that have a matchingfield_name
.User Functions
- Parameters:
op – [inout]
CeedOperator
field_label – [in] Label of field to set
values – [in] Values to set
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetContextBooleanRead(CeedOperator op, CeedContextFieldLabel field_label, size_t *num_values, const bool **values)
Get
CeedQFunctionContext
field holding boolean values, read-only.For composite operators, the values correspond to the first sub-operator
CeedQFunctionContext
that has a matchingfield_name
.User Functions
- Parameters:
op – [in]
CeedOperator
field_label – [in] Label of field to get
num_values – [out] Number of boolean values in
values
values – [out] Pointer to context values
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorRestoreContextBooleanRead(CeedOperator op, CeedContextFieldLabel field_label, const bool **values)
Restore
CeedQFunctionContext
field holding boolean values, read-only.User Functions
- Parameters:
op – [in]
CeedOperator
field_label – [in] Label of field to get
values – [out] Pointer to context values
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorApply(CeedOperator op, CeedVector in, CeedVector out, CeedRequest *request)
Apply
CeedOperator
to aCeedVector
.This computes the action of the operator on the specified (active) input, yielding its (active) output. All inputs and outputs must be specified using CeedOperatorSetField().
Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to applyin – [in]
CeedVector
containing input state or CEED_VECTOR_NONE if there are no active inputsout – [out]
CeedVector
to store result of applying operator (must be distinct fromin
) or CEED_VECTOR_NONE if there are no active outputsrequest – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorApplyAdd(CeedOperator op, CeedVector in, CeedVector out, CeedRequest *request)
Apply
CeedOperator
to aCeedVector
and add result to outputCeedVector
.This computes the action of the operator on the specified (active) input, yielding its (active) output. All inputs and outputs must be specified using CeedOperatorSetField().
User Functions
- Parameters:
op – [in]
CeedOperator
to applyin – [in]
CeedVector
containing input state or CEED_VECTOR_NONE if there are no active inputsout – [out]
CeedVector
to sum in result of applying operator (must be distinct fromin
) or CEED_VECTOR_NONE if there are no active outputsrequest – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorDestroy(CeedOperator *op)
Destroy a
CeedOperator
User Functions
- Parameters:
op – [inout]
CeedOperator
to destroy
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssembleQFunction(CeedOperator op, CeedVector *assembled, CeedElemRestriction *rstr, CeedRequest *request)
Assemble a linear
CeedQFunction
associated with aCeedOperator
.This returns a
CeedVector
containing a matrix at each quadrature point providing the action of theCeedQFunction
associated with theCeedOperator
. The vectorassembled
is of shape[num_elements, num_input_fields, num_output_fields, num_quad_points]
and contains column-major matrices representing the action of theCeedQFunction
for a corresponding quadrature point on an element.Inputs and outputs are in the order provided by the user when adding
CeedOperator
fields. For example, aCeedQFunction
with inputsu
andgradu
and outputsgradv
andv
, provided in that order, would result in an assembledCeedQFunction
that consists of(1 + dim) x (dim + 1)
matrices at each quadrature point acting on the input[u, du_0, du_1]
and producing the output[dv_0, dv_1, v]
.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to assembleCeedQFunction
assembled – [out]
CeedVector
to store assembledCeedQFunction
at quadrature pointsrstr – [out]
CeedElemRestriction
forCeedVector
containing assembledCeedQFunction
request – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssembleQFunctionBuildOrUpdate(CeedOperator op, CeedVector *assembled, CeedElemRestriction *rstr, CeedRequest *request)
Assemble
CeedQFunction
and store result internally.Return copied references of stored data to the caller. Caller is responsible for ownership and destruction of the copied references. See also CeedOperatorLinearAssembleQFunction().
Note: If the value of
assembled
orrstr
passed to this function are non-NULL
, then it is assumed that they hold valid pointers. These objects will be destroyed if*assembled
or*rstr
is the only reference to the object.User Functions
- Parameters:
op – [in]
CeedOperator
to assembleCeedQFunction
assembled – [out]
CeedVector
to store assembledCeedQFunction
at quadrature pointsrstr – [out]
CeedElemRestriction
forCeedVector
containing assembledCeedQFunction
request – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssembleDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request)
Assemble the diagonal of a square linear
CeedOperator
This overwrites a
CeedVector
with the diagonal of a linearCeedOperator
.Note: Currently only non-composite
CeedOperator
with a single field and compositeCeedOperator
with single field sub-operators are supported.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to assembleCeedQFunction
assembled – [out]
CeedVector
to store assembledCeedOperator
diagonalrequest – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssembleAddDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request)
Assemble the diagonal of a square linear
CeedOperator
.This sums into a
CeedVector
the diagonal of a linearCeedOperator
.Note: Currently only non-composite
CeedOperator
with a single field and compositeCeedOperator
with single field sub-operators are supported.Note: Calling this function asserts that setup is complete and sets the CeedOperator as immutable.
User Functions
- Parameters:
op – [in]
CeedOperator
to assembleCeedQFunction
assembled – [out]
CeedVector
to store assembledCeedOperator
diagonalrequest – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssemblePointBlockDiagonalSymbolic(CeedOperator op, CeedSize *num_entries, CeedInt **rows, CeedInt **cols)
Fully assemble the point-block diagonal pattern of a linear
CeedOperator
.Expected to be used in conjunction with CeedOperatorLinearAssemblePointBlockDiagonal().
The assembly routines use coordinate format, with
num_entries
tuples of the form(i, j, value)
which indicate that value should be added to the matrix in entry(i, j)
. Note that the(i, j)
pairs are unique. This function returns the number of entries and their(i, j)
locations, while CeedOperatorLinearAssemblePointBlockDiagonal() provides the values in the same ordering.This will generally be slow unless your operator is low-order.
Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to assemblenum_entries – [out] Number of entries in coordinate nonzero pattern
rows – [out] Row number for each entry
cols – [out] Column number for each entry
-
int CeedOperatorLinearAssemblePointBlockDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request)
Assemble the point block diagonal of a square linear
CeedOperator
.This overwrites a
CeedVector
with the point block diagonal of a linearCeedOperator
.Note: Currently only non-composite
CeedOperator
with a single field and compositeCeedOperator
with single field sub-operators are supported.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to assembleCeedQFunction
assembled – [out]
CeedVector
to store assembledCeedOperator
point block diagonal, provided in row-major form with annum_comp * num_comp
block at each node. The dimensions of this vector are derived from the active vector for theCeedOperator
. The array has shape[nodes, component out, component in]
.request – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssembleAddPointBlockDiagonal(CeedOperator op, CeedVector assembled, CeedRequest *request)
Assemble the point block diagonal of a square linear
CeedOperator
.This sums into a
CeedVector
with the point block diagonal of a linearCeedOperator
.Note: Currently only non-composite
CeedOperator
with a single field and compositeCeedOperator
with single field sub-operators are supported.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to assembleCeedQFunction
assembled – [out]
CeedVector
to store assembled CeedOperator point block diagonal, provided in row-major form with annum_comp * num_comp
block at each node. The dimensions of this vector are derived from the active vector for theCeedOperator
. The array has shape[nodes, component out, component in]
.request – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssembleSymbolic(CeedOperator op, CeedSize *num_entries, CeedInt **rows, CeedInt **cols)
Fully assemble the nonzero pattern of a linear
CeedOperator
.Expected to be used in conjunction with CeedOperatorLinearAssemble().
The assembly routines use coordinate format, with
num_entries
tuples of the form(i, j, value)
which indicate that value should be added to the matrix in entry(i, j)
. Note that the(i, j)
pairs are not unique and may repeat. This function returns the number of entries and their(i, j)
locations, while CeedOperatorLinearAssemble() provides the values in the same ordering.This will generally be slow unless your operator is low-order.
Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to assemblenum_entries – [out] Number of entries in coordinate nonzero pattern
rows – [out] Row number for each entry
cols – [out] Column number for each entry
-
int CeedOperatorLinearAssemble(CeedOperator op, CeedVector values)
Fully assemble the nonzero entries of a linear operator.
Expected to be used in conjunction with CeedOperatorLinearAssembleSymbolic().
The assembly routines use coordinate format, with
num_entries
tuples of the form(i, j, value)
which indicate that value should be added to the matrix in entry(i, j)
. Note that the(i, j)
pairs are not unique and may repeat. This function returns the values of the nonzero entries to be added, their(i, j)
locations are provided by CeedOperatorLinearAssembleSymbolic().This will generally be slow unless your operator is low-order.
Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to assemblevalues – [out] Values to assemble into matrix
-
int CeedCompositeOperatorGetMultiplicity(CeedOperator op, CeedInt num_skip_indices, CeedInt *skip_indices, CeedVector mult)
Get the multiplicity of nodes across sub-operators in a composite
CeedOperator
.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in] Composite
CeedOperator
num_skip_indices – [in] Number of sub-operators to skip
skip_indices – [in] Array of indices of sub-operators to skip
mult – [out] Vector to store multiplicity (of size
l_size
)
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorMultigridLevelCreate(CeedOperator op_fine, CeedVector p_mult_fine, CeedElemRestriction rstr_coarse, CeedBasis basis_coarse, CeedOperator *op_coarse, CeedOperator *op_prolong, CeedOperator *op_restrict)
Create a multigrid coarse
CeedOperator
and level transferCeedOperator
for aCeedOperator
, creating the prolongation basis from the fine and coarse grid interpolation.Note: Calling this function asserts that setup is complete and sets all four
CeedOperator
as immutable.User Functions
- Parameters:
op_fine – [in] Fine grid
CeedOperator
p_mult_fine – [in] L-vector multiplicity in parallel gather/scatter, or
NULL
if not creating prolongation/restrictionCeedOperator
rstr_coarse – [in] Coarse grid
CeedElemRestriction
basis_coarse – [in] Coarse grid active vector
CeedBasis
op_coarse – [out] Coarse grid
CeedOperator
op_prolong – [out] Coarse to fine
CeedOperator
, orNULL
op_restrict – [out] Fine to coarse
CeedOperator
, orNULL
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorMultigridLevelCreateTensorH1(CeedOperator op_fine, CeedVector p_mult_fine, CeedElemRestriction rstr_coarse, CeedBasis basis_coarse, const CeedScalar *interp_c_to_f, CeedOperator *op_coarse, CeedOperator *op_prolong, CeedOperator *op_restrict)
Create a multigrid coarse
CeedOperator
and level transferCeedOperator
for aCeedOperator
with a tensor basis for the active basis.Note: Calling this function asserts that setup is complete and sets all four
CeedOperator
as immutable.User Functions
- Parameters:
op_fine – [in] Fine grid
CeedOperator
p_mult_fine – [in] L-vector multiplicity in parallel gather/scatter, or
NULL
if not creating prolongation/restrictionCeedOperator
rstr_coarse – [in] Coarse grid
CeedElemRestriction
basis_coarse – [in] Coarse grid active vector
CeedBasis
interp_c_to_f – [in] Matrix for coarse to fine interpolation, or
NULL
if not creating prolongation/restrictionCeedOperator
op_coarse – [out] Coarse grid
CeedOperator
op_prolong – [out] Coarse to fine
CeedOperator
, orNULL
op_restrict – [out] Fine to coarse
CeedOperator
, orNULL
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorMultigridLevelCreateH1(CeedOperator op_fine, CeedVector p_mult_fine, CeedElemRestriction rstr_coarse, CeedBasis basis_coarse, const CeedScalar *interp_c_to_f, CeedOperator *op_coarse, CeedOperator *op_prolong, CeedOperator *op_restrict)
Create a multigrid coarse
CeedOperator
and level transferCeedOperator
for aCeedOperator
with a non-tensor basis for the active vector.Note: Calling this function asserts that setup is complete and sets all four
CeedOperator
as immutable.User Functions
- Parameters:
op_fine – [in] Fine grid
CeedOperator
p_mult_fine – [in] L-vector multiplicity in parallel gather/scatter, or
NULL
if not creating prolongation/restrictionCeedOperator
rstr_coarse – [in] Coarse grid
CeedElemRestriction
basis_coarse – [in] Coarse grid active vector
CeedBasis
interp_c_to_f – [in] Matrix for coarse to fine interpolation, or
NULL
if not creating prolongation/restrictionCeedOperator
op_coarse – [out] Coarse grid
CeedOperator
op_prolong – [out] Coarse to fine
CeedOperator
, orNULL
op_restrict – [out] Fine to coarse
CeedOperator
, orNULL
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCreateFDMElementInverse(CeedOperator op, CeedOperator *fdm_inv, CeedRequest *request)
Build a FDM based approximate inverse for each element for a
CeedOperator
.This returns a
CeedOperator
andCeedVector
to apply a Fast Diagonalization Method based approximate inverse. This function obtains the simultaneous diagonalization for the 1D mass and Laplacian operators, \(M = V^T V, K = V^T S V\). The assembledCeedQFunction
is used to modify the eigenvalues from simultaneous diagonalization and obtain an approximate inverse of the form \(V^T \hat S V\). TheCeedOperator
must be linear and non-composite. The associatedCeedQFunction
must therefore also be linear.Note: Calling this function asserts that setup is complete and sets the
CeedOperator
as immutable.User Functions
- Parameters:
op – [in]
CeedOperator
to create element inversesfdm_inv – [out]
CeedOperator
to apply the action of a FDM based inverse for each elementrequest – [in] Address of CeedRequest for non-blocking completion, else CEED_REQUEST_IMMEDIATE
- Returns:
An error code: 0 - success, otherwise - failure