5#ifndef DUNE_ALBERTA_DOFADMIN_HH
6#define DUNE_ALBERTA_DOFADMIN_HH
10#include <dune/common/hybridutilities.hh>
34 template<
int dim,
int codim >
54 node_ = dofSpace->admin->mesh->node[ codimtype ];
55 index_ = dofSpace->admin->n0_dof[ codimtype ];
61 assert( node_ != -1 );
63 return element->dof[ node_ + subEntity ][ index_ + i ];
68 return (*
this)( element, subEntity, 0 );
73 return (*
this)( elementInfo.
el(), subEntity, i );
78 return (*
this)( elementInfo.
el(), subEntity );
103 static const int nNodeTypes = N_NODE_TYPES;
105 template<
int codim >
106 struct CreateDofSpace;
108 template<
int codim >
109 struct CacheDofSpace;
111 typedef std::pair< int, int > Cache;
119 This &operator= (
const This & );
129 assert( !(*
this) ==
false );
130 assert( (codim >= 0) && (codim <=
dimension) );
131 const Cache &cache = cache_[ codim ];
132 return element->dof[ cache.first + subEntity ][ cache.second ];
137 return (*
this)( element.
el(), codim, subEntity );
140 explicit operator bool ()
const
148 assert( (codim >= 0) && (codim <=
dimension) );
149 return dofSpace_[ codim ];
165 return dofSpace( codim )->admin->size;
174 for(
int codim = 0; codim <=
dimension; ++codim )
175 freeDofSpace( dofSpace_[ codim ] );
176 freeDofSpace( emptySpace_ );
184 const std::string &name,
185 const int (&ndof)[ nNodeTypes ],
186 const bool periodic =
false );
208 Hybrid::forEach( std::make_index_sequence< dimension+1 >{}, [ & ](
auto i ){ CreateDofSpace< i >::apply( mesh_, dofSpace_ ); } );
209 Hybrid::forEach( std::make_index_sequence< dimension+1 >{}, [ & ](
auto i ){ CacheDofSpace< i >::apply( dofSpace_, cache_ ); } );
211 emptySpace_ = createEmptyDofSpace( mesh_ );
212 for(
int i = 0; i < nNodeTypes; ++i )
213 assert( emptySpace_->admin->n_dof[ i ] == 0 );
222 int ndof[ nNodeTypes ];
223 for(
int i = 0; i < nNodeTypes; ++i )
225 std::string name =
"Empty";
226 return createDofSpace( mesh, name, ndof );
232 HierarchyDofNumbering< dim >::createDofSpace (
const MeshPointer &mesh,
233 const std::string &name,
234 const int (&ndof)[ nNodeTypes ],
235 const bool periodic )
238 = ADM_PRESERVE_COARSE_DOFS | (periodic ? ADM_PERIODIC : 0);
239 return ALBERTA get_dof_space ( mesh, name.c_str(), ndof, flags );
245 HierarchyDofNumbering< dim >::freeDofSpace (
const DofSpace *dofSpace )
247 ALBERTA free_fe_space( dofSpace );
256 template<
int codim >
257 struct HierarchyDofNumbering< dim >::CreateDofSpace
261 int ndof[ nNodeTypes ];
262 for(
int i = 0; i < nNodeTypes; ++i )
264 ndof[ CodimType< dim, codim >::value ] = 1;
266 std::string name =
"Codimension ";
267 name += (char)(codim +
'0');
280 template<
int codim >
281 struct HierarchyDofNumbering< dim >::CacheDofSpace
283 static void apply (
const DofSpace *(&
dofSpace)[ dim+1 ], Cache (&cache)[ dim+1 ] )
286 const int codimtype = CodimType< dim, codim >::value;
287 cache[ codim ].first =
dofSpace[ codim ]->mesh->node[ codimtype ];
288 cache[ codim ].second =
dofSpace[ codim ]->admin->n0_dof[ codimtype ];
provides a wrapper for ALBERTA's el_info structure
#define ALBERTA
Definition: albertaheader.hh:29
Include standard header files.
Definition: agrid.hh:60
ALBERTA EL Element
Definition: misc.hh:54
ALBERTA FE_SPACE DofSpace
Definition: misc.hh:65
Definition: dofadmin.hh:36
static const int dimension
Definition: dofadmin.hh:42
DofAccess()
Definition: dofadmin.hh:47
static const int codimension
Definition: dofadmin.hh:43
static const int numSubEntities
Definition: dofadmin.hh:40
DofAccess(const DofSpace *dofSpace)
Definition: dofadmin.hh:51
int operator()(const Element *element, int subEntity, int i) const
Definition: dofadmin.hh:58
Alberta::ElementInfo< dimension > ElementInfo
Definition: dofadmin.hh:45
Definition: dofadmin.hh:93
HierarchyDofNumbering()
Definition: dofadmin.hh:114
int operator()(const Element *element, int codim, unsigned int subEntity) const
Definition: dofadmin.hh:127
const MeshPointer & mesh() const
Definition: dofadmin.hh:158
void create(const MeshPointer &mesh)
Definition: dofadmin.hh:199
~HierarchyDofNumbering()
Definition: dofadmin.hh:122
Alberta::MeshPointer< dimension > MeshPointer
Definition: dofadmin.hh:99
int size(int codim) const
Definition: dofadmin.hh:163
const DofSpace * dofSpace(int codim) const
Definition: dofadmin.hh:145
Alberta::ElementInfo< dimension > ElementInfo
Definition: dofadmin.hh:100
static const int dimension
Definition: dofadmin.hh:97
const DofSpace * emptyDofSpace() const
Definition: dofadmin.hh:152
void release()
Definition: dofadmin.hh:170
Element * el() const
Definition: elementinfo.hh:737