1 #ifndef DUNE_ALBERTA_DGFPARSER_HH
2 #define DUNE_ALBERTA_DGFPARSER_HH
23 template <
class Gr
idImp,
template <
class >
class IntersectionImp >
29 template<
int dim,
int dimworld >
35 typedef typename Grid::template Codim<0>::Entity
Element;
36 typedef typename Grid::template Codim<dimension>::Entity
Vertex;
49 template<
class Intersection >
52 return factory_.wasInserted( intersection );
55 template<
class Intersection >
58 return Grid::getRealImplementation( intersection ).boundaryId();
64 return dgf_.haveBndParameters;
67 template <
class GG,
template <
class >
class II >
76 const GenericReferenceElement< double, dimension > & refElem =
77 GenericReferenceElements< double, dimension >::general( entity.type() );
78 int corners = refElem.size( face, 1,
dimension );
79 std :: vector< unsigned int > bound( corners );
80 for(
int i=0; i < corners; ++i )
82 const int k = refElem.subEntity( face, 1, i,
dimension );
83 bound[ i ] = factory_.insertionIndex( *entity.template subEntity< dimension >( k ) );
86 DuneGridFormatParser::facemap_t::key_type key( bound,
false );
87 const DuneGridFormatParser::facemap_t::const_iterator pos = dgf_.facemap.find( key );
88 if( pos != dgf_.facemap.end() )
89 return dgf_.facemap.find( key )->second.second;
98 return dgf_.nofelparams;
100 return dgf_.nofvtxparams;
107 if( numParameters< 0 >() <= 0 )
109 DUNE_THROW( InvalidStateException,
110 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
112 return dgf_.elParams[ factory_.insertionIndex( element ) ];
117 if( numParameters< dimension >() <= 0 )
119 DUNE_THROW( InvalidStateException,
120 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
122 return dgf_.vtxParams[ factory_.insertionIndex( vertex ) ];
126 bool generate( std::istream &input );
138 template<
int dim,
int dimworld >
157 template<
int dim,
int dimworld >
158 inline DGFGridFactory< AlbertaGrid< dim, dimworld > >
165 DUNE_THROW(
DGFException,
"Error resetting input stream." );
170 template<
int dim,
int dimworld >
175 std::ifstream input( filename.c_str() );
177 DUNE_THROW(
DGFException,
"Macrofile " << filename <<
" not found." );
178 if( !generate( input ) )
185 #endif // #if HAVE_ALBERTA
187 #endif // #ifndef DUNE_ALBERTA_DGFPARSER_HH