Sundance::MeshSourceBase Class Reference

Inheritance diagram for Sundance::MeshSourceBase:

Playa::Handleable< MeshSourceBase > Playa::Printable Sundance::Noncopyable Playa::ObjectWithVerbosity Sundance::HNMesher2D Sundance::HNMesher3D Sundance::MeshReaderBase Sundance::OneTetMesher Sundance::OneTriangleMesher Sundance::PartitionedLineMesher Sundance::PartitionedRectangleMesher Sundance::PeanoMesher2D Sundance::PeanoMesher3D Sundance::PeriodicLineMesher

List of all members.

Public Member Functions

 MeshSourceBase (const MeshType &meshType, int verbosity, const MPIComm &comm)
 MeshSourceBase (const ParameterList &params)
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 MPICommcomm () 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_


Detailed Description

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.

Writing your own MeshSourceBase subtype

The only method you will need to override is

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.


Constructor & Destructor Documentation

MeshSourceBase::MeshSourceBase ( const MeshType meshType,
int  verbosity,
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 26 of file SundanceMeshSourceBase.cpp.

virtual Sundance::MeshSourceBase::~MeshSourceBase (  )  [inline, virtual]

virtual dtor

Definition at line 95 of file SundanceMeshSourceBase.hpp.


Member Function Documentation

const MPIComm& Sundance::MeshSourceBase::comm (  )  const [inline]

Mesh MeshSourceBase::createMesh ( int  dim  )  const [protected]

virtual std::string Sundance::MeshSourceBase::description (  )  const [inline, virtual]

RCP<Array<Array<double> > >& Sundance::MeshSourceBase::elemAttributes (  )  const [inline, protected]

internal access to the element attributes

Definition at line 147 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]

void MeshSourceBase::getAttributes ( RCP< Array< Array< double > > > &  nodeAttributes,
RCP< Array< Array< double > > > &  elemAttributes 
) const

Definition at line 57 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 37 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]

RCP<Array<Array<double> > >& Sundance::MeshSourceBase::nodeAttributes (  )  const [inline, protected]

internal access to the node attributes

Definition at line 143 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]

virtual void Sundance::MeshSourceBase::print ( std::ostream &  os  )  const [inline, virtual]

Print to a stream

Implements Playa::Printable.

Definition at line 112 of file SundanceMeshSourceBase.hpp.

References description().


Member Data Documentation

Definition at line 155 of file SundanceMeshSourceBase.hpp.

Referenced by createMesh(), and getMesh().

Definition at line 164 of file SundanceMeshSourceBase.hpp.

Referenced by comm(), and createMesh().

RCP<Array<Array<double> > > Sundance::MeshSourceBase::elemAttributes_ [mutable, private]

Definition at line 167 of file SundanceMeshSourceBase.hpp.

Referenced by elemAttributes().

Definition at line 158 of file SundanceMeshSourceBase.hpp.

Referenced by createMesh(), and getMesh().

Definition at line 161 of file SundanceMeshSourceBase.hpp.

Referenced by createMesh().

RCP<Array<Array<double> > > Sundance::MeshSourceBase::nodeAttributes_ [mutable, private]

Definition at line 170 of file SundanceMeshSourceBase.hpp.

Referenced by nodeAttributes().

Site Contact