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::StlIO Class Reference

This class reads from STL file format and creates triangular elements in given model_part. More...

#include <stl_io.h>

Inheritance diagram for Kratos::StlIO:
Collaboration diagram for Kratos::StlIO:

Public Member Functions

Life Cycle
 StlIO (const std::filesystem::path &rFilename, Parameters ThisParameters=Parameters())
 Constructs a StlIO object using a filename. More...
 
 StlIO (Kratos::shared_ptr< std::iostream > pInputStream, Parameters ThisParameters=Parameters())
 Constructs a StlIO object using an input/output stream. More...
 
virtual ~StlIO ()
 Destructor. More...
 
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 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 WriteModelPart (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 Attributes

Protected member Variables
Parameters mParameters
 
IndexType mNextNodeId = 0
 The configuration parameters. More...
 
IndexType mNextElementId = 0
 The next node ID. More...
 
IndexType mNextConditionId = 0
 The next element ID. More...
 

Type Definitions

using GeometriesMapType = ModelPart::GeometriesMapType
 Geometries map type definition. More...
 
using NodesArrayType = Element::NodesArrayType
 The nodes array type definition. More...
 
using IndexType = std::size_t
 The index type definition. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (StlIO)
 Pointer definition of StlIO. More...
 

Operations

void ReadModelPart (ModelPart &rThisModelPart) override
 Reads a model part. More...
 
void WriteModelPart (const ModelPart &rThisModelPart) override
 Writes a model part. More...
 
static Parameters GetDefaultParameters ()
 Retrieves the default parameters. 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

This class reads from STL file format and creates triangular elements in given model_part.

The current version only reads triangles from the STL and not higher order polygons The nodes corresponging to given vertices are not collapsed A SubModelPart for each additional solid block will be created For definition STL format please check https://en.wikipedia.org/wiki/STL_(file_format) A sample file format with 3 triangles: solid 3 triangles facet normal 1.000000 0.000000 0.000000 outer loop vertex 0.1 -2.56114e-08 0.1 vertex 0.1 -0.499156 -0.0352136 vertex 0.1 -0.473406 -0.0446259 endloop endfacet facet normal 1.000000 -0.000000 0.000000 outer loop vertex 0.1 -0.473406 -0.0446259 vertex 0.1 -0.447464 -0.0534931 vertex 0.1 -2.56114e-08 0.1 endloop endfacet facet normal 1.000000 0.000000 0.000000 outer loop vertex 0.1 -0.6 0.1 vertex 0.1 -0.524702 -0.0252604 vertex 0.1 -0.499156 -0.0352136 endloop endfacet endsolid 3 triangles

Member Typedef Documentation

◆ GeometriesMapType

Geometries map type definition.

◆ IndexType

using Kratos::StlIO::IndexType = std::size_t

The index type definition.

◆ NodesArrayType

The nodes array type definition.

Constructor & Destructor Documentation

◆ StlIO() [1/2]

Kratos::StlIO::StlIO ( const std::filesystem::path &  rFilename,
Parameters  ThisParameters = Parameters() 
)

Constructs a StlIO object using a filename.

This constructor will create a StlIO object and open a file with the provided filename and open options. The default open option is read mode.

Parameters
rFilenameThe path of the file to open.
ThisParametersOptional. Additional parameters for the StlIO object. Defaults to an empty Parameters object.

◆ StlIO() [2/2]

Kratos::StlIO::StlIO ( Kratos::shared_ptr< std::iostream >  pInputStream,
Parameters  ThisParameters = Parameters() 
)

Constructs a StlIO object using an input/output stream.

This constructor will create a StlIO object using a provided input/output stream.

Parameters
pInputStreamA shared pointer to the input/output stream to use.
ThisParametersOptional. Additional parameters for the StlIO object. Defaults to an empty Parameters object.

◆ ~StlIO()

virtual Kratos::StlIO::~StlIO ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ GetDefaultParameters()

Parameters Kratos::StlIO::GetDefaultParameters ( )
static

Retrieves the default parameters.

Returns
The default parameters.

◆ Info()

std::string Kratos::StlIO::Info ( ) const
overridevirtual

Turn back information as a string.

Reimplemented from Kratos::IO.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::StlIO::KRATOS_CLASS_POINTER_DEFINITION ( StlIO  )

Pointer definition of StlIO.

◆ PrintData()

void Kratos::StlIO::PrintData ( std::ostream &  rOStream) const
overridevirtual

Print object's data.

Reimplemented from Kratos::IO.

◆ PrintInfo()

void Kratos::StlIO::PrintInfo ( std::ostream &  rOStream) const
overridevirtual

Print information about this object.

Reimplemented from Kratos::IO.

◆ ReadModelPart()

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

Reads a model part.

Reads a model part from the source and stores it in the provided model part object.

Parameters
rThisModelPartReference to the model part to read into.

Reimplemented from Kratos::IO.

◆ WriteModelPart()

void Kratos::StlIO::WriteModelPart ( const ModelPart rThisModelPart)
overridevirtual

Writes a model part.

Writes the provided model part to the destination.

Parameters
rThisModelPartConst reference to the model part to write from.

Reimplemented from Kratos::IO.

Member Data Documentation

◆ mNextConditionId

IndexType Kratos::StlIO::mNextConditionId = 0
protected

The next element ID.

◆ mNextElementId

IndexType Kratos::StlIO::mNextElementId = 0
protected

The next node ID.

◆ mNextNodeId

IndexType Kratos::StlIO::mNextNodeId = 0
protected

The configuration parameters.

◆ mParameters

Parameters Kratos::StlIO::mParameters
protected

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