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.
find_intersected_geometrical_objects_with_obb_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 #if !defined(KRATOS_FIND_INTERSECTED_GEOMETRICAL_OBJECTS_WITH_OBB_PROCESS_H_INCLUDED )
14 #define KRATOS_FIND_INTERSECTED_GEOMETRICAL_OBJECTS_WITH_OBB_PROCESS_H_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
23 
24 namespace Kratos
25 {
28 
32 
36 
40 
44 
55 {
56 public:
59 
62 
65  KRATOS_DEFINE_LOCAL_FLAG( SEPARATING_AXIS_THEOREM );
66  KRATOS_DEFINE_LOCAL_FLAG( BUILD_OBB_FROM_BB );
67 
69  typedef std::size_t IndexType;
70 
72  typedef std::size_t SizeType;
73 
75  typedef Point PointType;
76 
79 
81  typedef typename BaseType::OctreeType OctreeType;
82 
84  using NodeType = Node;
85 
88 
92 
98 
105  ModelPart& rModelPartIntersected,
106  ModelPart& rModelPartIntersecting,
107  const double BoundingBoxFactor = -1.0,
108  const Flags Options = FindIntersectedGeometricalObjectsProcess::INTERSECTING_CONDITIONS|
109  FindIntersectedGeometricalObjectsProcess::INTERSECTING_ELEMENTS|
110  FindIntersectedGeometricalObjectsProcess::INTERSECTED_CONDITIONS|
111  FindIntersectedGeometricalObjectsProcess::INTERSECTED_ELEMENTS|
112  FindIntersectedGeometricalObjectsWithOBBProcess::DEBUG_OBB.AsFalse()|
113  FindIntersectedGeometricalObjectsWithOBBProcess::SEPARATING_AXIS_THEOREM|
114  FindIntersectedGeometricalObjectsWithOBBProcess::BUILD_OBB_FROM_BB
115  );
116 
123  Model& rModel,
124  Parameters ThisParameters
125  );
126 
129 
132 
136  const Parameters GetDefaultParameters() const override;
137 
140 
144 
148 
150  std::string Info() const override {
151  return "FindIntersectedGeometricalObjectsWithOBBProcess";
152  }
153 
155  void PrintInfo(std::ostream& rOStream) const override {
156  rOStream << Info();
157  }
158 
160  void PrintData(std::ostream& rOStream) const override {
161 
162  }
163 
165 
166 protected:
169 
173 
174  double mBoundingBoxFactor = -1.0;
176 
180 
184 
188  void SetOctreeBoundingBox() override;
189 
195  bool HasIntersection(
196  GeometryType& rFirstGeometry,
197  GeometryType& rSecondGeometry
198  ) override;
199 
205  virtual bool HasIntersection2D(
206  GeometryType& rFirstGeometry,
207  GeometryType& rSecondGeometry
208  );
209 
215  virtual bool HasDirectIntersection2D(
216  GeometryType& rFirstGeometry,
217  GeometryType& rSecondGeometry
218  );
219 
225  virtual bool HasIntersection3D(
226  GeometryType& rFirstGeometry,
227  GeometryType& rSecondGeometry
228  );
229 
235  virtual bool HasDirectIntersection3D(
236  GeometryType& rFirstGeometry,
237  GeometryType& rSecondGeometry
238  );
239 
246  void CreateDebugOBB2D(
247  ModelPart& rModelPart,
248  Properties::Pointer pProperties,
249  OrientedBoundingBox<2>& rOrientedBoundingBox
250  );
251 
258  void CreateDebugOBB3D(
259  ModelPart& rModelPart,
260  Properties::Pointer pProperties,
261  OrientedBoundingBox<3>& rOrientedBoundingBox
262  );
263 
269  void ConvertIntersection(const std::string& rString)
270  {
271  if (rString == "Direct" || rString == "direct")
272  BaseType::mOptions.Set(FindIntersectedGeometricalObjectsWithOBBProcess::SEPARATING_AXIS_THEOREM, false);
273  else if (rString == "SeparatingAxisTheorem" || rString == "separating_axis_theorem")
274  BaseType::mOptions.Set(FindIntersectedGeometricalObjectsWithOBBProcess::SEPARATING_AXIS_THEOREM, true);
275  else
276  BaseType::mOptions.Set(FindIntersectedGeometricalObjectsWithOBBProcess::SEPARATING_AXIS_THEOREM, true);
277  }
278 
284  {
285  if (BaseType::mOptions.Is(FindIntersectedGeometricalObjectsWithOBBProcess::SEPARATING_AXIS_THEOREM))
287  else
289  }
290 
294 
298 
302 
304 
305 private:
308 
309 
313 
317 
321 
324 
325 
327 
328 }; // Class FindIntersectedGeometricalObjectsWithOBBProcess
329 
331 
334 
335 
339 
340 
342 inline std::istream& operator >> (std::istream& rIStream,
344 
346 inline std::ostream& operator << (std::ostream& rOStream,
348 {
349  rThis.PrintInfo(rOStream);
350  rOStream << std::endl;
351  rThis.PrintData(rOStream);
352 
353  return rOStream;
354 }
356 
358 
359 } // namespace Kratos.
360 
361 #endif // KRATOS_FIND_INTERSECTED_GEOMETRICAL_OBJECTS_WITH_OBB_PROCESS_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
This class takes two modelparts and marks the intersected ones with SELECTED flag.
Definition: find_intersected_geometrical_objects_process.h:321
This class takes two modelparts and marks the intersected ones with SELECTED flag....
Definition: find_intersected_geometrical_objects_with_obb_process.h:55
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: find_intersected_geometrical_objects_with_obb_process.h:160
std::string Info() const override
Turn back information as a string.
Definition: find_intersected_geometrical_objects_with_obb_process.h:150
KRATOS_CLASS_POINTER_DEFINITION(FindIntersectedGeometricalObjectsWithOBBProcess)
Pointer definition of FindIntersectedGeometricalObjectsWithOBBProcess.
std::size_t IndexType
Definition of the index type.
Definition: find_intersected_geometrical_objects_with_obb_process.h:69
FindIntersectedGeometricalObjectsWithOBBProcess(FindIntersectedGeometricalObjectsWithOBBProcess const &rOther)=delete
Copy constructor.
std::size_t SizeType
Definition of the size type.
Definition: find_intersected_geometrical_objects_with_obb_process.h:72
Parameters mThisParameters
The factor to be consider when computing the bounding box (if negative not considered)
Definition: find_intersected_geometrical_objects_with_obb_process.h:175
OBBHasIntersectionType GetOBBHasIntersectionType()
This returns the interesection type from the flag.
Definition: find_intersected_geometrical_objects_with_obb_process.h:283
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: find_intersected_geometrical_objects_with_obb_process.h:155
FindIntersectedGeometricalObjectsWithOBBProcess()=delete
Default constructor.
~FindIntersectedGeometricalObjectsWithOBBProcess() override
Destructor.
Definition: find_intersected_geometrical_objects_with_obb_process.h:131
Point PointType
Definition of the point type.
Definition: find_intersected_geometrical_objects_with_obb_process.h:75
FindIntersectedGeometricalObjectsProcess BaseType
Definition of the base type.
Definition: find_intersected_geometrical_objects_with_obb_process.h:78
void ConvertIntersection(const std::string &rString)
This sets the interesection flag.
Definition: find_intersected_geometrical_objects_with_obb_process.h:269
BaseType::OctreeType OctreeType
Octree type definition.
Definition: find_intersected_geometrical_objects_with_obb_process.h:81
Definition: flags.h:58
Geometry base class.
Definition: geometry.h:71
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
This class defines the Oriented bounding box class.
Definition: oriented_bounding_box.h:77
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
Point class.
Definition: point.h:59
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
OBBHasIntersectionType
This enum defines the different types of checks that can be done for the HasIntersection:
Definition: oriented_bounding_box.h:47
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432