dune-fem  2.4.1-rc
mapper/dofmapper.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_DOFMAPPER_HH
2 #define DUNE_FEM_DOFMAPPER_HH
3 
4 //- Dune includes
7 
8 namespace Dune
9 {
10 
11  namespace Fem
12  {
13 
27  //-------------------------------------------------------------------------
28  //-
29  //- --MapperInterface
30  //-
31  //-------------------------------------------------------------------------
39  template< class DofMapperTraits >
40  class DofMapper
41  : public Fem::BartonNackmanInterface< DofMapper< DofMapperTraits >,
42  typename DofMapperTraits :: DofMapperType >
43  {
46 
47  public:
48  typedef DofMapperTraits Traits;
49 
52 
54  typedef typename Traits::ElementType ElementType;
55 
57  typedef typename Traits::SizeType SizeType;
58 
59  typedef ElementType EntityType;
60 
61  protected:
62  using BaseType::asImp;
63 
64  public:
67  SizeType size () const
68  {
69  CHECK_INTERFACE_IMPLEMENTATION(asImp().size());
70  return asImp().size();
71  }
72 
79  bool contains ( const int codim ) const
80  {
81  CHECK_INTERFACE_IMPLEMENTATION( asImp().contains( codim ) );
82  return asImp().contains( codim );
83  }
84 
86  bool fixedDataSize ( const int codim ) const
87  {
88  CHECK_INTERFACE_IMPLEMENTATION( asImp().fixedDataSize( codim ) );
89  return asImp().fixedDataSize( codim );
90  }
91 
115  template< class Functor >
116  void mapEach ( const ElementType &element, Functor f ) const
117  {
118  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().mapEach( element, f ) );
119  }
120 
144  template< class Entity, class Functor >
145  void mapEachEntityDof ( const Entity &entity, Functor f ) const
146  {
147  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().mapEachEntityDof( entity, f ) );
148  }
149 
152  int maxNumDofs () const
153  {
154  CHECK_INTERFACE_IMPLEMENTATION(asImp().maxNumDofs());
155  return asImp().maxNumDofs();
156  }
157 
164  SizeType numDofs ( const ElementType &element ) const
165  {
166  CHECK_INTERFACE_IMPLEMENTATION( asImp().numDofs( element ) );
167  return asImp().numDofs( element );
168  }
169 
184  template< class Entity >
185  SizeType numEntityDofs ( const Entity &entity ) const
186  {
187  CHECK_INTERFACE_IMPLEMENTATION( asImp().numEntityDofs( entity ) );
188  return asImp().numEntityDofs( entity );
189  }
190 
191  };
192 
193 
194 
195  //-------------------------------------------------------------------------
196  //-
197  //- --AdaptiveMapperInterface
198  //-
199  //-------------------------------------------------------------------------
203  template< class DofMapperTraits >
205  : public DofMapper< DofMapperTraits >
206  {
208 
209  protected:
210  using BaseType::asImp;
211 
212  public:
214  typedef typename BaseType::SizeType SizeType;
215 
217  typedef SizeType GlobalKeyType;
218 
220  SizeType numberOfHoles ( const int block ) const
221  {
222  CHECK_INTERFACE_IMPLEMENTATION(asImp().numberOfHoles(block));
223  return asImp().numberOfHoles(block);
224  }
225 
227  GlobalKeyType oldIndex ( const int hole, const int block ) const
228  {
229  CHECK_INTERFACE_IMPLEMENTATION(asImp().oldIndex(hole,block));
230  return asImp().oldIndex(hole,block);
231  }
232 
234  GlobalKeyType newIndex ( const int hole, const int block ) const
235  {
236  CHECK_INTERFACE_IMPLEMENTATION(asImp().newIndex(hole,block));
237  return asImp().newIndex(hole,block);
238  }
239 
241  bool consecutive () const
242  {
243  CHECK_INTERFACE_IMPLEMENTATION( asImp().consecutive() );
244  return asImp().consecutive();
245  }
246 
248  SizeType oldOffSet ( const int block ) const
249  {
250  CHECK_INTERFACE_IMPLEMENTATION(asImp().oldOffSet(block));
251  return asImp().oldOffSet(block);
252  }
253 
255  SizeType offSet ( const int block ) const
256  {
257  CHECK_INTERFACE_IMPLEMENTATION(asImp().offSet(block));
258  return asImp().offSet(block);
259  }
260 
262  SizeType numBlocks () const
263  {
264  CHECK_INTERFACE_IMPLEMENTATION(asImp().numBlocks());
265  return asImp().numBlocks();
266  }
267  };
268 
270 
271  } // end namespace Fem
272 
273 } // end namespace Dune
274 
275 #endif // #ifndef DUNE_FEM_DOFMAPPER_HH
Definition: fourier/dofmapper.hh:17
Extended interface for adaptive DoF mappers.
Definition: mapper/dofmapper.hh:204
int maxNumDofs() const
obtain maximal number of DoFs on one entity
Definition: mapper/dofmapper.hh:152
bool contains(const int codim) const
returns true if DoFs for given codimension exist
Definition: mapper/dofmapper.hh:79
SizeType size() const
return number of dofs for special function space and grid on specified level
Definition: mapper/dofmapper.hh:67
SizeType GlobalKeyType
at the moment this should be similar to SizeType
Definition: mapper/dofmapper.hh:217
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37
ElementType EntityType
Definition: mapper/dofmapper.hh:59
Traits::ElementType ElementType
type of codimension 0 entities
Definition: mapper/dofmapper.hh:54
Traits::SizeType SizeType
type of size integer
Definition: mapper/dofmapper.hh:57
GlobalKeyType oldIndex(const int hole, const int block) const
return old index of hole for data block (with resprect to new offset)
Definition: mapper/dofmapper.hh:227
Interface for calculating the size of a function space for a grid on a specified level. Furthermore the local to global mapping of dof number is done. Also during grid adaptation this mapper knows about old and new indices of entities.
Definition: mapper/dofmapper.hh:40
DofMapperTraits Traits
Definition: mapper/dofmapper.hh:48
SizeType oldOffSet(const int block) const
return old offsets for given block
Definition: mapper/dofmapper.hh:248
Traits::DofMapperType DofMapperType
type of the DofMapper implementation
Definition: mapper/dofmapper.hh:51
GridPartType::template Codim< 0 >::EntityType ElementType
Definition: fourier/dofmapper.hh:30
SizeType numDofs(const ElementType &element) const
obtain number of DoFs on an entity
Definition: mapper/dofmapper.hh:164
Definition: coordinate.hh:4
std::size_t SizeType
Definition: fourier/dofmapper.hh:32
void mapEach(const ElementType &element, Functor f) const
map each local DoF number to a global key
Definition: mapper/dofmapper.hh:116
SizeType offSet(const int block) const
return current offsets for given block
Definition: mapper/dofmapper.hh:255
SizeType numBlocks() const
return number of supported blocks
Definition: mapper/dofmapper.hh:262
BaseType::SizeType SizeType
type of size integer
Definition: mapper/dofmapper.hh:214
SizeType numEntityDofs(const Entity &entity) const
obtain number of DoFs actually belonging to an entity
Definition: mapper/dofmapper.hh:185
bool consecutive() const
return true if compress will affect data
Definition: mapper/dofmapper.hh:241
GlobalKeyType newIndex(const int hole, const int block) const
return new index of hole for data block (with resprect to new offset)
Definition: mapper/dofmapper.hh:234
SizeType numberOfHoles(const int block) const
return number of holes for data block
Definition: mapper/dofmapper.hh:220
bool fixedDataSize(const int codim) const
Check, whether the data in a codimension has fixed size.
Definition: mapper/dofmapper.hh:86
void mapEachEntityDof(const Entity &entity, Functor f) const
map each local DoF number to a global key
Definition: mapper/dofmapper.hh:145
Definition: bartonnackmaninterface.hh:15