KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Public Types | Public Member Functions | List of all members
Kratos::VtkOutput Class Reference

VtkOutput A simple class that has functionality to write vtk output. More...

#include <vtk_output.h>

Inheritance diagram for Kratos::VtkOutput:
Collaboration diagram for Kratos::VtkOutput:

Public Types

enum class  FileFormat { VTK_ASCII , VTK_BINARY }
 
using SizeType = std::size_t
 Definition of the size type. More...
 
using IndexType = std::size_t
 Definition of the index type. More...
 
using NodeType = Node
 Definition of the node type. More...
 
using GeometryType = Geometry< NodeType >
 Definition of the geometry type with given NodeType. More...
 
- Public Types inherited from Kratos::IO
typedef Node NodeType
 
typedef Geometry< NodeTypeGeometryType
 
typedef Mesh< NodeType, Properties, Element, ConditionMeshType
 
typedef MeshType::NodesContainerType NodesContainerType
 
typedef MeshType::PropertiesContainerType PropertiesContainerType
 
typedef ModelPart::GeometryContainerType GeometryContainerType
 
typedef MeshType::ElementsContainerType ElementsContainerType
 
typedef MeshType::ConditionsContainerType ConditionsContainerType
 
typedef std::vector< std::vector< std::size_t > > ConnectivitiesContainerType
 
typedef std::vector< std::vector< std::size_t > > PartitionIndicesContainerType
 
typedef std::vector< std::size_t > PartitionIndicesType
 
typedef std::size_t SizeType
 
typedef DenseMatrix< intGraphType
 

Public Member Functions

 KRATOS_CLASS_POINTER_DEFINITION (VtkOutput)
 Pointer definition of VtkOutput. More...
 
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Prints information about the class. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. More...
 
Life Cycle
 VtkOutput (ModelPart &rModelPart, Parameters ThisParameters=Parameters(R"({})"))
 Constructor by passing a ModelPart and Kratos-Parameters. More...
 
virtual ~VtkOutput ()=default
 Destructor. More...
 
- Public Member Functions inherited from Kratos::IO
 IO ()=default
 Default constructor. More...
 
virtual ~IO ()=default
 Destructor. More...
 
 IO (IO const &rOther)=delete
 Copy constructor. More...
 
IOoperator= (IO const &rOther)=delete
 Assignment operator. More...
 
virtual bool ReadNode (NodeType &rThisNode)
 This method reads one node. More...
 
virtual bool ReadNodes (NodesContainerType &rThisNodes)
 This method reads the nodes from an array of nodes. More...
 
virtual std::size_t ReadNodesNumber ()
 This method reads the number of nodes. More...
 
virtual void WriteNodes (NodesContainerType const &rThisNodes)
 This method writes the nodes from an array of nodes. More...
 
virtual void ReadProperties (Properties &rThisProperties)
 This method reads one Properties. More...
 
virtual void ReadProperties (PropertiesContainerType &rThisProperties)
 This method reads the Properties from an array of Properties. More...
 
virtual void WriteProperties (Properties const &rThisProperties)
 This method writes one Properties. More...
 
virtual void WriteProperties (PropertiesContainerType const &rThisProperties)
 This method writes the Properties from an array of Properties. More...
 
virtual void ReadGeometry (NodesContainerType &rThisNodes, GeometryType::Pointer &pThisGeometry)
 This method reads one geometry. More...
 
virtual void ReadGeometries (NodesContainerType &rThisNodes, GeometryContainerType &rThisGeometries)
 This method reads an array of geometries. More...
 
virtual std::size_t ReadGeometriesConnectivities (ConnectivitiesContainerType &rGeometriesConnectivities)
 This method reads the geometries connectivities. More...
 
virtual void WriteGeometries (GeometryContainerType const &rThisGeometries)
 This method writes an array of geometries. More...
 
virtual void ReadElement (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, Element::Pointer &pThisElement)
 This method reads one element. More...
 
virtual void ReadElements (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, ElementsContainerType &rThisElements)
 This method reads an array of elements. More...
 
virtual std::size_t ReadElementsConnectivities (ConnectivitiesContainerType &rElementsConnectivities)
 This method reads the elements connectivities. More...
 
virtual void WriteElements (ElementsContainerType const &rThisElements)
 This method writes an array of elements. More...
 
virtual void ReadCondition (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, Condition::Pointer &pThisCondition)
 This method reads one condition. More...
 
virtual void ReadConditions (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, ConditionsContainerType &rThisConditions)
 This method reads an array of conditions. More...
 
virtual std::size_t ReadConditionsConnectivities (ConnectivitiesContainerType &rConditionsConnectivities)
 This method reads the conditions connectivities. More...
 
virtual void WriteConditions (ConditionsContainerType const &rThisConditions)
 This method writes an array of conditions. More...
 
virtual void ReadInitialValues (ModelPart &rThisModelPart)
 This method reads the initial values of the model part. More...
 
virtual void ReadInitialValues (NodesContainerType &rThisNodes, ElementsContainerType &rThisElements, ConditionsContainerType &rThisConditions)
 This method reads the initial values of the nodes, elements and conditios. More...
 
virtual void ReadMesh (MeshType &rThisMesh)
 This method reads the mesh. More...
 
virtual void WriteMesh (MeshType &rThisMesh)
 This method writes the mesh. More...
 
virtual void WriteMesh (const MeshType &rThisMesh)
 This method writes the mesh. More...
 
virtual void ReadModelPart (ModelPart &rThisModelPart)
 This method reads the model part. More...
 
virtual void WriteModelPart (ModelPart &rThisModelPart)
 This method writes the model part. More...
 
virtual void WriteModelPart (const ModelPart &rThisModelPart)
 This method writes the model part. More...
 
virtual void WriteNodeMesh (MeshType &rThisMesh)
 This method writes the node mesh. More...
 
virtual void WriteNodeMesh (const MeshType &rThisMesh)
 This method writes the node mesh. More...
 
virtual std::size_t ReadNodalGraph (ConnectivitiesContainerType &rAuxConnectivities)
 Read the input file and create the nodal connectivities graph, stored in CSR format. More...
 
virtual void DivideInputToPartitions (SizeType NumberOfPartitions, const PartitioningInfo &rPartitioningInfo)
 This method divides a model part into partitions. More...
 
virtual void DivideInputToPartitions (SizeType NumberOfPartitions, GraphType const &rDomainsColoredGraph, PartitionIndicesType const &rNodesPartitions, PartitionIndicesType const &rElementsPartitions, PartitionIndicesType const &rConditionsPartitions, PartitionIndicesContainerType const &rNodesAllPartitions, PartitionIndicesContainerType const &rElementsAllPartitions, PartitionIndicesContainerType const &rConditionsAllPartitions)
 This method divides a model part into partitions. More...
 
virtual void DivideInputToPartitions (Kratos::shared_ptr< std::iostream > *pStreams, SizeType NumberOfPartitions, const PartitioningInfo &rPartitioningInfo)
 This method divides a model part into partitions. More...
 
virtual void DivideInputToPartitions (Kratos::shared_ptr< std::iostream > *pStreams, SizeType NumberOfPartitions, GraphType const &rDomainsColoredGraph, PartitionIndicesType const &rNodesPartitions, PartitionIndicesType const &rElementsPartitions, PartitionIndicesType const &rConditionsPartitions, PartitionIndicesContainerType const &rNodesAllPartitions, PartitionIndicesContainerType const &rElementsAllPartitions, PartitionIndicesContainerType const &rConditionsAllPartitions)
 This method divides a model part into partitions. More...
 
virtual void ReadSubModelPartElementsAndConditionsIds (std::string const &rModelPartName, std::unordered_set< SizeType > &rElementsIds, std::unordered_set< SizeType > &rConditionsIds)
 
virtual std::size_t ReadNodalGraphFromEntitiesList (ConnectivitiesContainerType &rAuxConnectivities, std::unordered_set< SizeType > &rElementsIds, std::unordered_set< SizeType > &rConditionsIds)
 
 KRATOS_CLASS_POINTER_DEFINITION (IO)
 Pointer definition of IO. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (READ)
 Local Flags. More...
 
 KRATOS_DEFINE_LOCAL_FLAG (WRITE)
 
 KRATOS_DEFINE_LOCAL_FLAG (APPEND)
 
 KRATOS_DEFINE_LOCAL_FLAG (IGNORE_VARIABLES_ERROR)
 
 KRATOS_DEFINE_LOCAL_FLAG (SKIP_TIMER)
 
 KRATOS_DEFINE_LOCAL_FLAG (MESH_ONLY)
 
 KRATOS_DEFINE_LOCAL_FLAG (SCIENTIFIC_PRECISION)
 

Protected Types

Enum's
enum class  EntityType { ELEMENT , CONDITION , AUTOMATIC , NONE }
 

Member Variables

ModelPartmrModelPart
 
VtkOutput::FileFormat mFileFormat
 The main model part to post process. More...
 
Parameters mOutputSettings
 The file format considered. More...
 
unsigned int mDefaultPrecision
 The configuration parameters. More...
 
std::unordered_map< int, intmKratosIdToVtkId
 The default precision. More...
 
bool mShouldSwap = false
 The map storing the relationship between the Kratos ID and VTK ID. More...
 
IntegrationValuesExtrapolationToNodesProcess::UniquePointer mpGaussToNodesProcess
 If the bytes need to be swapped (endianness) More...
 

Operations

The entities to be written

void PrintOutput (const std::string &rOutputFilename="")
 Prints mrModelPart in VTK format together with the results. More...
 
static Parameters GetDefaultParameters ()
 This method provides the defaults parameters to avoid conflicts between the different constructors. More...
 
EntityType GetEntityType (const ModelPart &rModelPart) const
 Helper to determine which entities to write. More...
 
void PrepareGaussPointResults ()
 Interpolates the gauss point results on to the node using IntegrationValuesExtrapolationToNodesProcess. More...
 
void WriteModelPartToFile (const ModelPart &rModelPart, const bool IsSubModelPart, const std::string &rOutputFilename)
 Print the given rModelPart as VTK file together with the requested results. More...
 
std::string GetOutputFileName (const ModelPart &rModelPart, const bool IsSubModelPart, const std::string &rOutputFilename)
 Get the output file name based on the provided settings and the MPI rank. More...
 
void Initialize (const ModelPart &rModelPart)
 Initialize function for the class. More...
 
void CreateMapFromKratosIdToVTKId (const ModelPart &rModelPart)
 Create a map with kratos nodeId as key and VTK nodeId as value. This require for VTK that the node numbers are in sequence. More...
 
void WriteHeaderToFile (const ModelPart &rModelPart, std::ofstream &rFileStream) const
 Write the VTK header for the output of given rModelPart. More...
 
void WriteMeshToFile (const ModelPart &rModelPart, std::ofstream &rFileStream) const
 Write the mesh from rModelPart. Nodes, Elements or/and Conditions. More...
 
virtual void WriteNodesToFile (const ModelPart &rModelPart, std::ofstream &rFileStream) const
 Write the nodes in the rModelPart. More...
 
virtual void WriteConditionsAndElementsToFile (const ModelPart &rModelPart, std::ofstream &rFileStream) const
 Write the elements and conditions in rModelPart. IMPORTANT : Need to write them together because of the CELLS block in VTK format. More...
 
template<typename TContainerType >
std::size_t DetermineVtkCellListSize (const TContainerType &rContainer) const
 Calculate the total number of cells which are in the provided rModelPart. = num_elements + num_conditions It is necessary to be known prior to output. More...
 
template<typename TContainerType >
void WriteConnectivity (const TContainerType &rContainer, std::ofstream &rFileStream) const
 Write the element/condition WriteConnectivity provided the container they are in. More...
 
template<typename TContainerType >
void WriteCellType (const TContainerType &rContainer, std::ofstream &rFileStream) const
 Write the element/condition cell types provided the container they are in. More...
 
bool IsCompatibleVariable (const std::string &rVariableName) const
 It checks if the variable is compatible with the VTK format. More...
 
virtual void WriteNodalResultsToFile (const ModelPart &rModelPart, std::ofstream &rFileStream)
 Write the results on the nodes. More...
 
void WriteElementResultsToFile (const ModelPart &rModelPart, std::ofstream &rFileStream)
 Write the results/flags on the elements of rModelPart. More...
 
void WriteConditionResultsToFile (const ModelPart &rModelPart, std::ofstream &rFileStream)
 Write the results/flags on the conditions of rModelPart. More...
 
void WriteNodalContainerResults (const std::string &rVariableName, const ModelPart::NodesContainerType &rNodes, const bool IsHistoricalValue, std::ofstream &rFileStream) const
 Write the results of rNodes. Synchronization is necessary because both local and ghost-node-values are printed in MPI and can overlap! More...
 
template<typename TContainerType >
void WriteGeometricalContainerResults (const std::string &rVariableName, const TContainerType &rContainer, std::ofstream &rFileStream) const
 Write the variable results of rContainer (Elements or Conditions). More...
 
template<typename TContainerType >
void WriteGeometricalContainerIntegrationResults (const std::string &rVariableName, const TContainerType &rContainer, std::ofstream &rFileStream) const
 Write the variable GP results of rContainer (Elements or Conditions). More...
 
template<class TVarType >
void WriteNodalScalarValues (const ModelPart::NodesContainerType &rNodes, const TVarType &rVariable, const bool IsHistoricalValue, std::ofstream &rFileStream) const
 Writes scalar results of rNodes. Wraps the necessary synchronization-calls. More...
 
template<class TVarType >
void WriteNodalVectorValues (const ModelPart::NodesContainerType &rNodes, const TVarType &rVariable, const bool IsHistoricalValue, std::ofstream &rFileStream) const
 Writes vector results of rNodes. Wraps the necessary synchronization-calls. More...
 
template<typename TContainerType , class TVarType >
void WriteScalarSolutionStepVariable (const TContainerType &rContainer, const TVarType &rVariable, std::ofstream &rFileStream) const
 Write the scalar-historical variable results of rContainer. More...
 
template<typename TContainerType , class TVarType >
void WriteVectorSolutionStepVariable (const TContainerType &rContainer, const TVarType &rVariable, std::ofstream &rFileStream) const
 Write the vector-historical variable results of rContainer. More...
 
template<typename TContainerType >
void WriteFlagContainerVariable (const TContainerType &rContainer, const Flags Flag, const std::string &rFlagName, std::ofstream &rFileStream) const
 Write the flag results of rContainer. More...
 
template<typename TContainerType , class TVarType >
void WriteScalarContainerVariable (const TContainerType &rContainer, const TVarType &rVariable, std::ofstream &rFileStream) const
 Write the scalar-nonhistorical variable results of rContainer. More...
 
template<typename TContainerType , class TVarType >
void WriteIntegrationScalarContainerVariable (const TContainerType &rContainer, const Variable< TVarType > &rVariable, std::ofstream &rFileStream) const
 Write the scalar GP variable results of rContainer. More...
 
template<typename TContainerType , class TVarType >
void WriteVectorContainerVariable (const TContainerType &rContainer, const TVarType &rVariable, std::ofstream &rFileStream) const
 Write the vector-nonhistorical variable results of rContainer. More...
 
template<typename TContainerType , class TVarType >
void WriteIntegrationVectorContainerVariable (const TContainerType &rContainer, const Variable< TVarType > &rVariable, std::ofstream &rFileStream) const
 Write the vector-GP variable results of rContainer. More...
 
template<typename TData >
void WriteScalarDataToFile (const TData &rData, std::ofstream &rFileStream) const
 Write the scalar value to the file provided, takes care of binary and ascii formats. More...
 
template<typename TData >
void WriteVectorDataToFile (const TData &rData, std::ofstream &rFileStream) const
 Write the vector values to the file provided, takes care of binary and ascii formats. More...
 
void ForceBigEndian (unsigned char *pBytes) const
 Only used in the binary format output. This function forces the big endian format for the input binary stream. More...
 

Detailed Description

VtkOutput A simple class that has functionality to write vtk output.

See also
: https://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf

Member Typedef Documentation

◆ GeometryType

Definition of the geometry type with given NodeType.

◆ IndexType

using Kratos::VtkOutput::IndexType = std::size_t

Definition of the index type.

◆ NodeType

Definition of the node type.

◆ SizeType

using Kratos::VtkOutput::SizeType = std::size_t

Definition of the size type.

Member Enumeration Documentation

◆ EntityType

enum Kratos::VtkOutput::EntityType
strongprotected
Enumerator
ELEMENT 
CONDITION 
AUTOMATIC 
NONE 

◆ FileFormat

Enumerator
VTK_ASCII 
VTK_BINARY 

Constructor & Destructor Documentation

◆ VtkOutput()

Kratos::VtkOutput::VtkOutput ( ModelPart rModelPart,
Parameters  ThisParameters = Parameters(R"({})" ) 
)
explicit

Constructor by passing a ModelPart and Kratos-Parameters.

Parameters
rModelPartThe modelpart which is used for output
ParametersParameters including settings for the output

◆ ~VtkOutput()

virtual Kratos::VtkOutput::~VtkOutput ( )
virtualdefault

Destructor.

Member Function Documentation

◆ CreateMapFromKratosIdToVTKId()

void Kratos::VtkOutput::CreateMapFromKratosIdToVTKId ( const ModelPart rModelPart)
protected

Create a map with kratos nodeId as key and VTK nodeId as value. This require for VTK that the node numbers are in sequence.

Parameters
rModelPartmodelpart which is beging output

◆ DetermineVtkCellListSize()

template<typename TContainerType >
std::size_t Kratos::VtkOutput::DetermineVtkCellListSize ( const TContainerType &  rContainer) const
protected

Calculate the total number of cells which are in the provided rModelPart. = num_elements + num_conditions It is necessary to be known prior to output.

Template Parameters
TContainerTypetype of container.
Parameters
rContainerthe container which is beging output

◆ ForceBigEndian()

void Kratos::VtkOutput::ForceBigEndian ( unsigned char *  pBytes) const
protected

Only used in the binary format output. This function forces the big endian format for the input binary stream.

Parameters
pBytesbytes on which the big endian format is to be applied

◆ GetDefaultParameters()

Parameters Kratos::VtkOutput::GetDefaultParameters ( )
static

This method provides the defaults parameters to avoid conflicts between the different constructors.

◆ GetEntityType()

VtkOutput::EntityType Kratos::VtkOutput::GetEntityType ( const ModelPart rModelPart) const
protected

Helper to determine which entities to write.

Parameters
rModelPartThe ModelPart that is currently outputted (can be a SubModelPart)

◆ GetOutputFileName()

std::string Kratos::VtkOutput::GetOutputFileName ( const ModelPart rModelPart,
const bool  IsSubModelPart,
const std::string &  rOutputFilename 
)
protected

Get the output file name based on the provided settings and the MPI rank.

Parameters
rModelPartmodelpart which is beging output

◆ Info()

std::string Kratos::VtkOutput::Info ( ) const
inlineoverridevirtual

Turn back information as a string.

Reimplemented from Kratos::IO.

Reimplemented in Kratos::VtkEigenOutput, and Kratos::ParticleVtkOutput.

◆ Initialize()

void Kratos::VtkOutput::Initialize ( const ModelPart rModelPart)
protected

Initialize function for the class.

Parameters
rModelPartmodelpart which is beging output

◆ IsCompatibleVariable()

bool Kratos::VtkOutput::IsCompatibleVariable ( const std::string &  rVariableName) const
protected

It checks if the variable is compatible with the VTK format.

Parameters
rVariableNamename of the result to be written.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::VtkOutput::KRATOS_CLASS_POINTER_DEFINITION ( VtkOutput  )

Pointer definition of VtkOutput.

◆ PrepareGaussPointResults()

void Kratos::VtkOutput::PrepareGaussPointResults ( )
protected

Interpolates the gauss point results on to the node using IntegrationValuesExtrapolationToNodesProcess.

◆ PrintData()

void Kratos::VtkOutput::PrintData ( std::ostream &  rOStream) const
inlineoverridevirtual

Print object's data.

Reimplemented from Kratos::IO.

Reimplemented in Kratos::VtkEigenOutput, and Kratos::ParticleVtkOutput.

◆ PrintInfo()

void Kratos::VtkOutput::PrintInfo ( std::ostream &  rOStream) const
inlineoverridevirtual

Prints information about the class.

Parameters
rOStreamostream object where output is printed

Reimplemented from Kratos::IO.

Reimplemented in Kratos::VtkEigenOutput, and Kratos::ParticleVtkOutput.

◆ PrintOutput()

void Kratos::VtkOutput::PrintOutput ( const std::string &  rOutputFilename = "")

Prints mrModelPart in VTK format together with the results.

◆ WriteCellType()

template<typename TContainerType >
void Kratos::VtkOutput::WriteCellType ( const TContainerType &  rContainer,
std::ofstream &  rFileStream 
) const
protected

Write the element/condition cell types provided the container they are in.

Template Parameters
TEntityElement/Condition
Parameters
rContainerThe container containing elements/conditions
rFileStreamthe file stream to which data is to be written.

◆ WriteConditionResultsToFile()

void Kratos::VtkOutput::WriteConditionResultsToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
)
protected

Write the results/flags on the conditions of rModelPart.

Parameters
rModelPartmodelpart which is beging output
rFileStreamthe file stream to which data is to be written.

◆ WriteConditionsAndElementsToFile()

void Kratos::VtkOutput::WriteConditionsAndElementsToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
) const
protectedvirtual

Write the elements and conditions in rModelPart. IMPORTANT : Need to write them together because of the CELLS block in VTK format.

Parameters
rModelPartmodelpart which is beging output
rFileStreamthe file stream to which data is to be written.

Reimplemented in Kratos::ParticleVtkOutput.

◆ WriteConnectivity()

template<typename TContainerType >
void Kratos::VtkOutput::WriteConnectivity ( const TContainerType &  rContainer,
std::ofstream &  rFileStream 
) const
protected

Write the element/condition WriteConnectivity provided the container they are in.

Template Parameters
TEntityElement/Condition
Parameters
rContainerThe container containing elements/conditions
rFileStreamthe file stream to which data is to be written.

◆ WriteElementResultsToFile()

void Kratos::VtkOutput::WriteElementResultsToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
)
protected

Write the results/flags on the elements of rModelPart.

Parameters
rModelPartmodelpart which is beging output
rFileStreamthe file stream to which data is to be written.

◆ WriteFlagContainerVariable()

template<typename TContainerType >
void Kratos::VtkOutput::WriteFlagContainerVariable ( const TContainerType &  rContainer,
const Flags  Flag,
const std::string &  rFlagName,
std::ofstream &  rFileStream 
) const
protected

Write the flag results of rContainer.

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
Parameters
rContainerthe container which is beging output
FlagThe flag to be considered to be written
rFlagNameThe name of the flag that will appear on the post file
rFileStreamthe file stream to which data is to be written.

◆ WriteGeometricalContainerIntegrationResults()

template<typename TContainerType >
void Kratos::VtkOutput::WriteGeometricalContainerIntegrationResults ( const std::string &  rVariableName,
const TContainerType &  rContainer,
std::ofstream &  rFileStream 
) const
protected

Write the variable GP results of rContainer (Elements or Conditions).

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
Parameters
rVariableNamename of the result to be written.
rContainerthe container which is beging output
rFileStreamthe file stream to which data is to be written.

◆ WriteGeometricalContainerResults()

template<typename TContainerType >
void Kratos::VtkOutput::WriteGeometricalContainerResults ( const std::string &  rVariableName,
const TContainerType &  rContainer,
std::ofstream &  rFileStream 
) const
protected

Write the variable results of rContainer (Elements or Conditions).

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
Parameters
rVariableNamename of the result to be written.
rContainerthe container which is beging output
rFileStreamthe file stream to which data is to be written.

◆ WriteHeaderToFile()

void Kratos::VtkOutput::WriteHeaderToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
) const
protected

Write the VTK header for the output of given rModelPart.

Parameters
rModelPartmodelpart which is beging output
rFileStreamthe file stream to which data is to be written.

◆ WriteIntegrationScalarContainerVariable()

template<typename TContainerType , class TVarType >
void Kratos::VtkOutput::WriteIntegrationScalarContainerVariable ( const TContainerType &  rContainer,
const Variable< TVarType > &  rVariable,
std::ofstream &  rFileStream 
) const
protected

Write the scalar GP variable results of rContainer.

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
TVarTypeThe type of Variable of the entity on which the results are to be written
Parameters
rContainerthe container which is beging output
rVariableVariable of the result to be written.
rFileStreamthe file stream to which data is to be written.

◆ WriteIntegrationVectorContainerVariable()

template<typename TContainerType , class TVarType >
void Kratos::VtkOutput::WriteIntegrationVectorContainerVariable ( const TContainerType &  rContainer,
const Variable< TVarType > &  rVariable,
std::ofstream &  rFileStream 
) const
protected

Write the vector-GP variable results of rContainer.

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
TVarTypeThe type of Variable of the entity on which the results are to be written
Parameters
rContainerthe container which is beging output
rVariableVariable of the result to be written.
VtkDataTypetype of vtk data
rFileStreamthe file stream to which data is to be written.

◆ WriteMeshToFile()

void Kratos::VtkOutput::WriteMeshToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
) const
protected

Write the mesh from rModelPart. Nodes, Elements or/and Conditions.

Parameters
rModelPartmodelpart which is beging output
rFileStreamthe file stream to which data is to be written.

◆ WriteModelPartToFile()

void Kratos::VtkOutput::WriteModelPartToFile ( const ModelPart rModelPart,
const bool  IsSubModelPart,
const std::string &  rOutputFilename 
)
protected

Print the given rModelPart as VTK file together with the requested results.

Parameters
rModelPartmodelpart which is beging output
IsSubModelPartwhether the modelpart is to be treated as a submodelpart this is only relevant for the file-name

◆ WriteNodalContainerResults()

void Kratos::VtkOutput::WriteNodalContainerResults ( const std::string &  rVariableName,
const ModelPart::NodesContainerType rNodes,
const bool  IsHistoricalValue,
std::ofstream &  rFileStream 
) const
protected

Write the results of rNodes. Synchronization is necessary because both local and ghost-node-values are printed in MPI and can overlap!

Parameters
rVariableNamename of the result to be written.
rNodesthe nodes which is beging output
IsHistoricalValuewhether the values are historical or not
rFileStreamthe file stream to which data is to be written.

◆ WriteNodalResultsToFile()

void Kratos::VtkOutput::WriteNodalResultsToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
)
protectedvirtual

Write the results on the nodes.

Parameters
rModelPartmodelpart which is beging output
rFileStreamthe file stream to which data is to be written.

Reimplemented in Kratos::ParticleVtkOutput.

◆ WriteNodalScalarValues()

template<class TVarType >
void Kratos::VtkOutput::WriteNodalScalarValues ( const ModelPart::NodesContainerType rNodes,
const TVarType &  rVariable,
const bool  IsHistoricalValue,
std::ofstream &  rFileStream 
) const
protected

Writes scalar results of rNodes. Wraps the necessary synchronization-calls.

Parameters
rNodesthe nodes which is beging output
rVariableVariable of the result to be written.
IsHistoricalValuewhether the values are historical or not
rFileStreamthe file stream to which data is to be written.

◆ WriteNodalVectorValues()

template<class TVarType >
void Kratos::VtkOutput::WriteNodalVectorValues ( const ModelPart::NodesContainerType rNodes,
const TVarType &  rVariable,
const bool  IsHistoricalValue,
std::ofstream &  rFileStream 
) const
protected

Writes vector results of rNodes. Wraps the necessary synchronization-calls.

Parameters
rNodesthe nodes which is beging output
rVariableVariable of the result to be written.
IsHistoricalValuewhether the values are historical or not
rFileStreamthe file stream to which data is to be written.

◆ WriteNodesToFile()

void Kratos::VtkOutput::WriteNodesToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
) const
protectedvirtual

Write the nodes in the rModelPart.

Parameters
rModelPartmodelpart which is beging output
rFileStreamthe file stream to which data is to be written.

Reimplemented in Kratos::ParticleVtkOutput.

◆ WriteScalarContainerVariable()

template<typename TContainerType , class TVarType >
void Kratos::VtkOutput::WriteScalarContainerVariable ( const TContainerType &  rContainer,
const TVarType &  rVariable,
std::ofstream &  rFileStream 
) const
protected

Write the scalar-nonhistorical variable results of rContainer.

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
TVarTypeThe type of Variable of the entity on which the results are to be written
Parameters
rContainerthe container which is beging output
rVariableVariable of the result to be written.
rFileStreamthe file stream to which data is to be written.

◆ WriteScalarDataToFile()

template<typename TData >
void Kratos::VtkOutput::WriteScalarDataToFile ( const TData &  rData,
std::ofstream &  rFileStream 
) const
inlineprotected

Write the scalar value to the file provided, takes care of binary and ascii formats.

Template Parameters
TDataThe type of data to be written to the file stream rFileStream
Parameters
rDatadata to be written
rFileStreamthe file stream to which data is to be written.

◆ WriteScalarSolutionStepVariable()

template<typename TContainerType , class TVarType >
void Kratos::VtkOutput::WriteScalarSolutionStepVariable ( const TContainerType &  rContainer,
const TVarType &  rVariable,
std::ofstream &  rFileStream 
) const
protected

Write the scalar-historical variable results of rContainer.

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
TVarTypeThe type of Variable of the entity on which the results are to be written
Parameters
rContainerthe container which is beging output
rVariableVariable of the result to be written.
rFileStreamthe file stream to which data is to be written.

◆ WriteVectorContainerVariable()

template<typename TContainerType , class TVarType >
void Kratos::VtkOutput::WriteVectorContainerVariable ( const TContainerType &  rContainer,
const TVarType &  rVariable,
std::ofstream &  rFileStream 
) const
protected

Write the vector-nonhistorical variable results of rContainer.

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
TVarTypeThe type of Variable of the entity on which the results are to be written
Parameters
rContainerthe container which is beging output
rVariableVariable of the result to be written.
VtkDataTypetype of vtk data
rFileStreamthe file stream to which data is to be written.

◆ WriteVectorDataToFile()

template<typename TData >
void Kratos::VtkOutput::WriteVectorDataToFile ( const TData &  rData,
std::ofstream &  rFileStream 
) const
inlineprotected

Write the vector values to the file provided, takes care of binary and ascii formats.

Template Parameters
TDataThe type of data to be written to the file stream rFileStream
Parameters
rDatadata to be written
rFileStreamthe file stream to which data is to be written.

◆ WriteVectorSolutionStepVariable()

template<typename TContainerType , class TVarType >
void Kratos::VtkOutput::WriteVectorSolutionStepVariable ( const TContainerType &  rContainer,
const TVarType &  rVariable,
std::ofstream &  rFileStream 
) const
protected

Write the vector-historical variable results of rContainer.

Template Parameters
TContainerTypeThe type of container of the entity on which the results are to be written
TVarTypeThe type of Variable of the entity on which the results are to be written
Parameters
rContainerthe container which is beging output
rVariableVariable of the result to be written.
rFileStreamthe file stream to which data is to be written.

Member Data Documentation

◆ mDefaultPrecision

unsigned int Kratos::VtkOutput::mDefaultPrecision
protected

The configuration parameters.

◆ mFileFormat

VtkOutput::FileFormat Kratos::VtkOutput::mFileFormat
protected

The main model part to post process.

◆ mKratosIdToVtkId

std::unordered_map<int, int> Kratos::VtkOutput::mKratosIdToVtkId
protected

The default precision.

◆ mOutputSettings

Parameters Kratos::VtkOutput::mOutputSettings
protected

The file format considered.

◆ mpGaussToNodesProcess

IntegrationValuesExtrapolationToNodesProcess::UniquePointer Kratos::VtkOutput::mpGaussToNodesProcess
protected

If the bytes need to be swapped (endianness)

◆ mrModelPart

ModelPart& Kratos::VtkOutput::mrModelPart
protected

◆ mShouldSwap

bool Kratos::VtkOutput::mShouldSwap = false
protected

The map storing the relationship between the Kratos ID and VTK ID.


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