DUNE-FEM (unstable)

dofmapper.hh
1 #ifndef DUNE_FEM_DOFMAPPER_HH
2 #define DUNE_FEM_DOFMAPPER_HH
3 
4 //- Dune includes
5 #include <dune/fem/misc/bartonnackmaninterface.hh>
6 #include <dune/fem/space/mapper/capabilities.hh>
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  {
44  typedef DofMapper< DofMapperTraits > ThisType;
45  typedef Fem::BartonNackmanInterface< ThisType, typename DofMapperTraits::DofMapperType > BaseType;
46 
47  public:
48  typedef DofMapperTraits Traits;
49 
51  typedef typename Traits::DofMapperType DofMapperType;
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  {
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 
200  void update ()
201  {
203  }
204  };
205 
206 
207 
208  //-------------------------------------------------------------------------
209  //-
210  //- --AdaptiveMapperInterface
211  //-
212  //-------------------------------------------------------------------------
216  template< class DofMapperTraits >
218  : public DofMapper< DofMapperTraits >
219  {
220  typedef DofMapper< DofMapperTraits > BaseType;
221 
222  protected:
223  using BaseType::asImp;
224 
225  public:
227  typedef typename BaseType::SizeType SizeType;
228 
231 
233  SizeType numberOfHoles ( const int block ) const
234  {
235  CHECK_INTERFACE_IMPLEMENTATION(asImp().numberOfHoles(block));
236  return asImp().numberOfHoles(block);
237  }
238 
240  GlobalKeyType oldIndex ( const int hole, const int block ) const
241  {
242  CHECK_INTERFACE_IMPLEMENTATION(asImp().oldIndex(hole,block));
243  return asImp().oldIndex(hole,block);
244  }
245 
247  GlobalKeyType newIndex ( const int hole, const int block ) const
248  {
249  CHECK_INTERFACE_IMPLEMENTATION(asImp().newIndex(hole,block));
250  return asImp().newIndex(hole,block);
251  }
252 
254  bool consecutive () const
255  {
256  CHECK_INTERFACE_IMPLEMENTATION( asImp().consecutive() );
257  return asImp().consecutive();
258  }
259 
261  SizeType oldOffSet ( const int block ) const
262  {
263  CHECK_INTERFACE_IMPLEMENTATION(asImp().oldOffSet(block));
264  return asImp().oldOffSet(block);
265  }
266 
268  SizeType offSet ( const int block ) const
269  {
270  CHECK_INTERFACE_IMPLEMENTATION(asImp().offSet(block));
271  return asImp().offSet(block);
272  }
273 
276  {
277  CHECK_INTERFACE_IMPLEMENTATION(asImp().numBlocks());
278  return asImp().numBlocks();
279  }
280 
287  void update () {}
288  };
289 
291 
292  } // end namespace Fem
293 
294 } // end namespace Dune
295 
296 #endif // #ifndef DUNE_FEM_DOFMAPPER_HH
#define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)
Definition: bartonnackmanifcheck.hh:61
Wrapper class for entities.
Definition: entity.hh:66
Extended interface for adaptive DoF mappers.
Definition: dofmapper.hh:219
SizeType GlobalKeyType
at the moment this should be similar to SizeType
Definition: dofmapper.hh:230
SizeType numberOfHoles(const int block) const
return number of holes for data block
Definition: dofmapper.hh:233
SizeType oldOffSet(const int block) const
return old offsets for given block
Definition: dofmapper.hh:261
GlobalKeyType oldIndex(const int hole, const int block) const
return old index of hole for data block (with resprect to new offset)
Definition: dofmapper.hh:240
SizeType numBlocks() const
return number of supported blocks
Definition: dofmapper.hh:275
SizeType offSet(const int block) const
return current offsets for given block
Definition: dofmapper.hh:268
BaseType::SizeType SizeType
type of size integer
Definition: dofmapper.hh:227
GlobalKeyType newIndex(const int hole, const int block) const
return new index of hole for data block (with resprect to new offset)
Definition: dofmapper.hh:247
void update()
update DoF mapping after grid modification
Definition: dofmapper.hh:287
bool consecutive() const
return true if compress will affect data
Definition: dofmapper.hh:254
Interface for calculating the size of a function space for a grid on a specified level....
Definition: dofmapper.hh:43
void update()
update DoF mapping after grid modification
Definition: dofmapper.hh:200
bool contains(const int codim) const
returns true if DoFs for given codimension exist
Definition: dofmapper.hh:79
int maxNumDofs() const
obtain maximal number of DoFs on one entity
Definition: dofmapper.hh:152
SizeType numEntityDofs(const Entity &entity) const
obtain number of DoFs actually belonging to an entity
Definition: dofmapper.hh:185
Traits::DofMapperType DofMapperType
type of the DofMapper implementation
Definition: dofmapper.hh:51
SizeType numDofs(const ElementType &element) const
obtain number of DoFs on an entity
Definition: dofmapper.hh:164
void mapEach(const ElementType &element, Functor f) const
map each local DoF number to a global key
Definition: dofmapper.hh:116
Traits::ElementType ElementType
type of codimension 0 entities
Definition: dofmapper.hh:54
SizeType size() const
return number of dofs for special function space and grid on specified level
Definition: dofmapper.hh:67
bool fixedDataSize(const int codim) const
Check, whether the data in a codimension has fixed size.
Definition: dofmapper.hh:86
Traits::SizeType SizeType
type of size integer
Definition: dofmapper.hh:57
void mapEachEntityDof(const Entity &entity, Functor f) const
map each local DoF number to a global key
Definition: dofmapper.hh:145
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)