Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
CmguiDeformedSolutionsWriter< DIM > Class Template Reference

#include <CmguiDeformedSolutionsWriter.hpp>

+ Inheritance diagram for CmguiDeformedSolutionsWriter< DIM >:
+ Collaboration diagram for CmguiDeformedSolutionsWriter< DIM >:

Public Member Functions

 CmguiDeformedSolutionsWriter (std::string outputDirectory, std::string baseName, AbstractTetrahedralMesh< DIM, DIM > &rQuadraticMesh, CmguiMeshWriteType writeType)
 
void WriteInitialMesh (std::string fileName="")
 
void WriteDeformationPositions (std::vector< c_vector< double, DIM > > &rDeformedPositions, unsigned counter)
 
void WriteCmguiScript (std::string fieldBaseName="", std::string undeformedBaseName="")
 
void ConvertOutput (std::string inputDirectory, std::string inputFileBaseName, unsigned finalCounter)
 
- Public Member Functions inherited from CmguiMeshWriter< DIM, DIM >
 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 ()
 
unsigned GetNumElements ()
 
unsigned GetNumBoundaryFaces ()
 
unsigned GetNumCableElements ()
 
void WriteFilesUsingMeshReader (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
 

Private Member Functions

unsigned GetNumNodes ()
 

Private Attributes

AbstractTetrahedralMesh< DIM, DIM > * mpQuadraticMesh
 
unsigned mFinalCounter
 
unsigned mNumNodesToUse
 

Additional Inherited Members

- Protected Member Functions inherited from CmguiMeshWriter< DIM, DIM >
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 inherited from CmguiMeshWriter< DIM, DIM >
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 DIM>
class CmguiDeformedSolutionsWriter< DIM >

CmguiDeformedSolutionsWriter

A class for writing a mesh, and solutions from a solid mechanics (ie deformed meshes) problem, in Cmgui output format.

Inherits from CmguiMeshWriter

Definition at line 65 of file CmguiDeformedSolutionsWriter.hpp.

Constructor & Destructor Documentation

◆ CmguiDeformedSolutionsWriter()

template<unsigned DIM>
CmguiDeformedSolutionsWriter< DIM >::CmguiDeformedSolutionsWriter ( std::string  outputDirectory,
std::string  baseName,
AbstractTetrahedralMesh< DIM, DIM > &  rQuadraticMesh,
CmguiMeshWriteType  writeType 
)

Constructor

Parameters
outputDirectoryThe output directory for the Cmgui files
baseNameThe base name for the Cmgui output files - the files written will be [basename_0.exnode, [basename]_0.exelem; [basename]_1.exnode, [basename]_2.exnode, ..
rQuadraticMeshThe quadratic mesh used in the mechanics simulation
writeTypeShould be equal to either WRITE_LINEAR_MESH or WRITE_QUADRATIC_MESH, depending on whether linear visualisation of the quadratic mesh (just vertices output) or full quadratic visualisation is required.

Definition at line 40 of file CmguiDeformedSolutionsWriter.cpp.

References EXCEPTION, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumVertices(), CmguiMeshWriter< DIM, DIM >::mAdditionalFieldHeader, CmguiMeshWriter< DIM, DIM >::mCoordinatesFileHeader, CmguiMeshWriter< DIM, DIM >::mElementFileHeader, CmguiMeshWriter< DIM, DIM >::mNumNodesPerElement, CmguiDeformedSolutionsWriter< DIM >::mNumNodesToUse, CmguiDeformedSolutionsWriter< DIM >::mpQuadraticMesh, CmguiMeshWriter< DIM, DIM >::mReordering, and NEVER_REACHED.

Member Function Documentation

◆ ConvertOutput()

template<unsigned DIM>
void CmguiDeformedSolutionsWriter< DIM >::ConvertOutput ( std::string  inputDirectory,
std::string  inputFileBaseName,
unsigned  finalCounter 
)

For a simulation that has already been run, convert the chaste output to cmgui format.

Parameters
inputDirectoryThe directory the chaste output is in
inputFileBaseNameThe base name for the chaste output
finalCounterThe final counter, ie the value N for the final file [basename]_N.nodes. The first file is assumed to be [basename]_0.nodes. The files [basename]_0.nodes up to [basename]_N.nodes will be converted to cmgui format and put in the output directory given in the constructor.

Definition at line 212 of file CmguiDeformedSolutionsWriter.cpp.

References EXCEPTION.

◆ GetNumNodes()

template<unsigned DIM>
unsigned CmguiDeformedSolutionsWriter< DIM >::GetNumNodes ( )
inlineprivatevirtual

Overloaded GetNumNodes().

Returns
either mpQuadraticMesh->GetNumVertices() for linear visualisation or mpQuadraticMesh->GetNumNodes() for quadratic visualisation

Reimplemented from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 91 of file CmguiDeformedSolutionsWriter.hpp.

References CmguiDeformedSolutionsWriter< DIM >::mNumNodesToUse.

◆ WriteCmguiScript()

template<unsigned DIM>
void CmguiDeformedSolutionsWriter< DIM >::WriteCmguiScript ( std::string  fieldBaseName = "",
std::string  undeformedBaseName = "" 
)

Writes a small cmgui script called LoadSolutions.com, for loading the output that has been written. Assumes the output was solution_0.exnode .. solution_N.exnode, where N is the counter that was given in the last call to WriteDeformationPositions()

Parameters
fieldBaseNameIf there is a field to visualise on top of the deforming mesh, give it's path (relative to the cmgui deformation directory), and filename prefix. Leave empty if no field to visualise. For example, WriteCmguiScript("../../electrics/cmgui_output/voltage_mechanics_mesh"); for the script to read files voltage_mechanics_mesh_0.exnode .. voltage_mechanics_mesh_N.exnode.
undeformedBaseNameis assumed to be "solution_0.exnode" and .exelem unless this optional parameter is given. Depends on what parameters were given to WriteInitialMesh(). If undeformedBaseName the time given to plot the undeformed shape is set to -1, otherwise it is set to 0.

Definition at line 173 of file CmguiDeformedSolutionsWriter.cpp.

Referenced by AbstractNonlinearElasticitySolver< DIM >::CreateCmguiOutput(), and CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

◆ WriteDeformationPositions()

template<unsigned DIM>
void CmguiDeformedSolutionsWriter< DIM >::WriteDeformationPositions ( std::vector< c_vector< double, DIM > > &  rDeformedPositions,
unsigned  counter 
)

Write [basename]_i.exnode using the given deformed positions

Parameters
rDeformedPositionsstd::vector of deformed positions to be used, must have size equal to number of nodes in the mesh
counterthe value "i" in "[basename]_i.exnode" to be used.

Definition at line 142 of file CmguiDeformedSolutionsWriter.cpp.

References EXCEPTION.

Referenced by AbstractNonlinearElasticitySolver< DIM >::CreateCmguiOutput(), and CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

◆ WriteInitialMesh()

template<unsigned DIM>
void CmguiDeformedSolutionsWriter< DIM >::WriteInitialMesh ( std::string  fileName = "")

Write [basename]_0.exnode, [basename]_0.exelem using the quadratic mesh If the optional argument fileName is given, writes [fileName].exnode and [fileName].exelem instead

Parameters
fileNameOptional file name (stem).

Definition at line 126 of file CmguiDeformedSolutionsWriter.cpp.

Referenced by AbstractNonlinearElasticitySolver< DIM >::CreateCmguiOutput(), and CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

Member Data Documentation

◆ mFinalCounter

template<unsigned DIM>
unsigned CmguiDeformedSolutionsWriter< DIM >::mFinalCounter
private

A counter is given whenever WriteDeformationPositions() is called, this variable stores the last one used

Definition at line 78 of file CmguiDeformedSolutionsWriter.hpp.

◆ mNumNodesToUse

template<unsigned DIM>
unsigned CmguiDeformedSolutionsWriter< DIM >::mNumNodesToUse
private

Number of nodes to output - either mpQuadraticMesh->GetNumVertices() (linear visualisation) mpQuadraticMesh->GetNumNodes() (quadratic visualisation)

Definition at line 84 of file CmguiDeformedSolutionsWriter.hpp.

Referenced by CmguiDeformedSolutionsWriter< DIM >::CmguiDeformedSolutionsWriter(), and CmguiDeformedSolutionsWriter< DIM >::GetNumNodes().

◆ mpQuadraticMesh

template<unsigned DIM>
AbstractTetrahedralMesh<DIM,DIM>* CmguiDeformedSolutionsWriter< DIM >::mpQuadraticMesh
private

The quadratic mesh used in the mechanics simulation. solution_0.exnode and solution_0.exelem (the only exelem file written) will be written using this mesh

Definition at line 72 of file CmguiDeformedSolutionsWriter.hpp.

Referenced by CmguiDeformedSolutionsWriter< DIM >::CmguiDeformedSolutionsWriter().


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