Public Member Functions | |
| TriangleMeshReader (const std::string &filename, const MeshType &meshType, int verbosity=0, const MPIComm &comm=MPIComm::world()) | |
| TriangleMeshReader (const ParameterList ¶ms) | |
| virtual | ~TriangleMeshReader () |
| virtual Mesh | fillMesh () const |
| virtual std::string | description () const |
| virtual RCP< MeshSourceBase > | getRcp () |
Private Member Functions | |
| void | readParallelInfo (Array< int > &ptGID, Array< int > &ptOwner, Array< int > &elemGID, Array< int > &elemOwner) const |
| Mesh | readNodes (Array< int > &ptGID, Array< int > &ptOwner) const |
| void | readSides (Mesh &mesh) const |
| void | readEdges (Mesh &mesh) const |
| void | readElems (Mesh &mesh, const Array< int > &nodeGID, Array< int > &elemGID, Array< int > &elemOwner) const |
Private Attributes | |
| std::string | nodeFilename_ |
| std::string | elemFilename_ |
| std::string | parFilename_ |
| std::string | sideFilename_ |
| std::string | edgeFilename_ |
| int | offset_ |
TriangleMeshReader reads a mesh stored in Shewchuk's Triangle format. This format is documented at the Triangle homepage. This reader expects to find node information in .node files and element information in .ele files. The filename constructor argument is the stem of the filenames, and so that a reader constructed with filename joe will look for node and element data in joe.node and joe.ele respectively. Node and element attributes are read if present, and can be accessed with the getAttributes() method of MeshSource.
We have extended the Triangle format to deal with distributed meshes. A TriangleMeshReader is constructed with an MPIComm object, and if that communicator has more than one processor the mesh is assumed to be split into files, one for each processor. Data on mesh "joe" for the nnn-th processor will be found in the files
joe.node.nnn joe.ele.nnn joe.par.nnn The .node.nnn and .ele.nnn files contain the node and element data for the part of the mesh seen by the nnn-th processor. The node and element numberings given in those two files are local indexes. The .par.nnn contains node and element ownership information for the part of the mesh seen by the nnn-th processor.
A .par file is formatted as follows:
rank numProcs numPoints ptLID ptGID ptOwnerRank numElems elemLID elemGID elemOwnerRank Definition at line 100 of file SundanceTriangleMeshReader.hpp.
| TriangleMeshReader::TriangleMeshReader | ( | const std::string & | filename, |
| const MeshType & | meshType, | ||
| int | verbosity = 0, |
||
| const MPIComm & | comm = MPIComm::world() |
||
| ) |
Definition at line 55 of file SundanceTriangleMeshReader.cpp.
References edgeFilename_, elemFilename_, Sundance::MeshSourceBase::myRank(), nodeFilename_, Sundance::MeshSourceBase::nProc(), parFilename_, sideFilename_, SUNDANCE_OUT, Sundance::toString(), and Playa::ObjectWithVerbosity::verb().
| TriangleMeshReader::TriangleMeshReader | ( | const ParameterList & | params | ) |
Construct from a ParameterList
Definition at line 93 of file SundanceTriangleMeshReader.cpp.
References edgeFilename_, elemFilename_, Sundance::MeshSourceBase::myRank(), nodeFilename_, Sundance::MeshSourceBase::nProc(), parFilename_, sideFilename_, SUNDANCE_OUT, Sundance::toString(), and Playa::ObjectWithVerbosity::verb().
| virtual Sundance::TriangleMeshReader::~TriangleMeshReader | ( | ) | [inline, virtual] |
virtual dtor
Definition at line 113 of file SundanceTriangleMeshReader.hpp.
| virtual std::string Sundance::TriangleMeshReader::description | ( | ) | const [inline, virtual] |
Print a short descriptive std::string
Reimplemented from Sundance::MeshSourceBase.
Definition at line 120 of file SundanceTriangleMeshReader.hpp.
References Sundance::MeshReaderBase::filename().
| Mesh TriangleMeshReader::fillMesh | ( | ) | const [virtual] |
Create a mesh
Implements Sundance::MeshSourceBase.
Definition at line 129 of file SundanceTriangleMeshReader.cpp.
References Sundance::Mesh::freezeTopology(), readEdges(), readElems(), readNodes(), readParallelInfo(), and readSides().
| virtual RCP<MeshSourceBase> Sundance::TriangleMeshReader::getRcp | ( | ) | [inline, virtual] |
Return a ref count pointer to self
Implements Playa::Handleable< MeshSourceBase >.
Definition at line 125 of file SundanceTriangleMeshReader.hpp.
| void TriangleMeshReader::readEdges | ( | Mesh & | mesh | ) | const [private] |
Definition at line 573 of file SundanceTriangleMeshReader.cpp.
References Sundance::MeshReaderBase::atoi(), edgeFilename_, Sundance::MeshReaderBase::getNextLine(), Sundance::lookupEdgeLIDFromVerts(), offset_, Sundance::MeshReaderBase::openFile(), Sundance::Mesh::setLabel(), SUNDANCE_TRACE, and SUNDANCE_VERB_LOW.
Referenced by fillMesh().
| void TriangleMeshReader::readElems | ( | Mesh & | mesh, |
| const Array< int > & | nodeGID, | ||
| Array< int > & | elemGID, | ||
| Array< int > & | elemOwner | ||
| ) | const [private] |
Definition at line 400 of file SundanceTriangleMeshReader.cpp.
References Sundance::Mesh::addElement(), Sundance::MeshReaderBase::atof(), Sundance::MeshReaderBase::atoi(), Sundance::MeshSourceBase::elemAttributes(), elemFilename_, Sundance::MeshReaderBase::getNextLine(), Sundance::MeshSourceBase::nProc(), offset_, Sundance::MeshReaderBase::openFile(), parFilename_, Sundance::Mesh::spatialDim(), and SUNDANCE_TRACE.
Referenced by fillMesh().
| Mesh TriangleMeshReader::readNodes | ( | Array< int > & | ptGID, |
| Array< int > & | ptOwner | ||
| ) | const [private] |
Definition at line 277 of file SundanceTriangleMeshReader.cpp.
References Sundance::Mesh::addVertex(), Sundance::MeshReaderBase::atof(), Sundance::MeshReaderBase::atoi(), Sundance::MeshSourceBase::createMesh(), Sundance::dimension(), Sundance::MeshReaderBase::getNextLine(), Sundance::MeshSourceBase::nodeAttributes(), nodeFilename_, Sundance::MeshSourceBase::nProc(), offset_, Sundance::MeshReaderBase::openFile(), parFilename_, SUNDANCE_OUT, and Playa::ObjectWithVerbosity::verb().
Referenced by fillMesh().
| void TriangleMeshReader::readParallelInfo | ( | Array< int > & | ptGID, |
| Array< int > & | ptOwner, | ||
| Array< int > & | elemGID, | ||
| Array< int > & | elemOwner | ||
| ) | const [private] |
Definition at line 153 of file SundanceTriangleMeshReader.cpp.
References Sundance::MeshReaderBase::atoi(), Sundance::MeshReaderBase::getNextLine(), Sundance::MeshSourceBase::myRank(), Sundance::MeshSourceBase::nProc(), Sundance::MeshReaderBase::openFile(), parFilename_, SUNDANCE_OUT, SUNDANCE_TRACE, and Playa::ObjectWithVerbosity::verb().
Referenced by fillMesh().
| void TriangleMeshReader::readSides | ( | Mesh & | mesh | ) | const [private] |
Definition at line 503 of file SundanceTriangleMeshReader.cpp.
References Sundance::MeshReaderBase::atoi(), Sundance::Mesh::facetLID(), Sundance::MeshReaderBase::getNextLine(), Sundance::Mesh::hasGID(), Sundance::Mesh::mapGIDToLID(), Sundance::MeshReaderBase::openFile(), Sundance::Mesh::setLabel(), sideFilename_, Sundance::Mesh::spatialDim(), SUNDANCE_TRACE, and SUNDANCE_VERB_LOW.
Referenced by fillMesh().
std::string Sundance::TriangleMeshReader::edgeFilename_ [private] |
Definition at line 162 of file SundanceTriangleMeshReader.hpp.
Referenced by readEdges(), and TriangleMeshReader().
std::string Sundance::TriangleMeshReader::elemFilename_ [private] |
Definition at line 153 of file SundanceTriangleMeshReader.hpp.
Referenced by readElems(), and TriangleMeshReader().
std::string Sundance::TriangleMeshReader::nodeFilename_ [private] |
Definition at line 150 of file SundanceTriangleMeshReader.hpp.
Referenced by readNodes(), and TriangleMeshReader().
int Sundance::TriangleMeshReader::offset_ [mutable, private] |
Definition at line 165 of file SundanceTriangleMeshReader.hpp.
Referenced by readEdges(), readElems(), and readNodes().
std::string Sundance::TriangleMeshReader::parFilename_ [private] |
Definition at line 156 of file SundanceTriangleMeshReader.hpp.
Referenced by readElems(), readNodes(), readParallelInfo(), and TriangleMeshReader().
std::string Sundance::TriangleMeshReader::sideFilename_ [private] |
Definition at line 159 of file SundanceTriangleMeshReader.hpp.
Referenced by readSides(), and TriangleMeshReader().