#include <VtkMeshWriter.hpp>
Inherits AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Public Member Functions | |
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 | AddPointData (std::string name, std::vector< double > data) |
void | AddPointData (std::string name, std::vector< c_vector< double, SPACE_DIM > > data) |
void | SetParallelFiles (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh) |
void | WriteFilesUsingMesh (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, bool keepOriginalElementIndexing=true) |
void | AddProvenance (std::string fileName) |
virtual | ~VtkMeshWriter () |
Private Member Functions | |
void | MakeVtkMesh () |
Private Attributes | |
bool | mWriteParallelFiles |
std::map< unsigned, unsigned > | mGlobalToNodeIndexMap |
std::vector< std::vector < unsigned > > | mNodesToSendPerProcess |
std::vector< std::vector < unsigned > > | mNodesToReceivePerProcess |
vtkUnstructuredGrid * | mpVtkUnstructedMesh |
Writes a mesh in VTK .vtu format (that's an XML-based, data compressed unstructured mesh)
Definition at line 58 of file VtkMeshWriter.hpp.
VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::VtkMeshWriter | ( | const std::string & | rDirectory, | |
const std::string & | rBaseName, | |||
const bool & | rCleanDirectory = 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 | |
rCleanDirectory | whether to clean the directory (defaults to true) |
Definition at line 37 of file VtkMeshWriter.cpp.
References AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mIndexFromZero, and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh.
VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::~VtkMeshWriter | ( | ) | [inline, virtual] |
Destructor.
Definition at line 50 of file VtkMeshWriter.cpp.
References VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh.
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData | ( | std::string | name, | |
std::vector< c_vector< double, SPACE_DIM > > | data | |||
) | [inline] |
Add a vector data field to each element (known as "cell" in VTK).
name | is a meaningful name with which to annotate the data | |
data | is the data which should appear in the same order as the element numbering The length of the data vector is assumed to match the number of elements in the mesh. Checking cannot be done at this stage since the data is associated with an empty VTK mesh structure. |
Definition at line 149 of file VtkMeshWriter.cpp.
References VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh.
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData | ( | std::string | name, | |
std::vector< double > | data | |||
) | [inline] |
Add a scalar data field to each element (known as "cell" in VTK).
name | is a meaningful name with which to annotate the data | |
data | is the data which should appear in the same order as the element numbering The length of the data vector is assumed to match the number of elements in the mesh. Checking cannot be done at this stage since the data is associated with an empty VTK mesh structure. |
Definition at line 134 of file VtkMeshWriter.cpp.
References VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh.
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData | ( | std::string | name, | |
std::vector< c_vector< double, SPACE_DIM > > | data | |||
) | [inline] |
Add a vector data field to each node (known as "point" in VTK).
name | is a meaningful name with which to annotate the data | |
data | is the data which should appear in the same order as the node numbering The length of the data vector is assumed to match the number of nodes in the mesh Checking cannot be done at this stage since the data is associated with an empty VTK mesh structure. |
Definition at line 264 of file VtkMeshWriter.cpp.
References PetscTools::GetMyRank(), PetscTools::GetNumProcs(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGlobalToNodeIndexMap, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToReceivePerProcess, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToSendPerProcess, AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpDistributedMesh, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh, and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mWriteParallelFiles.
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData | ( | std::string | name, | |
std::vector< double > | data | |||
) | [inline] |
Add a scalar data field to each node (known as "point" in VTK).
name | is a meaningful name with which to annotate the data | |
data | is the data which should appear in the same order as the node numbering The length of the data vector is assumed to match the number of nodes in the mesh Checking cannot be done at this stage since the data is associated with an empty VTK mesh structure. |
Definition at line 174 of file VtkMeshWriter.cpp.
References PetscTools::GetMyRank(), PetscTools::GetNumProcs(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGlobalToNodeIndexMap, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToReceivePerProcess, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToSendPerProcess, AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpDistributedMesh, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh, and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mWriteParallelFiles.
Referenced by Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), and LinearParabolicPdeSystemWithCoupledOdeSystemSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteVtkResultsToFile().
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddProvenance | ( | std::string | fileName | ) | [inline] |
Add Chaste provenance data to a VTK file as an XML comment string
fileName | is the file name relative to mpOutputFileHandler The file is assumed have been written to and to be closed - so that it can safely be appended to. |
Definition at line 99 of file VtkMeshWriter.cpp.
References ChasteBuildInfo::GetProvenanceString(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpOutputFileHandler, and OutputFileHandler::OpenOutputFile().
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles(), and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::MakeVtkMesh | ( | ) | [inline, private] |
Private helper method which copies the mesh details into the waiting VTK mesh structure. Called by WriteFiles().
Definition at line 56 of file VtkMeshWriter.cpp.
References AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextElement(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextNode(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh, and ElementData::NodeIndices.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles().
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetParallelFiles | ( | AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & | rMesh | ) | [inline] |
Should be called to enable files to be written in parallel (i.e. a .pvtu file and .vtu files for each process's sub-mesh).
rMesh | the mesh (must be a DistributedTetrahedralMesh) |
Definition at line 366 of file VtkMeshWriter.cpp.
References EXCEPTION, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), PetscTools::IsSequential(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGlobalToNodeIndexMap, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToReceivePerProcess, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToSendPerProcess, AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpDistributedMesh, and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mWriteParallelFiles.
Referenced by Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter().
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles | ( | ) | [inline, virtual] |
Write mesh data to files.
Implements AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Definition at line 110 of file VtkMeshWriter.cpp.
References VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddProvenance(), OutputFileHandler::GetOutputDirectoryFullPath(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::MakeVtkMesh(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBaseName, AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpOutputFileHandler, and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh.
void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh | ( | AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & | rMesh, | |
bool | keepOriginalElementIndexing = true | |||
) | [inline, virtual] |
Write files. Overrides the method implemented in AbstractTetrahedralMeshWriter, which concentrates mesh data onto a single file in order to output a monolithic file. For VTK, a DistributedTetrahedralMesh in parallel is instead written out as a set of .vtu files (one for each sub-mesh) and a .pvtu file that provides the visualizer with information about them.
rMesh | the mesh | |
keepOriginalElementIndexing | Whether to write the mesh with the same element ordering. Optimisations can be applied if this is not needed. |
Add to the main file
Reimplemented from AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Definition at line 413 of file VtkMeshWriter.cpp.
References VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddProvenance(), PetscTools::AmMaster(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), PetscTools::GetMyRank(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), PetscTools::GetNumProcs(), OutputFileHandler::GetOutputDirectoryFullPath(), PetscTools::IsSequential(), AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBaseName, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGlobalToNodeIndexMap, AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpDistributedMesh, AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpOutputFileHandler, VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh, and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mWriteParallelFiles.
Referenced by Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter().
std::map<unsigned, unsigned> VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mGlobalToNodeIndexMap [private] |
Map a global node index into a local index (into mNodes and mHaloNodes as if they were concatenated)
Definition at line 66 of file VtkMeshWriter.hpp.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetParallelFiles(), and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().
std::vector<std::vector<unsigned> > VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToReceivePerProcess [private] |
Used to communicate node-wise halo data
Definition at line 69 of file VtkMeshWriter.hpp.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData(), and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetParallelFiles().
std::vector<std::vector<unsigned> > VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNodesToSendPerProcess [private] |
Used to communicate node-wise halo data
Definition at line 68 of file VtkMeshWriter.hpp.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData(), and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetParallelFiles().
vtkUnstructuredGrid* VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh [private] |
A VTK mesh data structure. Created at construction, has data associated with it by AddCellData and AddCellPoint, then is filled with mesh geometry by MakeVtkMesh() in WriteFiles().
Definition at line 78 of file VtkMeshWriter.hpp.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::MakeVtkMesh(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::VtkMeshWriter(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFiles(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh(), and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::~VtkMeshWriter().
bool VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mWriteParallelFiles [private] |
Whether to write parallel (.pvtu + .vtu for each process) files, defaults to false
Definition at line 64 of file VtkMeshWriter.hpp.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData(), VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetParallelFiles(), and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().