1 #ifndef DUNE_ALBERTA_DOFADMIN_HH
2 #define DUNE_ALBERTA_DOFADMIN_HH
26 template<
int dim,
int codim >
29 static const int codimtype = CodimType< dim, codim >::value;
46 node_ = dofSpace->admin->mesh->node[ codimtype ];
47 index_ = dofSpace->admin->n0_dof[ codimtype ];
53 assert( node_ != -1 );
55 return element->dof[ node_ + subEntity ][ index_ + i ];
60 return (*
this)( element, subEntity, 0 );
65 return (*
this)( elementInfo.
el(), subEntity, i );
70 return (*
this)( elementInfo.
el(), subEntity );
95 static const int nNodeTypes = N_NODE_TYPES;
98 struct CreateDofSpace;
100 template<
int codim >
101 struct CacheDofSpace;
103 typedef std::pair< int, int > Cache;
111 This &operator= (
const This & );
121 assert( !(*
this) ==
false );
122 assert( (codim >= 0) && (codim <=
dimension) );
123 const Cache &cache = cache_[ codim ];
124 return element->dof[ cache.first + subEntity ][ cache.second ];
129 return (*
this)( element.
el(), codim, subEntity );
132 operator bool ()
const
140 assert( (codim >= 0) && (codim <=
dimension) );
141 return dofSpace_[ codim ];
157 return dofSpace( codim )->admin->size;
166 for(
int codim = 0; codim <=
dimension; ++codim )
167 freeDofSpace( dofSpace_[ codim ] );
168 freeDofSpace( emptySpace_ );
176 const std::string &name,
177 const int (&ndof)[ nNodeTypes ],
178 const bool periodic =
false );
199 ForLoop< CreateDofSpace, 0, dimension >::apply( mesh_, dofSpace_ );
200 ForLoop< CacheDofSpace, 0, dimension >::apply( dofSpace_, cache_ );
202 emptySpace_ = createEmptyDofSpace( mesh_ );
203 for(
int i = 0; i < nNodeTypes; ++i )
204 assert( emptySpace_->admin->n_dof[ i ] == 0 );
213 int ndof[ nNodeTypes ];
214 for(
int i = 0; i < nNodeTypes; ++i )
216 std::string name =
"Empty";
217 return createDofSpace( mesh, name, ndof );
221 #if DUNE_ALBERTA_VERSION >= 0x300
224 HierarchyDofNumbering< dim >::createDofSpace (
const MeshPointer &mesh,
225 const std::string &name,
226 const int (&ndof)[ nNodeTypes ],
227 const bool periodic )
230 = ADM_PRESERVE_COARSE_DOFS | (periodic ? ADM_PERIODIC : 0);
231 return ALBERTA get_dof_space ( mesh, name.c_str(), ndof, flags );
233 #endif // #if DUNE_ALBERTA_VERSION >= 0x300
235 #if DUNE_ALBERTA_VERSION == 0x200
238 HierarchyDofNumbering< dim >::createDofSpace (
const MeshPointer &mesh,
239 const std::string &name,
240 const int (&ndof)[ nNodeTypes ],
241 const bool periodic )
243 return ALBERTA get_fe_space( mesh, name.c_str(), ndof, NULL, 1 );
245 #endif // #if DUNE_ALBERTA_VERSION == 0x200
248 #if DUNE_ALBERTA_VERSION >= 0x300
251 HierarchyDofNumbering< dim >::freeDofSpace (
const DofSpace *dofSpace )
253 ALBERTA free_fe_space( dofSpace );
255 #endif // #if DUNE_ALBERTA_VERSION >= 0x300
257 #if DUNE_ALBERTA_VERSION == 0x200
260 HierarchyDofNumbering< dim >::freeDofSpace (
const DofSpace *dofSpace )
263 ALBERTA free_fe_space( const_cast< DofSpace * >( dofSpace ) );
265 #endif // #if DUNE_ALBERTA_VERSION == 0x200
273 template<
int codim >
278 int ndof[ nNodeTypes ];
279 for(
int i = 0; i < nNodeTypes; ++i )
281 ndof[ CodimType< dim, codim >::value ] = 1;
283 std::string name =
"Codimension ";
284 name += (char)(codim +
'0');
286 dofSpace[ codim ] = createDofSpace( mesh, name, ndof );
287 assert( dofSpace[ codim ] );
297 template<
int codim >
300 static void apply (
const DofSpace *(&dofSpace)[ dim+1 ], Cache (&cache)[ dim+1 ] )
302 assert( dofSpace[ codim ] );
303 const int codimtype = CodimType< dim, codim >::value;
304 cache[ codim ].first = dofSpace[ codim ]->mesh->node[ codimtype ];
305 cache[ codim ].second = dofSpace[ codim ]->admin->n0_dof[ codimtype ];
313 #endif // #if HAVE_ALBERTA
315 #endif // #ifndef DUNE_ALBERTA_DOFADMIN_HH