![]() |
Chaste Commit::675f9facbe008c5eacb9006feaeb6423206579ea
|
#include <VtkMeshWriter.hpp>
Inheritance diagram for VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >:
Collaboration diagram for VtkMeshWriter< 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 | 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< double > | GetNextNode () |
| 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 Member Functions | |
| void | MakeVtkMesh () |
| void | AugmentCellData () |
Private Attributes | |
| bool | mWriteParallelFiles |
| bool | mWriteMeshCells |
| std::map< unsigned, unsigned > | mGlobalToNodeIndexMap |
| std::vector< std::vector< unsigned > > | mNodesToSendPerProcess |
| std::vector< std::vector< unsigned > > | mNodesToReceivePerProcess |
| NodesOnlyMesh< SPACE_DIM > * | mpNodesOnlyMesh |
| vtkUnstructuredGrid * | mpVtkUnstructedMesh |
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 > | |
| OutputFileHandler * | mpOutputFileHandler |
| std::string | mBaseName |
| AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * | mpMeshReader |
| unsigned | mNumNodes |
| unsigned | mNumElements |
| unsigned | mNumBoundaryElements |
| unsigned | mNumCableElements |
Writes a mesh in VTK .vtu format (that's an XML-based, data compressed unstructured mesh)
Definition at line 71 of file VtkMeshWriter.hpp.
| VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::VtkMeshWriter | ( | const std::string & | rDirectory, |
| const std::string & | rBaseName, | ||
| const bool & | rCleanDirectory = true |
||
| ) |
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 51 of file VtkMeshWriter.cpp.
References AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::mIndexFromZero, and VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh.
|
virtual |
Destructor.
Definition at line 67 of file VtkMeshWriter.cpp.
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData | ( | std::string | name, |
| std::vector< c_vector< double, SPACE_DIM > > | data | ||
| ) |
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 268 of file VtkMeshWriter.cpp.
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData | ( | std::string | name, |
| std::vector< double > | data | ||
| ) |
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 220 of file VtkMeshWriter.cpp.
Referenced by AbstractContinuumMechanicsSolver< DIM >::CreateVtkOutput(), and VtkNonlinearElasticitySolutionWriter< DIM >::Write().
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData | ( | std::string | name, |
| std::vector< c_vector< double, SPACE_DIM > > | data | ||
| ) |
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 439 of file VtkMeshWriter.cpp.
References PetscTools::GetMyRank(), PetscTools::GetNumProcs(), and UNUSED_OPT.
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData | ( | std::string | name, |
| std::vector< double > | data | ||
| ) |
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 365 of file VtkMeshWriter.cpp.
References PetscTools::GetMyRank(), PetscTools::GetNumProcs(), and UNUSED_OPT.
Referenced by Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), AbstractContinuumMechanicsSolver< DIM >::CreateVtkOutput(), VtkNonlinearElasticitySolutionWriter< DIM >::Write(), CaBasedCellPopulation< DIM >::WriteVtkResultsToFile(), MeshBasedCellPopulationWithGhostNodes< DIM >::WriteVtkResultsToFile(), NodeBasedCellPopulation< DIM >::WriteVtkResultsToFile(), NodeBasedCellPopulationWithParticles< DIM >::WriteVtkResultsToFile(), PottsBasedCellPopulation< DIM >::WriteVtkResultsToFile(), and LinearParabolicPdeSystemWithCoupledOdeSystemSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteVtkResultsToFile().
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddProvenance | ( | std::string | fileName | ) |
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 186 of file VtkMeshWriter.cpp.
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddTensorCellData | ( | std::string | name, |
| std::vector< c_matrix< double, SPACE_DIM, SPACE_DIM > > | data | ||
| ) |
Add a tensor 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 328 of file VtkMeshWriter.cpp.
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddTensorCellData | ( | std::string | name, |
| std::vector< c_vector< double, SPACE_DIM *(SPACE_DIM+1)/2 > > | data | ||
| ) |
Add a symmetric tensor 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. The data vector represents the lower half of the tensor Checking cannot be done at this stage since the data is associated with an empty VTK mesh structure. |
Definition at line 292 of file VtkMeshWriter.cpp.
Referenced by VtkNonlinearElasticitySolutionWriter< DIM >::Write().
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddTensorPointData | ( | std::string | name, |
| std::vector< c_matrix< double, SPACE_DIM, SPACE_DIM > > | data | ||
| ) |
Add a tensor data field to each point.
| 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 523 of file VtkMeshWriter.cpp.
|
private |
At the time of adding VTK cell data, it is assumed that there is one piece of data for each element in the original mesh. If the mesh is mixed-dimension (elements and cable elements) the VTK mesh makes no distinction between the two types of cells. All data associated with cells must be the same length as the overall number of cells. This method inspects each cell data component and adds dummy data to cover the cable elements.
Definition at line 235 of file VtkMeshWriter.cpp.
|
private |
Private helper method which copies the mesh details into the waiting VTK mesh structure. Called by WriteFiles().
Definition at line 73 of file VtkMeshWriter.cpp.
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetParallelFiles | ( | AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & | rMesh | ) |
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 559 of file VtkMeshWriter.cpp.
References EXCEPTION, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), and PetscTools::IsSequential().
Referenced by Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), NodeBasedCellPopulation< DIM >::WriteVtkResultsToFile(), and NodeBasedCellPopulationWithParticles< DIM >::WriteVtkResultsToFile().
| void VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::SetWriteMeshCells | ( | bool | writeMeshCells | ) |
Specify whether the next call to MakeVtkMesh() - which is called when writing with WriteFiles()- will need to insert information on the mesh cells (aka mesh elements) or not. When requesting multiple WriteFiles() from this same object, the information on mesh cells must be included only the first time. This method can then be called after the first time by setting the flag to false.
| writeMeshCells | true if the next call to MakeVtkMesh() will need to include information on the mesh cells (aka mesh elements) |
Definition at line 180 of file VtkMeshWriter.cpp.
|
virtual |
Write mesh data to files.
Implements AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.
Definition at line 197 of file VtkMeshWriter.cpp.
|
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 609 of file VtkMeshWriter.cpp.
References 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(), DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumLocalElements(), PetscTools::GetNumProcs(), PetscTools::IsSequential(), and AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().
Referenced by Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), AbstractContinuumMechanicsSolver< DIM >::CreateVtkOutput(), VtkNonlinearElasticitySolutionWriter< DIM >::Write(), CaBasedCellPopulation< DIM >::WriteVtkResultsToFile(), MeshBasedCellPopulationWithGhostNodes< DIM >::WriteVtkResultsToFile(), NodeBasedCellPopulation< DIM >::WriteVtkResultsToFile(), NodeBasedCellPopulationWithParticles< DIM >::WriteVtkResultsToFile(), PottsBasedCellPopulation< DIM >::WriteVtkResultsToFile(), and LinearParabolicPdeSystemWithCoupledOdeSystemSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteVtkResultsToFile().
|
private |
Map a global node index into a local index (into mNodes and mHaloNodes as if they were concatenated)
Definition at line 86 of file VtkMeshWriter.hpp.
|
private |
Used to communicate node-wise halo data
Definition at line 89 of file VtkMeshWriter.hpp.
|
private |
Used to communicate node-wise halo data
Definition at line 88 of file VtkMeshWriter.hpp.
|
private |
A pointer to a NodesOnlyMesh to write to file, created by dynamic cast
Definition at line 92 of file VtkMeshWriter.hpp.
|
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 100 of file VtkMeshWriter.hpp.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::VtkMeshWriter().
|
private |
Whether or not the information on mesh cells (aka mesh elements) need to be printed. Defaults to true. When calling the "write" method multiple times, you may need to set it to false after the first time.
Definition at line 84 of file VtkMeshWriter.hpp.
|
private |
Whether to write parallel (.pvtu + .vtu for each process) files, defaults to false
Definition at line 77 of file VtkMeshWriter.hpp.