CEPS  24.01
Cardiac ElectroPhysiology Simulator
VtkWriter Class Reference

Detailed Description

A class that enables the output of binary parallel VTK format files.

Multiple scalar fields can be ouputted in the same file

Possible outputs are

  • vtk legacy (binary) + xml collection file (music)
  • pvtu + paraview series files
  • custom format that prevents duplication of mesh data (cf contrib/paraviewPlugin)

Definition at line 68 of file VtkWriter.hpp.

#include <VtkWriter.hpp>

Inheritance diagram for VtkWriter:
[legend]

Public Member Functions

 VtkWriter ()=delete
 Deleted constructor. More...
 
 VtkWriter (AbstractDiscretization *discr, const CepsString &name, CepsUInt nOutputs, CepsOutputFormat outputFormat, CepsBool writeGlobalIndices=false)
 Constructor. More...
 
 ~VtkWriter () override
 Destructor. More...
 
void addScalarData (const DHVecPtr &v, const CepsVector< CepsString > &fieldNames, const CepsVector< Unknown * > &us)
 Set multiple scalar fields to be output by this writer. addScalarData for several unknowns. More...
 
void addScalarData (const DHVecPtr &v, const CepsString &fieldName, Unknown *u)
 Set a scalar field to be output by this writer. More...
 
void write (CepsReal time=0., CepsBool writeXmlEntry=true)
 Write all stored data. More...
 
CepsString getByeByeMessage ()
 Get string to be displayed at end of computation. More...
 
void setOutputType (CepsOutputFormat flag)
 Set the output type. More...
 
CepsOutputFormat getOutputType () const
 Get the output type. More...
 
CepsString getOuputExtension () const
 Get the extension, deduced from CepsOutputFormat. More...
 
- Public Member Functions inherited from CepsObject
 CepsObject ()=default
 default constructor More...
 
 CepsObject (const CepsObject &)=default
 Copy constructor. More...
 
virtual ~CepsObject ()=default
 Destructor. More...
 
CepsObjectoperator= (const CepsObject &)=default
 Assignment operator. More...
 
CepsObjecttoBaseObject ()
 Returns a pointer to CepsObject class. More...
 
const CepsObjecttoBaseObject () const
 Returns a pointer to CepsObject class, const version. More...
 
ProfilergetProfiler () const
 Access to profiler. More...
 

Protected Member Functions

void writeVTU ()
 Write current state (Paraview xml pvtu & vtu file) More...
 
void writeLegacyVTK ()
 Write current state (Paraview legacy vtk) More...
 
void writeDataArray ()
 Write current state (vtk_ceps format) More...
 
void writeSeriesFile ()
 Write time series file for all time steps (Paraview pvtu.series) More...
 
void writeMetaDataSet ()
 Write time pvd file for all time steps (Paraview .pvd) More...
 
void updateMeshData ()
 Global geometrical data regrouping. More...
 
void insertPointData ()
 Add coordinates to VTK structures, add array of global indices if needed. More...
 
void insertElementData ()
 Add cell definition to VTK structures. More...
 
void insertElementsOfDim (CepsUInt dim)
 Internal method which for looping on all elements on a mesh of given dimension. More...
 
void insertCell (GeomCell *cell)
 Internal method which inserts one element as a cell in a unstructuredGrid vtk object. More...
 
vtkCell * allocateCellOfDim (CepsUInt dim)
 Internal method allocating a cell for a finite element (tetra,tri,...) More...
 
void addTimeFieldToUGrid (CepsReal time)
 Adds a single scalar field to unstructred grid to write, called before writing. More...
 

Protected Attributes

AbstractDiscretizationm_discr
 Discretization (dofs) More...
 
Geometrym_geom
 Direct link to geometry. More...
 
CepsVector< CepsRealm_writtenTimes
 Previous times already written. More...
 
CepsString m_baseName
 base name of output files More...
 
CepsUInt m_outputNb
 number of output file (not iteration) More...
 
CepsUInt m_outputLgMax
 estimated number of output files (log10)+1 More...
 
CepsString m_outputDir
 output directory More...
 
CepsUInt m_internalIndex
 Points counter. More...
 
CepsOutputFormat m_outputType
 Output type. More...
 
CepsBool m_updateMesh
 if the mesh data (geometry) must be updated More...
 
CepsBool m_writeGeomIndices
 option to add array of CEPS point IDs More...
 
vtkSmartPointer< vtkUnstructuredGrid > m_unstructuredGrid
 the vtk data wrapper More...
 
std::map< CepsUInt, CepsUIntm_geomToVtkNodeIndex
 mapping used for nodes More...
 
std::map< CepsUInt, CepsUIntm_geomToVtkCellIndex
 mapping used for elements More...
 
vtkSmartPointer< vtkMPICommunicator > m_vtkMpiComm
 a vtk wrapping object for the communicator More...
 
vtkMPICommunicatorOpaqueComm m_opaqueCommVTK
 a vtk object to create user defined MPI communicators More...
 
vtkSmartPointer< vtkMPIController > m_vtkMpiController
 vtk mpi controller More...
 

Additional Inherited Members

- Static Protected Attributes inherited from CepsObject
static Profiler m_profiler
 The same profiler for each big object. More...
 

Constructor & Destructor Documentation

◆ VtkWriter() [1/2]

VtkWriter::VtkWriter ( )
delete

Deleted constructor.

◆ VtkWriter() [2/2]

VtkWriter::VtkWriter ( AbstractDiscretization discr,
const CepsString name,
CepsUInt  nOutputs,
CepsOutputFormat  outputFormat,
CepsBool  writeGlobalIndices = false 
)

Constructor.

Parameters
discrpointer on spatial discretization
namea base name for each outputted file
nOutputsexpected nb of outputs, to to sell size of nb in file name
outputFormatselects output type
writeGlobalIndicesadds an int array of point data with the CEPS index of each point. Needed for convergence study (mesh interpolations)

VTK mpi controller

Definition at line 38 of file VtkWriter.cpp.

◆ ~VtkWriter()

VtkWriter::~VtkWriter ( )
override

Destructor.

Definition at line 89 of file VtkWriter.cpp.

Member Function Documentation

◆ addScalarData() [1/2]

void VtkWriter::addScalarData ( const DHVecPtr v,
const CepsString fieldName,
Unknown u 
)

Set a scalar field to be output by this writer.

Multiple scalar fields can be added.

Parameters
[in]vdistributed halo vector holding the scalars
[in]fieldNamea name for this scalar field. If there already exists a field with this name, it is replaced. This is useful when outputting at each time step an updated solution.
[in]uunknown for which data will be extracted from the distributed vector

Definition at line 94 of file VtkWriter.cpp.

◆ addScalarData() [2/2]

void VtkWriter::addScalarData ( const DHVecPtr v,
const CepsVector< CepsString > &  fieldNames,
const CepsVector< Unknown * > &  us 
)

Set multiple scalar fields to be output by this writer. addScalarData for several unknowns.

Definition at line 101 of file VtkWriter.cpp.

◆ addTimeFieldToUGrid()

void VtkWriter::addTimeFieldToUGrid ( CepsReal  time)
protected

Adds a single scalar field to unstructred grid to write, called before writing.

Definition at line 593 of file VtkWriter.cpp.

◆ allocateCellOfDim()

vtkCell * VtkWriter::allocateCellOfDim ( CepsUInt  dim)
protected

Internal method allocating a cell for a finite element (tetra,tri,...)

Definition at line 580 of file VtkWriter.cpp.

◆ getByeByeMessage()

CepsString VtkWriter::getByeByeMessage ( )

Get string to be displayed at end of computation.

Definition at line 217 of file VtkWriter.cpp.

◆ getOuputExtension()

CepsString VtkWriter::getOuputExtension ( ) const

Get the extension, deduced from CepsOutputFormat.

Definition at line 239 of file VtkWriter.cpp.

◆ getOutputType()

CepsOutputFormat VtkWriter::getOutputType ( ) const

Get the output type.

Definition at line 233 of file VtkWriter.cpp.

◆ insertCell()

void VtkWriter::insertCell ( GeomCell cell)
protected

Internal method which inserts one element as a cell in a unstructuredGrid vtk object.

Definition at line 560 of file VtkWriter.cpp.

◆ insertElementData()

void VtkWriter::insertElementData ( )
protected

Add cell definition to VTK structures.

Definition at line 483 of file VtkWriter.cpp.

◆ insertElementsOfDim()

void VtkWriter::insertElementsOfDim ( CepsUInt  dim)
protected

Internal method which for looping on all elements on a mesh of given dimension.

Definition at line 550 of file VtkWriter.cpp.

◆ insertPointData()

void VtkWriter::insertPointData ( )
protected

Add coordinates to VTK structures, add array of global indices if needed.

Definition at line 390 of file VtkWriter.cpp.

◆ setOutputType()

void VtkWriter::setOutputType ( CepsOutputFormat  flag)

Set the output type.

Definition at line 227 of file VtkWriter.cpp.

◆ updateMeshData()

void VtkWriter::updateMeshData ( )
protected

Global geometrical data regrouping.

Definition at line 375 of file VtkWriter.cpp.

◆ write()

void VtkWriter::write ( CepsReal  time = 0.,
CepsBool  writeXmlEntry = true 
)

Write all stored data.

Parameters
[in]timecurrent time of simulation
[in]writeXmlEntryif true, writes in the xml collection files the name of the generated vt<X> files. Set it to true once per iteration to avoid duplicates in the xml files.

Definition at line 176 of file VtkWriter.cpp.

◆ writeDataArray()

void VtkWriter::writeDataArray ( )
protected

Write current state (vtk_ceps format)

Definition at line 291 of file VtkWriter.cpp.

◆ writeLegacyVTK()

void VtkWriter::writeLegacyVTK ( )
protected

Write current state (Paraview legacy vtk)

Definition at line 276 of file VtkWriter.cpp.

◆ writeMetaDataSet()

void VtkWriter::writeMetaDataSet ( )
protected

Write time pvd file for all time steps (Paraview .pvd)

Write time series file for all time steps (Music)

Definition at line 345 of file VtkWriter.cpp.

◆ writeSeriesFile()

void VtkWriter::writeSeriesFile ( )
protected

Write time series file for all time steps (Paraview pvtu.series)

Definition at line 316 of file VtkWriter.cpp.

◆ writeVTU()

void VtkWriter::writeVTU ( )
protected

Write current state (Paraview xml pvtu & vtu file)

The pvtu xml writer

Definition at line 255 of file VtkWriter.cpp.

Field Documentation

◆ m_baseName

CepsString VtkWriter::m_baseName
protected

base name of output files

Definition at line 208 of file VtkWriter.hpp.

◆ m_discr

AbstractDiscretization* VtkWriter::m_discr
protected

Discretization (dofs)

Definition at line 204 of file VtkWriter.hpp.

◆ m_geom

Geometry* VtkWriter::m_geom
protected

Direct link to geometry.

Definition at line 205 of file VtkWriter.hpp.

◆ m_geomToVtkCellIndex

std::map<CepsUInt, CepsUInt> VtkWriter::m_geomToVtkCellIndex
protected

mapping used for elements

Definition at line 221 of file VtkWriter.hpp.

◆ m_geomToVtkNodeIndex

std::map<CepsUInt, CepsUInt> VtkWriter::m_geomToVtkNodeIndex
protected

mapping used for nodes

Definition at line 220 of file VtkWriter.hpp.

◆ m_internalIndex

CepsUInt VtkWriter::m_internalIndex
protected

Points counter.

Definition at line 213 of file VtkWriter.hpp.

◆ m_opaqueCommVTK

vtkMPICommunicatorOpaqueComm VtkWriter::m_opaqueCommVTK
protected

a vtk object to create user defined MPI communicators

Definition at line 225 of file VtkWriter.hpp.

◆ m_outputDir

CepsString VtkWriter::m_outputDir
protected

output directory

Definition at line 211 of file VtkWriter.hpp.

◆ m_outputLgMax

CepsUInt VtkWriter::m_outputLgMax
protected

estimated number of output files (log10)+1

Definition at line 210 of file VtkWriter.hpp.

◆ m_outputNb

CepsUInt VtkWriter::m_outputNb
protected

number of output file (not iteration)

Definition at line 209 of file VtkWriter.hpp.

◆ m_outputType

CepsOutputFormat VtkWriter::m_outputType
protected

Output type.

Definition at line 214 of file VtkWriter.hpp.

◆ m_unstructuredGrid

vtkSmartPointer<vtkUnstructuredGrid> VtkWriter::m_unstructuredGrid
protected

the vtk data wrapper

Definition at line 218 of file VtkWriter.hpp.

◆ m_updateMesh

CepsBool VtkWriter::m_updateMesh
protected

if the mesh data (geometry) must be updated

Definition at line 215 of file VtkWriter.hpp.

◆ m_vtkMpiComm

vtkSmartPointer<vtkMPICommunicator> VtkWriter::m_vtkMpiComm
protected

a vtk wrapping object for the communicator

Definition at line 224 of file VtkWriter.hpp.

◆ m_vtkMpiController

vtkSmartPointer<vtkMPIController> VtkWriter::m_vtkMpiController
protected

vtk mpi controller

Definition at line 226 of file VtkWriter.hpp.

◆ m_writeGeomIndices

CepsBool VtkWriter::m_writeGeomIndices
protected

option to add array of CEPS point IDs

Definition at line 216 of file VtkWriter.hpp.

◆ m_writtenTimes

CepsVector<CepsReal> VtkWriter::m_writtenTimes
protected

Previous times already written.

Definition at line 206 of file VtkWriter.hpp.


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