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.
|
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>
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... | |
ModelPart & | DeepCopyModelPart (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... | |
This utility includes auxiliar methods not included in the model part to avoid increase more than necessary the API.
|
inline |
The default constructor
|
virtualdefault |
|
static |
This method copies the structure of submodelparts.
rModelPartToCopyFromIt | The model part to copy from it |
rModelPartToCopyIntoIt | The model part where to copy the structure of the submodelparts |
|
inline |
This method deep copies a entities.
Only works with Element and Condition due to the lack of consistency of the entities Clone methods
rModelPart | The model part to copy the entities |
rEntities | The entities to be copied |
rReferenceEntities | The entities to be copied |
rGeometryPointerDatabase | The database of geometries |
TClassContainer | rEntities type |
TReferenceClassContainer | rReferenceEntities type |
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
rNewModelPartName | The name of the new model part |
pModel | The pointer to the Model that will host the new ModelPart, if nullptr, the current Model will be used. |
We will copy the member variables of the model part one by one
void Kratos::AuxiliarModelPartUtilities::EnsureModelPartOwnsProperties | ( | const bool | RemovePreviousProperties = true | ) |
This method ensured that the properties of elements and conditions are on the model part.
RemovePreviousProperties | If we clear previous properties and ensure only the properties existing in the elements and conditions (true by default) |
|
inline |
To Export a Scalar data (Double/int/...)
|
inline |
To Export a Vector data (std::vector/array/..)
|
inlinevirtual |
Turn back information as a string.
Kratos::AuxiliarModelPartUtilities::KRATOS_CLASS_POINTER_DEFINITION | ( | AuxiliarModelPartUtilities | ) |
Counted pointer of AuxiliarModelPartUtilities.
|
inlinevirtual |
Print object's data.
|
inlinevirtual |
Print information about this object.
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)
RemovePreviousProperties | If we clear previous properties and ensure only the properties existing in the elements and conditions (true by default) |
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
rThisCondition | The reference to the condition to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
pThisCondition | The pointer to the condition to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
ConditionId | The ID of the condition to remove |
IdentifierFlag | The flag that identifies the entities to removeentities too |
ThisIndex | The index of the mesh where remove the entity |
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
rThisCondition | The reference to the condition to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
pThisCondition | The pointer to the condition to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
ConditionId | The ID of the condition to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
IdentifierFlag | The flag that identifies the entities to remove |
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
IdentifierFlag | The flag that identifies the entities to remove |
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
rThisElement | The reference of the element |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
pThisElement | The pointer to the element to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
ElementId | The id of the element to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
rThisElement | The reference of the element |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
pThisElement | The pointer to the element to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
ElementId | The id of the element to remove |
IdentifierFlag | The flag that identifies the entities to remove |
ThisIndex | The index of the mesh where remove the entity |
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
IdentifierFlag | The flag that identifies the entities to remove |
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
IdentifierFlag | The flag that identifies the entities to remove |
void Kratos::AuxiliarModelPartUtilities::RemoveOrphanNodesFromSubModelParts | ( | ) |
This method removed nodes from submodelparts not contained neither in the elements or conditions.
|
inline |
To Import a Scalar data (Double/int/...)
|
inline |
To Import a Vector data (std::vector/array/..)