MeshSourceBase provides the internal interface for mesh sources, i.e., objects such as mesh generators and file readers that can produce a mesh object. More...
Public Member Functions | |
| MeshSourceBase (const MeshType &meshType, const MPIComm &comm) | |
| Construct with a mesh type and MPI communicator. | |
| MeshSourceBase (const ParameterList ¶ms) | |
| Construct from a parameter list. | |
| virtual | ~MeshSourceBase () |
| virtual dtor | |
| Mesh | getMesh () const |
| Get a mesh from the source. | |
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 |
| Print to a stream. | |
Describable interface | |
| virtual std::string | description () const |
| Print to a stream. | |
| const MPIComm & | comm () const |
| access to the MPI communicator | |
Protected Member Functions | |
| int | myRank () const |
| Get processor rank. | |
| int | nProc () const |
| Get number of processors. | |
| virtual Mesh | fillMesh () const =0 |
| Fill a mesh object with data from the source. | |
| Mesh | createMesh (int dim) const |
| createMesh() physically allocates the mesh object | |
| RCP< Array< Array< double > > > & | nodeAttributes () const |
| internal access to the node attributes | |
| RCP< Array< Array< double > > > & | elemAttributes () const |
| internal access to the element attributes | |
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 79 of file SundanceMeshSourceBase.hpp.
| MeshSourceBase::MeshSourceBase | ( | const MeshType & | meshType, |
| const MPIComm & | comm | ||
| ) |
Construct with a mesh type and MPI communicator.
Definition at line 13 of file SundanceMeshSourceBase.cpp.
| MeshSourceBase::MeshSourceBase | ( | const ParameterList & | params | ) |
Construct from a parameter list.
Definition at line 24 of file SundanceMeshSourceBase.cpp.
| virtual Sundance::MeshSourceBase::~MeshSourceBase | ( | ) | [inline, virtual] |
virtual dtor
Definition at line 94 of file SundanceMeshSourceBase.hpp.
| const MPIComm& Sundance::MeshSourceBase::comm | ( | ) | const [inline] |
access to the MPI communicator
Definition at line 121 of file SundanceMeshSourceBase.hpp.
References comm_.
Referenced by Sundance::PartitionedLineMesher::fillMesh(), myRank(), and nProc().
| Mesh MeshSourceBase::createMesh | ( | int | dim | ) | const [protected] |
createMesh() physically allocates the mesh object
Definition at line 62 of file SundanceMeshSourceBase.cpp.
References cachedMesh_, comm_, Sundance::MeshType::createEmptyMesh(), hasCachedMesh_, meshType_, Sundance::Handle< PointerType >::ptr(), and Sundance::DefaultObjectWithVerbosity::verb().
Referenced by Sundance::PeanoMesher3D::fillMesh(), Sundance::PeanoMesher2D::fillMesh(), Sundance::PartitionedRectangleMesher::fillMesh(), Sundance::PartitionedLineMesher::fillMesh(), Sundance::OneTetMesher::fillMesh(), Sundance::OneTriangleMesher::fillMesh(), Sundance::HNMesher3D::fillMesh(), Sundance::HNMesher2D::fillMesh(), Sundance::ExodusNetCDFMeshReader::fillMesh(), Sundance::ExodusMeshReader::fillMesh(), Sundance::BamgMeshReader::readMesh(), and Sundance::TriangleMeshReader::readNodes().
| virtual std::string Sundance::MeshSourceBase::description | ( | ) | const [inline, virtual] |
Print to a stream.
Reimplemented in Sundance::BamgMeshReader, Sundance::ExodusMeshReader, Sundance::ExodusNetCDFMeshReader, Sundance::HNMesher2D, Sundance::HNMesher3D, Sundance::OneTriangleMesher, Sundance::OneTetMesher, Sundance::PartitionedLineMesher, Sundance::PartitionedRectangleMesher, Sundance::PeanoMesher2D, Sundance::PeanoMesher3D, Sundance::PeriodicLineMesher, and Sundance::TriangleMeshReader.
Definition at line 117 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 146 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::BamgMeshReader, Sundance::ExodusMeshReader, Sundance::ExodusNetCDFMeshReader, Sundance::HNMesher2D, Sundance::HNMesher3D, Sundance::OneTriangleMesher, Sundance::OneTetMesher, Sundance::PartitionedLineMesher, Sundance::PartitionedRectangleMesher, Sundance::PeanoMesher2D, Sundance::PeanoMesher3D, Sundance::PeriodicLineMesher, and Sundance::TriangleMeshReader.
Referenced by getMesh().
| void MeshSourceBase::getAttributes | ( | RCP< Array< Array< double > > > & | nodeAttributes, |
| RCP< Array< Array< double > > > & | elemAttributes | ||
| ) | const |
Definition at line 55 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 35 of file SundanceMeshSourceBase.cpp.
References cachedMesh_, fillMesh(), hasCachedMesh_, Sundance::Mesh::numCells(), Sundance::Mesh::spatialDim(), and Sundance::DefaultObjectWithVerbosity::verb().
| int Sundance::MeshSourceBase::myRank | ( | ) | const [inline, protected] |
Get processor rank.
Definition at line 128 of file SundanceMeshSourceBase.hpp.
References comm().
Referenced by Sundance::BamgMeshReader::BamgMeshReader(), Sundance::ExodusMeshReader::ExodusMeshReader(), Sundance::PartitionedRectangleMesher::fillMesh(), Sundance::PartitionedLineMesher::fillMesh(), Sundance::TriangleMeshReader::readParallelInfo(), Sundance::ExodusMeshReader::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 142 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 130 of file SundanceMeshSourceBase.hpp.
References comm().
Referenced by Sundance::BamgMeshReader::BamgMeshReader(), Sundance::ExodusMeshReader::ExodusMeshReader(), Sundance::ExodusNetCDFMeshReader::ExodusNetCDFMeshReader(), Sundance::PartitionedRectangleMesher::fillMesh(), Sundance::PartitionedLineMesher::fillMesh(), Sundance::ExodusMeshReader::fillMesh(), Sundance::TriangleMeshReader::readElems(), Sundance::TriangleMeshReader::readNodes(), Sundance::TriangleMeshReader::readParallelInfo(), Sundance::ExodusMeshReader::readParallelInfo(), Sundance::BamgMeshReader::readParallelInfo(), and Sundance::TriangleMeshReader::TriangleMeshReader().
| virtual void Sundance::MeshSourceBase::print | ( | std::ostream & | os | ) | const [inline, virtual] |
Print to a stream.
Implements Sundance::Printable.
Definition at line 111 of file SundanceMeshSourceBase.hpp.
References description().
Mesh Sundance::MeshSourceBase::cachedMesh_ [mutable, private] |
Definition at line 154 of file SundanceMeshSourceBase.hpp.
Referenced by createMesh(), and getMesh().
MPIComm Sundance::MeshSourceBase::comm_ [private] |
Definition at line 163 of file SundanceMeshSourceBase.hpp.
Referenced by comm(), and createMesh().
RCP<Array<Array<double> > > Sundance::MeshSourceBase::elemAttributes_ [mutable, private] |
Definition at line 166 of file SundanceMeshSourceBase.hpp.
Referenced by elemAttributes().
bool Sundance::MeshSourceBase::hasCachedMesh_ [mutable, private] |
Definition at line 157 of file SundanceMeshSourceBase.hpp.
Referenced by createMesh(), and getMesh().
MeshType Sundance::MeshSourceBase::meshType_ [private] |
Definition at line 160 of file SundanceMeshSourceBase.hpp.
Referenced by createMesh().
RCP<Array<Array<double> > > Sundance::MeshSourceBase::nodeAttributes_ [mutable, private] |
Definition at line 169 of file SundanceMeshSourceBase.hpp.
Referenced by nodeAttributes().