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
CeedOperatorexpresses 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
CeedOperatorand associate aCeedQFunction.A
CeedBasisandCeedElemRestrictioncan be associated withCeedQFunctionfields with CeedOperatorSetField().User Functions
- Parameters:
ceed – [in]
Ceedobject used to create theCeedOperatorqf – [in]
CeedQFunctiondefining the action of the operator at quadrature pointsdqf – [in]
CeedQFunctiondefining the action of the Jacobian ofqf(or CEED_QFUNCTION_NONE)dqfT – [in]
CeedQFunctiondefining the action of the transpose of the Jacobian ofqf(or CEED_QFUNCTION_NONE)op – [out] Address of the variable where the newly created
CeedOperatorwill be stored
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCreateAtPoints(Ceed ceed, CeedQFunction qf, CeedQFunction dqf, CeedQFunction dqfT, CeedOperator *op)
Create a
CeedOperatorfor evaluation at evaluation at arbitrary points in each element.A
CeedBasisandCeedElemRestrictioncan be associated withCeedQFunctionfields withCeedOperatorSetField. The locations of each point are set with CeedOperatorAtPointsSetPoints().User Functions
- Parameters:
ceed – [in]
Ceedobject used to create theCeedOperatorqf – [in]
CeedQFunctiondefining the action of the operator at quadrature pointsdqf – [in]
CeedQFunctiondefining the action of the Jacobian of qf (or CEED_QFUNCTION_NONE)dqfT – [in]
CeedQFunctiondefining 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 CeedOperatorCreateComposite(Ceed ceed, CeedOperator *op)
Create a composite
CeedOperatorthat composes the action of severalCeedOperatorUser Functions
- Parameters:
ceed – [in]
Ceedobject used to create theCeedOperatorop – [out] Address of the variable where the newly created composite
CeedOperatorwill 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_copypassed to this function is non-NULL, then it is assumed that*op_copyis a pointer to aCeedOperator. ThisCeedOperatorwill be destroyed if*op_copyis the only reference to thisCeedOperator.User Functions
- Parameters:
op – [in]
CeedOperatorto 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
CeedOperatorfor use by itsCeedQFunction.This function is used to specify both active and passive fields to a
CeedOperator. For passive fields, aCeedVectorvecmust 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 inputCeedVectorand 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]
CeedOperatoron which to provide the fieldfield_name – [in] Name of the field (to be matched with the name used by
CeedQFunction)rstr – [in]
CeedElemRestrictionbasis – [in]
CeedBasisin which the field resides or CEED_BASIS_NONE if collocated with quadrature pointsvec – [in]
CeedVectorto 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
CeedOperatorField of aCeedOperator.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.Advanced Functions
- Parameters:
op – [in]
CeedOperatornum_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
CeedOperatorat points.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.Advanced Functions
- Parameters:
op – [inout]
CeedOperatorat pointsrstr_points – [in]
CeedElemRestrictionfor the coordinates of each point by elementpoint_coords – [in]
CeedVectorholding 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
CeedOperatorwas created withCeedOperatorCreateAtPointsUser Functions
- Parameters:
op – [in]
CeedOperatoris_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
CeedOperatorat points.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.Advanced Functions
- Parameters:
op – [in]
CeedOperatorat pointsrstr_points – [out] Variable to hold
CeedElemRestrictionfor the coordinates of each point by elementpoint_coords – [out] Variable to hold
CeedVectorholding 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
CeedOperatorField of aCeedOperatorfrom its name.op_fieldis set toNULLif the field is not found.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.Advanced Functions
- Parameters:
op – [in]
CeedOperatorfield_name – [in] Name of desired
CeedOperatorFieldop_field – [out]
CeedOperatorField 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
CeedOperatorField.Advanced Functions
- Parameters:
op_field – [in]
CeedOperatorFieldfield_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
CeedElemRestrictionof aCeedOperatorField.Note: Caller is responsible for destroying the
rstrwith CeedElemRestrictionDestroy().Advanced Functions
- Parameters:
op_field – [in]
CeedOperatorFieldrstr – [out] Variable to store
CeedElemRestriction
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorFieldGetBasis(CeedOperatorField op_field, CeedBasis *basis)
Get the
CeedBasisof aCeedOperatorField.Note: Caller is responsible for destroying the
basiswith CeedBasisDestroy().Advanced Functions
- Parameters:
op_field – [in]
CeedOperatorFieldbasis – [out] Variable to store
CeedBasis
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorFieldGetVector(CeedOperatorField op_field, CeedVector *vec)
Get the
CeedVectorof aCeedOperatorField.Note: Caller is responsible for destroying the
vecwith CeedVectorDestroy().Advanced Functions
- Parameters:
op_field – [in]
CeedOperatorFieldvec – [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
CeedOperatorField.Any arguments set as
NULLare ignored..Note: Caller is responsible for destroying the
rstr,basis, andvec.Advanced Functions
- Parameters:
op_field – [in]
CeedOperatorFieldfield_name – [out] Variable to store the field name
rstr – [out] Variable to store
CeedElemRestrictionbasis – [out] Variable to store
CeedBasisvec – [out] Variable to store
CeedVector
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCompositeAddSub(CeedOperator composite_op, CeedOperator sub_op)
Add a sub-operator to a composite
CeedOperatorUser Functions
- Parameters:
composite_op – [inout] Composite
CeedOperatorsub_op – [in] Sub-operator
CeedOperator
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCompositeGetNumSub(CeedOperator op, CeedInt *num_suboperators)
Get the number of sub-operators associated with a
CeedOperatorBackend Developer Functions
- Parameters:
op – [in]
CeedOperatornum_suboperators – [out] Variable to store number of sub-operators
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCompositeGetSubList(CeedOperator op, CeedOperator **sub_operators)
Get the list of sub-operators associated with a
CeedOperatorBackend Developer Functions
- Parameters:
op – [in]
CeedOperatorsub_operators – [out] Variable to store list of sub-operators
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCompositeGetSubByName(CeedOperator op, const char *op_name, CeedOperator *sub_op)
Get a sub
CeedOperatorof a compositeCeedOperatorfrom its name.sub_opis set toNULLif the sub operator is not found.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.Advanced Functions
- Parameters:
op – [in] Composite
CeedOperatorop_name – [in] Name of desired sub
CeedOperatorsub_op – [out] Sub
CeedOperatorcorresponding to the name
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCompositeSetSequential(CeedOperator op, bool is_sequential)
Set whether the sub-operators of the composite
CeedOperatormust be run sequentially.Note: This value currently only affects the GPU
/gpu/cuda/genand/gpu/hip/genbackends.Advanced Functions
- Parameters:
op – [in] Composite
CeedOperatoris_sequential – [in] Flag value to set, if
true, forces the compositeCeedOperatorto execute sequentially
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCompositeIsSequential(CeedOperator op, bool *is_sequential)
Get whether the sub-operators of the composite
CeedOperatormust be run sequentially.Note: This value currently only affects the GPU
/gpu/cuda/genand/gpu/hip/genbackends.Advanced Functions
- Parameters:
op – [in] Composite
CeedOperatoris_sequential – [out] Variable to store sequential status
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorCheckReady(CeedOperator op)
Check if a
CeedOperatoris ready to be used.User Functions
- Parameters:
op – [in]
CeedOperatorto 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
CeedVectorof aCeedOperator.Note: Lengths of
-1indicate that the CeedOperator does not have an active input and/or output.User Functions
- Parameters:
op – [in]
CeedOperatorinput_size – [out] Variable to store active input vector length, or
NULLoutput_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
CeedQFunctiondata inCeedOperatorLinearAssemble*()functions.When
reuse_assembly_data = false(default), theCeedQFunctionassociated with thisCeedOperatoris re-assembled every time aCeedOperatorLinearAssemble*()function is called. Whenreuse_assembly_data = true, theCeedQFunctionassociated with thisCeedOperatoris reused between calls to CeedOperatorSetQFunctionAssemblyDataUpdateNeeded().Advanced Functions
- Parameters:
op – [in]
CeedOperatorreuse_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
CeedQFunctiondata as updated and theCeedQFunctionas requiring re-assembly.Advanced Functions
- Parameters:
op – [in]
CeedOperatorneeds_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
CeedOperatorfor CeedOperatorView() output.User Functions
- Parameters:
op – [inout]
CeedOperatorname – [in] Name to set, or NULL to remove previously set name
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorGetName(CeedOperator op, const char **name)
Get name of
CeedOperatorUser Functions
- Parameters:
op – [in]
CeedOperatorname – [inout] Address of variable to hold currently set name
- Returns:
An error code: 0 - success, otherwise - failure
-
static int CeedOperatorView_Core(CeedOperator op, FILE *stream, bool is_full)
Core logic for viewing a
CeedOperatorLibrary Developer Functions
- Parameters:
op – [in]
CeedOperatorto view brief summarystream – [in] Stream to write; typically
stdoutor a fileis_full – [in] Whether to write full operator view or terse
- Returns:
Error code: 0 - success, otherwise - failure
-
int CeedOperatorSetNumViewTabs(CeedOperator op, CeedInt num_tabs)
Set the number of tabs to indent for CeedOperatorView() output.
User Functions
- Parameters:
op – [in]
CeedOperatorto set the number of view tabsnum_tabs – [in] Number of view tabs to set
- Returns:
Error code: 0 - success, otherwise - failure
-
int CeedOperatorGetNumViewTabs(CeedOperator op, CeedInt *num_tabs)
Get the number of tabs to indent for CeedOperatorView() output.
User Functions
- Parameters:
op – [in]
CeedOperatorto get the number of view tabsnum_tabs – [out] Number of view tabs
- Returns:
Error code: 0 - success, otherwise - failure
-
int CeedOperatorView(CeedOperator op, FILE *stream)
View a
CeedOperatorUser Functions
- Parameters:
op – [in]
CeedOperatorto viewstream – [in] Stream to write; typically
stdoutor a file
- Returns:
Error code: 0 - success, otherwise - failure
-
int CeedOperatorViewTerse(CeedOperator op, FILE *stream)
View a brief summary
CeedOperatorUser Functions
- Parameters:
op – [in]
CeedOperatorto view brief summarystream – [in] Stream to write; typically
stdoutor a file
- Returns:
Error code: 0 - success, otherwise - failure
-
int CeedOperatorGetCeed(CeedOperator op, Ceed *ceed)
Get the
Ceedassociated with aCeedOperatorAdvanced Functions
- Parameters:
op – [in]
CeedOperatorceed – [out] Variable to store
Ceed
- Returns:
An error code: 0 - success, otherwise - failure
-
Ceed CeedOperatorReturnCeed(CeedOperator op)
Return the
Ceedassociated with aCeedOperatorAdvanced Functions
- Parameters:
op – [in]
CeedOperator
- Returns:
Ceedassociated with theop
-
int CeedOperatorGetNumElements(CeedOperator op, CeedInt *num_elem)
Get the number of elements associated with a
CeedOperatorAdvanced Functions
- Parameters:
op – [in]
CeedOperatornum_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
CeedOperatorAdvanced Functions
- Parameters:
op – [in]
CeedOperatornum_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
CeedOperatoron the activeCeedVectorBackend Developer Functions
- Parameters:
op – [in]
CeedOperatorto estimate FLOPs forflops – [out] Address of variable to hold FLOPs estimate
-
int CeedOperatorGetContext(CeedOperator op, CeedQFunctionContext *ctx)
Get
CeedQFunctionglobal context for aCeedOperator.The caller is responsible for destroying
ctxreturned from this function via CeedQFunctionContextDestroy().Note: If the value of
ctxpassed into this function is non-NULL, then it is assumed thatctxis a pointer to aCeedQFunctionContext. ThisCeedQFunctionContextwill be destroyed ifctxis the only reference to thisCeedQFunctionContext.Advanced Functions
- Parameters:
op – [in]
CeedOperatorctx – [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
CeedQFunctionContextfield, orNULLif no field has been registered with thisfield_name.Fields are registered via
CeedQFunctionContextRegister*()functions (eg. CeedQFunctionContextRegisterDouble()).User Functions
- Parameters:
op – [in]
CeedOperatorfield_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
CeedQFunctionContextfield holding double precision values.For composite operators, the values are set in all sub-operator
CeedQFunctionContextthat have a matchingfield_name.User Functions
- Parameters:
op – [inout]
CeedOperatorfield_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
CeedQFunctionContextfield holding double precision values, read-only.For composite operators, the values correspond to the first sub-operator
CeedQFunctionContextthat has a matchingfield_name.User Functions
- Parameters:
op – [in]
CeedOperatorfield_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
CeedQFunctionContextfield holding double precision values, read-only.User Functions
- Parameters:
op – [in]
CeedOperatorfield_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
CeedQFunctionContextfield holdingint32values.For composite operators, the values are set in all sub-operator
CeedQFunctionContextthat have a matchingfield_name.User Functions
- Parameters:
op – [inout]
CeedOperatorfield_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
CeedQFunctionContextfield holdingint32values, read-only.For composite operators, the values correspond to the first sub-operator
CeedQFunctionContextthat has a matchingfield_name.User Functions
- Parameters:
op – [in]
CeedOperatorfield_label – [in] Label of field to get
num_values – [out] Number of
int32values invaluesvalues – [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
CeedQFunctionContextfield holdingint32values, read-only.User Functions
- Parameters:
op – [in]
CeedOperatorfield_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
CeedQFunctionContextfield holding boolean values.For composite operators, the values are set in all sub-operator
CeedQFunctionContextthat have a matchingfield_name.User Functions
- Parameters:
op – [inout]
CeedOperatorfield_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
CeedQFunctionContextfield holding boolean values, read-only.For composite operators, the values correspond to the first sub-operator
CeedQFunctionContextthat has a matchingfield_name.User Functions
- Parameters:
op – [in]
CeedOperatorfield_label – [in] Label of field to get
num_values – [out] Number of boolean values in
valuesvalues – [out] Pointer to context values
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorRestoreContextBooleanRead(CeedOperator op, CeedContextFieldLabel field_label, const bool **values)
Restore
CeedQFunctionContextfield holding boolean values, read-only.User Functions
- Parameters:
op – [in]
CeedOperatorfield_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
CeedOperatorto 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().
User Functions
Note
Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.- Parameters:
op – [in]
CeedOperatorto applyin – [in]
CeedVectorcontaining input state or CEED_VECTOR_NONE if there are no active inputsout – [out]
CeedVectorto 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
CeedOperatorto aCeedVectorand 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
See also
Note
Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.Warning
This function adds into ALL outputs, including passive outputs. To only add into the active output, use
CeedOperatorApplyAddActive().- Parameters:
op – [in]
CeedOperatorto applyin – [in]
CeedVectorcontaining input state or CEED_VECTOR_NONE if there are no active inputsout – [out]
CeedVectorto 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 CeedOperatorApplyAddActive(CeedOperator op, CeedVector in, CeedVector out, CeedRequest *request)
Apply
CeedOperatorto aCeedVectorand add result to outputCeedVector.Only sums into active outputs, overwrites passive outputs.
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
Note
Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.- Parameters:
op – [in]
CeedOperatorto applyin – [in]
CeedVectorcontaining input state or CEED_VECTOR_NONE if there are no active inputsout – [out]
CeedVectorto 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 CeedOperatorAssemblyDataStrip(CeedOperator op)
Destroy temporary assembly data associated with a
CeedOperatorUser Functions
- Parameters:
op – [inout]
CeedOperatorwhose assembly data to destroy
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorDestroy(CeedOperator *op)
Destroy a
CeedOperatorUser Functions
- Parameters:
op – [inout]
CeedOperatorto destroy
- Returns:
An error code: 0 - success, otherwise - failure
-
int CeedOperatorLinearAssembleQFunction(CeedOperator op, CeedVector *assembled, CeedElemRestriction *rstr, CeedRequest *request)
Assemble a linear
CeedQFunctionassociated with aCeedOperator.This returns a
CeedVectorcontaining a matrix at each quadrature point providing the action of theCeedQFunctionassociated with theCeedOperator. The vectorassembledis of shape[num_elements, num_input_fields, num_output_fields, num_quad_points]and contains column-major matrices representing the action of theCeedQFunctionfor a corresponding quadrature point on an element.Inputs and outputs are in the order provided by the user when adding
CeedOperatorfields. For example, aCeedQFunctionwith inputsuandgraduand outputsgradvandv, provided in that order, would result in an assembledCeedQFunctionthat 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
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto assembleCeedQFunctionassembled – [out]
CeedVectorto store assembledCeedQFunctionat quadrature pointsrstr – [out]
CeedElemRestrictionforCeedVectorcontaining assembledCeedQFunctionrequest – [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
CeedQFunctionand 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
assembledorrstrpassed to this function are non-NULL, then it is assumed that they hold valid pointers. These objects will be destroyed if*assembledor*rstris the only reference to the object.User Functions
- Parameters:
op – [in]
CeedOperatorto assembleCeedQFunctionassembled – [out]
CeedVectorto store assembledCeedQFunctionat quadrature pointsrstr – [out]
CeedElemRestrictionforCeedVectorcontaining assembledCeedQFunctionrequest – [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
CeedOperatorThis overwrites a
CeedVectorwith the diagonal of a linearCeedOperator.Note: Currently only non-composite
CeedOperatorwith a single field and compositeCeedOperatorwith single field sub-operators are supported.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto assembleCeedQFunctionassembled – [out]
CeedVectorto store assembledCeedOperatordiagonalrequest – [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
CeedVectorthe diagonal of a linearCeedOperator.Note: Currently only non-composite
CeedOperatorwith a single field and compositeCeedOperatorwith 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]
CeedOperatorto assembleCeedQFunctionassembled – [out]
CeedVectorto store assembledCeedOperatordiagonalrequest – [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_entriestuples 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
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto 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
CeedVectorwith the point block diagonal of a linearCeedOperator.Note: Currently only non-composite
CeedOperatorwith a single field and compositeCeedOperatorwith single field sub-operators are supported.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto assembleCeedQFunctionassembled – [out]
CeedVectorto store assembledCeedOperatorpoint block diagonal, provided in row-major form with annum_comp * num_compblock 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
CeedVectorwith the point block diagonal of a linearCeedOperator.Note: Currently only non-composite
CeedOperatorwith a single field and compositeCeedOperatorwith single field sub-operators are supported.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto assembleCeedQFunctionassembled – [out]
CeedVectorto store assembled CeedOperator point block diagonal, provided in row-major form with annum_comp * num_compblock 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_entriestuples 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
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto 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_entriestuples 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
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto assemblevalues – [out] Values to assemble into matrix
-
int CeedOperatorCompositeGetMultiplicity(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
CeedOperatoras immutable.User Functions
- Parameters:
op – [in] Composite
CeedOperatornum_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
CeedOperatorand level transferCeedOperatorfor 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
CeedOperatoras immutable.User Functions
- Parameters:
op_fine – [in] Fine grid
CeedOperatorp_mult_fine – [in] L-vector multiplicity in parallel gather/scatter, or
NULLif not creating prolongation/restrictionCeedOperatorrstr_coarse – [in] Coarse grid
CeedElemRestrictionbasis_coarse – [in] Coarse grid active vector
CeedBasisop_coarse – [out] Coarse grid
CeedOperatorop_prolong – [out] Coarse to fine
CeedOperator, orNULLop_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
CeedOperatorand level transferCeedOperatorfor aCeedOperatorwith a tensor basis for the active basis.Note: Calling this function asserts that setup is complete and sets all four
CeedOperatoras immutable.User Functions
- Parameters:
op_fine – [in] Fine grid
CeedOperatorp_mult_fine – [in] L-vector multiplicity in parallel gather/scatter, or
NULLif not creating prolongation/restrictionCeedOperatorrstr_coarse – [in] Coarse grid
CeedElemRestrictionbasis_coarse – [in] Coarse grid active vector
CeedBasisinterp_c_to_f – [in] Matrix for coarse to fine interpolation, or
NULLif not creating prolongation/restrictionCeedOperatorop_coarse – [out] Coarse grid
CeedOperatorop_prolong – [out] Coarse to fine
CeedOperator, orNULLop_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
CeedOperatorand level transferCeedOperatorfor aCeedOperatorwith a non-tensor basis for the active vector.Note: Calling this function asserts that setup is complete and sets all four
CeedOperatoras immutable.User Functions
- Parameters:
op_fine – [in] Fine grid
CeedOperatorp_mult_fine – [in] L-vector multiplicity in parallel gather/scatter, or
NULLif not creating prolongation/restrictionCeedOperatorrstr_coarse – [in] Coarse grid
CeedElemRestrictionbasis_coarse – [in] Coarse grid active vector
CeedBasisinterp_c_to_f – [in] Matrix for coarse to fine interpolation, or
NULLif not creating prolongation/restrictionCeedOperatorop_coarse – [out] Coarse grid
CeedOperatorop_prolong – [out] Coarse to fine
CeedOperator, orNULLop_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
CeedOperatorandCeedVectorto 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 assembledCeedQFunctionis used to modify the eigenvalues from simultaneous diagonalization and obtain an approximate inverse of the form \(V^T \hat S V\). TheCeedOperatormust be linear and non-composite. The associatedCeedQFunctionmust therefore also be linear.Note: Calling this function asserts that setup is complete and sets the
CeedOperatoras immutable.User Functions
- Parameters:
op – [in]
CeedOperatorto create element inversesfdm_inv – [out]
CeedOperatorto 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