svMultiPhysics
Loading...
Searching...
No Matches
Modules | Classes | Enumerations | Functions

Basis-function interfaces, concrete basis families, and reference-node conventions. More...

Collaboration diagram for Basis:

Modules

 Exceptions
 Basis-module exception hierarchy.
 
 LagrangeBasis
 Construction and evaluation API for nodal Lagrange finite-element bases.
 
 Reference-node generation (internal)
 Reference-node generators that the basis families build on.
 
 SerendipityBasis
 Construction and evaluation API for reduced serendipity finite-element bases.
 

Classes

struct  svmp::FE::basis::BasisRequest
 Runtime description of a basis to construct. More...
 
class  svmp::FE::basis::BasisFunction
 Abstract interface for finite-element basis-function families. More...
 

Enumerations

enum class  svmp::FE::basis::BasisTopology {
  BasisTopology::Unknown ,
  BasisTopology::Point ,
  BasisTopology::Line ,
  BasisTopology::Triangle ,
  BasisTopology::Quadrilateral ,
  BasisTopology::Tetrahedron ,
  BasisTopology::Hexahedron ,
  BasisTopology::Wedge
}
 Reference-cell topology of a basis (the shape, independent of order). More...
 

Functions

std::unique_ptr< BasisFunction > svmp::FE::basis::basis_factory::create (const BasisRequest &req)
 Create a basis from a runtime request.
 
BasisRequest svmp::FE::basis::basis_factory::default_basis_request (ElementType element_type)
 Return the default basis request (family and order) for an element type.
 
std::unique_ptr< BasisFunction > svmp::FE::basis::basis_factory::create_default_for (ElementType element_type)
 Create the default basis for an element type.
 
constexpr ElementType svmp::FE::basis::named_element_for (BasisTopology top, int order, BasisType family) noexcept
 Named ElementType denoted by a (topology, order, family) triple.
 

Detailed Description

Basis-function interfaces, concrete basis families, and reference-node conventions.

Scope

The Basis module owns reference-element shape functions. It provides the number of basis functions and the values and derivatives, \(N_i\), \(\partial N_i / \partial \xi_j\), and \(\partial^2 N_i / \partial \xi_j \partial \xi_k\) at reference points. It does not own mesh storage, quadrature selection, field formulation policy, or transformation of derivatives to physical coordinates. Those decisions stay with the solver layer that has the mesh, material model, and equation context.

The main pieces are:

Object and evaluation contract

A basis object is immutable after construction. It represents one reference topology (e.g. tetrahedron, hexahedron), basis family (Lagrange or serendipity), and effective polynomial order, and can be shared safely across evaluations. Construction may be computationally expensive – it can build node lattices or invert interpolation matrices – so a basis should be constructed only once for each distinct basis request, through basis_factory, and reused rather than rebuilt inside element loops.

Every evaluator takes a three-component reference coordinate. For lower-dimensional elements, only the first dimension() components are active. Returned gradients always have three components and Hessians are always 3-by-3 matrices; inactive reference directions are expected to be zero for conforming lower-dimensional bases. The *_to overloads write to caller-owned spans and are the override points a concrete family implements: the nodal families (LagrangeBasis, SerendipityBasis) compute directly into the span, so this is the allocation-free path for assembly. The std::vector overloads are convenient for setup, tests, and adapter code; they are defined once on the base class, which sizes the output and forwards to the matching span overload.

Outputs are in ReferenceNodeLayout basis order, not necessarily the mesh or solver's native node order. A caller that stores elements in another local ordering must apply the appropriate permutation at the boundary between the basis module and that storage format.

Inputs and ownership

Constructing and evaluating a basis combines several independent choices:

Basis inputs and responsibilities

Reference scope and the solver adapter

The solver-facing adapter in nn.cpp is the boundary between this reference basis contract and legacy solver storage. It translates solver element enums to ElementType, obtains cached default bases for mesh/face shape tables, permutes from ReferenceNodeLayout order into solver node order, and stores N, Nx, and, where needed, packed Nxx at Gauss points. At that stage Nx and Nxx are still derivatives with respect to reference coordinates. Physical-coordinate derivatives are formed later, for a particular configuration and element geometry, by composing the cached reference data with the mapping Jacobian (nn::gnn for first derivatives and nn::gn_nxx for second derivatives).

Enumeration Type Documentation

◆ BasisTopology

enum class svmp::FE::basis::BasisTopology
strong

Reference-cell topology of a basis (the shape, independent of order).

Together with a polynomial order this is the order-agnostic identity a basis is built from: the arbitrary-order constructors take a BasisTopology and an order, and BasisRequest::topology selects that path. A named ElementType maps to one of these through topology().

Enumerator
Unknown 

Unrecognized or uninitialized topology.

Point 

0D point.

Line 

1D line segment.

Triangle 

2D triangle (simplex).

Quadrilateral 

2D quadrilateral (tensor product).

Tetrahedron 

3D tetrahedron (simplex).

Hexahedron 

3D hexahedron (tensor product).

Wedge 

3D triangular prism.

Function Documentation

◆ create()

std::unique_ptr< BasisFunction > svmp::FE::basis::basis_factory::create ( const BasisRequest &  req)

Create a basis from a runtime request.

A request must identify exactly one construction target: set BasisRequest::element_type for a named mesh-node layout, or set BasisRequest::topology for an arbitrary-order reference-topology basis. Setting neither target, or setting both, is rejected. Named element requests keep the element's fixed polynomial order contract; topology requests are the arbitrary-order path.

Parameters
reqBasis family, target, and order request.
Returns
Unique basis instance. Move it into a std::shared_ptr at the call site if shared ownership is needed.

◆ create_default_for()

std::unique_ptr< BasisFunction > svmp::FE::basis::basis_factory::create_default_for ( ElementType  element_type)

Create the default basis for an element type.

Equivalent to create(default_basis_request(element_type)).

Parameters
element_typeElement type to create a default basis for.
Returns
Unique basis instance. Move it into a std::shared_ptr at the call site if shared ownership is needed.

◆ default_basis_request()

BasisRequest svmp::FE::basis::basis_factory::default_basis_request ( ElementType  element_type)

Return the default basis request (family and order) for an element type.

This is the single source of truth for which basis family and polynomial order a given element type uses by default: serendipity node layouts (Quad8, Hex20, Wedge15) select the quadratic serendipity family, and every complete Lagrange element selects the Lagrange family at the order given by its node layout. Solver-facing adapters should translate their element names to ElementType and delegate the basis choice here rather than tabulating family/order themselves.

Parameters
element_typeElement type to select a default basis for.
Returns
Basis request suitable for create().
Exceptions
BasisElementCompatibilityExceptionIf no default basis is defined for the element type.

◆ named_element_for()

constexpr ElementType svmp::FE::basis::named_element_for ( BasisTopology  top,
int  order,
BasisType  family 
)
constexprnoexcept

Named ElementType denoted by a (topology, order, family) triple.

Inverse of topology() + order() for the named layouts: returns the ElementType a basis identity denotes, or ElementType::Unknown when no named layout exists (order 0 on a non-point topology, any order >= 3, or a reduced family at an unsupported order). topology() + order() remain the authoritative identity; callers that want a named ElementType for a basis pass its topology(), order(), and basis_type() here.

Parameters
topReference topology.
orderPolynomial order.
familyBasis family; only Serendipity is distinguished from nodal/Lagrange naming.
Returns
Named ElementType, or ElementType::Unknown when none applies.