Dune Core Modules (2.8.0)

Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy > Struct Template Reference

Switch for uniform treatment of finite element with either the local or the global interface. More...

#include <dune/localfunctions/common/interfaceswitch.hh>

Public Types

typedef FiniteElement::Traits::Basis Basis
 export the type of the basis
 
typedef FiniteElement::Traits::Interpolation Interpolation
 export the type of the interpolation
 
typedef FiniteElement::Traits::Coefficients Coefficients
 export the type of the coefficients
 
typedef std::shared_ptr< const FiniteElement > Store
 Type for storing finite elements. More...
 

Static Public Member Functions

static const Basisbasis (const FiniteElement &fe)
 access basis
 
static const Interpolationinterpolation (const FiniteElement &fe)
 access interpolation
 
static const Coefficientscoefficients (const FiniteElement &fe)
 access coefficients
 
static void setStore (Store &store, const FiniteElement &fe)
 Store a finite element in the store. More...
 
static void setStore (Store &store, FiniteElement &&fe)
 Store a finite element in the store.
 
static void setStore (Store &store, const Store &fe)
 Store a finite element in the store.
 

Detailed Description

template<class FiniteElement, class Dummy = void>
struct Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >

Switch for uniform treatment of finite element with either the local or the global interface.

Template Parameters
FiniteElementType of the finite element to handle.
DummyDummy parameter for enable_if. This must be left at the default value of void.
Note
The local interface is detected by the presence of the type FiniteElement::Traits::LocalBasisType.

Member Typedef Documentation

◆ Store

template<class FiniteElement , class Dummy = void>
typedef std::shared_ptr<const FiniteElement> Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::Store

Type for storing finite elements.

Some algorithms use one variable to store (as a shared pointer) a finite element and update that pointer while iterating through the grid. This works well as long as there is only a moderate number of different finite elements, which can be stored somewhere and don't change for the duration of the algorithm. This is the case for most local finite elements, since they exists in a finite number of variants.

If the number of possible finite element realizations grows to big, e.g. for global finite elements or also for p-adaptive local finite elements, these are only created on the fly. Therefore we need to store a copy. Since finite elements in general are not assignable, we either copy-construct or move-construt them for each grid element we visit.

To accommodate both interfaces, we store in a shared_ptr. Different ways to initialize a possible, from an l-value reference, an r-value reference or from a shared_ptr.

For backwards compatibility we assume that an l-value reference to a local finite element is persistent and that we can simply store the pointer using stackobject_to_shared_ptr, while in the case of global finite elements we always need to copy construct using make_shared. If a local finite element is not persistent, it should be passed in as an r-value reference. Access to the finite element is done by simply dereferencing the store in both cases.

Member Function Documentation

◆ setStore()

template<class FiniteElement , class Dummy = void>
static void Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::setStore ( Store store,
const FiniteElement &  fe 
)
inlinestatic

Store a finite element in the store.

For local finite elements this means storing the address of the passed reference, for global finite element this means creating a new object with allocation and copy-construction and storing that.


The documentation for this struct was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)