3 #ifndef DUNE_ALBERTA_MESHPOINTER_HH
4 #define DUNE_ALBERTA_MESHPOINTER_HH
31 class HierarchyDofNumbering;
45 class BoundaryProvider;
47 template<
int dimWorld >
66 operator bool ()
const
73 return MacroIterator( *
this,
false );
76 MacroIterator
end ()
const
78 return MacroIterator( *
this,
true );
82 int size (
int codim )
const;
93 template<
class Proj,
class Impl >
101 unsigned int create (
const std::string &filename,
bool binary =
false );
112 unsigned int read (
const std::string &filename,
Real &time );
114 bool write (
const std::string &filename,
Real time )
const;
118 template<
class Functor >
122 template<
class Functor >
131 static ALBERTA NODE_PROJECTION *
132 initNodeProjection (
Mesh *mesh,
ALBERTA MACRO_EL *macroElement,
int n );
133 template<
class ProjectionProv
ider >
134 static ALBERTA NODE_PROJECTION *
135 initNodeProjection (
Mesh *mesh,
ALBERTA MACRO_EL *macroElement,
int n );
146 template<
int dimWorld >
190 return (index_ == other.index_);
202 return static_cast< const MacroElement &
>( mesh().mesh_->macro_els[ index_ ] );
218 return elementInfo();
223 return equals( other );
228 return !equals( other );
237 return ElementInfo( mesh(), macroElement(), fillFlags );
253 return (mesh_ ? mesh_->n_macro_el : 0);
260 assert( (codim >= 0) && (codim <= 1) );
261 return (codim == 0 ? mesh_->n_elements : mesh_->n_vertices);
267 assert( (codim >= 0) && (codim <= 2) );
269 return mesh_->n_elements;
270 else if( codim == 2 )
271 return mesh_->n_vertices;
273 return mesh_->n_edges;
279 assert( (codim >= 0) && (codim <= 3) );
281 return mesh_->n_elements;
282 else if( codim == 3 )
283 return mesh_->n_vertices;
284 else if( codim == 1 )
285 return mesh_->n_faces;
287 return mesh_->n_edges;
304 template<
class Proj,
class Impl >
325 ::create (
const std::string &filename,
bool binary )
328 macroData.
read( filename, binary );
329 const unsigned int boundaryCount = create( macroData );
331 return boundaryCount;
341 #if DUNE_ALBERTA_VERSION >= 0x300
342 mesh_ =
ALBERTA read_mesh_xdr( filename.c_str(), &time, NULL, NULL );
344 mesh_ =
ALBERTA read_mesh_xdr( filename.c_str(), &time, NULL );
353 int success =
ALBERTA write_mesh_xdr( mesh_, filename.c_str(), time );
354 return (success == 0);
366 template<
class Functor >
381 template<
class Functor >
395 #if DUNE_ALBERTA_VERSION >= 0x300
404 #endif // #if DUNE_ALBERTA_VERSION >= 0x300
406 #if DUNE_ALBERTA_VERSION <= 0x200
416 #endif // #if DUNE_ALBERTA_VERSION <= 0x200
419 #if DUNE_ALBERTA_VERSION >= 0x300
425 #endif // #if DUNE_ALBERTA_VERSION >= 0x300
427 #if DUNE_ALBERTA_VERSION <= 0x200
434 #endif // #if DUNE_ALBERTA_VERSION <= 0x200
438 inline ALBERTA NODE_PROJECTION *
442 if( (n > 0) && macroElement.
isBoundary( n-1 ) )
450 template<
class ProjectionFactory >
451 inline ALBERTA NODE_PROJECTION *
452 MeshPointer< dim >::initNodeProjection (
Mesh *mesh,
ALBERTA MACRO_EL *macroEl,
int n )
456 const MacroElement ¯oElement =
static_cast< const MacroElement &
>( *macroEl );
458 MeshPointer< dim > meshPointer( mesh );
460 const ProjectionFactory &projectionFactory = *
static_cast< const ProjectionFactory *
>( Library< dimWorld >::projectionFactory );
461 if( (n > 0) && macroElement.isBoundary( n-1 ) )
463 const unsigned int boundaryIndex = Library< dimWorld >::boundaryCount++;
464 if( projectionFactory.hasProjection( elementInfo, n-1 ) )
466 Projection projection = projectionFactory.projection( elementInfo, n-1 );
467 return new NodeProjection< dim, Projection >( boundaryIndex, projection );
470 return new BasicNodeProjection( boundaryIndex );
472 else if( (dim <
dimWorld) && (n == 0) )
475 if( projectionFactory.hasProjection( elementInfo ) )
477 Projection projection = projectionFactory.projection( elementInfo );
478 return new NodeProjection< dim, Projection >( boundaryIndex, projection );
491 #endif // #if HAVE_ALBERTA
493 #endif // #ifndef DUNE_ALBERTA_MESHPOINTER_HH