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 const ReferenceElement< double, dimension > & refElem =
80 ReferenceElements< double, dimension >::general( entity.type() );
81 int corners = refElem.size( face, 1, dimension );
82 std :: vector< unsigned int > bound( corners );
83 for(
int i=0; i < corners; ++i )
85 const int k = refElem.subEntity( face, 1, i, dimension );
86 bound[ i ] = factory_.insertionIndex( entity.template subEntity< dimension >( k ) );
89 DuneGridFormatParser::facemap_t::key_type key( bound,
false );
90 const DuneGridFormatParser::facemap_t::const_iterator pos = dgf_.facemap.find( key );
91 if( pos != dgf_.facemap.end() )
92 return dgf_.facemap.find( key )->second.second;
101 return dgf_.nofelparams;
102 else if( codim == dimension )
103 return dgf_.nofvtxparams;
108 std::vector< double > &
parameter (
const Element &element )
110 if( numParameters< 0 >() <= 0 )
112 DUNE_THROW( InvalidStateException,
113 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
115 return dgf_.elParams[ factory_.insertionIndex( element ) ];
120 if( numParameters< dimension >() <= 0 )
122 DUNE_THROW( InvalidStateException,
123 "Calling DGFGridFactory::parameter is only allowed if there are parameters." );
125 return dgf_.vtxParams[ factory_.insertionIndex( vertex ) ];
129 bool generate( std::istream &input );
132 GridFactory factory_;
141 template<
int dim,
int dimworld >
160 template<
int dim,
int dimworld >
161 inline DGFGridFactory< AlbertaGrid< dim, dimworld > >
168 DUNE_THROW(
DGFException,
"Error resetting input stream." );
173 template<
int dim,
int dimworld >
178 std::ifstream input( filename.c_str() );
180 DUNE_THROW(
DGFException,
"Macrofile " << filename <<
" not found." );
181 if( !generate( input ) )
188 #endif // #if HAVE_ALBERTA
190 #endif // #ifndef DUNE_ALBERTA_DGFPARSER_HH
std::vector< double > & parameter(const Vertex &vertex)
Definition: albertagrid/dgfparser.hh:118
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: albertagrid/dgfparser.hh:26
int boundaryId(const Intersection &intersection) const
Definition: albertagrid/dgfparser.hh:60
Grid::template Codim< dimension >::Entity Vertex
Definition: albertagrid/dgfparser.hh:40
Grid * grid() const
Definition: albertagrid/dgfparser.hh:48
The DuneGridFormatParser class: reads a DGF file and stores build information in vector structures us...
Definition: parser.hh:44
Grid::template Codim< 0 >::Entity Element
Definition: albertagrid/dgfparser.hh:39
const DGFBoundaryParameter::type & boundaryParameter(const Intersection< GG, II > &intersection) const
Definition: albertagrid/dgfparser.hh:73
static double refineWeight()
Definition: albertagrid/dgfparser.hh:149
GridImp::template Codim< 0 >::Entity Entity
Type of entity that this Intersection belongs to.
Definition: common/intersection.hh:185
[ provides Dune::Grid ]
Definition: agrid.hh:137
std::vector< double > & parameter(const Element &element)
Definition: albertagrid/dgfparser.hh:108
static const int dimension
Definition: dgfgridfactory.hh:38
int indexInInside() const
Local index of codim 1 entity in the inside() entity where intersection is contained in...
Definition: common/intersection.hh:393
AlbertaGrid< dim, dimworld > Grid
Definition: albertagrid/dgfparser.hh:36
Some simple static information for a given GridType.
Definition: io/file/dgfparser/dgfparser.hh:54
Definition: common.hh:179
Dune::GridFactory< Grid > GridFactory
Definition: albertagrid/dgfparser.hh:41
std::string type
type of additional boundary parameters
Definition: parser.hh:23
int numParameters() const
Definition: albertagrid/dgfparser.hh:98
static const type & defaultValue()
default constructor
Definition: parser.hh:26
The dimension of the grid.
Definition: common/grid.hh:402
MPIHelper::MPICommunicator MPICommunicatorType
Definition: albertagrid/dgfparser.hh:38
bool haveBoundaryParameters() const
Definition: albertagrid/dgfparser.hh:66
specialization of the generic GridFactory for AlbertaGrid
Include standard header files.
Definition: agrid.hh:59
static int refineStepsForHalf()
Definition: albertagrid/dgfparser.hh:144
exception class for IO errors in the DGF parser
Definition: dgfexception.hh:12
bool wasInserted(const Intersection &intersection) const
Definition: albertagrid/dgfparser.hh:54
DGFGridFactory(std::istream &input, MPICommunicatorType comm=MPIHelper::getCommunicator())
Definition: dgfgridfactory.hh:47
Entity inside() const
return EntityPointer to the Entity on the inside of this intersection. That is the Entity where we st...
Definition: common/intersection.hh:286