FEEvaluator
The FEEvaluator
provides a unified interface for evaluating finite element basis functions, their derivatives, and related quantities for a given function operator, quadrature rule, and mesh entity. It manages the storage and reuse of basis evaluations both on the reference element (where derivatives are computed via automatic differentiation) and on the current mesh item. The mesh item context can be updated dynamically using the update!
function.
ExtendableFEMBase.FEEvaluator
— Methodfunction FEEvaluator(FE::FESpace, operator::AbstractFunctionOperator, qrule::QuadratureRule; T = Float64, AT = ON_CELLS, L2G = nothing)
Construct a finite element basis function evaluator for a given finite element space, operator, and quadrature rule.
Arguments
FE::FESpace
: The finite element space whose basis functions are to be evaluated.operator::AbstractFunctionOperator
: The operator to apply to the basis functions (e.g.,Identity
,Gradient
, etc.).qrule::QuadratureRule
: The quadrature rule specifying the evaluation points (quadrature points) on the reference element.xgrid
: (optional, defaults toFE.dofgrid
) The grid on which the FE space is defined. Used for geometric information.L2G
: (optional) A local-to-global transformation object. If not provided, it is constructed automatically.T
: (optional, defaultFloat64
) The floating-point type for computations.AT
: (optional, defaultON_CELLS
) The assembly type, specifying the geometric entity (cells, faces, etc.) for evaluation.
Returns
A FEEvaluator
object that can efficiently evaluate (and cache) the values of the specified operator applied to the FE basis functions at the quadrature points of each cell (or other entity). The evaluator supports fast updates to new cells via update_basis!
.
Usage
- After construction, call
update_basis!(FEB, cellid)
to update the evaluator to a new cell. - Access the evaluated values via
FEB.cvals[component, dof, qp]
, where:component
: the output component (e.g., vector or matrix entry)dof
: the local basis function indexqp
: the quadrature point index
Notes
- For matrix-valued operators (e.g.,
Gradient
), the result is stored as a long vector in component-wise order. - The evaluator is designed for high performance in assembly loops and supports both scalar and vector-valued elements and operators.
- For advanced use, the evaluator exposes internal fields for basis values, derivatives, and transformation matrices.
Example
```julia FEB = FEEvaluator(FE, Gradient, qrule) for cell in 1:ncells update_basis!(FEB, cell) # Access FEB.cvals for basis gradients at quadrature points end
ExtendableFEMBase.eval_febe!
— Function eval_febe!(result, FEBE::FEBasisEvaluator, j::Int, i::Int, offset::Int = 0, factor = 1)
Evaluate the j-th basis function of the FEBasisEvaluator at the i-th quadrature point and writes the (possibly vector-valued) evaluation into result (beginning at offset and with the specified factor).
ExtendableFEMBase.eval_febe!
— Function eval_febe!(result, FEBE::FEBasisEvaluator, j::Int, i::Int, offset::Int = 0, factor = 1)
Evaluates the linear combination of the basisfunction with given coefficients at the i-th quadrature point and writes the (possibly vector-valued) evaluation into result (beginning at offset and with the specified factor).
ExtendableFEMBase.update_basis!
— Methodfunction update_basis!(FEBE::FEEvaluator, item::Integer)
Sets FEBE.citem[] = item and updates the basis.
ExtendableFEMBase.update_basis!
— Methodfunction update_basis!(FEBE::SingleFEEvaluator)
Updates the basis for the current item FEBE.citem[].