1#ifndef DUNE_FEM_SPACE_COMBINEDSPACE_POWERSPACE_HH
2#define DUNE_FEM_SPACE_COMBINEDSPACE_POWERSPACE_HH
12#include <dune/fem/common/memory.hh>
13#include <dune/fem/common/utility.hh>
14#include <dune/fem/space/basisfunctionset/vectorial.hh>
15#include <dune/fem/space/combinedspace/generic.hh>
16#include <dune/fem/space/combinedspace/interpolation.hh>
17#include <dune/fem/space/combinedspace/lagrangepointsetexporter.hh>
18#include <dune/fem/space/combinedspace/powerlocalrestrictprolong.hh>
19#include <dune/fem/space/combinedspace/powermapper.hh>
20#include <dune/fem/space/common/defaultcommhandler.hh>
30 template<
class DiscreteFunctionSpace,
int N >
31 class PowerDiscreteFunctionSpace;
37 template<
class DiscreteFunctionSpace,
int N >
38 struct PowerDiscreteFunctionSpaceTraits
41 typedef std::shared_ptr< DiscreteFunctionSpace > DiscreteFunctionSpaceTupleType;
45 struct SubDiscreteFunctionSpace
51 typedef typename Type::BlockMapperType BlockMapperType;
54 static const Type &subDiscreteFunctionSpace (
const DiscreteFunctionSpaceTupleType &tuple )
59 static BlockMapperType &subBlockMapper (
const DiscreteFunctionSpaceTupleType &tuple )
61 return subDiscreteFunctionSpace().blockMapper();
66 typedef typename DiscreteFunctionSpace::GridPartType GridPartType;
67 typedef typename GridPartType::GridType GridType;
69 typedef typename GridPartType::template Codim< 0 >::IteratorType IteratorType;
70 typedef typename IteratorType::Entity EntityType;
74 typedef PowerDiscreteFunctionSpace< DiscreteFunctionSpace, N > DiscreteFunctionSpaceType;
76 static const int codimension = DiscreteFunctionSpace::Traits::codimension;
78 static_assert( DiscreteFunctionSpace::FunctionSpaceType::dimRange == 1,
79 "PowerDiscreteFunctionSpace only works for ContainedSpaces with dimRange = 1" );
81 typedef typename DiscreteFunctionSpace::BasisFunctionSetType ScalarBasisFunctionSetType;
82 typedef typename ScalarBasisFunctionSetType::FunctionSpaceType::RangeFieldType RangeFieldType;
83 typedef VectorialBasisFunctionSet< ScalarBasisFunctionSetType, FieldVector< RangeFieldType, N >, VerticalDofAlignment > BasisFunctionSetType;
86 typedef PowerMapper< GridPartType, typename DiscreteFunctionSpace::BlockMapperType, N > BlockMapperType;
89 typedef typename DiscreteFunctionSpace::LocalBlockIndices LocalBlockIndices;
95 template<
class DiscreteFunction,
97 =
typename DiscreteFunctionSpace::template CommDataHandle< DiscreteFunctionSpace >::OperationType >
101 typedef typename DiscreteFunctionSpace::
102 template CommDataHandle< DiscreteFunction, Operation >::Type Type;
104 typedef typename DiscreteFunctionSpace::
105 template CommDataHandle< DiscreteFunction, Operation >::OperationType OperationType;
109 static BlockMapperType *getBlockMapper (
const DiscreteFunctionSpaceTupleType &spaceTuple )
111 return new BlockMapperType( spaceTuple->gridPart(), spaceTuple->blockMapper() );
115 static DiscreteFunctionSpaceTupleType createSpaces ( GridPartType &gridPart,
InterfaceType commInterface,
118 return std::make_shared< DiscreteFunctionSpace >( gridPart, commInterface, commDirection );
121 template<
class Entity >
122 static BasisFunctionSetType getBasisFunctionSet (
const Entity &entity,
const DiscreteFunctionSpaceTupleType &tuple )
124 return BasisFunctionSetType( tuple->basisFunctionSet( entity ) );
127 template<
class T,
class F >
128 static T
accumulate (
const DiscreteFunctionSpaceTupleType &tuple, T value, F &&f )
130 return f( value, *tuple );
146 template<
class DiscreteFunctionSpace,
int N >
147 class PowerDiscreteFunctionSpace
148 :
public GenericCombinedDiscreteFunctionSpace< PowerDiscreteFunctionSpaceTraits< DiscreteFunctionSpace, N > >,
149 public CombinedSpaceHelper::LagrangePointSetExporter< DiscreteFunctionSpace >
151 typedef PowerDiscreteFunctionSpace< DiscreteFunctionSpace, N > ThisType;
152 typedef GenericCombinedDiscreteFunctionSpace< PowerDiscreteFunctionSpaceTraits< DiscreteFunctionSpace, N > > BaseType;
153 typedef CombinedSpaceHelper::LagrangePointSetExporter< DiscreteFunctionSpace > LagrangePointSetExporterType;
156 typedef PowerDiscreteFunctionSpaceTraits< DiscreteFunctionSpace, N > Traits;
158 typedef typename Traits::GridPartType GridPartType;
164 typedef PowerSpaceInterpolation< ThisType, N > InterpolationType;
166 typedef typename Traits::EntityType EntityType;
174 PowerDiscreteFunctionSpace ( GridPartType &gridPart,
177 : BaseType( gridPart, commInterface, commDirection ),
178 LagrangePointSetExporterType( containedSpace() )
182 : BaseType( referenceToSharedPtr( space ) )
185 PowerDiscreteFunctionSpace ( std::shared_ptr< DiscreteFunctionSpace > space )
186 : BaseType(
std::move( space ) )
189 PowerDiscreteFunctionSpace (
const ThisType & ) =
delete;
190 ThisType &operator= (
const ThisType & ) =
delete;
193 const ContainedDiscreteFunctionSpaceType &containedSpace ()
const
195 return BaseType::template subDiscreteFunctionSpace< 0 >();
199 InterpolationType interpolation (
const EntityType &entity )
const
201 return InterpolationType( *
this, entity );
207 template<
class DiscreteFunctionSpace,
int N,
class NewFunctionSpace >
210 typedef PowerDiscreteFunctionSpace< DiscreteFunctionSpace, NewFunctionSpace::dimRange > Type;
217 template<
class DiscreteFunctionSpace,
int N >
219 :
public PowerLocalRestrictProlong< DiscreteFunctionSpace, N >
221 typedef DefaultLocalRestrictProlong< PowerDiscreteFunctionSpace< DiscreteFunctionSpace, N > > ThisType;
222 typedef PowerDiscreteFunctionSpace< DiscreteFunctionSpace, N > DiscreteFunctionSpacesType;
223 typedef PowerLocalRestrictProlong< DiscreteFunctionSpace, N > BaseType;
226 DefaultLocalRestrictProlong (
const DiscreteFunctionSpacesType &space )
227 : BaseType( space.containedSpace() )
IntersectionIteratorType::Intersection IntersectionType
type of intersection
Definition: adaptiveleafgridpart.hh:95
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition: adaptiveleafindexset.hh:1351
A vector valued function space.
Definition: functionspace.hh:60
Different resources needed by all grid implementations.
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:279
Some useful basic math stuff.
Dune namespace.
Definition: alignedallocator.hh:13