3 #ifndef DUNE_ALBERTA_DGFPARSER_HH 4 #define DUNE_ALBERTA_DGFPARSER_HH 25 template<
class Gr
idImp,
class IntersectionImp >
33 template<
int dim,
int dimworld >
39 typedef typename Grid::template Codim<0>::Entity
Element;
40 typedef typename Grid::template Codim<dimension>::Entity
Vertex;
44 MPICommunicatorType comm = MPIHelper::getCommunicator() );
46 MPICommunicatorType comm = MPIHelper::getCommunicator() );
53 template<
class Intersection >
56 return factory_.wasInserted( intersection );
59 template<
class Intersection >
62 return Grid::getRealImplementation( intersection ).boundaryId();
68 return dgf_.haveBndParameters;
71 template <
class GG,
class II >
79 auto refElem = referenceElement< double, dimension >( entity.type() );
80 int corners = refElem.size( face, 1, dimension );
81 std :: vector< unsigned int > bound( corners );
82 for(
int i=0; i < corners; ++i )
84 const int k = refElem.subEntity( face, 1, i, dimension );
85 bound[ i ] = factory_.insertionIndex( entity.template subEntity< dimension >( k ) );
88 DuneGridFormatParser::facemap_t::key_type key( bound,
false );
89 const DuneGridFormatParser::facemap_t::const_iterator pos = dgf_.facemap.find( key );
90 if( pos != dgf_.facemap.end() )
91 return dgf_.facemap.find( key )->second.second;
100 return dgf_.nofelparams;
101 else if( codim == dimension )
102 return dgf_.nofvtxparams;
107 std::vector< double > &
parameter (
const Element &element )
109 if( numParameters< 0 >() <= 0 )
111 DUNE_THROW( InvalidStateException,
112 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
114 return dgf_.elParams[ factory_.insertionIndex( element ) ];
119 if( numParameters< dimension >() <= 0 )
121 DUNE_THROW( InvalidStateException,
122 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
124 return dgf_.vtxParams[ factory_.insertionIndex( vertex ) ];
128 bool generate( std::istream &input );
131 GridFactory factory_;
140 template<
int dim,
int dimworld >
159 template<
int dim,
int dimworld >
167 DUNE_THROW(
DGFException,
"Error resetting input stream." );
172 template<
int dim,
int dimworld >
177 std::ifstream input( filename.c_str() );
179 DUNE_THROW(
DGFException,
"Macrofile " << filename <<
" not found." );
180 if( !generate( input ) )
187 #endif // #if HAVE_ALBERTA 189 #endif // #ifndef DUNE_ALBERTA_DGFPARSER_HH static int refineStepsForHalf()
Definition: albertagrid/dgfparser.hh:143
static double refineWeight()
Definition: albertagrid/dgfparser.hh:148
std::vector< double > & parameter(const Element &element)
Definition: albertagrid/dgfparser.hh:107
MPIHelper::MPICommunicator MPICommunicatorType
Definition: albertagrid/dgfparser.hh:38
int numParameters() const
Definition: albertagrid/dgfparser.hh:97
GridImp::template Codim< 0 >::Entity Entity
Type of entity that this Intersection belongs to.
Definition: common/intersection.hh:190
Some simple static information for a given GridType.
Definition: io/file/dgfparser/dgfparser.hh:50
[ provides Dune::Grid ]
Definition: agrid.hh:136
exception class for IO errors in the DGF parser
Definition: dgfexception.hh:12
std::vector< double > & parameter(const Vertex &vertex)
Definition: albertagrid/dgfparser.hh:117
The DuneGridFormatParser class: reads a DGF file and stores build information in vector structures us...
Definition: parser.hh:44
specialization of the generic GridFactory for AlbertaGrid
Entity inside() const
return Entity on the inside of this intersection. That is the Entity where we started this...
Definition: common/intersection.hh:260
The dimension of the grid.
Definition: common/grid.hh:387
Dune::GridFactory< Grid > GridFactory
Definition: albertagrid/dgfparser.hh:41
Grid::template Codim< dimension >::Entity Vertex
Definition: albertagrid/dgfparser.hh:40
DGFGridFactory(std::istream &input, MPICommunicatorType comm=MPIHelper::getCommunicator())
Definition: dgfgridfactory.hh:47
std::string type
type of additional boundary parameters
Definition: parser.hh:23
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: albertagrid/dgfparser.hh:26
bool wasInserted(const Intersection &intersection) const
Definition: albertagrid/dgfparser.hh:54
AlbertaGrid< dim, dimworld > Grid
Definition: albertagrid/dgfparser.hh:36
Definition: common.hh:179
static const int dimension
Definition: dgfgridfactory.hh:38
Grid::template Codim< 0 >::Entity Element
Definition: albertagrid/dgfparser.hh:39
int boundaryId(const Intersection &intersection) const
Definition: albertagrid/dgfparser.hh:60
int indexInInside() const
Local index of codim 1 entity in the inside() entity where intersection is contained in...
Definition: common/intersection.hh:356
Grid * grid() const
Definition: albertagrid/dgfparser.hh:48
static const type & defaultValue()
default constructor
Definition: parser.hh:26
const DGFBoundaryParameter::type & boundaryParameter(const Intersection< GG, II > &intersection) const
Definition: albertagrid/dgfparser.hh:73
bool haveBoundaryParameters() const
Definition: albertagrid/dgfparser.hh:66
Include standard header files.
Definition: agrid.hh:58