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

This utility includes auxiliar methods not included in the model part to avoid increase more than necessary the API. More...

#include <auxiliar_model_part_utilities.h>

Collaboration diagram for Kratos::AuxiliarModelPartUtilities:

Public Member Functions

Life Cycle
 AuxiliarModelPartUtilities (ModelPart &rModelPart)
 
virtual ~AuxiliarModelPartUtilities ()=default
 

Type Definitions

using DataLocation = Globals::DataLocation
 
 KRATOS_CLASS_POINTER_DEFINITION (AuxiliarModelPartUtilities)
 Counted pointer of AuxiliarModelPartUtilities. More...
 

Operations

void RecursiveEnsureModelPartOwnsProperties (const bool RemovePreviousProperties=true)
 This method ensured that the properties of elements and conditions are on the model part (it does recursively in all model parts) More...
 
void EnsureModelPartOwnsProperties (const bool RemovePreviousProperties=true)
 This method ensured that the properties of elements and conditions are on the model part. More...
 
void RemoveElementAndBelongings (IndexType ElementId, Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove the element with given Id from mesh with ThisIndex in this modelpart and all its subs. More...
 
void RemoveElementAndBelongings (Element &rThisElement, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given element from mesh with ThisIndex in this modelpart and all its subs. More...
 
void RemoveElementAndBelongings (Element::Pointer pThisElement, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given element from mesh with ThisIndex in this modelpart and all its subs. More...
 
void RemoveElementAndBelongingsFromAllLevels (IndexType ElementId, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove the element with given Id from mesh with ThisIndex in parents, itself and children. More...
 
void RemoveElementAndBelongingsFromAllLevels (Element &rThisElement, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given element from mesh with ThisIndex in parents, itself and children. More...
 
void RemoveElementAndBelongingsFromAllLevels (Element::Pointer pThisElement, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given element from mesh with ThisIndex in parents, itself and children. More...
 
void RemoveElementsAndBelongings (Flags IdentifierFlag=TO_ERASE)
 It erases all elements identified by "IdentifierFlag" by removing the pointer. More...
 
void RemoveElementsAndBelongingsFromAllLevels (const Flags IdentifierFlag=TO_ERASE)
 It erases all elements identified by "IdentifierFlag" by removing the pointer. More...
 
void RemoveConditionAndBelongings (IndexType ConditionId, Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove the condition with given Id from mesh with ThisIndex in this modelpart and all its subs. More...
 
void RemoveConditionAndBelongings (Condition &ThisCondition, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given condition from mesh with ThisIndex in this modelpart and all its subs. More...
 
void RemoveConditionAndBelongings (Condition::Pointer pThisCondition, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given condition from mesh with ThisIndex in this modelpart and all its subs. This method removes belonging entities too. More...
 
void RemoveConditionAndBelongingsFromAllLevels (IndexType ConditionId, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove the condition with given Id from mesh with ThisIndex in parents, itself and children. More...
 
void RemoveConditionAndBelongingsFromAllLevels (Condition &rThisCondition, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given condition from mesh with ThisIndex in parents, itself and children. More...
 
void RemoveConditionAndBelongingsFromAllLevels (Condition::Pointer pThisCondition, const Flags IdentifierFlag=TO_ERASE, IndexType ThisIndex=0)
 Remove given condition from mesh with ThisIndex in parents, itself and children. More...
 
void RemoveConditionsAndBelongings (Flags IdentifierFlag=TO_ERASE)
 It erases all conditions identified by "IdentifierFlag" by removing the pointer. More...
 
void RemoveConditionsAndBelongingsFromAllLevels (const Flags IdentifierFlag=TO_ERASE)
 It erases all conditions identified by "IdentifierFlag" by removing the pointer. More...
 
void RemoveOrphanNodesFromSubModelParts ()
 This method removed nodes from submodelparts not contained neither in the elements or conditions. More...
 
template<class TContainerType >
void GetScalarData (const Variable< typename TContainerType::value_type > &rVariable, const DataLocation DataLoc, TContainerType &data) const
 To Export a Scalar data (Double/int/...) More...
 
template<class TContainerType , class TVarType >
void GetVectorData (const Variable< TVarType > &rVariable, const DataLocation DataLoc, TContainerType &data) const
 To Export a Vector data (std::vector/array/..) More...
 
template<class TContainerType >
void SetScalarData (const Variable< typename TContainerType::value_type > &rVariable, const DataLocation DataLoc, const TContainerType &rData)
 To Import a Scalar data (Double/int/...) More...
 
template<class TContainerType , class TVarType >
void SetVectorData (const Variable< TVarType > &rVariable, const DataLocation DataLoc, const TContainerType &rData)
 To Import a Vector data (std::vector/array/..) More...
 
ModelPartDeepCopyModelPart (const std::string &rNewModelPartName, Model *pModel=nullptr)
 This method deep copies a whole model part. More...
 
template<class TClassContainer , class TReferenceClassContainer >
void DeepCopyEntities (ModelPart &rModelPart, TClassContainer &rEntities, TReferenceClassContainer &rReferenceEntities, std::unordered_map< Geometry< Node >::Pointer, Geometry< Node >::Pointer > &rGeometryPointerDatabase)
 This method deep copies a entities. More...
 
virtual std::string Info () const
 Turn back information as a string. More...
 
virtual void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
virtual void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 
static void CopySubModelPartStructure (const ModelPart &rModelPartToCopyFromIt, ModelPart &rModelPartToCopyIntoIt)
 This method copies the structure of submodelparts. More...
 

Detailed Description

This utility includes auxiliar methods not included in the model part to avoid increase more than necessary the API.

Todo:
Typo, Auxiliar is not English, it is Auxiliary, please replace it.
Author
Vicente Mataix Ferrandiz

Member Typedef Documentation

◆ DataLocation

Constructor & Destructor Documentation

◆ AuxiliarModelPartUtilities()

Kratos::AuxiliarModelPartUtilities::AuxiliarModelPartUtilities ( ModelPart rModelPart)
inline

The default constructor

◆ ~AuxiliarModelPartUtilities()

virtual Kratos::AuxiliarModelPartUtilities::~AuxiliarModelPartUtilities ( )
virtualdefault

Member Function Documentation

◆ CopySubModelPartStructure()

void Kratos::AuxiliarModelPartUtilities::CopySubModelPartStructure ( const ModelPart rModelPartToCopyFromIt,
ModelPart rModelPartToCopyIntoIt 
)
static

This method copies the structure of submodelparts.

Parameters
rModelPartToCopyFromItThe model part to copy from it
rModelPartToCopyIntoItThe model part where to copy the structure of the submodelparts

◆ DeepCopyEntities()

template<class TClassContainer , class TReferenceClassContainer >
void Kratos::AuxiliarModelPartUtilities::DeepCopyEntities ( ModelPart rModelPart,
TClassContainer &  rEntities,
TReferenceClassContainer &  rReferenceEntities,
std::unordered_map< Geometry< Node >::Pointer, Geometry< Node >::Pointer > &  rGeometryPointerDatabase 
)
inline

This method deep copies a entities.

Only works with Element and Condition due to the lack of consistency of the entities Clone methods

Parameters
rModelPartThe model part to copy the entities
rEntitiesThe entities to be copied
rReferenceEntitiesThe entities to be copied
rGeometryPointerDatabaseThe database of geometries
Template Parameters
TClassContainerrEntities type
TReferenceClassContainerrReferenceEntities type

◆ DeepCopyModelPart()

ModelPart & Kratos::AuxiliarModelPartUtilities::DeepCopyModelPart ( const std::string &  rNewModelPartName,
Model pModel = nullptr 
)

This method deep copies a whole model part.

When a pointer to Model is provided the provided Model will be considered for the copy, otherwise the Model of the current ModelPart will be considered. The last is the default behaviour. This is deep copy, meaning that every entity is deep copied, so created from scratch. The only thing that would be equal will be the Model if not custom Model is provided

Parameters
rNewModelPartNameThe name of the new model part
pModelThe pointer to the Model that will host the new ModelPart, if nullptr, the current Model will be used.
Returns
The deep copied model part

We will copy the member variables of the model part one by one

◆ EnsureModelPartOwnsProperties()

void Kratos::AuxiliarModelPartUtilities::EnsureModelPartOwnsProperties ( const bool  RemovePreviousProperties = true)

This method ensured that the properties of elements and conditions are on the model part.

Parameters
RemovePreviousPropertiesIf we clear previous properties and ensure only the properties existing in the elements and conditions (true by default)

◆ GetScalarData()

template<class TContainerType >
void Kratos::AuxiliarModelPartUtilities::GetScalarData ( const Variable< typename TContainerType::value_type > &  rVariable,
const DataLocation  DataLoc,
TContainerType &  data 
) const
inline

To Export a Scalar data (Double/int/...)

◆ GetVectorData()

template<class TContainerType , class TVarType >
void Kratos::AuxiliarModelPartUtilities::GetVectorData ( const Variable< TVarType > &  rVariable,
const DataLocation  DataLoc,
TContainerType &  data 
) const
inline

To Export a Vector data (std::vector/array/..)

◆ Info()

virtual std::string Kratos::AuxiliarModelPartUtilities::Info ( ) const
inlinevirtual

Turn back information as a string.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::AuxiliarModelPartUtilities::KRATOS_CLASS_POINTER_DEFINITION ( AuxiliarModelPartUtilities  )

Counted pointer of AuxiliarModelPartUtilities.

◆ PrintData()

virtual void Kratos::AuxiliarModelPartUtilities::PrintData ( std::ostream &  rOStream) const
inlinevirtual

Print object's data.

◆ PrintInfo()

virtual void Kratos::AuxiliarModelPartUtilities::PrintInfo ( std::ostream &  rOStream) const
inlinevirtual

Print information about this object.

◆ RecursiveEnsureModelPartOwnsProperties()

void Kratos::AuxiliarModelPartUtilities::RecursiveEnsureModelPartOwnsProperties ( const bool  RemovePreviousProperties = true)

This method ensured that the properties of elements and conditions are on the model part (it does recursively in all model parts)

Parameters
RemovePreviousPropertiesIf we clear previous properties and ensure only the properties existing in the elements and conditions (true by default)

◆ RemoveConditionAndBelongings() [1/3]

void Kratos::AuxiliarModelPartUtilities::RemoveConditionAndBelongings ( Condition ThisCondition,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given condition from mesh with ThisIndex in this modelpart and all its subs.

This method removes belonging entities too. This means that if the condition has nodes defining an element, and the nodes defining that element are removed the element is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
rThisConditionThe reference to the condition to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveConditionAndBelongings() [2/3]

void Kratos::AuxiliarModelPartUtilities::RemoveConditionAndBelongings ( Condition::Pointer  pThisCondition,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given condition from mesh with ThisIndex in this modelpart and all its subs. This method removes belonging entities too.

The method check that when removing the nodes doesn't affect to other entities

Parameters
pThisConditionThe pointer to the condition to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveConditionAndBelongings() [3/3]

void Kratos::AuxiliarModelPartUtilities::RemoveConditionAndBelongings ( IndexType  ConditionId,
Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove the condition with given Id from mesh with ThisIndex in this modelpart and all its subs.

This method removes belonging entities too. This means that if the condition has nodes defining an element, and the nodes defining that element are removed the element is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
ConditionIdThe ID of the condition to remove
IdentifierFlagThe flag that identifies the entities to removeentities too
ThisIndexThe index of the mesh where remove the entity

◆ RemoveConditionAndBelongingsFromAllLevels() [1/3]

void Kratos::AuxiliarModelPartUtilities::RemoveConditionAndBelongingsFromAllLevels ( Condition rThisCondition,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given condition from mesh with ThisIndex in parents, itself and children.

This method removes belonging entities too. This means that if the condition has nodes defining an element, and the nodes defining that element are removed the element is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
rThisConditionThe reference to the condition to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveConditionAndBelongingsFromAllLevels() [2/3]

void Kratos::AuxiliarModelPartUtilities::RemoveConditionAndBelongingsFromAllLevels ( Condition::Pointer  pThisCondition,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given condition from mesh with ThisIndex in parents, itself and children.

This method removes belonging entities too. This means that if the condition has nodes defining an element, and the nodes defining that element are removed the element is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
pThisConditionThe pointer to the condition to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveConditionAndBelongingsFromAllLevels() [3/3]

void Kratos::AuxiliarModelPartUtilities::RemoveConditionAndBelongingsFromAllLevels ( IndexType  ConditionId,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove the condition with given Id from mesh with ThisIndex in parents, itself and children.

This method removes belonging entities too. This means that if the condition has nodes defining an element, and the nodes defining that element are removed the element is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
ConditionIdThe ID of the condition to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveConditionsAndBelongings()

void Kratos::AuxiliarModelPartUtilities::RemoveConditionsAndBelongings ( Flags  IdentifierFlag = TO_ERASE)

It erases all conditions identified by "IdentifierFlag" by removing the pointer.

This method removes belonging entities too. This means that if the condition has nodes defining an element, and the nodes defining that element are removed the element is removed too Basically the method checks that when removing the nodes doesn't affect to other entities Pointers are erased from this level downwards nodes will be automatically destructured when no pointer is left to them

Parameters
IdentifierFlagThe flag that identifies the entities to remove

◆ RemoveConditionsAndBelongingsFromAllLevels()

void Kratos::AuxiliarModelPartUtilities::RemoveConditionsAndBelongingsFromAllLevels ( const Flags  IdentifierFlag = TO_ERASE)

It erases all conditions identified by "IdentifierFlag" by removing the pointer.

This method removes belonging entities too. This means that if the condition has nodes defining an element, and the nodes defining that element are removed the element is removed too Basically the method checks that when removing the nodes doesn't affect to other entities Pointers are erased from this level downwards nodes will be automatically destructured when no pointer is left to them

Parameters
IdentifierFlagThe flag that identifies the entities to remove

◆ RemoveElementAndBelongings() [1/3]

void Kratos::AuxiliarModelPartUtilities::RemoveElementAndBelongings ( Element rThisElement,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given element from mesh with ThisIndex in this modelpart and all its subs.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
rThisElementThe reference of the element
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveElementAndBelongings() [2/3]

void Kratos::AuxiliarModelPartUtilities::RemoveElementAndBelongings ( Element::Pointer  pThisElement,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given element from mesh with ThisIndex in this modelpart and all its subs.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
pThisElementThe pointer to the element to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveElementAndBelongings() [3/3]

void Kratos::AuxiliarModelPartUtilities::RemoveElementAndBelongings ( IndexType  ElementId,
Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove the element with given Id from mesh with ThisIndex in this modelpart and all its subs.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
ElementIdThe id of the element to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveElementAndBelongingsFromAllLevels() [1/3]

void Kratos::AuxiliarModelPartUtilities::RemoveElementAndBelongingsFromAllLevels ( Element rThisElement,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given element from mesh with ThisIndex in parents, itself and children.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
rThisElementThe reference of the element
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveElementAndBelongingsFromAllLevels() [2/3]

void Kratos::AuxiliarModelPartUtilities::RemoveElementAndBelongingsFromAllLevels ( Element::Pointer  pThisElement,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove given element from mesh with ThisIndex in parents, itself and children.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
pThisElementThe pointer to the element to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveElementAndBelongingsFromAllLevels() [3/3]

void Kratos::AuxiliarModelPartUtilities::RemoveElementAndBelongingsFromAllLevels ( IndexType  ElementId,
const Flags  IdentifierFlag = TO_ERASE,
IndexType  ThisIndex = 0 
)

Remove the element with given Id from mesh with ThisIndex in parents, itself and children.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities

Parameters
ElementIdThe id of the element to remove
IdentifierFlagThe flag that identifies the entities to remove
ThisIndexThe index of the mesh where remove the entity

◆ RemoveElementsAndBelongings()

void Kratos::AuxiliarModelPartUtilities::RemoveElementsAndBelongings ( Flags  IdentifierFlag = TO_ERASE)

It erases all elements identified by "IdentifierFlag" by removing the pointer.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities Pointers are erased from this level downwards nodes will be automatically destructured when no pointer is left to them

Parameters
IdentifierFlagThe flag that identifies the entities to remove

◆ RemoveElementsAndBelongingsFromAllLevels()

void Kratos::AuxiliarModelPartUtilities::RemoveElementsAndBelongingsFromAllLevels ( const Flags  IdentifierFlag = TO_ERASE)

It erases all elements identified by "IdentifierFlag" by removing the pointer.

This method removes belonging entities too. This means that if the element has nodes defining a condition, and the nodes defining that condition are removed the condition is removed too Basically the method checks that when removing the nodes doesn't affect to other entities Pointers are erased from this level downwards nodes will be automatically destructured when no pointer is left to them

Parameters
IdentifierFlagThe flag that identifies the entities to remove

◆ RemoveOrphanNodesFromSubModelParts()

void Kratos::AuxiliarModelPartUtilities::RemoveOrphanNodesFromSubModelParts ( )

This method removed nodes from submodelparts not contained neither in the elements or conditions.

◆ SetScalarData()

template<class TContainerType >
void Kratos::AuxiliarModelPartUtilities::SetScalarData ( const Variable< typename TContainerType::value_type > &  rVariable,
const DataLocation  DataLoc,
const TContainerType &  rData 
)
inline

To Import a Scalar data (Double/int/...)

◆ SetVectorData()

template<class TContainerType , class TVarType >
void Kratos::AuxiliarModelPartUtilities::SetVectorData ( const Variable< TVarType > &  rVariable,
const DataLocation  DataLoc,
const TContainerType &  rData 
)
inline

To Import a Vector data (std::vector/array/..)


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