3 #ifndef DUNE_ALBERTA_DOFADMIN_HH
4 #define DUNE_ALBERTA_DOFADMIN_HH
6 #include <dune/common/hybridutilities.hh>
7 #include <dune/common/std/utility.hh>
31 template<
int dim,
int codim >
51 node_ = dofSpace->admin->mesh->node[ codimtype ];
52 index_ = dofSpace->admin->n0_dof[ codimtype ];
58 assert( node_ != -1 );
60 return element->dof[ node_ + subEntity ][ index_ + i ];
65 return (*
this)( element, subEntity, 0 );
70 return (*
this)( elementInfo.
el(), subEntity, i );
75 return (*
this)( elementInfo.
el(), subEntity );
100 static const int nNodeTypes = N_NODE_TYPES;
102 template<
int codim >
103 struct CreateDofSpace;
105 template<
int codim >
106 struct CacheDofSpace;
108 typedef std::pair< int, int > Cache;
116 This &operator= (
const This & );
126 assert( !(*
this) ==
false );
127 assert( (codim >= 0) && (codim <=
dimension) );
128 const Cache &cache = cache_[ codim ];
129 return element->dof[ cache.first + subEntity ][ cache.second ];
134 return (*
this)( element.
el(), codim, subEntity );
137 explicit operator bool ()
const
145 assert( (codim >= 0) && (codim <=
dimension) );
146 return dofSpace_[ codim ];
162 return dofSpace( codim )->admin->size;
171 for(
int codim = 0; codim <=
dimension; ++codim )
172 freeDofSpace( dofSpace_[ codim ] );
173 freeDofSpace( emptySpace_ );
181 const std::string &name,
182 const int (&ndof)[ nNodeTypes ],
183 const bool periodic =
false );
205 Hybrid::forEach( Std::make_index_sequence< dimension+1 >{}, [ & ](
auto i ){ CreateDofSpace< i >::apply( mesh_, dofSpace_ ); } );
206 Hybrid::forEach( Std::make_index_sequence< dimension+1 >{}, [ & ](
auto i ){ CacheDofSpace< i >::apply( dofSpace_, cache_ ); } );
208 emptySpace_ = createEmptyDofSpace( mesh_ );
209 for(
int i = 0; i < nNodeTypes; ++i )
210 assert( emptySpace_->admin->n_dof[ i ] == 0 );
219 int ndof[ nNodeTypes ];
220 for(
int i = 0; i < nNodeTypes; ++i )
222 std::string name =
"Empty";
223 return createDofSpace( mesh, name, ndof );
229 HierarchyDofNumbering< dim >::createDofSpace (
const MeshPointer &mesh,
230 const std::string &name,
231 const int (&ndof)[ nNodeTypes ],
232 const bool periodic )
235 = ADM_PRESERVE_COARSE_DOFS | (periodic ? ADM_PERIODIC : 0);
236 return ALBERTA get_dof_space ( mesh, name.c_str(), ndof, flags );
242 HierarchyDofNumbering< dim >::freeDofSpace (
const DofSpace *dofSpace )
244 ALBERTA free_fe_space( dofSpace );
253 template<
int codim >
254 struct HierarchyDofNumbering< dim >::CreateDofSpace
258 int ndof[ nNodeTypes ];
259 for(
int i = 0; i < nNodeTypes; ++i )
261 ndof[ CodimType< dim, codim >::value ] = 1;
263 std::string name =
"Codimension ";
264 name += (char)(codim +
'0');
277 template<
int codim >
278 struct HierarchyDofNumbering< dim >::CacheDofSpace
280 static void apply (
const DofSpace *(&
dofSpace)[ dim+1 ], Cache (&cache)[ dim+1 ] )
283 const int codimtype = CodimType< dim, codim >::value;
284 cache[ codim ].first =
dofSpace[ codim ]->mesh->node[ codimtype ];
285 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:59
ALBERTA EL Element
Definition: misc.hh:52
ALBERTA FE_SPACE DofSpace
Definition: misc.hh:63
Definition: dofadmin.hh:33
static const int dimension
Definition: dofadmin.hh:39
DofAccess()
Definition: dofadmin.hh:44
static const int codimension
Definition: dofadmin.hh:40
static const int numSubEntities
Definition: dofadmin.hh:37
DofAccess(const DofSpace *dofSpace)
Definition: dofadmin.hh:48
int operator()(const Element *element, int subEntity, int i) const
Definition: dofadmin.hh:55
Alberta::ElementInfo< dimension > ElementInfo
Definition: dofadmin.hh:42
Definition: dofadmin.hh:90
HierarchyDofNumbering()
Definition: dofadmin.hh:111
int operator()(const Element *element, int codim, unsigned int subEntity) const
Definition: dofadmin.hh:124
void create(const MeshPointer &mesh)
Definition: dofadmin.hh:196
const DofSpace * dofSpace(int codim) const
Definition: dofadmin.hh:142
~HierarchyDofNumbering()
Definition: dofadmin.hh:119
Alberta::MeshPointer< dimension > MeshPointer
Definition: dofadmin.hh:96
int size(int codim) const
Definition: dofadmin.hh:160
const DofSpace * emptyDofSpace() const
Definition: dofadmin.hh:149
const MeshPointer & mesh() const
Definition: dofadmin.hh:155
Alberta::ElementInfo< dimension > ElementInfo
Definition: dofadmin.hh:97
static const int dimension
Definition: dofadmin.hh:94
void release()
Definition: dofadmin.hh:167
Element * el() const
Definition: elementinfo.hh:735