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_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: Jordi Cotela
11 //
12 
13 #if !defined(KRATOS_SUB_MODEL_PART_SKIN_DETECTION_PROCESS_H_INCLUDED)
14 #define KRATOS_SUB_MODEL_PART_SKIN_DETECTION_PROCESS_H_INCLUDED
15 
16 // System includes
17 #include <string>
18 #include <iostream>
19 
20 // Project includes
21 #include "skin_detection_process.h"
22 
23 namespace Kratos
24 {
27 
30 
36 template<SizeType TDim>
37 class KRATOS_API(KRATOS_CORE) SubModelPartSkinDetectionProcess: public SkinDetectionProcess<TDim>
38 {
39 
40 KRATOS_DEFINE_LOCAL_FLAG( NODE_SELECTED );
41 
46 class FaceSelector
47 {
48 public:
49  KRATOS_CLASS_POINTER_DEFINITION(FaceSelector);
50  virtual ~FaceSelector() = default;
51  virtual void Prepare(ModelPart& rMainModelPart) const = 0;
52  virtual bool IsSelected(const Geometry<Node>::PointsArrayType&) const = 0;
53 };
54 
60 class SelectIfAllNodesOnSubModelPart: public FaceSelector
61 {
62  std::string mName;
63 
64 public:
65  SelectIfAllNodesOnSubModelPart(const std::string& rName): mName(rName) {}
66 
67  void Prepare(ModelPart& rMainModelPart) const override;
68 
69  bool IsSelected(const Geometry<Node>::PointsArrayType& rNodes) const override;
70 };
71 
78 class SelectIfOneNodeNotOnSubModelPart: public FaceSelector
79 {
80  std::vector<std::string> mNames;
81 
82 public:
83  SelectIfOneNodeNotOnSubModelPart(const std::vector<std::string>& rNames): mNames(rNames) {}
84 
85  void Prepare(ModelPart& rMainModelPart) const override;
86 
87  bool IsSelected(const Geometry<Node>::PointsArrayType& rNodes) const override;
88 };
89 
90 public:
93 
96 
100 
102 
106 
109 
112 
115 
118 
122 
125 
129 
130 void Execute() override;
131 
135 
136 std::string Info() const override
137 {
138  return "SkinDetectionProcess";
139 }
140 
142 void PrintInfo(std::ostream& rOStream) const override
143 {
144  rOStream << "SkinDetectionProcess";
145 }
146 
148 void PrintData(std::ostream& rOStream) const override
149 {
150 }
151 
153 
154 protected:
155 
158 
159 void CreateConditions(
160  ModelPart& rMainModelPart,
161  ModelPart& rSkinModelPart,
162  HashMapVectorIntType& rInverseFaceMap,
163  HashMapVectorIntIdsType& rPropertiesFaceMap,
164  std::unordered_set<IndexType>& rNodesInTheSkin,
165  const std::string& rConditionName) const override;
166 
170 const Parameters GetDefaultParameters() const override;
171 
173 
174 private:
175 
178 
179 typename FaceSelector::Pointer mpFaceSelector;
180 
184 
185 static bool FaceIsNeeded(const Geometry<Node>::PointsArrayType&)
186 {
187  return true;
188 }
189 
191 
192 }; // Class SubModelPartSkinDetectionProcess
193 
197 
199 template<SizeType TDim>
200 inline std::istream &operator>>(std::istream &rIStream,
202 
204 template<SizeType TDim>
205 inline std::ostream &operator<<(std::ostream &rOStream,
207 {
208  rThis.PrintInfo(rOStream);
209  rOStream << std::endl;
210  rThis.PrintData(rOStream);
211 
212  return rOStream;
213 }
215 
217 
218 } // namespace Kratos.
219 
220 #endif // KRATOS_SUB_MODEL_PART_SKIN_DETECTION_PROCESS_H_INCLUDED defined
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
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
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
std::vector< IndexType > VectorIndexType
Definition of the vector indexes considered.
Definition: skin_detection_process.h:82
std::unordered_map< VectorIndexType, VectorIndexType, VectorIndexHasherType, VectorIndexComparorType > HashMapVectorIntType
Define the map considered for face ids.
Definition: skin_detection_process.h:97
Create a SubModelPart covering a part of the outside skin of the computation domain where a condition...
Definition: sub_model_part_skin_detection_process.h:38
KRATOS_CLASS_POINTER_DEFINITION(SubModelPartSkinDetectionProcess)
Pointer definition of SubModelPartSkinDetectionProcess.
~SubModelPartSkinDetectionProcess() override=default
Destructor.
SubModelPartSkinDetectionProcess(SubModelPartSkinDetectionProcess const &rOther)=delete
Deleted copy constructor.
bool(const Geometry< Node >::PointsArrayType &) ConditionCheckType
Definition: sub_model_part_skin_detection_process.h:101
SubModelPartSkinDetectionProcess()=delete
Deleted default constructor.
std::string Info() const override
Turn back information as a string.
Definition: sub_model_part_skin_detection_process.h:136
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: sub_model_part_skin_detection_process.h:142
SubModelPartSkinDetectionProcess & operator=(SubModelPartSkinDetectionProcess const &rOther)=delete
Deleted sssignment operator.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: sub_model_part_skin_detection_process.h:148
#define KRATOS_DEFINE_LOCAL_FLAG(name)
Definition: define.h:673
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
REACTION_CHECK_STIFFNESS_FACTOR INNER_LOOP_ITERATION DISTANCE_THRESHOLD ACTIVE_CHECK_FACTOR AUXILIAR_COORDINATES NORMAL_GAP WEIGHTED_GAP WEIGHTED_SCALAR_RESIDUAL bool
Definition: contact_structural_mechanics_application_variables.h:93
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
#define KRATOS_CLASS_POINTER_DEFINITION(a)
Definition: smart_pointers.h:69