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 | Static Public Member Functions | Protected Member Functions | List of all members
Kratos::ParticleVtkOutput Class Reference

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

#include <particle_vtk_output.h>

Inheritance diagram for Kratos::ParticleVtkOutput:
Collaboration diagram for Kratos::ParticleVtkOutput:

Public Types

using SizeType = std::size_t
 Definition of the size type. More...
 
using IndexType = std::size_t
 Definition of the index type. More...
 
- Public Types inherited from Kratos::VtkOutput
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 (ParticleVtkOutput)
 Pointer definition of ParticleVtkOutput. 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
 ParticleVtkOutput (ModelPart &rModelPart, Parameters ThisParameters=Parameters(R"({})"))
 Constructor by passing a ModelPart and Kratos-Parameters. More...
 
- Public Member Functions inherited from Kratos::VtkOutput
 KRATOS_CLASS_POINTER_DEFINITION (VtkOutput)
 Pointer definition of VtkOutput. More...
 
 VtkOutput (ModelPart &rModelPart, Parameters ThisParameters=Parameters(R"({})"))
 Constructor by passing a ModelPart and Kratos-Parameters. More...
 
virtual ~VtkOutput ()=default
 Destructor. More...
 
void PrintOutput (const std::string &rOutputFilename="")
 Prints mrModelPart in VTK format together with the results. 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)
 

Static Public Member Functions

static Parameters GetDefaultParameters ()
 This method provides the defaults parameters to avoid conflicts between the different constructors. More...
 
- Static Public Member Functions inherited from Kratos::VtkOutput
static Parameters GetDefaultParameters ()
 This method provides the defaults parameters to avoid conflicts between the different constructors. More...
 

Protected Member Functions

void WriteNodesToFile (const ModelPart &rModelPart, std::ofstream &rFileStream) const override
 Write the nodes in the rModelPart. 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...
 
void WriteConditionsAndElementsToFile (const ModelPart &rModelPart, std::ofstream &rFileStream) const override
 Write the elements and conditions in rModelPart. IMPORTANT : Need to write them together because of the CELLS block in VTK format. More...
 
void WriteNodalResultsToFile (const ModelPart &rModelPart, std::ofstream &rFileStream) override
 Write the results on the nodes. More...
 
- Protected Member Functions inherited from Kratos::VtkOutput
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...
 
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...
 
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...
 

Additional Inherited Members

- Protected Types inherited from Kratos::VtkOutput
enum class  EntityType { ELEMENT , CONDITION , AUTOMATIC , NONE }
 
- Protected Attributes inherited from Kratos::VtkOutput
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...
 

Detailed Description

ParticleVtkOutput 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

◆ IndexType

Definition of the index type.

◆ SizeType

Definition of the size type.

Constructor & Destructor Documentation

◆ ParticleVtkOutput()

Kratos::ParticleVtkOutput::ParticleVtkOutput ( 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

Member Function Documentation

◆ GetDefaultParameters()

Parameters Kratos::ParticleVtkOutput::GetDefaultParameters ( )
static

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

◆ Info()

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

Turn back information as a string.

Reimplemented from Kratos::VtkOutput.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::ParticleVtkOutput::KRATOS_CLASS_POINTER_DEFINITION ( ParticleVtkOutput  )

Pointer definition of ParticleVtkOutput.

◆ PrintData()

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

Print object's data.

Reimplemented from Kratos::VtkOutput.

◆ PrintInfo()

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

Prints information about the class.

Parameters
rOStreamostream object where output is printed

Reimplemented from Kratos::VtkOutput.

◆ WriteCellType()

template<typename TContainerType >
void Kratos::ParticleVtkOutput::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.

◆ WriteConditionsAndElementsToFile()

void Kratos::ParticleVtkOutput::WriteConditionsAndElementsToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
) const
overrideprotectedvirtual

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 from Kratos::VtkOutput.

◆ WriteConnectivity()

template<typename TContainerType >
void Kratos::ParticleVtkOutput::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.

◆ WriteNodalResultsToFile()

void Kratos::ParticleVtkOutput::WriteNodalResultsToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
)
overrideprotectedvirtual

Write the results on the nodes.

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

Reimplemented from Kratos::VtkOutput.

◆ WriteNodesToFile()

void Kratos::ParticleVtkOutput::WriteNodesToFile ( const ModelPart rModelPart,
std::ofstream &  rFileStream 
) const
overrideprotectedvirtual

Write the nodes in the rModelPart.

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

Reimplemented from Kratos::VtkOutput.


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