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

Class collecting a set of free-floating utility functions for querying and mutating ModelPart s. More...

#include <model_part_utils.h>

Collaboration diagram for Kratos::ModelPartUtils:

Public Types

Type definitions
using IndexType = std::size_t
 

Static Public Member Functions

template<Globals::DataLocation TLocation>
static const auto & GetContainer (const ModelPart &rModelPart)
 Templated interface for getting nodes, elements, conditions or ProcessInfo from a ModelPart. More...
 
template<Globals::DataLocation TLocation>
static auto & GetContainer (ModelPart &rModelPart)
 Templated interface for getting nodes, elements, conditions or ProcessInfo from a ModelPart. More...
 
Static operations
static std::vector< ModelPart * > GetModelPartsWithCommonReferenceEntities (const std::vector< ModelPart * > &rExaminedModelPartsList, const std::vector< ModelPart * > &rReferenceModelParts, const bool AreNodesConsidered, const bool AreConditionsConsidered, const bool AreElementsConsidered, const bool AreNeighboursConsidered, const IndexType EchoLevel=0)
 Get Newly Created or Existing Model Parts List With Common Reference Entities Between Reference List And Examined List. More...
 
static void RemoveModelPartsWithCommonReferenceEntitiesBetweenReferenceListAndExaminedList (const std::vector< ModelPart * > rModelParts)
 Removes automatically generated model parts. More...
 
static void LogModelPartStatus (ModelPart &rModelPart, const std::string &rStatus)
 
static std::vector< std::string > GetModelPartStatusLog (ModelPart &rModelPart)
 
static bool CheckModelPartStatus (const ModelPart &rModelPart, const std::string &rStatus)
 

Detailed Description

Class collecting a set of free-floating utility functions for querying and mutating ModelPart s.

Member Typedef Documentation

◆ IndexType

using Kratos::ModelPartUtils::IndexType = std::size_t

Member Function Documentation

◆ CheckModelPartStatus()

bool Kratos::ModelPartUtils::CheckModelPartStatus ( const ModelPart rModelPart,
const std::string &  rStatus 
)
static

◆ GetContainer() [1/2]

template<Globals::DataLocation TLocation>
static const auto& Kratos::ModelPartUtils::GetContainer ( const ModelPart rModelPart)
inlinestatic

Templated interface for getting nodes, elements, conditions or ProcessInfo from a ModelPart.

◆ GetContainer() [2/2]

template<Globals::DataLocation TLocation>
static auto& Kratos::ModelPartUtils::GetContainer ( ModelPart rModelPart)
inlinestatic

Templated interface for getting nodes, elements, conditions or ProcessInfo from a ModelPart.

◆ GetModelPartStatusLog()

std::vector< std::string > Kratos::ModelPartUtils::GetModelPartStatusLog ( ModelPart rModelPart)
static

◆ GetModelPartsWithCommonReferenceEntities()

std::vector< ModelPart * > Kratos::ModelPartUtils::GetModelPartsWithCommonReferenceEntities ( const std::vector< ModelPart * > &  rExaminedModelPartsList,
const std::vector< ModelPart * > &  rReferenceModelParts,
const bool  AreNodesConsidered,
const bool  AreConditionsConsidered,
const bool  AreElementsConsidered,
const bool  AreNeighboursConsidered,
const IndexType  EchoLevel = 0 
)
static

Get Newly Created or Existing Model Parts List With Common Reference Entities Between Reference List And Examined List.

This method returns newly created or gets an existing sub-model part in each model part in rReferenceModelParts with entities common between that model part and all the model parts in rExaminedModelPartsList with following entities.

  1. If AreNodesConsidered is made to true, then common nodes are found and added to the resulting sub-model part.
  2. If AreConditionsConsidered is made to true, then common conditions are found and added to the resulting sub-model part. All the nodes belonging to added conditions are also added to the sub-model part.
  3. If AreElementsConsidered is made to true, then common elements are found and added to the resulting sub-model part. All the nodes belonging to added elements are also added to the sub-model part.
  4. If AreNeighboursConsidered is made to true, then first common nodes are found. Then neighbour conditions (if AreConditionsConsidered is set to true) and elements (if AreElementsConsidered is set to true) for those common nodes are found and added to the sub-model part. All nodes belonging to added conditions and elements are also added to the sub-model part.

The created sub-model part is only populated with the entities from the refrence model part. Hence, to find common conditions and elements, each entity from each model part in rExaminedModelPartsList is searched within each of the model parts in rReferenceModelParts.

This method creates the sub-model parts with unique name generated for all the input arguments. If it finds an existing sub-model part with the same name, then it is retrieved. Hence this method only creates these model parts with expensive operations only one. If it is required to force create, then the sub-model parts should be removed. All the sub-model parts created by this method have names starting with "<OPTIMIZATION_APP_AUTO>" so it is easier to search and remove them if required.

This method keeps the communicator types, process info, properties and tables as same as the rReferenceModelParts. The local mesh, interface mesh and ghost meshes are properly updated. Hence this method is compatible with OpenMP and MPI.

This method does not create or destroy nodes, conditions and elements.

Parameters
rExaminedModelPartsListList of input model parts where the entities are searched between.
rReferenceModelPartsList of reference model parts where common entities are added to output model parts.
AreNodesConsideredIf true, common nodes from reference model parts are added to output model parts.
AreConditionsConsideredIf true, common conditions from reference model parts are added to output model parts.
AreElementsConsideredIf true, common elements from reference model parts are added to output model parts.
AreNeighboursConsideredIf true, neighbour conditions and elements from reference model parts for common nodes are added to output model parts.
EchoLevelEcho level for printing info.
Returns
std::vector<ModelPart*> List of output model parts.

◆ LogModelPartStatus()

void Kratos::ModelPartUtils::LogModelPartStatus ( ModelPart rModelPart,
const std::string &  rStatus 
)
static

◆ RemoveModelPartsWithCommonReferenceEntitiesBetweenReferenceListAndExaminedList()

void Kratos::ModelPartUtils::RemoveModelPartsWithCommonReferenceEntitiesBetweenReferenceListAndExaminedList ( const std::vector< ModelPart * >  rModelParts)
static

Removes automatically generated model parts.

This method removes all the automatically generted sub model parts in the given list of rModelParts

Parameters
rModelPartsThe list of model parts to look for automatically generated sub model parts.

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