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.
skin_detection_process.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: Vicente Mataix Ferrandiz
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // External includes
18 #include <unordered_set>
19 #include <unordered_map>
20 
21 // Project includes
22 #include "processes/process.h"
23 #include "includes/key_hash.h"
24 #include "includes/model_part.h"
26 
27 namespace Kratos
28 {
29 
32 
36 
37  // General geometry type definitions
38  using GeometryType = Geometry<Node>;
39 
41  using IndexType = std::size_t;
42 
44  using SizeType = std::size_t;
45 
49 
53 
57 
66 template<SizeType TDim>
67 class KRATOS_API(KRATOS_CORE) SkinDetectionProcess
68  : public Process
69 {
70 public:
73 
76 
77  // Weak pointers vectors types
80 
82  using VectorIndexType = std::vector<IndexType>;
83 
86 
89 
91  using HashSetVectorIntType = std::unordered_set<VectorIndexType, VectorIndexHasherType, VectorIndexComparorType>;
92 
94  using HashSetVectorIntTypeIteratorType = HashSetVectorIntType::iterator;
95 
97  using HashMapVectorIntType = std::unordered_map<VectorIndexType, VectorIndexType, VectorIndexHasherType, VectorIndexComparorType>;
98 
100  using HashMapVectorIntTypeIteratorType = HashMapVectorIntType::iterator;
101 
103  using HashMapVectorIntIdsType = std::unordered_map<VectorIndexType, IndexType, VectorIndexHasherType, VectorIndexComparorType>;
104 
106  using HashMapVectorIntIdsTypeIteratorType = HashMapVectorIntIdsType::iterator;
107 
111 
118  ModelPart& rModelPart,
119  Parameters ThisParameters = Parameters(R"({})")
120  );
121 
124 
128 
129  void operator()()
130  {
131  Execute();
132  }
133 
137 
141  void Execute() override;
142 
146 
150 
154 
156  std::string Info() const override
157  {
158  return "SkinDetectionProcess";
159  }
160 
162  void PrintInfo(std::ostream& rOStream) const override
163  {
164  rOStream << "SkinDetectionProcess";
165  }
166 
168  void PrintData(std::ostream& rOStream) const override
169  {
170  }
171 
175 
177 protected:
180 
184 
188 
192 
197  void GenerateFaceMaps(
198  HashMapVectorIntType& rInverseFaceMap,
199  HashMapVectorIntIdsType& rPropertiesFaceMap) const;
200 
204  ModelPart& SetUpAuxiliaryModelPart();
205 
211  void FillAuxiliaryModelPart(
212  ModelPart& rAuxiliaryModelPart,
213  HashMapVectorIntType& rInverseFaceMap,
214  HashMapVectorIntIdsType& rPropertiesFaceMap);
215 
224  virtual void CreateConditions(
225  ModelPart& rMainModelPart,
226  ModelPart& rSkinModelPart,
227  HashMapVectorIntType& rInverseFaceMap,
228  HashMapVectorIntIdsType& rPropertiesFaceMap,
229  std::unordered_set<IndexType>& rNodesInTheSkin,
230  const std::string& rConditionName
231  ) const;
232 
236  void SetUpAdditionalSubModelParts(const ModelPart& rAuxiliaryModelPart);
237 
241  const Parameters GetDefaultParameters() const override;
242 
246 
247  ModelPart& GetModelPart() const;
248 
249  Parameters GetSettings() const;
250 
254 
258 
260  SkinDetectionProcess(ModelPart& rModelPart, Parameters Settings, Parameters DefaultSettings);
261 
263 
264 private:
267 
271 
272  ModelPart& mrModelPart;
273  Parameters mThisParameters;
274 
278 
282 
287  void GenerateSetNodeIdsInterface(std::unordered_set<IndexType>& rSetNodeIdsInterface);
288 
294  void FilterMPIInterfaceNodes(
295  const std::unordered_set<IndexType>& rSetNodeIdsInterface,
296  HashMapVectorIntType& rInverseFaceMap
297  );
298 
302 
306 
310 
313 
315 
316 }; // Class SkinDetectionProcess
317 
319 
322 
326 
328 template<SizeType TDim>
329 inline std::istream& operator >> (std::istream& rIStream,
331 
333 template<SizeType TDim>
334 inline std::ostream& operator << (std::ostream& rOStream,
335  const SkinDetectionProcess<TDim>& rThis)
336 {
337  rThis.PrintInfo(rOStream);
338  rOStream << std::endl;
339  rThis.PrintData(rOStream);
340 
341  return rOStream;
342 }
344 
345 } // namespace Kratos.
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The base class for all processes in Kratos.
Definition: process.h:49
An algorithm that looks for neighbour elements in a mesh and creates a submodelpart containing the sk...
Definition: skin_detection_process.h:69
std::unordered_map< VectorIndexType, IndexType, VectorIndexHasherType, VectorIndexComparorType > HashMapVectorIntIdsType
Define the map considered for properties ids.
Definition: skin_detection_process.h:103
void operator()()
Definition: skin_detection_process.h:129
std::vector< IndexType > VectorIndexType
Definition of the vector indexes considered.
Definition: skin_detection_process.h:82
HashMapVectorIntIdsType::iterator HashMapVectorIntIdsTypeIteratorType
Define the HashMapVectorIntIdsType iterator type.
Definition: skin_detection_process.h:106
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: skin_detection_process.h:162
HashSetVectorIntType::iterator HashSetVectorIntTypeIteratorType
Define the HashSetVectorIntTypeIteratorType iterator type.
Definition: skin_detection_process.h:94
std::string Info() const override
Turn back information as a string.
Definition: skin_detection_process.h:156
std::unordered_set< VectorIndexType, VectorIndexHasherType, VectorIndexComparorType > HashSetVectorIntType
Define the set considered for element pointers.
Definition: skin_detection_process.h:91
virtual ~SkinDetectionProcess()
Destructor.
Definition: skin_detection_process.h:123
HashMapVectorIntType::iterator HashMapVectorIntTypeIteratorType
Define the HashMapVectorIntTypeIteratorType iterator type.
Definition: skin_detection_process.h:100
KRATOS_CLASS_POINTER_DEFINITION(SkinDetectionProcess)
Pointer definition of SkinDetectionProcess.
std::unordered_map< VectorIndexType, VectorIndexType, VectorIndexHasherType, VectorIndexComparorType > HashMapVectorIntType
Define the map considered for face ids.
Definition: skin_detection_process.h:97
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: skin_detection_process.h:168
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
This is a key comparer between two vectors of indexes.
Definition: key_hash.h:351
This is a hasher between two vectors of indexes.
Definition: key_hash.h:333