SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::discretization::backend::mfem::TensorBasisCache Class Referencefinal

Share immutable tensor plans within one operator; copied rules are keyed by their contents. More...

#include <tensor_basis.hpp>

Collaboration diagram for serif::discretization::backend::mfem::TensorBasisCache:
[legend]

Classes

struct  Entry
 A struct that represents an entry in the TensorBasisCache. Each entry contains a non-owning pointer to a finite element, the reference operation, the number of copies, the points used to construct the TensorBasis, and a shared pointer to the TensorBasis itself. More...
 

Public Member Functions

std::shared_ptr< const TensorBasis > get (const ::mfem::FiniteElement &element, const ::mfem::IntegrationRule &rule, ReferenceOperation operation, const int copies, const ElementReconstruction *reconstruction=nullptr)
 Retrieve a verified plan, caching unsupported combinations as well.
 
std::size_t size () const noexcept
 Get the number of entries in the TensorBasisCache.
 
void clear ()
 Clear the TensorBasisCache, removing all entries.
 

Private Attributes

std::vector< Entry > m_entries
 The entries in the TensorBasisCache, each containing a non-owning pointer to a finite element, the reference operation, the number of copies, the points used to construct the TensorBasis, and a shared pointer to the TensorBasis itself.
 

Detailed Description

Share immutable tensor plans within one operator; copied rules are keyed by their contents.

A cache for TensorBasis objects to avoid repeated construction of the same tensor basis. This class stores a vector of "Entry" structs which each contain a non-owning pointer to some element, options, a shared pointer to a TensorBasis, and the points used to construct the TensorBasis.

Member Function Documentation

◆ clear()

void serif::discretization::backend::mfem::TensorBasisCache::clear ( )
inline

Clear the TensorBasisCache, removing all entries.

◆ get()

std::shared_ptr< const TensorBasis > serif::discretization::backend::mfem::TensorBasisCache::get ( const ::mfem::FiniteElement & element,
const ::mfem::IntegrationRule & rule,
ReferenceOperation operation,
const int copies,
const ElementReconstruction * reconstruction = nullptr )
inlinenodiscard

Retrieve a verified plan, caching unsupported combinations as well.

Retrieve a verified tensor basis, caching unsupported combinations as well.

Parameters
elementThe finite element for which to retrieve the tensor basis.
ruleThe integration rule to use for evaluating the basis functions.
operationThe reference operation to apply (e.g., value, gradient).
copiesThe number of copies of the basis functions.
Returns
A shared pointer to a TensorBasis object if the tensor basis can be constructed, or an empty shared pointer if it cannot.
Todo
I think it would make sense, at some point, to switch this to an std::optional return

◆ size()

std::size_t serif::discretization::backend::mfem::TensorBasisCache::size ( ) const
inlinenodiscardnoexcept

Get the number of entries in the TensorBasisCache.

Returns
The number of entries in the cache.

Member Data Documentation

◆ m_entries

std::vector<Entry> serif::discretization::backend::mfem::TensorBasisCache::m_entries
private

The entries in the TensorBasisCache, each containing a non-owning pointer to a finite element, the reference operation, the number of copies, the points used to construct the TensorBasis, and a shared pointer to the TensorBasis itself.


The documentation for this class was generated from the following file: