1#ifndef DUNE_FEM_HPDG_SPACE_BASISFUNCTIONSETS_LEGENDRE_HH
2#define DUNE_FEM_HPDG_SPACE_BASISFUNCTIONSETS_LEGENDRE_HH
11#include <dune/geometry/type.hh>
13#include <dune/grid/common/capabilities.hh>
36 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
bool hierarchicalOrdering,
class Storage >
37 class LegendreBasisFunctionSets;
46 template<
class FunctionSpace,
int order,
bool hierarchicalOrdering,
class Storage >
47 class LegendreShapeFunctionSets
49 using ThisType = LegendreShapeFunctionSets< FunctionSpace, order, hierarchicalOrdering, Storage >;
52 using ShapeFunctionSetType =
56 LegendreShapeFunctionSets ()
58 for(
int p = 0; p <= order; ++p )
59 shapeFunctionSets_[ p ].reset(
new ShapeFunctionSetType( type(),
typename ShapeFunctionSetType::ImplementationType( p ) ) );
62 static const ThisType &instance ()
64 static ThisType instance;
69 static const ShapeFunctionSetType &
get (
int p )
71 return *instance().shapeFunctionSets_[ p ];
75 static GeometryType type ()
77 return Dune::GeometryTypes::cube( FunctionSpace::dimDomain );
80 std::array< std::unique_ptr< ShapeFunctionSetType >, order+1 > shapeFunctionSets_;
88 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
bool hierarchicalOrdering,
class Storage >
89 class LegendreBasisFunctionSetsTraits
92 using ImplementationType = LegendreBasisFunctionSets< FunctionSpace, GridPart, maxOrder, hierarchicalOrdering, Storage >;
94 using GridPartType = GridPart;
95 using Types = std::array< GeometryType, 1 >;
98 using DataType = KeyType;
100 using EntityType =
typename GridPartType::template Codim< 0 >::EntityType;
102 using ShapeFunctionSetsType = LegendreShapeFunctionSets< Dune::Fem::FunctionSpace< typename FunctionSpace::DomainFieldType, typename FunctionSpace::RangeFieldType, EntityType::mydimension, 1 >, maxOrder, hierarchicalOrdering, Storage >;
105 using BasisFunctionSetType = DefaultBasisFunctionSet< EntityType, ShapeFunctionSetType >;
107 static const int localBlockSize = BasisFunctionSetType::RangeType::dimension;
128 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
bool hierarchicalOrdering,
class Storage >
130 :
public BasisFunctionSets< LegendreBasisFunctionSetsTraits< FunctionSpace, GridPart, maxOrder, hierarchicalOrdering, Storage > >
142 using ShapeFunctionSetsType =
typename BaseType::Traits::ShapeFunctionSetsType;
143 using ShapeFunctionSetType =
typename BaseType::Traits::ShapeFunctionSetType;
166 return std::array< GeometryType, 1 >{{ Dune::GeometryTypes::cube( EntityType::mydimension ) }};
172 return ShapeFunctionSetsType::get( maxOrder ).size();
178 return contains( type ) ?
maxBlocks() : 0u;
184 return contains( type ) ? ShapeFunctionSetsType::get( key ).size() : 0u;
196 using GridType =
typename GridPartType::GridType;
197 return Dune::Capabilities::isCartesian< GridType >::v;
201 static constexpr int order () noexcept {
return maxOrder; }
204 static constexpr int order ( GeometryType type )
noexcept {
return order(); }
209 assert( contains( type ) );
210 return static_cast< int >( key );
216 assert( contains( entity.type() ) );
221 static bool contains ( GeometryType type )
223 return (type.isCube() && type.dim() == EntityType::mydimension);
226 static ShapeFunctionSetType shapeFunctionSet (
KeyType key )
228 return ShapeFunctionSetType( &ShapeFunctionSetsType::get(
static_cast< int >( key ) ) );
Provides a proxy class for pointers to a shape function set.
Definition: bindguard.hh:11
std::tuple_element< i, Tuple >::type & get(Dune::TypeIndexedTuple< Tuple, Types > &tuple)
Definition: typeindexedtuple.hh:122
abstract interface class for a family of local basis function sets
Definition: basisfunctionset/hpdg/basisfunctionsets.hh:30
typename Traits::DataType DataType
data type
Definition: basisfunctionset/hpdg/basisfunctionsets.hh:53
typename Traits::Types Types
a range of geometry types
Definition: basisfunctionset/hpdg/basisfunctionsets.hh:47
typename Traits::BasisFunctionSetType BasisFunctionSetType
basis function set type
Definition: basisfunctionset/hpdg/basisfunctionsets.hh:42
typename BasisFunctionSetType::EntityType EntityType
entity type
Definition: basisfunctionset/hpdg/basisfunctionsets.hh:44
typename Traits::KeyType KeyType
key type
Definition: basisfunctionset/hpdg/basisfunctionsets.hh:39
typename Traits::GridPartType GridPartType
grid part type
Definition: basisfunctionset/hpdg/basisfunctionsets.hh:36
A family of local product basis function sets.
Definition: basisfunctionset/hpdg/legendre.hh:131
typename BaseType::BasisFunctionSetType BasisFunctionSetType
basis function set
Definition: basisfunctionset/hpdg/legendre.hh:147
BasisFunctionSetType basisFunctionSet(const EntityType &entity, KeyType key) const
return basis function set for given entity
Definition: basisfunctionset/hpdg/legendre.hh:214
typename BaseType::KeyType KeyType
Definition: basisfunctionset/hpdg/legendre.hh:150
int order(GeometryType type, KeyType key) const
return maximum order
Definition: basisfunctionset/hpdg/legendre.hh:207
typename BaseType::EntityType EntityType
entity type
Definition: basisfunctionset/hpdg/legendre.hh:139
static constexpr int order() noexcept
return maximum order
Definition: basisfunctionset/hpdg/legendre.hh:201
LegendreBasisFunctionSets(const ThisType &)=default
copy constructor
std::size_t blocks(GeometryType type, KeyType key) const
Definition: basisfunctionset/hpdg/legendre.hh:182
std::size_t maxBlocks() const
Definition: basisfunctionset/hpdg/legendre.hh:170
static constexpr int order(GeometryType type) noexcept
return maximum order
Definition: basisfunctionset/hpdg/legendre.hh:204
typename BaseType::GridPartType GridPartType
Definition: basisfunctionset/hpdg/legendre.hh:137
LegendreBasisFunctionSets()=default
constructor
BaseType::Types types() const
Definition: basisfunctionset/hpdg/legendre.hh:164
std::size_t maxBlocks(GeometryType type) const
Definition: basisfunctionset/hpdg/legendre.hh:176
static KeyType decode(const DataType &data) noexcept
Definition: basisfunctionset/hpdg/legendre.hh:191
static constexpr bool orthogonal() noexcept
Definition: basisfunctionset/hpdg/legendre.hh:194
LegendreBasisFunctionSets(ThisType &&)=default
move constructor
static DataType encode(const KeyType &key) noexcept
Definition: basisfunctionset/hpdg/legendre.hh:188
typename BaseType::DataType DataType
Definition: basisfunctionset/hpdg/legendre.hh:152
Definition: selectcaching.hh:26
Definition: shapefunctionset/vectorial.hh:447