1 #ifndef DUNE_FEM_HPDG_SPACE_BASISFUNCTIONSETS_ANISOTROPIC_HH
2 #define DUNE_FEM_HPDG_SPACE_BASISFUNCTIONSETS_ANISOTROPIC_HH
10 #include <type_traits>
13 #include <dune/common/fvector.hh>
14 #include <dune/common/power.hh>
15 #include <dune/common/std/utility.hh>
17 #include <dune/geometry/type.hh>
19 #include <dune/grid/common/capabilities.hh>
43 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
bool caching = true >
53 template<
class FunctionSpace,
int order,
bool caching >
54 class LegendreShapeFunctionSetTuple
57 using FactoryType = LegendreShapeFunctionSets< typename Dune::Fem::ToNewDimDomainFunctionSpace< FunctionSpace, 1 >::Type, order,
false, caching >;
60 template<
int i,
class MultiIndex >
61 static ElementType
get (
const MultiIndex &multiIndex )
66 template<
class MultiIndex,
int... i >
67 static auto get (
const MultiIndex &multiIndex, Dune::Std::integer_sequence< int, i... > )
68 -> decltype( std::make_tuple( get< i, MultiIndex >( multiIndex )... ) )
70 return std::make_tuple( get< i, MultiIndex >( multiIndex )... );
74 using Type = decltype(
get( std::declval< Dune::FieldVector< int, FunctionSpace::dimDomain > >(), Dune::Std::make_integer_sequence< int, FunctionSpace::dimDomain >() ) );
76 template<
class MultiIndex >
77 static Type
get (
const MultiIndex &multiIndex )
79 return get( multiIndex, Dune::Std::make_integer_sequence< int, FunctionSpace::dimDomain >() );
88 template<
class FunctionSpace,
int order,
bool caching >
89 struct AnisotropicShapeFunctionSet
95 AnisotropicShapeFunctionSet ()
96 : AnisotropicShapeFunctionSet( multiIndex() )
99 template<
class MultiIndex >
100 explicit AnisotropicShapeFunctionSet (
const MultiIndex &multiIndex )
105 static Dune::FieldVector< int, FunctionSpace::dimDomain > multiIndex ()
107 return Dune::FieldVector< int, FunctionSpace::dimDomain >( order );
116 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
bool caching >
117 class AnisotropicBasisFunctionSetsTraits
122 using GridPartType = GridPart;
123 using EntityType =
typename GridPartType::template Codim< 0 >::EntityType;
124 using Types = std::array< GeometryType, 1 >;
126 using KeyType = Dune::FieldVector< int, FunctionSpace::dimDomain >;
129 using ScalarShapeFunctionSetType = AnisotropicShapeFunctionSet< ScalarFunctionSpaceType, maxOrder, caching >;
136 using DataType = int;
157 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
bool caching >
159 :
public BasisFunctionSets< AnisotropicBasisFunctionSetsTraits< FunctionSpace, GridPart, maxOrder, caching > >
173 using ScalarShapeFunctionSetType =
typename BaseType::Traits::ScalarShapeFunctionSetType;
174 using ShapeFunctionSetType =
typename BaseType::Traits::ShapeFunctionSetType;
187 std::array< GeometryType, 1 >
types;
188 types[ 0 ].makeCube( EntityType::mydimension );
189 return std::move(
types );
195 return Dune::StaticPower< maxOrder+1, FunctionSpace::dimDomain >::power;
199 static std::size_t
maxBlocks ( Dune::GeometryType type ) noexcept
201 assert( contains( type ) );
208 assert( contains( type ) );
215 std::for_each( key.begin(), key.end(),
function );
216 assert(
blocks == scalarShapeFunctionSet( key ).size() );
226 data += key[ i ]*factor;
227 factor *= maxOrder+1;
230 assert(
decode( data ) == key );
240 key[ i ] = data % (maxOrder+1);
241 data /= (maxOrder+1);
243 return std::move( key );
249 using GridType =
typename GridPartType::GridType;
250 return Dune::Capabilities::isCartesian< GridType >::v;
254 static constexpr
int order () noexcept {
return maxOrder; }
257 static constexpr
int order ( Dune::GeometryType type ) noexcept
259 assert( type == GeometryType( GeometryType::cube, EntityType::mydimension ) );
266 assert( type == GeometryType( GeometryType::cube, EntityType::mydimension ) );
267 return *std::max_element( key.begin(), key.end() );
273 assert( entity.type() == GeometryType( Dune::Impl::CubeTopology< EntityType::mydimension >::type::id, EntityType::mydimension ) );
278 static bool contains ( Dune::GeometryType type ) noexcept
280 return (type.isCube() && type.dim() == EntityType::mydimension);
283 static ScalarShapeFunctionSetType scalarShapeFunctionSet (
const KeyType &key ) noexcept
285 return ScalarShapeFunctionSetType( key );
288 static ShapeFunctionSetType shapeFunctionSet (
const KeyType &key ) noexcept
290 return ShapeFunctionSetType( scalarShapeFunctionSet( key ) );
Definition: bindguard.hh:11
std::tuple_element< i, Tuple >::type & get(Dune::TypeIndexedTuple< Tuple, Types > &tuple)
Definition: typeindexedtuple.hh:122
Definition: basisfunctionset/default.hh:47
A family of anisotropic local product basis function sets.
Definition: basisfunctionset/hpdg/anisotropic.hh:160
typename BaseType::BasisFunctionSetType BasisFunctionSetType
basis function set
Definition: basisfunctionset/hpdg/anisotropic.hh:170
static constexpr bool orthogonal() noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:247
static constexpr int order(Dune::GeometryType type) noexcept
return maximum order
Definition: basisfunctionset/hpdg/anisotropic.hh:257
typename BaseType::EntityType EntityType
entity type
Definition: basisfunctionset/hpdg/anisotropic.hh:167
static constexpr int order() noexcept
return maximum order
Definition: basisfunctionset/hpdg/anisotropic.hh:254
static int order(Dune::GeometryType type, KeyType key) noexcept
return maximum order
Definition: basisfunctionset/hpdg/anisotropic.hh:264
typename BaseType::GridPartType GridPartType
Definition: basisfunctionset/hpdg/anisotropic.hh:165
static KeyType decode(DataType data) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:235
typename BaseType::DataType DataType
Definition: basisfunctionset/hpdg/anisotropic.hh:180
BaseType::Types types() const noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:185
static std::size_t blocks(GeometryType type, KeyType key) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:206
static std::size_t maxBlocks(Dune::GeometryType type) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:199
typename BaseType::KeyType KeyType
Definition: basisfunctionset/hpdg/anisotropic.hh:178
static constexpr std::size_t maxBlocks() noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:193
static BasisFunctionSetType basisFunctionSet(const EntityType &entity, const KeyType &key) noexcept
return basis function set for given entity
Definition: basisfunctionset/hpdg/anisotropic.hh:271
static DataType encode(const KeyType &key) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:221
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
convert functions space to space with new dim range
Definition: functionspace.hh:250
@ dimDomain
dimension of domain vector space
Definition: functionspaceinterface.hh:46
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
Definition: shapefunctionset/proxy.hh:33
Definition: tensorproduct.hh:28
Definition: shapefunctionset/vectorial.hh:446
Provides a proxy class for pointers to a shape function set.