dune-grid  2.3.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
Dune::DuneGridFormatParser Class Reference

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>

Inheritance diagram for Dune::DuneGridFormatParser:
Dune::MacroGrid

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
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
DGFPrintInfoinfo
std::vector< double > emptyParam_

Friends

struct DGFGridFactory
struct DGFBaseFactory

Detailed Description

The DuneGridFormatParser class: reads a DGF file and stores build information in vector structures used by the MacroGrid class.

Member Typedef Documentation

typedef std::pair< int, BoundaryParameter > Dune::DuneGridFormatParser::BndParam
protected
typedef std::map< DGFEntityKey< unsigned int >, BndParam > Dune::DuneGridFormatParser::facemap_t
protected

Member Enumeration Documentation

Enumerator:
Simplex 
Cube 
General 
Enumerator:
counterclockwise 
clockwise 

Constructor & Destructor Documentation

Dune::DuneGridFormatParser::DuneGridFormatParser ( int  rank,
int  size 
)

constructor

Member Function Documentation

void Dune::DuneGridFormatParser::generateBoundaries ( std::istream &  gridin,
bool  bndseg 
)
protected
void Dune::DuneGridFormatParser::generateSimplexGrid ( std::istream &  gridin)
protected
std::vector< double > & Dune::DuneGridFormatParser::getElParam ( int  i,
std::vector< double > &  coord 
)
protected

References dimw, elements, elParams, and vtx.

std::vector< double > & Dune::DuneGridFormatParser::getVtxParam ( int  i,
std::vector< double > &  coord 
)
protected

References dimw, vtx, and vtxParams.

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'.

Parameters
inputstd::istream to check
Note
The stream must support seeking.
Returns
whether the keyword 'DGF' was found

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.

Parameters
filenamefile to check
Returns
whether the keyword 'DGF' was found

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.

Parameters
inputstd::istream to read the grid from
[in]dimGdimension of the grid (i.e., Grid::dimension)
[in]dimWdimension of the world (i.e., Grid::dimensionworld)
Note
The stream must support seeking.
Returns
whether reading succeeded

References Cube, cube2simplex, Dune::dgfid(), dimgrid, Dune::dgf::IntervalBlock::dimw(), dimw, element, elements, elParams, 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, testTriang(), vtx, vtxoffset, and vtxParams.

void Dune::DuneGridFormatParser::readTetgenTriangle ( const std::string &  name)
protected
void Dune::DuneGridFormatParser::removeCopies ( )
protected
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 ( )
inlinestaticprotected

Referenced by generateSimplexGrid().

double Dune::DuneGridFormatParser::testTriang ( int  snr)
protected

References elements, and vtx.

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 
)

Friends And Related Function Documentation

friend struct DGFBaseFactory
friend
friend struct DGFGridFactory
friend

Member Data Documentation

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
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 readDuneGrid().

double Dune::DuneGridFormatParser::minVertexDistance
protected

Referenced by removeCopies().

int Dune::DuneGridFormatParser::nofbound
protected
int Dune::DuneGridFormatParser::nofelements
protected
int Dune::DuneGridFormatParser::nofelparams
protected
int Dune::DuneGridFormatParser::nofvtx
protected
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

The documentation for this class was generated from the following files: