Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <CmguiMeshWriter.hpp>

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

Public Member Functions

 CmguiMeshWriter (const std::string &rDirectory, const std::string &rBaseName, bool cleanDirectory=true)
 
void WriteFiles ()
 
void SetAdditionalFieldNames (std::vector< std::string > &rFieldNames)
 
void SetRegionNames (std::vector< std::string > &rRegionNames)
 
virtual ~CmguiMeshWriter ()
 
- 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)
 

Protected Member Functions

std::ios_base::openmode GetOpenMode (bool append)
 
out_stream OpenNodeFile (bool append=false)
 
std::vector< boost::shared_ptr< std::ofstream > > OpenElementFiles (bool append=false)
 
void WriteNodeFileHeader (out_stream &rpNodeFile)
 
void WriteElementsFileHeader (std::vector< boost::shared_ptr< std::ofstream > > &rElemFiles)
 
void CreateFilesWithHeaders ()
 
void AppendLocalDataToFiles ()
 
void WriteFilesFooter ()
 

Protected Attributes

std::vector< std::string > mAdditionalFieldNames
 
std::vector< std::string > mRegionNames
 
std::string mGroupName
 
std::string mElementFileHeader
 
std::string mCoordinatesFileHeader
 
std::string mAdditionalFieldHeader
 
unsigned mNumNodesPerElement
 
std::vector< unsignedmReordering
 
- 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 CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >

CmguiMeshWriter

Writes a mesh in Cmgui (the visualisation frontend of CMISS) format. Creates an exnode file and a exelem file. Note that the lines and faces are not written in the exelem file, so to load the data in Cmgui, you must use 'generate_faces_and_lines', i.e.

gfx read node base_file gfx read elem base_file generate_faces_and_lines gfx cr win

Definition at line 535 of file CmguiMeshWriter.hpp.

Constructor & Destructor Documentation

◆ CmguiMeshWriter()

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

◆ ~CmguiMeshWriter()

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

Destructor.

Definition at line 677 of file CmguiMeshWriter.hpp.

Member Function Documentation

◆ AppendLocalDataToFiles()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles ( )
protectedvirtual

Append local mesh data to output files.

Reimplemented from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 301 of file CmguiMeshWriter.cpp.

◆ CreateFilesWithHeaders()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders ( )
protectedvirtual

Create output files and add headers.

Reimplemented from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 279 of file CmguiMeshWriter.cpp.

◆ GetOpenMode()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::ios_base::openmode CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetOpenMode ( bool  append)
protected
Returns
the mode to use when opening files.
Parameters
appendwhether to append to the file, or overwrite it

Definition at line 361 of file CmguiMeshWriter.cpp.

◆ OpenElementFiles()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< boost::shared_ptr< std::ofstream > > CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles ( bool  append = false)
protected

Helper method that open all the elements files (one per region in this case)

Returns
vector of file handlers
Parameters
appendwhether to clear (append=false) or to append (append=true). False by default. It applies to all files.

Definition at line 170 of file CmguiMeshWriter.cpp.

References EXCEPTION.

◆ OpenNodeFile()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
out_stream CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile ( bool  append = false)
protected

Open the file node information is written to.

Returns
file handler
Parameters
appendwhether to clear (append=false) or to append (append=true). False by default.

Definition at line 163 of file CmguiMeshWriter.cpp.

◆ SetAdditionalFieldNames()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetAdditionalFieldNames ( std::vector< std::string > &  rFieldNames)

Set any additional field that we want cmgui to visualize (interpolated over) elements and surfaces

Parameters
rFieldNamesis a reference to a vector of string containing the names of each additional field name

Definition at line 151 of file CmguiMeshWriter.cpp.

Referenced by Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToCmguiConverter(), and CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

◆ SetRegionNames()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetRegionNames ( std::vector< std::string > &  rRegionNames)

Set the region names to be used when generating multiple element files

Parameters
rRegionNamesis a reference to a vector of string containing the names of each region defined in the mesh

Definition at line 157 of file CmguiMeshWriter.cpp.

Referenced by Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToCmguiConverter(), and CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

◆ WriteElementsFileHeader()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader ( std::vector< boost::shared_ptr< std::ofstream > > &  rElemFiles)
protected

Write the headers of each element file (as many as number of regions defined).

Parameters
rElemFilesvector of pointers to file streams

Definition at line 239 of file CmguiMeshWriter.cpp.

References ChasteBuildInfo::GetProvenanceString().

◆ WriteFiles()

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

Write mesh data to files.

Todo:
: EXCEPTION maybe...

Implements AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 95 of file CmguiMeshWriter.cpp.

References ElementData::AttributeValue, and ElementData::NodeIndices.

◆ WriteFilesFooter()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesFooter ( )
protectedvirtual

Append footers to output files.

Reimplemented from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 355 of file CmguiMeshWriter.cpp.

◆ WriteNodeFileHeader()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteNodeFileHeader ( out_stream &  rpNodeFile)
protected

Write the header part of a node file, depending on the dimension. Short helper method, also called in CmguiDeformedSolutionsWriter. (Note, without the & below this method seg faults).

Parameters
rpNodeFilereference to the out_stream used for the node file

Definition at line 206 of file CmguiMeshWriter.cpp.

References ChasteBuildInfo::GetProvenanceString(), and NEVER_REACHED.

Member Data Documentation

◆ mAdditionalFieldHeader

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldHeader
protected

String which is set to either CmguiAdditionalFieldHeader2D or CmguiAdditionalFieldHeader2DQuadratic as appropriate

Definition at line 575 of file CmguiMeshWriter.hpp.

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

◆ mAdditionalFieldNames

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<std::string> CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldNames
protected

For storage of names of additional fields.

Definition at line 542 of file CmguiMeshWriter.hpp.

◆ mCoordinatesFileHeader

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mCoordinatesFileHeader
protected

String which is set to either CmguiCoordinatesFileHeader2D or CmguiCoordinatesFileHeader2DQuadratic as appropriate

Definition at line 569 of file CmguiMeshWriter.hpp.

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

◆ mElementFileHeader

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mElementFileHeader
protected

String which is set to either CmguiElementFileHeader2D or CmguiElementFileHeader2DQuadratic as appropriate

Definition at line 563 of file CmguiMeshWriter.hpp.

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

◆ mGroupName

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGroupName
protected

The group name to give in the output files. Defaults to the same as the base name. The CmguiDeformedSolutionsWriter prepends a counter to the base name (eg "solution_8.exnodes" instead of just "solution.exnodes"), but we would like the group name to stay as "solution", hence this separate variable

Definition at line 557 of file CmguiMeshWriter.hpp.

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

◆ mNumNodesPerElement

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNumNodesPerElement
protected

Number of nodes per element, eg, in 2D, 3 for linear visualisation and 6 for quadratic visualisation

Definition at line 581 of file CmguiMeshWriter.hpp.

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

◆ mRegionNames

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<std::string> CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mRegionNames
protected

Stored the names of different regions that we want Cmgui to be able to visualize separately. There will be one .exelem file per region.

Definition at line 549 of file CmguiMeshWriter.hpp.

◆ mReordering

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mReordering
protected

Ordering of the elements nodes, from Chaste convention to CMGUI convention

Definition at line 586 of file CmguiMeshWriter.hpp.

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


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