3 #ifndef DUNE_ALBERTA_DOFADMIN_HH
4 #define DUNE_ALBERTA_DOFADMIN_HH
8 #include <dune/common/hybridutilities.hh>
32 template<
int dim,
int codim >
52 node_ = dofSpace->admin->mesh->node[ codimtype ];
53 index_ = dofSpace->admin->n0_dof[ codimtype ];
59 assert( node_ != -1 );
61 return element->dof[ node_ + subEntity ][ index_ + i ];
66 return (*
this)( element, subEntity, 0 );
71 return (*
this)( elementInfo.
el(), subEntity, i );
76 return (*
this)( elementInfo.
el(), subEntity );
101 static const int nNodeTypes = N_NODE_TYPES;
103 template<
int codim >
104 struct CreateDofSpace;
106 template<
int codim >
107 struct CacheDofSpace;
109 typedef std::pair< int, int > Cache;
117 This &operator= (
const This & );
127 assert( !(*
this) ==
false );
128 assert( (codim >= 0) && (codim <=
dimension) );
129 const Cache &cache = cache_[ codim ];
130 return element->dof[ cache.first + subEntity ][ cache.second ];
135 return (*
this)( element.
el(), codim, subEntity );
138 explicit operator bool ()
const
146 assert( (codim >= 0) && (codim <=
dimension) );
147 return dofSpace_[ codim ];
163 return dofSpace( codim )->admin->size;
172 for(
int codim = 0; codim <=
dimension; ++codim )
173 freeDofSpace( dofSpace_[ codim ] );
174 freeDofSpace( emptySpace_ );
182 const std::string &name,
183 const int (&ndof)[ nNodeTypes ],
184 const bool periodic =
false );
206 Hybrid::forEach( std::make_index_sequence< dimension+1 >{}, [ & ](
auto i ){ CreateDofSpace< i >::apply( mesh_, dofSpace_ ); } );
207 Hybrid::forEach( std::make_index_sequence< dimension+1 >{}, [ & ](
auto i ){ CacheDofSpace< i >::apply( dofSpace_, cache_ ); } );
209 emptySpace_ = createEmptyDofSpace( mesh_ );
210 for(
int i = 0; i < nNodeTypes; ++i )
211 assert( emptySpace_->admin->n_dof[ i ] == 0 );
220 int ndof[ nNodeTypes ];
221 for(
int i = 0; i < nNodeTypes; ++i )
223 std::string name =
"Empty";
224 return createDofSpace( mesh, name, ndof );
230 HierarchyDofNumbering< dim >::createDofSpace (
const MeshPointer &mesh,
231 const std::string &name,
232 const int (&ndof)[ nNodeTypes ],
233 const bool periodic )
236 = ADM_PRESERVE_COARSE_DOFS | (periodic ? ADM_PERIODIC : 0);
237 return ALBERTA get_dof_space ( mesh, name.c_str(), ndof, flags );
243 HierarchyDofNumbering< dim >::freeDofSpace (
const DofSpace *dofSpace )
245 ALBERTA free_fe_space( dofSpace );
254 template<
int codim >
255 struct HierarchyDofNumbering< dim >::CreateDofSpace
259 int ndof[ nNodeTypes ];
260 for(
int i = 0; i < nNodeTypes; ++i )
262 ndof[ CodimType< dim, codim >::value ] = 1;
264 std::string name =
"Codimension ";
265 name += (char)(codim +
'0');
278 template<
int codim >
279 struct HierarchyDofNumbering< dim >::CacheDofSpace
281 static void apply (
const DofSpace *(&
dofSpace)[ dim+1 ], Cache (&cache)[ dim+1 ] )
284 const int codimtype = CodimType< dim, codim >::value;
285 cache[ codim ].first =
dofSpace[ codim ]->mesh->node[ codimtype ];
286 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:58
ALBERTA EL Element
Definition: misc.hh:52
ALBERTA FE_SPACE DofSpace
Definition: misc.hh:63
Definition: dofadmin.hh:34
static const int dimension
Definition: dofadmin.hh:40
DofAccess()
Definition: dofadmin.hh:45
static const int codimension
Definition: dofadmin.hh:41
static const int numSubEntities
Definition: dofadmin.hh:38
DofAccess(const DofSpace *dofSpace)
Definition: dofadmin.hh:49
int operator()(const Element *element, int subEntity, int i) const
Definition: dofadmin.hh:56
Alberta::ElementInfo< dimension > ElementInfo
Definition: dofadmin.hh:43
Definition: dofadmin.hh:91
HierarchyDofNumbering()
Definition: dofadmin.hh:112
int operator()(const Element *element, int codim, unsigned int subEntity) const
Definition: dofadmin.hh:125
void create(const MeshPointer &mesh)
Definition: dofadmin.hh:197
const DofSpace * dofSpace(int codim) const
Definition: dofadmin.hh:143
~HierarchyDofNumbering()
Definition: dofadmin.hh:120
Alberta::MeshPointer< dimension > MeshPointer
Definition: dofadmin.hh:97
int size(int codim) const
Definition: dofadmin.hh:161
const DofSpace * emptyDofSpace() const
Definition: dofadmin.hh:150
const MeshPointer & mesh() const
Definition: dofadmin.hh:156
Alberta::ElementInfo< dimension > ElementInfo
Definition: dofadmin.hh:98
static const int dimension
Definition: dofadmin.hh:95
void release()
Definition: dofadmin.hh:168
Element * el() const
Definition: elementinfo.hh:735