Public Member Functions | |
| MeshSourceBase (const MeshType &meshType, int verbosity, const MPIComm &comm) | |
| MeshSourceBase (const ParameterList ¶ms) | |
| virtual | ~MeshSourceBase () |
| Mesh | getMesh () const |
Extraction of attributes | |
| void | getAttributes (RCP< Array< Array< double > > > &nodeAttributes, RCP< Array< Array< double > > > &elemAttributes) const |
Printable interface | |
| virtual void | print (std::ostream &os) const |
Describable interface | |
| virtual std::string | description () const |
| const MPIComm & | comm () const |
Protected Member Functions | |
| int | myRank () const |
| int | nProc () const |
| virtual Mesh | fillMesh () const =0 |
| Mesh | createMesh (int dim) const |
| RCP< Array< Array< double > > > & | nodeAttributes () const |
| RCP< Array< Array< double > > > & | elemAttributes () const |
Private Attributes | |
| Mesh | cachedMesh_ |
| bool | hasCachedMesh_ |
| MeshType | meshType_ |
| MPIComm | comm_ |
| RCP< Array< Array< double > > > | elemAttributes_ |
| RCP< Array< Array< double > > > | nodeAttributes_ |
MeshSourceBase provides the internal interface for mesh sources, i.e., objects such as mesh generators and file readers that can produce a mesh object. The action of a mesh source should be independent of the internal mesh representation used. To allow user-level specification of the type of internal mesh representation to be used, a MeshSourceBase is constructed with a MeshType object which acts as a factory to produce empty meshes.
Mesh sources are constructed with a MPI communicator. If the communicator has more than one processor, the mesh created will be distributed.
The only method you will need to override is
virtual Mesh fillMesh() const which is where you fill in a mesh object and return it. This method should usually physically create the mesh with a call to createMesh(), ensuring that the correct mesh representation type is created using the MeshType factory with which the source was constructed.
See the PartitionedLineMesher source code for a very simple example of how to write a mesh source subtype.
Optionally, you can override the description() method to provide more informative descriptive output than the std::string "MeshSourceBase[unknown subtype]".
Definition at line 90 of file SundanceMeshSourceBase.hpp.
| MeshSourceBase::MeshSourceBase | ( | const MeshType & | meshType, |
| int | verbosity, | ||
| const MPIComm & | comm | ||
| ) |
Construct with a mesh type and MPI communicator
Definition at line 55 of file SundanceMeshSourceBase.cpp.
| MeshSourceBase::MeshSourceBase | ( | const ParameterList & | params | ) |
Construct from a parameter list
Definition at line 68 of file SundanceMeshSourceBase.cpp.
| virtual Sundance::MeshSourceBase::~MeshSourceBase | ( | ) | [inline, virtual] |
virtual dtor
Definition at line 106 of file SundanceMeshSourceBase.hpp.
| const MPIComm& Sundance::MeshSourceBase::comm | ( | ) | const [inline] |
access to the MPI communicator
Definition at line 133 of file SundanceMeshSourceBase.hpp.
References comm_.
Referenced by Sundance::PartitionedLineMesher::fillMesh(), myRank(), nProc(), and Sundance::PartitionedRectangleMesher::PartitionedRectangleMesher().
| Mesh MeshSourceBase::createMesh | ( | int | dim | ) | const [protected] |
createMesh() physically allocates the mesh object
Definition at line 106 of file SundanceMeshSourceBase.cpp.
References cachedMesh_, comm_, Sundance::MeshType::createEmptyMesh(), hasCachedMesh_, meshType_, Playa::Handle< PointerType >::ptr(), and Playa::ObjectWithVerbosity::verb().
Referenced by Sundance::OneTriangleMesher::fillMesh(), Sundance::ExodusMeshReader::fillMesh(), Sundance::ExodusNetCDFMeshReader::fillMesh(), Sundance::PartitionedLineMesher::fillMesh(), Sundance::PeanoMesher2D::fillMesh(), Sundance::OneTetMesher::fillMesh(), Sundance::PeanoMesher3D::fillMesh(), Sundance::PartitionedRectangleMesher::fillMesh(), Sundance::HNMesher2D::fillMesh(), Sundance::HNMesher3D::fillMesh(), Sundance::BamgMeshReader::readMesh(), and Sundance::TriangleMeshReader::readNodes().
| virtual std::string Sundance::MeshSourceBase::description | ( | ) | const [inline, virtual] |
Print to a stream
Reimplemented in Sundance::HNMesher2D, Sundance::HNMesher3D, Sundance::BamgMeshReader, Sundance::TriangleMeshReader, Sundance::PartitionedRectangleMesher, Sundance::OneTetMesher, Sundance::PeanoMesher3D, Sundance::PeanoMesher2D, Sundance::PeriodicLineMesher, Sundance::ExodusNetCDFMeshReader, Sundance::PartitionedLineMesher, Sundance::ExodusMeshReader, and Sundance::OneTriangleMesher.
Definition at line 129 of file SundanceMeshSourceBase.hpp.
Referenced by print().
| RCP<Array<Array<double> > >& Sundance::MeshSourceBase::elemAttributes | ( | ) | const [inline, protected] |
internal access to the element attributes
Definition at line 158 of file SundanceMeshSourceBase.hpp.
References elemAttributes_.
Referenced by Sundance::ExodusMeshReader::fillMesh(), Sundance::TriangleMeshReader::readElems(), and Sundance::BamgMeshReader::readMesh().
| virtual Mesh Sundance::MeshSourceBase::fillMesh | ( | ) | const [protected, pure virtual] |
Fill a mesh object with data from the source. Subclass implementors will need to provide a fillMesh() for their subclass. Implementors should use the createMesh() method for the allocation of the new mesh.
Implemented in Sundance::HNMesher3D, Sundance::HNMesher2D, Sundance::PartitionedRectangleMesher, Sundance::BamgMeshReader, Sundance::TriangleMeshReader, Sundance::PeanoMesher3D, Sundance::OneTetMesher, Sundance::PeanoMesher2D, Sundance::PartitionedLineMesher, Sundance::ExodusNetCDFMeshReader, Sundance::PeriodicLineMesher, Sundance::ExodusMeshReader, and Sundance::OneTriangleMesher.
Referenced by getMesh().
| void MeshSourceBase::getAttributes | ( | RCP< Array< Array< double > > > & | nodeAttributes, |
| RCP< Array< Array< double > > > & | elemAttributes | ||
| ) | const |
Definition at line 99 of file SundanceMeshSourceBase.cpp.
| Mesh MeshSourceBase::getMesh | ( | ) | const |
Get a mesh from the source. If a mesh has already been created, this method will return the cached mesh, otherwise it will build on with a call to fillMesh()
Definition at line 79 of file SundanceMeshSourceBase.cpp.
References cachedMesh_, fillMesh(), hasCachedMesh_, Sundance::Mesh::numCells(), Sundance::Mesh::spatialDim(), and Playa::ObjectWithVerbosity::verb().
| int Sundance::MeshSourceBase::myRank | ( | ) | const [inline, protected] |
Get processor rank
Definition at line 140 of file SundanceMeshSourceBase.hpp.
References comm(), and Playa::MPIComm::getRank().
Referenced by Sundance::BamgMeshReader::BamgMeshReader(), Sundance::ExodusMeshReader::ExodusMeshReader(), Sundance::PartitionedLineMesher::fillMesh(), Sundance::PartitionedRectangleMesher::fillMesh(), Sundance::ExodusMeshReader::readParallelInfo(), Sundance::TriangleMeshReader::readParallelInfo(), Sundance::BamgMeshReader::readParallelInfo(), and Sundance::TriangleMeshReader::TriangleMeshReader().
| RCP<Array<Array<double> > >& Sundance::MeshSourceBase::nodeAttributes | ( | ) | const [inline, protected] |
internal access to the node attributes
Definition at line 154 of file SundanceMeshSourceBase.hpp.
References nodeAttributes_.
Referenced by Sundance::ExodusMeshReader::fillMesh(), Sundance::BamgMeshReader::readMesh(), and Sundance::TriangleMeshReader::readNodes().
| int Sundance::MeshSourceBase::nProc | ( | ) | const [inline, protected] |
Get number of processors
Definition at line 142 of file SundanceMeshSourceBase.hpp.
References comm(), and Playa::MPIComm::getNProc().
Referenced by Sundance::BamgMeshReader::BamgMeshReader(), Sundance::ExodusMeshReader::ExodusMeshReader(), Sundance::ExodusNetCDFMeshReader::ExodusNetCDFMeshReader(), Sundance::ExodusMeshReader::fillMesh(), Sundance::PartitionedLineMesher::fillMesh(), Sundance::PartitionedRectangleMesher::fillMesh(), Sundance::TriangleMeshReader::readElems(), Sundance::TriangleMeshReader::readNodes(), Sundance::ExodusMeshReader::readParallelInfo(), Sundance::TriangleMeshReader::readParallelInfo(), Sundance::BamgMeshReader::readParallelInfo(), and Sundance::TriangleMeshReader::TriangleMeshReader().
| virtual void Sundance::MeshSourceBase::print | ( | std::ostream & | os | ) | const [inline, virtual] |
Print to a stream
Implements Playa::Printable.
Definition at line 123 of file SundanceMeshSourceBase.hpp.
References description().
Mesh Sundance::MeshSourceBase::cachedMesh_ [mutable, private] |
Definition at line 166 of file SundanceMeshSourceBase.hpp.
Referenced by createMesh(), and getMesh().
MPIComm Sundance::MeshSourceBase::comm_ [private] |
Definition at line 175 of file SundanceMeshSourceBase.hpp.
Referenced by comm(), and createMesh().
RCP<Array<Array<double> > > Sundance::MeshSourceBase::elemAttributes_ [mutable, private] |
Definition at line 178 of file SundanceMeshSourceBase.hpp.
Referenced by elemAttributes().
bool Sundance::MeshSourceBase::hasCachedMesh_ [mutable, private] |
Definition at line 169 of file SundanceMeshSourceBase.hpp.
Referenced by createMesh(), and getMesh().
MeshType Sundance::MeshSourceBase::meshType_ [private] |
Definition at line 172 of file SundanceMeshSourceBase.hpp.
Referenced by createMesh().
RCP<Array<Array<double> > > Sundance::MeshSourceBase::nodeAttributes_ [mutable, private] |
Definition at line 181 of file SundanceMeshSourceBase.hpp.
Referenced by nodeAttributes().