dune-localfunctions  2.2.1
Public Types | Static Public Member Functions | List of all members
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 More...
 
typedef
FiniteElement::Traits::Interpolation 
Interpolation
 export the type of the interpolation More...
 
typedef
FiniteElement::Traits::Coefficients 
Coefficients
 export the type of the coefficients More...
 
typedef shared_ptr< const
FiniteElement > 
Store
 Type for storing finite elements. More...
 

Static Public Member Functions

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

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

template<class FiniteElement , class Dummy = void>
typedef FiniteElement::Traits::Basis Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::Basis

export the type of the basis

template<class FiniteElement , class Dummy = void>
typedef FiniteElement::Traits::Coefficients Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::Coefficients

export the type of the coefficients

template<class FiniteElement , class Dummy = void>
typedef FiniteElement::Traits::Interpolation Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::Interpolation

export the type of the interpolation

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

Type for storing finite elements.

Some algorithms use one variable to store (a pointer) a finite element and update that pointer while iterating through the grid. This works well for local finite elements, since they exists in a finite number of variants, which can be stored somewhere and don't need to change for the duration of the algorithm, so we can always store a simple pointer. For global finite elements we have to store the object itself however, and we must make sure that we destroy the object when we are done with it. Since global finite elements are not assignable in general, we needs to copy-construct them for each grid element we visit.

To accommodate both interfaces, we define a store: for local finite elements it is a simple pointer, and if we want to store a finite element in it we simply store its address. For global finite elements we use a shared_ptr, and if we want to store a finite element in it we allocate a new object and initialise it with the copy-constructor. For local finite elements we don't need to do anything when we are done with it, global finite elements are automatically destructed by the shared_ptr when we store a new one or when the shared_ptr itself is destroyed. Access to the finite element is done by simply dereferencing the store in both cases.

Member Function Documentation

template<class FiniteElement , class Dummy = void>
static const Basis& Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::basis ( const FiniteElement &  fe)
inlinestatic

access basis

template<class FiniteElement , class Dummy = void>
static const Coefficients& Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::coefficients ( const FiniteElement &  fe)
inlinestatic

access coefficients

template<class FiniteElement , class Dummy = void>
static const Interpolation& Dune::FiniteElementInterfaceSwitch< FiniteElement, Dummy >::interpolation ( const FiniteElement &  fe)
inlinestatic

access interpolation

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: