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.
sub_model_part_entities_boolean_operation_utility.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Miguel Maso Sotomayor
11 //
12 
13 #ifndef KRATOS_SUB_MODEL_PART_OPERATIONS_H_INCLUDED
14 #define KRATOS_SUB_MODEL_PART_OPERATIONS_H_INCLUDED
15 
16 
17 // External includes
18 
19 
20 // Project includes
21 #include "includes/model_part.h"
22 
23 
24 namespace Kratos
25 {
28 
31 
35 
39 
46 template<class TEntityType, class TContainerType>
47 class KRATOS_API(KRATOS_CORE) SubModelPartEntitiesBooleanOperationUtility
48 {
49 public:
52 
55 
56  typedef std::size_t IndexType;
57 
61 
62  enum class BooleanOperators {Union, Intersection, Difference};
63 
67 
69 
71 
75 
76  static void Union(ModelPart& rModelPartA, ModelPart& rModelPartB, ModelPart& rDestination)
77  {
78  BooleanOperation(rModelPartA, rModelPartB, rDestination, BooleanOperators::Union);
79  }
80 
81  static void Intersection(ModelPart& rModelPartA, ModelPart& rModelPartB, ModelPart& rDestination)
82  {
83  BooleanOperation(rModelPartA, rModelPartB, rDestination, BooleanOperators::Intersection);
84  }
85 
86  static void Difference(ModelPart& rModelPartA, ModelPart& rModelPartB, ModelPart& rDestination)
87  {
88  BooleanOperation(rModelPartA, rModelPartB, rDestination, BooleanOperators::Difference);
89  }
90 
92 
93 private:
96 
97  static void AddEntities(const std::vector<IndexType>& rIds, ModelPart& rModelPart);
98 
99  static TContainerType& GetContainer(ModelPart& rModelPart);
100 
101  static std::vector<IndexType> GetContainerIds(ModelPart& rModelPart);
102 
103  static void BooleanOperation(
104  ModelPart& rModelPartA,
105  ModelPart& rModelPartB,
106  ModelPart& rDestination,
107  BooleanOperators ThisOperator);
108 
110 
111 }; // Class SubModelPartEntitiesBooleanOperationUtility
112 
114 
116 
117 } // namespace Kratos.
118 
119 #endif // KRATOS_SUB_MODEL_PART_OPERATIONS_H_INCLUDED defined
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Wrapper of boolean operations: union, intersection and difference.
Definition: sub_model_part_entities_boolean_operation_utility.h:48
KRATOS_CLASS_POINTER_DEFINITION(SubModelPartEntitiesBooleanOperationUtility)
Pointer definition of SubModelPartEntitiesBooleanOperationUtility.
static void Intersection(ModelPart &rModelPartA, ModelPart &rModelPartB, ModelPart &rDestination)
Definition: sub_model_part_entities_boolean_operation_utility.h:81
std::size_t IndexType
Definition: sub_model_part_entities_boolean_operation_utility.h:56
BooleanOperators
Definition: sub_model_part_entities_boolean_operation_utility.h:62
static void Difference(ModelPart &rModelPartA, ModelPart &rModelPartB, ModelPart &rDestination)
Definition: sub_model_part_entities_boolean_operation_utility.h:86
static void Union(ModelPart &rModelPartA, ModelPart &rModelPartB, ModelPart &rDestination)
Definition: sub_model_part_entities_boolean_operation_utility.h:76
TContainerType & GetContainer(ModelPart::MeshType &rMesh)
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
@ Intersection
The point belongs to the slave entity.