#include <CmguiMeshWriter.hpp>
Inherits AbstractTetrahedralMeshWriter< 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 () |
Static Public Member Functions | |
static bool | CompareCmguiFiles (std::string &rPath1, std::string &rPath2) |
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< unsigned > | mReordering |
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 510 of file CmguiMeshWriter.hpp.
CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter | ( | const std::string & | rDirectory, | |
const std::string & | rBaseName, | |||
bool | cleanDirectory = true | |||
) | [inline] |
Constructor.
rDirectory | the directory in which to write the mesh to file | |
rBaseName | the base name of the files in which to write the mesh data | |
cleanDirectory | whether to clean the directory (defaults to true) |
Definition at line 41 of file CmguiMeshWriter.cpp.
References CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldHeader, AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBaseName, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mCoordinatesFileHeader, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mElementFileHeader, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGroupName, AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mIndexFromZero, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNumNodesPerElement, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mReordering, and NEVER_REACHED.
virtual CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::~CmguiMeshWriter | ( | ) | [inline, virtual] |
Destructor.
Definition at line 651 of file CmguiMeshWriter.hpp.
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles | ( | ) | [inline, protected, virtual] |
Append local mesh data to output files.
Reimplemented from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Definition at line 294 of file CmguiMeshWriter.cpp.
References AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesPerElement, AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpDistributedMesh, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mRegionNames, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile().
bool CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CompareCmguiFiles | ( | std::string & | rPath1, | |
std::string & | rPath2 | |||
) | [inline, static] |
Compare two cmgui files, helper methods for tests. It will ignore the provenance lines of the files.
rPath1 | path to the first file from calling directory (or full absolute) | |
rPath2 | path to the second file from calling directory (or full absolute) |
Definition at line 368 of file CmguiMeshWriter.cpp.
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders | ( | ) | [inline, protected, virtual] |
Create output files and add headers.
Reimplemented from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Definition at line 272 of file CmguiMeshWriter.cpp.
References CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteNodeFileHeader().
std::ios_base::openmode CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetOpenMode | ( | bool | append | ) | [inline, protected] |
Get the mode to use when opening files.
append | whether to append to the file, or overwrite it |
Definition at line 353 of file CmguiMeshWriter.cpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile().
std::vector< boost::shared_ptr< std::ofstream > > CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles | ( | bool | append = false |
) | [inline, protected] |
Helper method that open all the elements files (one per region in this case)
append | whether to clear (append=false) or to append (append=true). False by default. It applies to all files. |
Definition at line 163 of file CmguiMeshWriter.cpp.
References EXCEPTION, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetOpenMode(), OutputFileHandler::GetOutputDirectoryFullPath(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBaseName, AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpOutputFileHandler, and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mRegionNames.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().
out_stream CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile | ( | bool | append = false |
) | [inline, protected] |
Open the file node information is written to.
append | whether to clear (append=false) or to append (append=true). False by default. |
Definition at line 156 of file CmguiMeshWriter.cpp.
References CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetOpenMode(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBaseName, AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpOutputFileHandler, and OutputFileHandler::OpenOutputFile().
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetAdditionalFieldNames | ( | std::vector< std::string > & | rFieldNames | ) | [inline] |
Set any additional field that we want cmgui to visualize (interpolated over) elements and surfaces
rFieldNames | is a reference to a vector of string containing the names of each additional field name |
Definition at line 144 of file CmguiMeshWriter.cpp.
References CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldNames.
Referenced by Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToCmguiConverter().
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetRegionNames | ( | std::vector< std::string > & | rRegionNames | ) | [inline] |
Set the region names to be used when generating multiple element files
rRegionNames | is a reference to a vector of string containing the names of each region defined in the mesh |
Definition at line 150 of file CmguiMeshWriter.cpp.
References CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mRegionNames.
Referenced by Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToCmguiConverter().
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader | ( | std::vector< boost::shared_ptr< std::ofstream > > & | rElemFiles | ) | [inline, protected] |
Write the headers of each element file (as many as number of regions defined).
rElemFiles | vector of pointers to file streams |
Definition at line 232 of file CmguiMeshWriter.cpp.
References ChasteBuildInfo::GetProvenanceString(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldHeader, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldNames, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mCoordinatesFileHeader, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mElementFileHeader, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGroupName, and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mRegionNames.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles | ( | ) | [inline, virtual] |
Write mesh data to files.
Implements AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Definition at line 88 of file CmguiMeshWriter.cpp.
References ElementData::AttributeValue, AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextElement(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextNode(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNumNodesPerElement, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mRegionNames, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mReordering, ElementData::NodeIndices, CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenNodeFile(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteNodeFileHeader().
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesFooter | ( | ) | [inline, protected, virtual] |
Append footers to output files.
Reimplemented from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Definition at line 347 of file CmguiMeshWriter.cpp.
void CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteNodeFileHeader | ( | out_stream & | rpNodeFile | ) | [inline, 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).
rpNodeFile | reference to the out_stream used for the node file |
Definition at line 199 of file CmguiMeshWriter.cpp.
References ChasteBuildInfo::GetProvenanceString(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGroupName, and NEVER_REACHED.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CreateFilesWithHeaders(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().
std::string CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldHeader [protected] |
String which is set to either CmguiAdditionalFieldHeader2D or CmguiAdditionalFieldHeader2DQuadratic as appropriate
Definition at line 551 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader().
std::vector<std::string> CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mAdditionalFieldNames [protected] |
For storage of names of additional fields.
Definition at line 517 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetAdditionalFieldNames(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader().
std::string CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mCoordinatesFileHeader [protected] |
String which is set to either CmguiCoordinatesFileHeader2D or CmguiCoordinatesFileHeader2DQuadratic as appropriate
Definition at line 545 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader().
std::string CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mElementFileHeader [protected] |
String which is set to either CmguiElementFileHeader2D or CmguiElementFileHeader2DQuadratic as appropriate
Definition at line 538 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader().
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 532 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteNodeFileHeader().
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 557 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().
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 524 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::AppendLocalDataToFiles(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::OpenElementFiles(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetRegionNames(), CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteElementsFileHeader(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().
std::vector<unsigned> CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::mReordering [protected] |
Ordering of the elements nodes, from Chaste convention to CMGUI convention
Definition at line 562 of file CmguiMeshWriter.hpp.
Referenced by CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::CmguiMeshWriter(), and CmguiMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().