dune-fem  2.4.1-rc
combinedspace/generic.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_GENERIC_HH
2 #define DUNE_FEM_SPACE_COMBINEDSPACE_GENERIC_HH
3 
4 #include <algorithm>
5 #include <type_traits>
6 
7 #include <dune/common/math.hh>
8 #include <dune/common/typetraits.hh>
9 #include <dune/grid/common/grid.hh>
10 
13 
14 namespace Dune
15 {
16 
17  namespace Fem
18  {
19 
20  // GenericCombinedDiscreteFunctionSpace
21  // ------------------------------------
22 
23  template< class Traits >
25  : public DiscreteFunctionSpaceDefault< Traits >
26  {
29 
30  typedef typename Traits::DiscreteFunctionSpaceTupleType DiscreteFunctionSpaceTupleType;
31 
32  public:
33  // type of i-th contained sub space
34  template< int i >
35  using SubDiscreteFunctionSpace = typename Traits::template SubDiscreteFunctionSpace< i >;
36 
40  typedef typename Traits::GridType GridType;
41  typedef typename GridPartType::IntersectionType IntersectionType;
46  enum { dimension = GridType::dimension };
47 
50 
52  enum { polynomialOrder = Traits::polynomialOrder };
53 
56 
59 
61  enum { localBlockSize = Traits::localBlockSize };
62 
64  typedef int IdentifierType;
66  static const IdentifierType id = 669;
67 
70 
72  static const InterfaceType defaultInterface = InteriorBorder_All_Interface;
73 
75  static const CommunicationDirection defaultDirection = ForwardCommunication;
76 
84  const InterfaceType commInterface = defaultInterface,
85  const CommunicationDirection commDirection = defaultDirection )
86  : BaseType( gridPart, commInterface, commDirection ),
87  spaceTuple_( Traits::createSpaces( gridPart, commInterface, commDirection ) ),
88  blockMapper_( Traits::getBlockMapper( spaceTuple_ ) )
89  {}
90 
91  // prohibit copy constructor and copy assignment
92  GenericCombinedDiscreteFunctionSpace ( const ThisType & ) = delete;
93  ThisType &operator= ( const ThisType & ) = delete;
94 
99  {
100  Traits::deleteBlockMapper( blockMapper_ );
101  Traits::deleteSpaces( spaceTuple_ );
102  }
103 
104  using BaseType::gridPart;
105 
107  bool contains ( const int codim ) const
108  {
109  // forward to mapper since this information is held there
110  return blockMapper().contains( codim );
111  }
112 
114  bool continuous () const
115  {
116  return Traits::continuous( spaceTuple_ );
117  }
118 
120  bool continuous ( const IntersectionType &intersection ) const
121  {
122  return Traits::continuous( intersection, spaceTuple_ );
123  }
124 
129  {
130  return DFSpaceIdentifier( -1 );
131  }
132 
134  int order () const
135  {
136  return polynomialOrder;
137  }
138 
140  template< class Entity >
141  int order ( const Entity &entity ) const
142  {
143  return polynomialOrder;
144  }
145 
147  template< class EntityType >
148  BasisFunctionSetType basisFunctionSet ( const EntityType &entity ) const
149  {
150  return Traits::getBasisFunctionSet( entity, spaceTuple_ );
151  }
152 
156  BlockMapperType &blockMapper () const
157  {
158  return *blockMapper_;
159  }
160 
162  template< int i >
164  {
166  }
167 
168  private:
170  DiscreteFunctionSpaceTupleType spaceTuple_;
171 
173  BlockMapperType *blockMapper_;
174  };
175 
176  } // namespace Fem
177 
178 } // namespace Dune
179 
180 #endif // #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_GENERIC_HH
int order(const Entity &entity) const
get global order of space
Definition: combinedspace/generic.hh:141
DFSpaceIdentifier type() const
get the type of this discrete function space
Definition: combinedspace/generic.hh:128
BasisFunctionSetType::FunctionSpaceType FunctionSpaceType
Definition: powerspace.hh:90
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: combinedspace/generic.hh:120
~GenericCombinedDiscreteFunctionSpace()
Destructor (freeing base functions and mapper)
Definition: combinedspace/generic.hh:98
DiscreteFunctionSpace::GridPartType GridPartType
Definition: powerspace.hh:64
Traits::IteratorType IteratorType
Definition: combinedspace/generic.hh:44
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:88
static const InterfaceType defaultInterface
default communication interface
Definition: combinedspace/generic.hh:72
Definition: datacollector.hh:45
int order() const
get global order of space
Definition: combinedspace/generic.hh:134
GridPartType::template Codim< 0 >::IteratorType IteratorType
Definition: powerspace.hh:67
typename PowerDiscreteFunctionSpaceTraits< DiscreteFunctionSpace, N >::template SubDiscreteFunctionSpace< i > SubDiscreteFunctionSpace
Definition: combinedspace/generic.hh:35
static const CommunicationDirection defaultDirection
default communication direction
Definition: combinedspace/generic.hh:75
int IdentifierType
type of identifier for this discrete function space
Definition: combinedspace/generic.hh:64
Definition: coordinate.hh:4
Traits::GridType GridType
Definition: combinedspace/generic.hh:40
GridPartType::IndexSetType IndexSetType
Definition: powerspace.hh:66
Traits::FunctionSpaceType FunctionSpaceType
the underlaying Analytical function space
Definition: combinedspace/generic.hh:49
Traits::GridPartType GridPartType
Definition: combinedspace/generic.hh:39
GenericCombinedDiscreteFunctionSpace(GridPartType &gridPart, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
constructor
Definition: combinedspace/generic.hh:83
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:595
const SubDiscreteFunctionSpace< i >::Type & subDiscreteFunctionSpace() const
obtain the i-th subspace
Definition: combinedspace/generic.hh:163
GridPartType::GridType GridType
Definition: powerspace.hh:65
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: combinedspace/generic.hh:148
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: combinedspace/generic.hh:114
Builds a vectorial basis function set from given scalar basis function set.
Definition: basisfunctionset/vectorial.hh:250
Traits::BlockMapperType BlockMapperType
mapper used to for block vector function
Definition: combinedspace/generic.hh:58
Traits::IndexSetType IndexSetType
extract informations about IndexSet and Iterators
Definition: combinedspace/generic.hh:43
mapper allocating one DoF per subentity of a given codimension
Definition: powermapper.hh:19
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:714
DofManager< GridType > DofManagerType
type of DofManager
Definition: combinedspace/generic.hh:69
bool contains(const int codim) const
Definition: combinedspace/generic.hh:107
Traits::BasisFunctionSetType BasisFunctionSetType
type of the base function set(s)
Definition: combinedspace/generic.hh:55
GridPartType::IntersectionType IntersectionType
Definition: combinedspace/generic.hh:41
ThisType & operator=(const ThisType &)=delete
GridPartType::template Codim< Traits::codimension >::EntityType EntityType
type of entity of codimension 0
Definition: discretefunctionspace.hh:200
Definition: combinedspace/generic.hh:46
BlockMapperType & blockMapper() const
obtain the DoF block mapper of this space
Definition: combinedspace/generic.hh:156
Definition: combinedspace/generic.hh:24