dune-grid
2.2.0
|
The DuneGridFormatParser class: reads a DGF file and stores build information in vector structures used by the MacroGrid class. More...
#include <dune/grid/io/file/dgfparser/parser.hh>
Public Types | |
enum | element_t { Simplex, Cube, General } |
enum | orientation_t { counterclockwise = 1, clockwise = -1 } |
Public Member Functions | |
DuneGridFormatParser (int rank, int size) | |
constructor | |
bool | readDuneGrid (std::istream &input, int dimG, int dimW) |
parse dune grid format from stream | |
bool | readDuneGrid (std::istream &input, int dimG=-1) |
void | writeTetgenPoly (const std::string &, std::string &, std::string &) |
method to write in Tetgen/Triangle Poly Format | |
void | writeTetgenPoly (std::ostream &out, const bool writeSegments=true) |
Static Public Member Functions | |
static bool | isDuneGridFormat (std::istream &input) |
check whether a stream is in DUNE grid format | |
static bool | isDuneGridFormat (const std::string &filename) |
check whether a file is in dune grid format | |
Protected Types | |
typedef DGFBoundaryParameter::type | BoundaryParameter |
typedef std::pair< int, BoundaryParameter > | BndParam |
typedef std::map< DGFEntityKey < unsigned int >, BndParam > | facemap_t |
Protected Member Functions | |
void | generateBoundaries (std::istream &, bool) |
void | generateSimplexGrid (std::istream &) |
void | readTetgenTriangle (const std::string &) |
void | removeCopies () |
void | setOrientation (int use1, int use2, orientation_t orientation=counterclockwise) |
void | setRefinement (int use1, int use2, int is1=-1, int is2=-1) |
double | testTriang (int snr) |
std::vector< double > & | getElParam (int i, std::vector< double > &coord) |
std::vector< double > & | getVtxParam (int i, std::vector< double > &coord) |
Static Protected Member Functions | |
static std::string | temporaryFileName () |
Protected Attributes | |
int | dimw |
int | dimgrid |
std::vector< std::vector < double > > | vtx |
int | nofvtx |
int | vtxoffset |
double | minVertexDistance |
std::vector< std::vector < unsigned int > > | elements |
int | nofelements |
std::vector< std::vector< int > > | bound |
int | nofbound |
facemap_t | facemap |
bool | haveBndParameters |
element_t | element |
bool | simplexgrid |
bool | cube2simplex |
int | nofvtxparams |
int | nofelparams |
std::vector< std::vector < double > > | vtxParams |
std::vector< std::vector < double > > | elParams |
DGFPrintInfo * | info |
std::vector< double > | emptyParam_ |
Friends | |
class | DGFGridFactory |
class | DGFBaseFactory |
The DuneGridFormatParser class: reads a DGF file and stores build information in vector structures used by the MacroGrid class.
typedef std::pair< int, BoundaryParameter > Dune::DuneGridFormatParser::BndParam [protected] |
typedef DGFBoundaryParameter::type Dune::DuneGridFormatParser::BoundaryParameter [protected] |
typedef std::map< DGFEntityKey< unsigned int >, BndParam > Dune::DuneGridFormatParser::facemap_t [protected] |
Dune::DuneGridFormatParser::DuneGridFormatParser | ( | int | rank, |
int | size | ||
) |
constructor
void Dune::DuneGridFormatParser::generateBoundaries | ( | std::istream & | gridin, |
bool | bndseg | ||
) | [protected] |
References Dune::dgf::BoundaryDomBlock::contains(), Dune::DGFBoundaryParameter::defaultValue(), Dune::ElementFaceUtil::generateFace(), Dune::dgf::BoundarySegBlock::get(), Dune::dgf::BoundaryDomBlock::hasParameter(), Dune::dgf::DomainData::id(), Dune::dgf::BasicBlock::isactive(), and Dune::ElementFaceUtil::nofFaces().
Referenced by readDuneGrid().
void Dune::DuneGridFormatParser::generateSimplexGrid | ( | std::istream & | gridin | ) | [protected] |
References Dune::DGFPrintInfo::block(), Dune::dgf::SimplexGenerationBlock::dimension(), dimw, Dune::dgf::SimplexGenerationBlock::display(), Dune::dgf::SimplexGenerationBlock::dumpFileName(), Dune::dgf::SimplexGenerationBlock::filename(), Dune::dgf::SimplexGenerationBlock::filetype(), Dune::dgf::SimplexGenerationBlock::hasfile(), Dune::dgf::SimplexGenerationBlock::haspath(), info, Dune::dgf::SimplexGenerationBlock::maxArea(), Dune::dgf::SimplexGenerationBlock::minAngle(), Dune::dgf::SimplexGenerationBlock::parameter(), Dune::dgf::SimplexGenerationBlock::path(), Dune::DGFPrintInfo::print(), readTetgenTriangle(), temporaryFileName(), and writeTetgenPoly().
Referenced by readDuneGrid().
std::vector< double > & Dune::DuneGridFormatParser::getElParam | ( | int | i, |
std::vector< double > & | coord | ||
) | [protected] |
std::vector< double > & Dune::DuneGridFormatParser::getVtxParam | ( | int | i, |
std::vector< double > & | coord | ||
) | [protected] |
bool Dune::DuneGridFormatParser::isDuneGridFormat | ( | std::istream & | input | ) | [static] |
check whether a stream is in DUNE grid format
Actually checks whether the stream starts with the keyword 'DGF'.
input | std::istream to check |
References Dune::dgfid(), and Dune::dgf::makeupcase().
Referenced by isDuneGridFormat(), and readDuneGrid().
bool Dune::DuneGridFormatParser::isDuneGridFormat | ( | const std::string & | filename | ) | [static] |
check whether a file is in dune grid format
This is just a convenience method. It calls isDuneGridFormat with a std::ifstream.
filename | file to check |
References isDuneGridFormat().
bool Dune::DuneGridFormatParser::readDuneGrid | ( | std::istream & | input, |
int | dimG, | ||
int | dimW | ||
) |
parse dune grid format from stream
This method actually fills the vtx, element, and bound vectors.
input | std::istream to read the grid from | |
[in] | dimG | dimension of the grid (i.e., Grid::dimension) |
[in] | dimW | dimension of the world (i.e., Grid::dimensionworld) |
References Dune::DGFPrintInfo::automatic(), Dune::DGFPrintInfo::block(), Cube, Dune::DGFPrintInfo::cube2simplex(), cube2simplex, Dune::dgfid(), dimgrid, Dune::dgf::IntervalBlock::dimw(), dimw, element, elements, elParams, Dune::DGFPrintInfo::finish(), General, generateBoundaries(), generateSimplexGrid(), Dune::dgf::VertexBlock::get(), Dune::dgf::SimplexBlock::get(), Dune::dgf::CubeBlock::get(), Dune::dgf::IntervalBlock::get(), info, Dune::dgf::BasicBlock::isactive(), isDuneGridFormat(), nofelements, nofelparams, nofvtx, nofvtxparams, Dune::dgf::IntervalBlock::numIntervals(), Dune::dgf::VertexBlock::offset(), removeCopies(), Simplex, simplexgrid, Dune::DGFPrintInfo::step1(), testTriang(), vtx, vtxoffset, and vtxParams.
Referenced by readDuneGrid().
bool Dune::DuneGridFormatParser::readDuneGrid | ( | std::istream & | input, |
int | dimG = -1 |
||
) | [inline] |
References readDuneGrid().
void Dune::DuneGridFormatParser::readTetgenTriangle | ( | const std::string & | name | ) | [protected] |
References dimw, elements, elParams, facemap, nofelements, nofelparams, nofvtx, nofvtxparams, vtx, and vtxParams.
Referenced by generateSimplexGrid().
void Dune::DuneGridFormatParser::removeCopies | ( | ) | [protected] |
References Dune::Alberta::abs(), dimw, elements, minVertexDistance, nofvtx, and vtx.
Referenced by readDuneGrid().
void Dune::DuneGridFormatParser::setOrientation | ( | int | use1, |
int | use2, | ||
orientation_t | orientation = counterclockwise |
||
) | [protected] |
References Dune::simplex.
void Dune::DuneGridFormatParser::setRefinement | ( | int | use1, |
int | use2, | ||
int | is1 = -1 , |
||
int | is2 = -1 |
||
) | [protected] |
std::string Dune::DuneGridFormatParser::temporaryFileName | ( | ) | [inline, static, protected] |
Referenced by generateSimplexGrid().
double Dune::DuneGridFormatParser::testTriang | ( | int | snr | ) | [protected] |
Referenced by readDuneGrid().
void Dune::DuneGridFormatParser::writeTetgenPoly | ( | const std::string & | prefixname, |
std::string & | extension, | ||
std::string & | params | ||
) |
method to write in Tetgen/Triangle Poly Format
Referenced by generateSimplexGrid().
void Dune::DuneGridFormatParser::writeTetgenPoly | ( | std::ostream & | out, |
const bool | writeSegments = true |
||
) |
References dimw, elements, elParams, facemap, nofelparams, nofvtx, nofvtxparams, vtx, and vtxParams.
friend class DGFBaseFactory [friend] |
friend class DGFGridFactory [friend] |
Reimplemented in Dune::MacroGrid.
std::vector< std::vector < int > > Dune::DuneGridFormatParser::bound [protected] |
bool Dune::DuneGridFormatParser::cube2simplex [protected] |
Referenced by readDuneGrid().
int Dune::DuneGridFormatParser::dimgrid [protected] |
Referenced by readDuneGrid(), and setRefinement().
int Dune::DuneGridFormatParser::dimw [protected] |
Referenced by generateSimplexGrid(), getElParam(), getVtxParam(), readDuneGrid(), readTetgenTriangle(), removeCopies(), setRefinement(), and writeTetgenPoly().
element_t Dune::DuneGridFormatParser::element [protected] |
Referenced by readDuneGrid(), and setRefinement().
std :: vector< std :: vector< unsigned int > > Dune::DuneGridFormatParser::elements [protected] |
std::vector< std::vector< double > > Dune::DuneGridFormatParser::elParams [protected] |
std::vector< double > Dune::DuneGridFormatParser::emptyParam_ [protected] |
facemap_t Dune::DuneGridFormatParser::facemap [protected] |
bool Dune::DuneGridFormatParser::haveBndParameters [protected] |
DGFPrintInfo* Dune::DuneGridFormatParser::info [protected] |
Referenced by generateSimplexGrid(), and readDuneGrid().
double Dune::DuneGridFormatParser::minVertexDistance [protected] |
Referenced by removeCopies().
int Dune::DuneGridFormatParser::nofbound [protected] |
int Dune::DuneGridFormatParser::nofelements [protected] |
Referenced by readDuneGrid(), readTetgenTriangle(), and setRefinement().
int Dune::DuneGridFormatParser::nofelparams [protected] |
int Dune::DuneGridFormatParser::nofvtx [protected] |
Referenced by readDuneGrid(), readTetgenTriangle(), removeCopies(), and writeTetgenPoly().
int Dune::DuneGridFormatParser::nofvtxparams [protected] |
bool Dune::DuneGridFormatParser::simplexgrid [protected] |
Referenced by readDuneGrid().
std::vector< std::vector < double > > Dune::DuneGridFormatParser::vtx [protected] |
int Dune::DuneGridFormatParser::vtxoffset [protected] |
Referenced by readDuneGrid().
std::vector< std::vector< double > > Dune::DuneGridFormatParser::vtxParams [protected] |