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;
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 >
80 const ReferenceElement< double, dimension > & refElem =
81 ReferenceElements< double, dimension >::general( entity.type() );
82 int corners = refElem.size( face, 1,
dimension );
83 std :: vector< unsigned int > bound( corners );
84 for(
int i=0; i < corners; ++i )
86 const int k = refElem.subEntity( face, 1, i,
dimension );
87 bound[ i ] = factory_.insertionIndex( *entity.template subEntity< dimension >( k ) );
90 DuneGridFormatParser::facemap_t::key_type key( bound,
false );
91 const DuneGridFormatParser::facemap_t::const_iterator pos = dgf_.facemap.find( key );
92 if( pos != dgf_.facemap.end() )
93 return dgf_.facemap.find( key )->second.second;
102 return dgf_.nofelparams;
104 return dgf_.nofvtxparams;
111 if( numParameters< 0 >() <= 0 )
113 DUNE_THROW( InvalidStateException,
114 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
116 return dgf_.elParams[ factory_.insertionIndex( element ) ];
121 if( numParameters< dimension >() <= 0 )
123 DUNE_THROW( InvalidStateException,
124 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
126 return dgf_.vtxParams[ factory_.insertionIndex( vertex ) ];
130 bool generate( std::istream &input );
142 template<
int dim,
int dimworld >
161 template<
int dim,
int dimworld >
162 inline DGFGridFactory< AlbertaGrid< dim, dimworld > >
169 DUNE_THROW(
DGFException,
"Error resetting input stream." );
174 template<
int dim,
int dimworld >
179 std::ifstream input( filename.c_str() );
181 DUNE_THROW(
DGFException,
"Macrofile " << filename <<
" not found." );
182 if( !generate( input ) )
189 #endif // #if HAVE_ALBERTA
191 #endif // #ifndef DUNE_ALBERTA_DGFPARSER_HH