1#ifndef DUNE_FEM_HPDG_SPACE_BASISFUNCTIONSETS_ANISOTROPIC_HH
2#define DUNE_FEM_HPDG_SPACE_BASISFUNCTIONSETS_ANISOTROPIC_HH
13#include <dune/common/fvector.hh>
14#include <dune/common/power.hh>
16#include <dune/geometry/type.hh>
18#include <dune/grid/common/capabilities.hh>
42 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
class Storage >
52 template<
class FunctionSpace,
int order,
class Storage >
53 class LegendreShapeFunctionSetTuple
56 using FactoryType = LegendreShapeFunctionSets< typename Dune::Fem::ToNewDimDomainFunctionSpace< FunctionSpace, 1 >::Type, order,
false, Storage >;
59 template<
int i,
class MultiIndex >
60 static ElementType
get (
const MultiIndex &multiIndex )
62 return &FactoryType::get( multiIndex[ i ] );
65 template<
class MultiIndex,
int... i >
66 static auto get (
const MultiIndex &multiIndex, std::integer_sequence< int, i... > )
67 ->
decltype( std::make_tuple( get< i, MultiIndex >( multiIndex )... ) )
69 return std::make_tuple( get< i, MultiIndex >( multiIndex )... );
73 using Type =
decltype(
get( std::declval< Dune::FieldVector< int, FunctionSpace::dimDomain > >(), std::make_integer_sequence< int, FunctionSpace::dimDomain >() ) );
75 template<
class MultiIndex >
76 static Type
get (
const MultiIndex &multiIndex )
78 return get( multiIndex, std::make_integer_sequence< int, FunctionSpace::dimDomain >() );
87 template<
class FunctionSpace,
int order,
class Storage >
88 struct AnisotropicShapeFunctionSet
94 AnisotropicShapeFunctionSet ()
95 : AnisotropicShapeFunctionSet( multiIndex() )
98 template<
class MultiIndex >
99 explicit AnisotropicShapeFunctionSet (
const MultiIndex &multiIndex )
100 : BaseType( LegendreShapeFunctionSetTuple< FunctionSpace, order, Storage >::get( multiIndex ) )
104 static Dune::FieldVector< int, FunctionSpace::dimDomain > multiIndex ()
106 return Dune::FieldVector< int, FunctionSpace::dimDomain >( order );
115 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
class Storage >
116 class AnisotropicBasisFunctionSetsTraits
121 using GridPartType = GridPart;
122 using EntityType =
typename GridPartType::template Codim< 0 >::EntityType;
123 using Types = std::array< GeometryType, 1 >;
125 using KeyType = Dune::FieldVector< int, FunctionSpace::dimDomain >;
128 using ScalarShapeFunctionSetType = AnisotropicShapeFunctionSet< ScalarFunctionSpaceType, maxOrder, Storage >;
133 static const int localBlockSize = FunctionSpace::dimRange;
135 using DataType = int;
156 template<
class FunctionSpace,
class Gr
idPart,
int maxOrder,
class Storage >
158 :
public BasisFunctionSets< AnisotropicBasisFunctionSetsTraits< FunctionSpace, GridPart, maxOrder, Storage > >
172 using ScalarShapeFunctionSetType =
typename BaseType::Traits::ScalarShapeFunctionSetType;
173 using ShapeFunctionSetType =
typename BaseType::Traits::ShapeFunctionSetType;
186 return std::array< GeometryType, 1 >{{ Dune::GeometryTypes::cube( EntityType::mydimension ) }};
192 return Dune::StaticPower< maxOrder+1, FunctionSpace::dimDomain >::power;
196 static std::size_t
maxBlocks ( Dune::GeometryType type )
noexcept
198 assert( contains( type ) );
205 assert( contains( type ) );
212 std::for_each( key.begin(), key.end(), function );
213 assert(
blocks == scalarShapeFunctionSet( key ).size() );
223 data += key[ i ]*factor;
224 factor *= maxOrder+1;
227 assert(
decode( data ) == key );
237 key[ i ] = data % (maxOrder+1);
238 data /= (maxOrder+1);
240 return std::move( key );
246 using GridType =
typename GridPartType::GridType;
247 return Dune::Capabilities::isCartesian< GridType >::v;
251 static constexpr int order () noexcept {
return maxOrder; }
254 static constexpr int order ( Dune::GeometryType type )
noexcept
256 assert( type == GeometryType( GeometryType::cube, EntityType::mydimension ) );
263 assert( type == GeometryType( GeometryType::cube, EntityType::mydimension ) );
264 return *std::max_element( key.begin(), key.end() );
270 assert( entity.type() == Dune::GeometryTypes::cube( EntityType::mydimension ) );
275 static bool contains ( Dune::GeometryType type )
noexcept
277 return (type.isCube() && type.dim() == EntityType::mydimension);
280 static ScalarShapeFunctionSetType scalarShapeFunctionSet (
const KeyType &key )
noexcept
282 return ScalarShapeFunctionSetType( key );
285 static ShapeFunctionSetType shapeFunctionSet (
const KeyType &key )
noexcept
287 return ShapeFunctionSetType( scalarShapeFunctionSet( 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
Definition: space/basisfunctionset/default.hh:52
A family of anisotropic local product basis function sets.
Definition: basisfunctionset/hpdg/anisotropic.hh:159
typename BaseType::EntityType EntityType
entity type
Definition: basisfunctionset/hpdg/anisotropic.hh:166
static DataType encode(const KeyType &key) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:218
static constexpr int order(Dune::GeometryType type) noexcept
return maximum order
Definition: basisfunctionset/hpdg/anisotropic.hh:254
static std::size_t blocks(GeometryType type, KeyType key) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:203
static std::size_t maxBlocks(Dune::GeometryType type) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:196
typename BaseType::KeyType KeyType
Definition: basisfunctionset/hpdg/anisotropic.hh:177
static constexpr std::size_t maxBlocks() noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:190
typename BaseType::BasisFunctionSetType BasisFunctionSetType
basis function set
Definition: basisfunctionset/hpdg/anisotropic.hh:169
static BasisFunctionSetType basisFunctionSet(const EntityType &entity, const KeyType &key) noexcept
return basis function set for given entity
Definition: basisfunctionset/hpdg/anisotropic.hh:268
static int order(Dune::GeometryType type, KeyType key) noexcept
return maximum order
Definition: basisfunctionset/hpdg/anisotropic.hh:261
static constexpr int order() noexcept
return maximum order
Definition: basisfunctionset/hpdg/anisotropic.hh:251
typename BaseType::DataType DataType
Definition: basisfunctionset/hpdg/anisotropic.hh:179
BaseType::Types types() const noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:184
static constexpr bool orthogonal() noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:244
static KeyType decode(DataType data) noexcept
Definition: basisfunctionset/hpdg/anisotropic.hh:232
typename BaseType::GridPartType GridPartType
Definition: basisfunctionset/hpdg/anisotropic.hh:164
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
Definition: tensorproduct.hh:28
Definition: shapefunctionset/vectorial.hh:447