3#ifndef DUNE_ALBERTA_ALBERTAREADER_HH 
    4#define DUNE_ALBERTA_ALBERTAREADER_HH 
    9#include <dune/grid/utility/grapedataioformattypes.hh> 
   18  template< 
class Gr
id >
 
   21    typedef AlbertaReader< Grid > This;
 
   32    static_assert(dimensionworld == Alberta::dimWorld,
 
   33                  "AlbertaReader: world dimension must match ALBERTA's world dimension.");
 
   35    typedef Alberta::MacroData< dimension > MacroData;
 
   39    AlbertaReader ( 
const This & );
 
   40    This &operator= ( 
const This & );
 
   46    template< GrapeIOFileFormatType type >
 
   47    void readGrid ( 
const std::string &fileName, GridFactory &factory )
 
   49      static_assert(type != pgm, 
"AlbertaReader: reading pgm format is not supported.");
 
   52      macroData_.read( fileName, (type == 
xdr) );
 
   55      const int numVertices = macroData_.vertexCount();
 
   56      for( 
int i = 0; i < numVertices; ++i )
 
   58        FieldVector< ctype, dimensionworld > v;
 
   59        const Alberta::GlobalVector &coords = macroData_.vertex( i );
 
   60        for( 
int j = 0; j < dimensionworld; ++j )
 
   62        factory.insertVertex( v );
 
   66      std::vector< unsigned int > vertices( dimension+1 );
 
   67      const int numElements = macroData_.elementCount();
 
   68      for( 
int i = 0; i < numElements; ++i )
 
   70        const typename MacroData::ElementId &
id = macroData_.element( i );
 
   71        for( 
int j = 0; j <= dimension; ++j )
 
   72          vertices[ j ] = 
id[ j ];
 
   73        typedef typename GenericGeometry::SimplexTopology< dimension >::type Topology;
 
   74        factory.insertElement( 
GeometryType( Topology() ), vertices );
 
   81    void readGrid ( 
const std::string &filename, GridFactory &factory )
 
   83      readGrid< ascii >( filename, factory );
 
@ dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:408
 
@ dimension
The dimension of the grid.
Definition: grid.hh:402
 
ct ctype
Define type used for coordinates in grid module.
Definition: grid.hh:548
 
Different resources needed by all grid implementations.
 
Provide a generic factory class for unstructured grids.
 
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
 
provides a wrapper for ALBERTA's macro_data structure
 
Dune namespace.
Definition: alignment.hh:10
 
@ xdr
Definition: grapedataioformattypes.hh:16