Chaste Commit::675f9facbe008c5eacb9006feaeb6423206579ea
VtkDeformedMeshWriter< DIM > Class Template Reference

#include <VtkDeformedMeshWriter.hpp>

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

Public Member Functions

 VtkDeformedMeshWriter (AbstractTetrahedralMesh< DIM, DIM > *pDeformedOutputMesh, const std::string &rDirectory, const std::string &rBaseName, const bool &rCleanDirectory=true)
 
 ~VtkDeformedMeshWriter ()
 
void SetOutputBaseFileName (const std::string &rOutputBaseFileName)
 
void WriteDeformedFiles ()
 
void ApplyDeformation (const std::vector< c_vector< double, DIM > > &rPositions)
 
- Public Member Functions inherited from VtkMeshWriter< DIM, DIM >
 VtkMeshWriter (const std::string &rDirectory, const std::string &rBaseName, const bool &rCleanDirectory=true)
 
void WriteFiles ()
 
void AddCellData (std::string name, std::vector< double > data)
 
void AddCellData (std::string name, std::vector< c_vector< double, SPACE_DIM > > data)
 
void AddTensorCellData (std::string name, std::vector< c_vector< double, SPACE_DIM *(SPACE_DIM+1)/2 > > data)
 
void AddTensorCellData (std::string name, std::vector< c_matrix< double, SPACE_DIM, SPACE_DIM > > data)
 
void AddPointData (std::string name, std::vector< double > data)
 
void AddPointData (std::string name, std::vector< c_vector< double, SPACE_DIM > > data)
 
void AddTensorPointData (std::string name, std::vector< c_matrix< double, SPACE_DIM, SPACE_DIM > > data)
 
void SetParallelFiles (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
 
void WriteFilesUsingMesh (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, bool keepOriginalElementIndexing=true)
 
void SetWriteMeshCells (bool writeMeshCells)
 
void AddProvenance (std::string fileName)
 
virtual ~VtkMeshWriter ()
 
- 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 ()
 
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)
 

Private Attributes

AbstractTetrahedralMesh< DIM, DIM > * mpDeformedMesh
 

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 DIM>
class VtkDeformedMeshWriter< DIM >

A class to write meshes in VTK format, allowing for specification of a new set of node positions ("deformed mesh") and a new file name.

This class was designed with time-dependent simulations in mind, where, at every time step, one may want to write out a mesh that is being deformed in the time loop.

Typical usage:

VtkDeformedMeshWriter<DIM> writer(...); //write undeformed mesh writer.AddPointData("name of node-wise data", some_data); writer.AddCellData("name of element-wise data", other_data); writer.WriteDeformedFiles();

//apply deformation - lines below could be in a time loop writer.ApplyDeformation(new_node_locations); writer.SetWriteMeshCells(false); //cells have been alreday written writer.SetOutputBaseFileName(new_name);//do not overwrite the previous file writer.WriteDeformedFiles();

Note that the ApplyDeformation method actually changes the mesh node coordinates. Use with caution as no other quantities of the mesh (e.g., Jacobian) are actually modified!

Definition at line 72 of file VtkDeformedMeshWriter.hpp.

Constructor & Destructor Documentation

◆ VtkDeformedMeshWriter()

template<unsigned DIM>
VtkDeformedMeshWriter< DIM >::VtkDeformedMeshWriter ( AbstractTetrahedralMesh< DIM, DIM > *  pDeformedOutputMesh,
const std::string &  rDirectory,
const std::string &  rBaseName,
const bool rCleanDirectory = true 
)

Constructor

Parameters
pDeformedOutputMesha pointer to the mesh objectto be used.
rDirectorythe directory in which to write the mesh to file
rBaseNamethe base name of the files in which to write the mesh data
rCleanDirectorywhether to clean the directory (defaults to true)

Definition at line 42 of file VtkDeformedMeshWriter.cpp.

◆ ~VtkDeformedMeshWriter()

Destructor.

Definition at line 52 of file VtkDeformedMeshWriter.cpp.

Member Function Documentation

◆ ApplyDeformation()

template<unsigned DIM>
void VtkDeformedMeshWriter< DIM >::ApplyDeformation ( const std::vector< c_vector< double, DIM > > &  rPositions)

Modify the node locations of the mesh by assigning the coordinates according to rPositions. Note that only node coordinates are changed (no Jacobians or other related quantities are modified). Use with caution!

Parameters
rPositionsthe node positions to be applied to the mesh

Definition at line 72 of file VtkDeformedMeshWriter.cpp.

References EXCEPTION.

◆ SetOutputBaseFileName()

template<unsigned DIM>
void VtkDeformedMeshWriter< DIM >::SetOutputBaseFileName ( const std::string &  rOutputBaseFileName)

Set the new file name to be used the next time WriteDeformedFiles() is called. The output file will then be rOutputBaseFileName.vtu

Parameters
rOutputBaseFileNamethe base name of the next output file (".vtu" will be added)

Definition at line 58 of file VtkDeformedMeshWriter.cpp.

◆ WriteDeformedFiles()

template<unsigned DIM>
void VtkDeformedMeshWriter< DIM >::WriteDeformedFiles ( )

Write the VTK files using the internal mesh, with any deformation that has been applied. Internally, it calls WriteFilesUsingMesh(). The output file name will be based on the latest call to SetOutputBaseFileName, or, if SetOutputBaseFileName was not called, the constructor parameter rBaseName

Definition at line 66 of file VtkDeformedMeshWriter.cpp.

Member Data Documentation

◆ mpDeformedMesh

template<unsigned DIM>
AbstractTetrahedralMesh<DIM,DIM>* VtkDeformedMeshWriter< DIM >::mpDeformedMesh
private

Pointer to the deformed mesh, used only for output here. Initialized to a new mesh object and constructed upon construction of this writer object

Definition at line 81 of file VtkDeformedMeshWriter.hpp.


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