Chaste  Release::2018.1
TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <TrianglesMeshWriter.hpp>

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

Public Member Functions

 TrianglesMeshWriter (const std::string &rDirectory, const std::string &rBaseName, const bool clearOutputDir=true)
 
void SetWriteFilesAsBinary ()
 
void WriteFiles ()
 
void WriteElementsAsFaces ()
 
void WriteFacesAsEdges ()
 
template<class T_DATA >
void WriteItem (out_stream &pFile, unsigned itemNumber, const std::vector< T_DATA > &dataPacket, const std::vector< double > &rAttributes)
 
template<class T_DATA >
void WriteItem (out_stream &pFile, unsigned itemNumber, const std::vector< T_DATA > &dataPacket)
 
virtual ~TrianglesMeshWriter ()
 
- Public Member Functions inherited from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >
 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 ()
 
void WriteFilesUsingMeshReader (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
 

Additional Inherited Members

- Protected Attributes inherited from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >
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
 

Detailed Description

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

A concrete mesh writer class that writes Triangle output files.

Definition at line 48 of file TrianglesMeshWriter.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM >::TrianglesMeshWriter ( 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 47 of file TrianglesMeshWriter.cpp.

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

Destructor.

Definition at line 56 of file TrianglesMeshWriter.cpp.

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetWriteFilesAsBinary ( )

Switch this mesh write to write binary files

(set to write ascii files in the constructor)

Definition at line 61 of file TrianglesMeshWriter.cpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsAsFaces ( )

Write elements as faces (used in the case ELEMENT_DIM== SPACE_DIM-1)

Definition at line 283 of file TrianglesMeshWriter.cpp.

References ElementData::AttributeValue, ChasteBuildInfo::GetProvenanceString(), and ElementData::NodeIndices.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFacesAsEdges ( )

Write faces as edges (used in the case ELEMENT_DIM==2, SPACE_DIM==3)

Definition at line 330 of file TrianglesMeshWriter.cpp.

References ChasteBuildInfo::GetProvenanceString(), and ElementData::NodeIndices.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles ( )
virtual

Write mesh data to files.

Todo:
#1949 Readers do not currently support reading of node attributes, so we cannot yet write them from a reader
Todo:
#1949
Todo:
#1949 Readers do not currently support reading of node attributes, so we cannot yet write them from a reader
Todo:
#1949 Will deadlock on GetNode(global ID) in parallel since this code is run on the master process
Todo:
#1949
Todo:
#1949

Implements AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 67 of file TrianglesMeshWriter.cpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
template<class T_DATA >
void TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteItem ( out_stream &  pFile,
unsigned  itemNumber,
const std::vector< T_DATA > &  dataPacket,
const std::vector< double > &  rAttributes 
)

Write a line (ascii format) to a specific file stream Templated over std::vector dataPacket contents of unsigned or doubles. Templated over type of attribute.

Parameters
pFilePointer to file stream
itemNumberIndex of the element, node or face
dataPacketList of unsigneds (for node indices) or doubles (for node locations)
rAttributesA vector of attributes (double precision).

Definition at line 385 of file TrianglesMeshWriter.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
template<class T_DATA >
void TrianglesMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteItem ( out_stream &  pFile,
unsigned  itemNumber,
const std::vector< T_DATA > &  dataPacket 
)

Write a line (ascii format) to a specific file stream Templated over std::vector dataPacket contents of unsigned or doubles.

Parameters
pFilePointer to file stream
itemNumberIndex of the element, node or face
dataPacketList of unsigneds (for node indices) or doubles (for node locations)

Definition at line 375 of file TrianglesMeshWriter.cpp.


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