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.
List of all members
Kratos::ModelPartIO Class Reference

An IO class for reading and writing a modelpart. More...

#include <model_part_io.h>

Inheritance diagram for Kratos::ModelPartIO:
Collaboration diagram for Kratos::ModelPartIO:

Public Member Functions

Life Cycle
 ModelPartIO (std::filesystem::path const &Filename, const Flags Options=IO::READ|IO::IGNORE_VARIABLES_ERROR.AsFalse()|IO::SKIP_TIMER)
 Constructor with filename. More...
 
 ModelPartIO (Kratos::shared_ptr< std::iostream > Stream, const Flags Options=IO::IGNORE_VARIABLES_ERROR.AsFalse()|IO::SKIP_TIMER)
 Constructor with stream. More...
 
 ~ModelPartIO () override
 Constructor with filenames. More...
 
Operations
bool ReadNode (NodeType &rThisNode) override
 This method reads one node. More...
 
bool ReadNodes (NodesContainerType &rThisNodes) override
 This method reads the nodes from an array of nodes. More...
 
std::size_t ReadNodesNumber () override
 This method reads the number of nodes. More...
 
void WriteNodes (NodesContainerType const &rThisNodes) override
 This method writes the nodes from an array of nodes. More...
 
void ReadProperties (Properties &rThisProperties) override
 This method reads one Properties. More...
 
void ReadProperties (PropertiesContainerType &rThisProperties) override
 This method reads the Properties from an array of Properties. More...
 
void WriteProperties (PropertiesContainerType const &rThisProperties) override
 This method writes one Properties. More...
 
void ReadGeometry (NodesContainerType &rThisNodes, GeometryType::Pointer &pThisGeometry) override
 This method reads one geometry. More...
 
void ReadGeometries (NodesContainerType &rThisNodes, GeometryContainerType &rThisGeometries) override
 This method reads an array of geometries. More...
 
std::size_t ReadGeometriesConnectivities (ConnectivitiesContainerType &rGeometriesConnectivities) override
 This method reads the geometries connectivities. More...
 
void WriteGeometries (GeometryContainerType const &rThisGeometries) override
 This method writes an array of geometries. More...
 
void ReadElement (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, Element::Pointer &pThisElement) override
 This method reads one element. More...
 
void ReadElements (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, ElementsContainerType &rThisElements) override
 This method reads an array of elements. More...
 
std::size_t ReadElementsConnectivities (ConnectivitiesContainerType &rElementsConnectivities) override
 This method reads the elements connectivities. More...
 
void WriteElements (ElementsContainerType const &rThisElements) override
 This method writes an array of elements. More...
 
void ReadConditions (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, ConditionsContainerType &rThisConditions) override
 This method reads an array of conditions. More...
 
std::size_t ReadConditionsConnectivities (ConnectivitiesContainerType &rConditionsConnectivities) override
 This method reads the conditions connectivities. More...
 
void WriteConditions (ConditionsContainerType const &rThisConditions) override
 This method writes an array of conditions. More...
 
void ReadInitialValues (ModelPart &rThisModelPart) override
 This method reads the initial values of the model part. More...
 
void ReadMesh (MeshType &rThisMesh) override
 This method reads the mesh. More...
 
void WriteMesh (MeshType &rThisMesh) override
 This method writes the mesh. More...
 
void ReadModelPart (ModelPart &rThisModelPart) override
 This method reads the model part. More...
 
void WriteModelPart (ModelPart &rThisModelPart) override
 This method writes the model part. More...
 
std::size_t ReadNodalGraph (ConnectivitiesContainerType &rAuxConnectivities) override
 Read the input file and create the nodal connectivities graph, stored in CSR format. More...
 
void DivideInputToPartitions (SizeType NumberOfPartitions, const PartitioningInfo &rPartitioningInfo) override
 This method divides a model part into partitions. More...
 
void DivideInputToPartitions (Kratos::shared_ptr< std::iostream > *pStreams, SizeType NumberOfPartitions, const PartitioningInfo &rPartitioningInfo) override
 This method divides a model part into partitions. More...
 
void SwapStreamSource (Kratos::shared_ptr< std::iostream > newStream)
 
void ReadSubModelPartElementsAndConditionsIds (std::string const &rModelPartName, std::unordered_set< SizeType > &rElementsIds, std::unordered_set< SizeType > &rConditionsIds) override
 
std::size_t ReadNodalGraphFromEntitiesList (ConnectivitiesContainerType &rAuxConnectivities, std::unordered_set< SizeType > &rElementsIds, std::unordered_set< SizeType > &rConditionsIds) override
 
Input and output
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. 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 void WriteProperties (Properties const &rThisProperties)
 This method writes one Properties. More...
 
virtual void ReadCondition (NodesContainerType &rThisNodes, PropertiesContainerType &rThisProperties, Condition::Pointer &pThisCondition)
 This method reads one condition. 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 WriteMesh (const MeshType &rThisMesh)
 This method writes the mesh. 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 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, 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...
 
 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 Member Functions

Protected Operations
virtual ModelPartIO::SizeType ReorderedNodeId (ModelPartIO::SizeType NodeId)
 
virtual ModelPartIO::SizeType ReorderedGeometryId (ModelPartIO::SizeType GeometryId)
 
virtual ModelPartIO::SizeType ReorderedElementId (ModelPartIO::SizeType ElementId)
 
virtual ModelPartIO::SizeType ReorderedConditionId (ModelPartIO::SizeType ConditionId)
 

Type Definitions

typedef IO BaseType
 
typedef BaseType::NodeType NodeType
 
typedef BaseType::MeshType MeshType
 
typedef BaseType::NodesContainerType NodesContainerType
 
typedef BaseType::PropertiesContainerType PropertiesContainerType
 
typedef BaseType::ElementsContainerType ElementsContainerType
 
typedef BaseType::ConditionsContainerType ConditionsContainerType
 
typedef BaseType::ConnectivitiesContainerType ConnectivitiesContainerType
 
typedef std::vector< std::ostream * > OutputFilesContainerType
 
typedef std::size_t SizeType
 
 KRATOS_CLASS_POINTER_DEFINITION (ModelPartIO)
 Pointer definition of ModelPartIO. 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...
 

Additional Inherited Members

- 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
 

Detailed Description

An IO class for reading and writing a modelpart.

This class reads and writes all modelpart data including the meshes.

Member Typedef Documentation

◆ BaseType

◆ ConditionsContainerType

◆ ConnectivitiesContainerType

◆ ElementsContainerType

◆ MeshType

◆ NodesContainerType

◆ NodeType

◆ OutputFilesContainerType

typedef std::vector<std::ostream*> Kratos::ModelPartIO::OutputFilesContainerType

◆ PropertiesContainerType

◆ SizeType

typedef std::size_t Kratos::ModelPartIO::SizeType

Constructor & Destructor Documentation

◆ ModelPartIO() [1/2]

Kratos::ModelPartIO::ModelPartIO ( std::filesystem::path const &  Filename,
const Flags  Options = IO::READ | IO::IGNORE_VARIABLES_ERROR.AsFalse() | IO::SKIP_TIMER 
)

Constructor with filename.

Constructor with filenames.

◆ ModelPartIO() [2/2]

Kratos::ModelPartIO::ModelPartIO ( Kratos::shared_ptr< std::iostream >  Stream,
const Flags  Options = IO::IGNORE_VARIABLES_ERROR.AsFalse() | IO::SKIP_TIMER 
)

Constructor with stream.

◆ ~ModelPartIO()

Kratos::ModelPartIO::~ModelPartIO ( )
override

Constructor with filenames.

Destructor.

Member Function Documentation

◆ DivideInputToPartitions() [1/2]

void Kratos::ModelPartIO::DivideInputToPartitions ( Kratos::shared_ptr< std::iostream > *  pStreams,
SizeType  NumberOfPartitions,
const PartitioningInfo rPartitioningInfo 
)
overridevirtual

This method divides a model part into partitions.

Parameters
pStreamsThe stream pointer
NumberOfPartitionsThe number of partitions
rPartitioningInfoInformation about partitioning of entities

Reimplemented from Kratos::IO.

◆ DivideInputToPartitions() [2/2]

void Kratos::ModelPartIO::DivideInputToPartitions ( SizeType  NumberOfPartitions,
const PartitioningInfo rPartitioningInfo 
)
overridevirtual

This method divides a model part into partitions.

Parameters
NumberOfPartitionsThe number of partitions
rPartitioningInfoInformation about partitioning of entities

Reimplemented from Kratos::IO.

◆ Info()

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

Turn back information as a string.

Reimplemented from Kratos::IO.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::ModelPartIO::KRATOS_CLASS_POINTER_DEFINITION ( ModelPartIO  )

Pointer definition of ModelPartIO.

◆ PrintData()

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

Print object's data.

Reimplemented from Kratos::IO.

◆ PrintInfo()

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

Print information about this object.

Reimplemented from Kratos::IO.

◆ ReadConditions()

void Kratos::ModelPartIO::ReadConditions ( NodesContainerType rThisNodes,
PropertiesContainerType rThisProperties,
ConditionsContainerType rThisConditions 
)
overridevirtual

This method reads an array of conditions.

Parameters
rThisNodesThe nodes constituying the condition
rThisPropertiesThe Properties of the condition
rThisConditionsThe array of conditions

Reimplemented from Kratos::IO.

◆ ReadConditionsConnectivities()

std::size_t Kratos::ModelPartIO::ReadConditionsConnectivities ( ConnectivitiesContainerType rConditionsConnectivities)
overridevirtual

This method reads the conditions connectivities.

Parameters
rConditionsConnectivitiesThe conditions connectivities
Returns
The number of conditions

Reimplemented from Kratos::IO.

◆ ReadElement()

void Kratos::ModelPartIO::ReadElement ( NodesContainerType rThisNodes,
PropertiesContainerType rThisProperties,
Element::Pointer &  pThisElement 
)
overridevirtual

This method reads one element.

Parameters
rThisNodesThe nodes constituying the element
rThisPropertiesThe Properties of the element
pThisElementsThe pointer to the element

Reimplemented from Kratos::IO.

◆ ReadElements()

void Kratos::ModelPartIO::ReadElements ( NodesContainerType rThisNodes,
PropertiesContainerType rThisProperties,
ElementsContainerType rThisElements 
)
overridevirtual

This method reads an array of elements.

Parameters
rThisNodesThe nodes constituying the element
rThisPropertiesThe Properties of the element
rThisElementThe array of elements

Reimplemented from Kratos::IO.

◆ ReadElementsConnectivities()

std::size_t Kratos::ModelPartIO::ReadElementsConnectivities ( ConnectivitiesContainerType rElementsConnectivities)
overridevirtual

This method reads the elements connectivities.

Parameters
rElementsConnectivitiesThe elements connectivities
Returns
The number of elements

Reimplemented from Kratos::IO.

◆ ReadGeometries()

void Kratos::ModelPartIO::ReadGeometries ( NodesContainerType rThisNodes,
GeometryContainerType rThisGeometries 
)
overridevirtual

This method reads an array of geometries.

Parameters
rThisNodesThe nodes constituying the geometry
rThisGeometryThe array of geometries

Reimplemented from Kratos::IO.

◆ ReadGeometriesConnectivities()

std::size_t Kratos::ModelPartIO::ReadGeometriesConnectivities ( ConnectivitiesContainerType rGeometriesConnectivities)
overridevirtual

This method reads the geometries connectivities.

Parameters
rGeometriesConnectivitiesThe geometries connectivities
Returns
The number of geometries

Reimplemented from Kratos::IO.

◆ ReadGeometry()

void Kratos::ModelPartIO::ReadGeometry ( NodesContainerType rThisNodes,
GeometryType::Pointer &  pThisGeometry 
)
overridevirtual

This method reads one geometry.

Parameters
rThisNodesThe nodes constituying the geometry
pThisGeometriesThe pointer to the geometry

Reimplemented from Kratos::IO.

◆ ReadInitialValues()

void Kratos::ModelPartIO::ReadInitialValues ( ModelPart rThisModelPart)
overridevirtual

This method reads the initial values of the model part.

Parameters
rThisModelPartThe model part with the initial values to be read

Reimplemented from Kratos::IO.

◆ ReadMesh()

void Kratos::ModelPartIO::ReadMesh ( MeshType rThisMesh)
overridevirtual

This method reads the mesh.

Parameters
rThisMeshThe mesh to be read

Reimplemented from Kratos::IO.

◆ ReadModelPart()

void Kratos::ModelPartIO::ReadModelPart ( ModelPart rThisModelPart)
overridevirtual

This method reads the model part.

Parameters
rThisModelPartThe model part to be read

Reimplemented from Kratos::IO.

◆ ReadNodalGraph()

std::size_t Kratos::ModelPartIO::ReadNodalGraph ( ConnectivitiesContainerType rAuxConnectivities)
overridevirtual

Read the input file and create the nodal connectivities graph, stored in CSR format.

This function produces input for Metis' nodal graph partitioning algorithms. The nodal graph is stored as a (compressed) matrix where index (i,j) is non-zero if there is an edge in the mesh joining nodes i and j (note that nodes are numbered from zero here, to make integration with Metis simpler). After call, will point to C array of size NumNodes+1 containing the first CSR array: entries related to node k are stored between positions (*NodeIndices)[k] and (*NodeIndices)[k+1] of *NodeConnectivities.

Parameters
rAuxConnectivitiesAfter call, will point to a C array of size (*NodeIndices)[NumNodes]. entries between (*NodeIndices)[k] and (*NodeIndices)[k+1] are a list of all nodes connected to node k (counting from 0).
Returns
Number of nodes.

Reimplemented from Kratos::IO.

◆ ReadNodalGraphFromEntitiesList()

std::size_t Kratos::ModelPartIO::ReadNodalGraphFromEntitiesList ( ConnectivitiesContainerType rAuxConnectivities,
std::unordered_set< SizeType > &  rElementsIds,
std::unordered_set< SizeType > &  rConditionsIds 
)
overridevirtual

Reimplemented from Kratos::IO.

◆ ReadNode()

bool Kratos::ModelPartIO::ReadNode ( NodeType rThisNode)
overridevirtual

This method reads one node.

Parameters
rThisNodeThe node to be read

Reimplemented from Kratos::IO.

◆ ReadNodes()

bool Kratos::ModelPartIO::ReadNodes ( NodesContainerType rThisNodes)
overridevirtual

This method reads the nodes from an array of nodes.

Parameters
rThisNodesThe array of nodes to be read

Reimplemented from Kratos::IO.

◆ ReadNodesNumber()

std::size_t Kratos::ModelPartIO::ReadNodesNumber ( )
overridevirtual

This method reads the number of nodes.

Returns
The number of nodes

Reimplemented from Kratos::IO.

◆ ReadProperties() [1/2]

void Kratos::ModelPartIO::ReadProperties ( Properties rThisProperties)
overridevirtual

This method reads one Properties.

Parameters
rThisPropertiesThe Properties to be read

Reimplemented from Kratos::IO.

◆ ReadProperties() [2/2]

void Kratos::ModelPartIO::ReadProperties ( PropertiesContainerType rThisProperties)
overridevirtual

This method reads the Properties from an array of Properties.

Parameters
rThisPropertiesThe array of Properties to be read

Reimplemented from Kratos::IO.

◆ ReadSubModelPartElementsAndConditionsIds()

void Kratos::ModelPartIO::ReadSubModelPartElementsAndConditionsIds ( std::string const &  rModelPartName,
std::unordered_set< SizeType > &  rElementsIds,
std::unordered_set< SizeType > &  rConditionsIds 
)
overridevirtual

Reimplemented from Kratos::IO.

◆ ReorderedConditionId()

ModelPartIO::SizeType Kratos::ModelPartIO::ReorderedConditionId ( ModelPartIO::SizeType  ConditionId)
protectedvirtual

◆ ReorderedElementId()

ModelPartIO::SizeType Kratos::ModelPartIO::ReorderedElementId ( ModelPartIO::SizeType  ElementId)
protectedvirtual

◆ ReorderedGeometryId()

ModelPartIO::SizeType Kratos::ModelPartIO::ReorderedGeometryId ( ModelPartIO::SizeType  GeometryId)
protectedvirtual

◆ ReorderedNodeId()

ModelPartIO::SizeType Kratos::ModelPartIO::ReorderedNodeId ( ModelPartIO::SizeType  NodeId)
protectedvirtual

◆ SwapStreamSource()

void Kratos::ModelPartIO::SwapStreamSource ( Kratos::shared_ptr< std::iostream >  newStream)

◆ WriteConditions()

void Kratos::ModelPartIO::WriteConditions ( ConditionsContainerType const &  rThisConditions)
overridevirtual

This method writes an array of conditions.

Parameters
rThisConditionsThe array of conditions to be written

Reimplemented from Kratos::IO.

◆ WriteElements()

void Kratos::ModelPartIO::WriteElements ( ElementsContainerType const &  rThisElements)
overridevirtual

This method writes an array of elements.

Parameters
rThisElementsThe array of elements to be written

Reimplemented from Kratos::IO.

◆ WriteGeometries()

void Kratos::ModelPartIO::WriteGeometries ( GeometryContainerType const &  rThisGeometries)
overridevirtual

This method writes an array of geometries.

Parameters
rThisGeometriesThe array of geometries to be written

Reimplemented from Kratos::IO.

◆ WriteMesh()

void Kratos::ModelPartIO::WriteMesh ( MeshType rThisMesh)
overridevirtual

This method writes the mesh.

Parameters
rThisMeshThe mesh to be written

Reimplemented from Kratos::IO.

◆ WriteModelPart()

void Kratos::ModelPartIO::WriteModelPart ( ModelPart rThisModelPart)
overridevirtual

This method writes the model part.

Parameters
rThisModelPartThe model part to be written

Reimplemented from Kratos::IO.

◆ WriteNodes()

void Kratos::ModelPartIO::WriteNodes ( NodesContainerType const &  rThisNodes)
overridevirtual

This method writes the nodes from an array of nodes.

Parameters
rThisNodesThe array of nodes to be written

Reimplemented from Kratos::IO.

◆ WriteProperties() [1/3]

virtual void Kratos::IO::WriteProperties
inline

This method writes one Properties.

Parameters
rThisPropertiesThe Properties to be written

◆ WriteProperties() [2/3]

virtual void Kratos::IO::WriteProperties
inline

This method writes the Properties from an array of Properties.

Parameters
rThisPropertiesThe array of Properties to be written

◆ WriteProperties() [3/3]

void Kratos::ModelPartIO::WriteProperties ( PropertiesContainerType const &  rThisProperties)
overridevirtual

This method writes one Properties.

Parameters
rThisPropertiesThe Properties to be written

Reimplemented from Kratos::IO.


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