3#ifndef DUNE_ALBERTA_DOFADMIN_HH
4#define DUNE_ALBERTA_DOFADMIN_HH
28 template<
int dim,
int codim >
48 node_ = dofSpace->admin->mesh->node[ codimtype ];
49 index_ = dofSpace->admin->n0_dof[ codimtype ];
55 assert( node_ != -1 );
57 return element->dof[ node_ + subEntity ][ index_ + i ];
62 return (*
this)( element, subEntity, 0 );
67 return (*
this)( elementInfo.
el(), subEntity, i );
72 return (*
this)( elementInfo.
el(), subEntity );
97 static const int nNodeTypes = N_NODE_TYPES;
100 struct CreateDofSpace;
102 template<
int codim >
103 struct CacheDofSpace;
105 typedef std::pair< int, int > Cache;
113 This &operator= (
const This & );
123 assert( !(*
this) ==
false );
124 assert( (codim >= 0) && (codim <=
dimension) );
125 const Cache &cache = cache_[ codim ];
126 return element->dof[ cache.first + subEntity ][ cache.second ];
131 return (*
this)( element.
el(), codim, subEntity );
134 operator bool ()
const
142 assert( (codim >= 0) && (codim <=
dimension) );
143 return dofSpace_[ codim ];
159 return dofSpace( codim )->admin->size;
168 for(
int codim = 0; codim <=
dimension; ++codim )
169 freeDofSpace( dofSpace_[ codim ] );
170 freeDofSpace( emptySpace_ );
178 const std::string &name,
179 const int (&ndof)[ nNodeTypes ],
180 const bool periodic =
false );
201 ForLoop< CreateDofSpace, 0, dimension >::apply( mesh_, dofSpace_ );
202 ForLoop< CacheDofSpace, 0, dimension >::apply( dofSpace_, cache_ );
204 emptySpace_ = createEmptyDofSpace( mesh_ );
205 for(
int i = 0; i < nNodeTypes; ++i )
206 assert( emptySpace_->admin->n_dof[ i ] == 0 );
215 int ndof[ nNodeTypes ];
216 for(
int i = 0; i < nNodeTypes; ++i )
218 std::string name =
"Empty";
219 return createDofSpace( mesh, name, ndof );
225 HierarchyDofNumbering< dim >::createDofSpace (
const MeshPointer &mesh,
226 const std::string &name,
227 const int (&ndof)[ nNodeTypes ],
228 const bool periodic )
231 = ADM_PRESERVE_COARSE_DOFS | (periodic ? ADM_PERIODIC : 0);
232 return ALBERTA get_dof_space ( mesh, name.c_str(), ndof, flags );
238 HierarchyDofNumbering< dim >::freeDofSpace (
const DofSpace *dofSpace )
240 ALBERTA free_fe_space( dofSpace );
249 template<
int codim >
250 struct HierarchyDofNumbering< dim >::CreateDofSpace
254 int ndof[ nNodeTypes ];
255 for(
int i = 0; i < nNodeTypes; ++i )
257 ndof[ CodimType< dim, codim >::value ] = 1;
259 std::string name =
"Codimension ";
260 name += (char)(codim +
'0');
273 template<
int codim >
274 struct HierarchyDofNumbering< dim >::CacheDofSpace
276 static void apply (
const DofSpace *(&
dofSpace)[ dim+1 ], Cache (&cache)[ dim+1 ] )
279 const int codimtype = CodimType< dim, codim >::value;
280 cache[ codim ].first =
dofSpace[ codim ]->mesh->node[ codimtype ];
281 cache[ codim ].second =
dofSpace[ codim ]->admin->n0_dof[ codimtype ];
#define ALBERTA
Definition albertaheader.hh:27
provides a wrapper for ALBERTA's el_info structure
Include standard header files.
Definition agrid.hh:60
ALBERTA EL Element
Definition misc.hh:51
ALBERTA FE_SPACE DofSpace
Definition misc.hh:62
Definition dofadmin.hh:30
static const int dimension
Definition dofadmin.hh:36
DofAccess()
Definition dofadmin.hh:41
static const int codimension
Definition dofadmin.hh:37
static const int numSubEntities
Definition dofadmin.hh:34
DofAccess(const DofSpace *dofSpace)
Definition dofadmin.hh:45
int operator()(const Element *element, int subEntity, int i) const
Definition dofadmin.hh:52
Alberta::ElementInfo< dimension > ElementInfo
Definition dofadmin.hh:39
Definition dofadmin.hh:87
HierarchyDofNumbering()
Definition dofadmin.hh:108
int operator()(const Element *element, int codim, unsigned int subEntity) const
Definition dofadmin.hh:121
const MeshPointer & mesh() const
Definition dofadmin.hh:152
void create(const MeshPointer &mesh)
Definition dofadmin.hh:193
~HierarchyDofNumbering()
Definition dofadmin.hh:116
Alberta::MeshPointer< dimension > MeshPointer
Definition dofadmin.hh:93
int size(int codim) const
Definition dofadmin.hh:157
const DofSpace * dofSpace(int codim) const
Definition dofadmin.hh:139
Alberta::ElementInfo< dimension > ElementInfo
Definition dofadmin.hh:94
static const int dimension
Definition dofadmin.hh:91
const DofSpace * emptyDofSpace() const
Definition dofadmin.hh:146
void release()
Definition dofadmin.hh:164
Element * el() const
Definition elementinfo.hh:735