An “operator template” is an expression tree that represents a DG operator. The following components can be used to build one in hedge:
Scalar constants, may be of type int, float, complex, numpy.number. These occur directly as part of the expression tree. pymbolic.primitives.is_constant() is a predicate to test for constant-ness.
numpy.ndarray with dtype=:class:`object` (called “object array” in numpy-speak). These evaluate to the same-shape array with each component evaluated.
Use hedge.tools.join_fields() to easily create object arrays from scalars and other arrays.
hedge.optemplate.Field: A placeholder for a user-supplied field.
Field instances or pymbolic.primitives.Subscript instances involving them are interpreted as scalar DG-discretized fields.
hedge.optemplate.ScalarParameter: A placeholder for a user-supplied scalar value.
pymbolic.primitives.Sum, pymbolic.primitives.Product, pymbolic.primitives.Quotient, pymbolic.primitives.Power: These are created implicitly when Expression objects are combined using the +, -, *, / and ** operators. These are all interpreted in a node-by-node fashion.
pymbolic.primitives.IfPositive offers a simple way to build conditionals and is interpreted in a node-by-node fashion.
pymbolic.primitives.CommonSubexpression (CSE for short): Prevents double evaluation of identical subexpressions when the operator expression tree is walked to evaluate the operator.
Use hedge.tools.make_common_subexpression() to wrap each component of an object array in a CSE.
pymbolic.primitives.Call: The function attribute must evaluate to a name that was registered by calling hedge.discretization.Discretization.add_function().
Operators may be left-multiplied with other field expressions. See Operators for an overview.
Return an object array of components subscripted Field instances.
| Parameter: | components – The number of components in the vector. |
|---|
These operators are only meaningful within the bfield argument of BoundaryPair, because they evaluate to boundary vectors of the given tag.