Chaste  Release::3.4
AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <AbstractTetrahedralMeshWriter.hpp>

+ Inheritance diagram for AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >:
+ Collaboration diagram for AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

 AbstractTetrahedralMeshWriter (const std::string &rDirectory, const std::string &rBaseName, const bool clearOutputDir=true)
 
virtual ~AbstractTetrahedralMeshWriter ()
 
virtual void WriteFilesUsingMesh (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, bool keepOriginalElementIndexing=true)
 
void WriteFilesUsingMeshReaderAndMesh (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
 
std::vector< doubleGetNextNode ()
 
ElementData GetNextElement ()
 
ElementData GetNextBoundaryElement ()
 
ElementData GetNextCableElement ()
 
- Public Member Functions inherited from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >
 AbstractMeshWriter (const std::string &rDirectory, const std::string &rBaseName, const bool clearOutputDir=true)
 
virtual ~AbstractMeshWriter ()
 
std::string GetOutputDirectory ()
 
virtual unsigned GetNumNodes ()
 
unsigned GetNumElements ()
 
unsigned GetNumBoundaryFaces ()
 
unsigned GetNumCableElements ()
 
virtual void WriteFiles ()=0
 
void WriteFilesUsingMeshReader (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
 

Protected Attributes

unsigned mNodesPerElement
 
unsigned mNodesPerBoundaryElement
 
AbstractTetrahedralMesh
< ELEMENT_DIM, SPACE_DIM > * 
mpMesh
 
DistributedTetrahedralMesh
< ELEMENT_DIM, SPACE_DIM > * 
mpDistributedMesh
 
MixedDimensionMesh
< ELEMENT_DIM, SPACE_DIM > * 
mpMixedMesh
 
MeshWriterIterators
< ELEMENT_DIM, SPACE_DIM > * 
mpIters
 
bool mIndexFromZero
 
bool mWriteMetaFile
 
unsigned mNodeCounterForParallelMesh
 
unsigned mElementCounterForParallelMesh
 
unsigned mBoundaryElementCounterForParallelMesh
 
unsigned mCableElementCounterForParallelMesh
 
bool mFilesAreBinary
 
- Protected Attributes inherited from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >
OutputFileHandlermpOutputFileHandler
 
std::string mBaseName
 
AbstractMeshReader
< ELEMENT_DIM, SPACE_DIM > * 
mpMeshReader
 
unsigned mNumNodes
 
unsigned mNumElements
 
unsigned mNumBoundaryElements
 
unsigned mNumCableElements
 

Private Member Functions

void PostElement (unsigned globalIndex, unsigned indices[], unsigned numIndices, unsigned tag, double attribute)
 
void UnpackElement (ElementData &rElementData, unsigned globalIndex, unsigned numIndices, unsigned tag)
 
virtual void WriteFilesUsingParallelMesh (bool keepOriginalElementIndexing=true)
 
void WriteNclFile (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, bool invertMeshPermutation=false)
 
virtual void CreateFilesWithHeaders ()
 
virtual void AppendLocalDataToFiles ()
 
virtual void WriteFilesFooter ()
 

Private Attributes

NodeMapmpNodeMap
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >

An abstract tetrahedral mesh writer class.

Definition at line 88 of file AbstractTetrahedralMeshWriter.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::AbstractTetrahedralMeshWriter ( const std::string &  rDirectory,
const std::string &  rBaseName,
const bool  clearOutputDir = true 
)

Constructor.

Parameters
rDirectorythe directory in which to write the mesh to file
rBaseNamethe base name of the files in which to write the mesh data
clearOutputDirwhether to clean the directory (defaults to true)

Definition at line 72 of file AbstractTetrahedralMeshWriter.cpp.

References AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpIters.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::~AbstractTetrahedralMeshWriter ( )
virtual

Destructor just deletes the node map if memory has been allocated for it

Definition at line 95 of file AbstractTetrahedralMeshWriter.cpp.

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles ( )
privatevirtual

Append local mesh data to output files.

Reimplemented in CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >, CmguiMeshWriter< DIM, DIM >, and MeshalyzerMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 654 of file AbstractTetrahedralMeshWriter.cpp.

References NEVER_REACHED.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders ( )
privatevirtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextBoundaryElement ( )
virtual
Returns
the data (indices) of the next boundary element to be written to file

Reimplemented from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 230 of file AbstractTetrahedralMeshWriter.cpp.

References PetscTools::AmMaster(), ElementData::AttributeValue, AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextBoundaryElement(), and ElementData::NodeIndices.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextNode ( )
virtual
Returns
the coordinates of the next node to be written to file

Reimplemented from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 120 of file AbstractTetrahedralMeshWriter.cpp.

References PetscTools::AmMaster(), and AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextNode().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::PostElement ( unsigned  globalIndex,
unsigned  indices[],
unsigned  numIndices,
unsigned  tag,
double  attribute 
)
inlineprivate

Post an element from a slave process to the master for concentration

Parameters
globalIndexindex of this element
indicesthe node index data for this element
numIndicesnumber of indices
tagtemporary
attribute

Definition at line 99 of file AbstractTetrahedralMeshWriter.hpp.

References GenericEventHandler< 11, MeshEventHandler >::BeginEvent(), and GenericEventHandler< 11, MeshEventHandler >::EndEvent().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::UnpackElement ( ElementData rElementData,
unsigned  globalIndex,
unsigned  numIndices,
unsigned  tag 
)
inlineprivate

Unpack an element from a slave process on the master for concentration

Parameters
rElementDatathe output structure to fill (should have the NodeIndices structure of the correct size
globalIndexindex of this element
numIndicesnumber of indices
tagtemporary

Definition at line 120 of file AbstractTetrahedralMeshWriter.hpp.

References ElementData::AttributeValue, GenericEventHandler< 11, MeshEventHandler >::BeginEvent(), GenericEventHandler< 11, MeshEventHandler >::EndEvent(), and ElementData::NodeIndices.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesFooter ( )
privatevirtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh ( AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh,
bool  keepOriginalElementIndexing = true 
)
virtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMeshReaderAndMesh ( AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &  rMeshReader,
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh 
)

Write a const mesh to file. Used by the serialization methods and avoids iterators. The master process will use the mesh reader to copy over most of the mesh files, converting them to binary format. However, the mesh is used to write a .ncl file which contains node connectivity information.

Parameters
rMeshReadera reader of the original mesh files on disk
rMeshthe mesh object in memory

Definition at line 524 of file AbstractTetrahedralMeshWriter.cpp.

Referenced by AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM >::save().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingParallelMesh ( bool  keepOriginalElementIndexing = true)
privatevirtual

Write a parallel mesh to file. Used by the serialization methods.

Parameters
keepOriginalElementIndexingWhether to write the mesh with the same element ordering as in memory. Optimisations can be applied if this is not needed.
Todo:
#2351 Also exclude VTK writer

Definition at line 533 of file AbstractTetrahedralMeshWriter.cpp.

References PetscTools::AmMaster(), PetscTools::AmTopMost(), PetscTools::Barrier(), GenericEventHandler< 11, MeshEventHandler >::BeginEvent(), PetscTools::BeginRoundRobin(), GenericEventHandler< 11, MeshEventHandler >::EndEvent(), PetscTools::EndRoundRobin(), PetscTools::GetMyRank(), and PetscTools::GetNumProcs().

Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBoundaryElementCounterForParallelMesh
protected

Used by master process for polling processes for the next boundary element

Definition at line 198 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mCableElementCounterForParallelMesh
protected

Used by master process for polling processes for the next cable element

Definition at line 199 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mElementCounterForParallelMesh
protected

Used by master process for polling processes for the next element

Definition at line 197 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mFilesAreBinary
protected

Whether all data is to be written as binary - used in derived class TrianglesMeshWriter

Definition at line 200 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mIndexFromZero
protected
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodeCounterForParallelMesh
protected

Used by master process for polling processes for the next node

Definition at line 196 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesPerBoundaryElement
protected

Same as (ELEMENT_DIM), except when writing a quadratic mesh!

Definition at line 187 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesPerElement
protected

Same as (ELEMENT_DIM+1), except when writing a quadratic mesh!

Definition at line 186 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
DistributedTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpDistributedMesh
protected

Another pointer to the mesh, produced by dynamic cast

Definition at line 190 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
MeshWriterIterators<ELEMENT_DIM,SPACE_DIM>* AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpIters
protected

Handy iterators so that we know the next node/element to be written

Definition at line 192 of file AbstractTetrahedralMeshWriter.hpp.

Referenced by AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::AbstractTetrahedralMeshWriter().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpMesh
protected

Pointer to the mesh (if we are writing from a mesh)

Definition at line 189 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
MixedDimensionMesh<ELEMENT_DIM,SPACE_DIM>* AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpMixedMesh
protected

Another pointer to the mesh, produced by dynamic cast

Definition at line 191 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
NodeMap* AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpNodeMap
private

Node map to be used when writing a mesh that has deleted nodes

Definition at line 182 of file AbstractTetrahedralMeshWriter.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mWriteMetaFile
protected

Whether to write a metafile (only used by MeshylazerMeshWriter)

Definition at line 195 of file AbstractTetrahedralMeshWriter.hpp.

Referenced by MeshalyzerMeshWriter< ELEMENT_DIM, SPACE_DIM >::MeshalyzerMeshWriter().


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