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.
spatial_containers_configure.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: Nelson Lafontaine
11 // Vicente Mataix Ferrandiz
12 //
13 
14 #pragma once
15 
16 // System includes
17 #include <string>
18 #include <iostream>
19 #include <cmath>
20 
21 // External includes
22 
23 // Project includes
24 
25 namespace Kratos
26 {
29 
33 
34 using SizeType = std::size_t;
35 
39 
43 
47 
57 template <SizeType TDimension, class TEntity = Element>
59 {
60 public:
63 
65  using PointType = Point;
66 
68  using NodeType = Node;
69 
72 
74  using DistanceIteratorType = std::vector<double>::iterator;
75 
77  using EntityType = TEntity;
78 
81  using PointerType = typename ContainerType::value_type;
82  using IteratorType = typename ContainerType::iterator;
84  using ResultPointerType = typename ResultContainerType::value_type;
85  using ResultIteratorType = typename ResultContainerType::iterator;
86 
88  static constexpr std::size_t Dimension = TDimension;
89 
91  static constexpr std::size_t DIMENSION = TDimension;
92 
94  static constexpr std::size_t MAX_LEVEL = 16;
95 
97  static constexpr std::size_t MIN_LEVEL = 2;
98 
101 
105 
109 
112 
115 
119 
123 
130  static inline void CalculateBoundingBox(
131  const PointerType& rObject,
132  PointType& rLowPoint,
133  PointType& rHighPoint
134  )
135  {
136  rHighPoint = rObject->GetGeometry().GetPoint(0);
137  rLowPoint = rObject->GetGeometry().GetPoint(0);
138  for (unsigned int point = 0; point<rObject->GetGeometry().PointsNumber(); point++) {
139  for(unsigned int i = 0; i<TDimension; i++) {
140  rLowPoint[i] = (rLowPoint[i] > rObject->GetGeometry().GetPoint(point)[i] ) ? rObject->GetGeometry().GetPoint(point)[i] : rLowPoint[i];
141  rHighPoint[i] = (rHighPoint[i] < rObject->GetGeometry().GetPoint(point)[i] ) ? rObject->GetGeometry().GetPoint(point)[i] : rHighPoint[i];
142  }
143  }
144  }
145 
153  static inline void CalculateBoundingBox(
154  const PointerType& rObject,
155  PointType& rLowPoint,
156  PointType& rHighPoint,
157  const double Radius
158  )
159  {
160  (void)Radius;
161  CalculateBoundingBox(rObject, rLowPoint, rHighPoint);
162  }
163 
170  static inline bool Intersection(
171  const PointerType& rObj_1,
172  const PointerType& rObj_2
173  )
174  {
175  GeometryType& r_geom_1 = rObj_1->GetGeometry();
176  GeometryType& r_geom_2 = rObj_2->GetGeometry();
177  return r_geom_1.HasIntersection(r_geom_2);
178  }
179 
186  static inline bool Intersection(
187  const PointerType& rObj_1,
188  const PointerType& rObj_2,
189  const double Radius
190  )
191  {
192  (void)Radius;
193  return Intersection(rObj_1, rObj_2);
194  }
195 
202  static inline bool IntersectionBox(
203  const PointerType& rObject,
204  const PointType& rLowPoint,
205  const PointType& rHighPoint
206  )
207  {
208  return rObject->GetGeometry().HasIntersection(rLowPoint, rHighPoint);
209  }
210 
218  static inline bool IntersectionBox(
219  const PointerType& rObject,
220  const PointType& rLowPoint,
221  const PointType& rHighPoint,
222  const double Radius
223  )
224  {
225  (void)Radius;
226  return IntersectionBox(rObject, rLowPoint, rHighPoint);
227  }
228 
235  static inline void Distance(
236  const PointerType& rObj_1,
237  const PointerType& rObj_2,
238  double& rDistance
239  )
240  {
241 
242  }
243 
247 
251 
255 
257  virtual std::string Info() const
258  {
259  return " Spatial Containers Configure";
260  }
261 
263  virtual void PrintInfo(std::ostream& rOStream) const {}
264 
266  virtual void PrintData(std::ostream& rOStream) const {}
267 
271 
273 protected:
276 
280 
284 
288 
292 
296 
300 
302 private:
305 
309 
313 
317 
321 
325 
329 
331  SpatialContainersConfigure& operator=(SpatialContainersConfigure const& rOther);
332 
335 
337 
338 }; // Class SpatialContainersConfigure
339 
341 
344 
348 
350 template <std::size_t TDimension>
351 inline std::istream& operator >> (std::istream& rIStream,
353 {
354  return rIStream;
355 }
356 
358 template <std::size_t TDimension>
359 inline std::ostream& operator << (std::ostream& rOStream,
361 {
362  rThis.PrintInfo(rOStream);
363  rOStream << std::endl;
364  rThis.PrintData(rOStream);
365 
366  return rOStream;
367 }
369 
370 } // namespace Kratos.
Geometry base class.
Definition: geometry.h:71
virtual bool HasIntersection(const GeometryType &ThisGeometry) const
Definition: geometry.h:1453
This class defines the node.
Definition: node.h:65
Point class.
Definition: point.h:59
TContainerType ContainerType
Definition: pointer_vector_set.h:90
Thhis class is a container for spatial search.
Definition: spatial_containers_configure.h:59
virtual ~SpatialContainersConfigure()
Destructor.
Definition: spatial_containers_configure.h:114
KRATOS_CLASS_POINTER_DEFINITION(SpatialContainersConfigure)
Pointer definition of SpatialContainersConfigure.
typename ContainerType::iterator IteratorType
Definition: spatial_containers_configure.h:82
static bool IntersectionBox(const PointerType &rObject, const PointType &rLowPoint, const PointType &rHighPoint, const double Radius)
This method computes the intersection box.
Definition: spatial_containers_configure.h:218
static bool Intersection(const PointerType &rObj_1, const PointerType &rObj_2)
This method computes the intersection.
Definition: spatial_containers_configure.h:170
static void CalculateBoundingBox(const PointerType &rObject, PointType &rLowPoint, PointType &rHighPoint, const double Radius)
This method computes the bounding box.
Definition: spatial_containers_configure.h:153
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: spatial_containers_configure.h:266
typename ContainerType::value_type PointerType
Definition: spatial_containers_configure.h:81
static bool Intersection(const PointerType &rObj_1, const PointerType &rObj_2, const double Radius)
This method computes the intersection.
Definition: spatial_containers_configure.h:186
TEntity EntityType
The entity definition.
Definition: spatial_containers_configure.h:77
static void CalculateBoundingBox(const PointerType &rObject, PointType &rLowPoint, PointType &rHighPoint)
This method computes the bounding box.
Definition: spatial_containers_configure.h:130
typename ResultContainerType::iterator ResultIteratorType
Definition: spatial_containers_configure.h:85
virtual std::string Info() const
Turn back information as a string.
Definition: spatial_containers_configure.h:257
std::vector< double >::iterator DistanceIteratorType
Dditance iterator.
Definition: spatial_containers_configure.h:74
static constexpr std::size_t Dimension
Definition of the Dimension (it is the template argument, but it is needed to be defined as a static ...
Definition: spatial_containers_configure.h:88
static void Distance(const PointerType &rObj_1, const PointerType &rObj_2, double &rDistance)
This method computes the distance.
Definition: spatial_containers_configure.h:235
typename PointerVectorSet< TEntity, IndexedObject >::ContainerType ContainerType
Container definition.
Definition: spatial_containers_configure.h:80
static constexpr std::size_t MIN_LEVEL
Definition of the minimum level.
Definition: spatial_containers_configure.h:97
static constexpr std::size_t MAX_LEVEL
Definition of the maximum level.
Definition: spatial_containers_configure.h:94
typename ResultContainerType::value_type ResultPointerType
Definition: spatial_containers_configure.h:84
static bool IntersectionBox(const PointerType &rObject, const PointType &rLowPoint, const PointType &rHighPoint)
This method computes the intersection box.
Definition: spatial_containers_configure.h:202
SpatialContainersConfigure()
Default constructor.
Definition: spatial_containers_configure.h:111
static constexpr std::size_t DIMENSION
Definition of the DIMENSION (it is the template argument, but it is needed to be defined as a static ...
Definition: spatial_containers_configure.h:91
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: spatial_containers_configure.h:263
typename PointerVectorSet< TEntity, IndexedObject >::ContainerType ResultContainerType
Definition: spatial_containers_configure.h:83
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
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
integer i
Definition: TensorModule.f:17