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.
bounding_volume_tree.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: hbui
11 //
12 
13 #pragma once
14 
15 // System includes
16 #include <iostream>
17 #include <string>
18 #include <cmath>
19 #include <vector>
20 #include <set>
21 
22 // External includes
23 
24 // Project includes
25 #include "includes/define.h"
26 #include "includes/variables.h"
27 #include "includes/node.h"
28 #include "includes/model_part.h"
29 #include "geometries/point.h"
30 #include "geometries/geometry.h"
31 
32 namespace Kratos
33 {
34 
38 class kDOP
39 {
40 public:
42 
43  typedef Node NodeType;
46  typedef const double ArrayType[3];
48 
49  kDOP() {this->Initialize();}
50 
51  virtual ~kDOP() {}
52 
54  virtual std::size_t NumberOfDirections() const
55  {
56  return 1;
57  }
58 
60  void Initialize()
61  {
62  mMinValues.resize(this->NumberOfDirections());
63  mMaxValues.resize(this->NumberOfDirections());
64  std::fill(mMinValues.begin(), mMinValues.end(), static_cast<double>(INT_MAX));
65  std::fill(mMaxValues.begin(), mMaxValues.end(), -static_cast<double>(INT_MAX));
66  }
67 
70  bool IsInside(const PointType& r_point, double tolerance) const
71  {
72  bool is_inside = true;
73  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
74  {
75  double v = NormalCoordinate(i, r_point[0], r_point[1], r_point[2]);
76  is_inside &= ((v >= mMinValues[i] - tolerance) && (v <= mMaxValues[i] + tolerance));
77  if(!is_inside)
78  break;
79  }
80  return is_inside;
81  }
82 
88  int TestOverlapped(const kDOP& rOther, double tolerance, bool test_tangent = true) const
89  {
90  if(this->NumberOfDirections() != rOther.NumberOfDirections())
91  return false;
92 
93  int mode = 1;
94  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
95  {
96  if( (mMaxValues[i] <= rOther.MinValues()[i] - tolerance) || (mMinValues[i] >= rOther.MaxValues()[i] + tolerance) )
97  {
98  mode = 0;
99  break;
100  }
101  }
102 
103  if(mode != 0 && test_tangent)
104  {
105  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
106  {
107  if( !(mMaxValues[i] >= rOther.MinValues()[i] + tolerance) && !(mMinValues[i] <= rOther.MaxValues()[i] - tolerance) )
108  {
109  mode = 2;
110  break;
111  }
112  }
113  }
114 
115  return mode;
116  }
117 
119  void InsertPoint(const double& rX, const double& rY, const double& rZ)
120  {
121  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
122  {
123  double v = NormalCoordinate(i, rX, rY, rZ);
124  if(v < mMinValues[i])
125  mMinValues[i] = v;
126  if(v > mMaxValues[i])
127  mMaxValues[i] = v;
128  }
129  }
130 
132  template<bool current_configuration>
133  void InsertGeometry(const GeometryType& rGeometry)
134  {
135  for(std::size_t i = 0; i < rGeometry.size(); ++i)
136  {
137  if(current_configuration)
138  {
139 // this->InsertPoint(rGeometry[i].X0() + rGeometry[i].GetSolutionStepValue(DISPLACEMENT_X),
140 // rGeometry[i].Y0() + rGeometry[i].GetSolutionStepValue(DISPLACEMENT_Y),
141 // rGeometry[i].Z0() + rGeometry[i].GetSolutionStepValue(DISPLACEMENT_Z));
142  this->InsertPoint(rGeometry[i].X(), rGeometry[i].Y(), rGeometry[i].Z());
143  }
144  else
145  {
146  this->InsertPoint(rGeometry[i].X0(), rGeometry[i].Y0(), rGeometry[i].Z0());
147  }
148  }
149  }
150 
152  void SetVolume(const kDOP& rBV1, const kDOP& rBV2)
153  {
154  if( (rBV1.GetType() != this->GetType()) || (rBV2.GetType() != this->GetType()) )
155  KRATOS_THROW_ERROR(std::logic_error, "The BV type is incompatible", "")
156 
157  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
158  {
159  mMinValues[i] = std::min(rBV1.MinValues()[i], rBV2.MinValues()[i]);
160  mMaxValues[i] = std::max(rBV1.MaxValues()[i], rBV2.MaxValues()[i]);
161  }
162  }
163 
165  bool SetVolumeIntersection(const kDOP& rBV1, const kDOP& rBV2, double tolerance)
166  {
167  int test = rBV1.TestOverlapped(rBV2, tolerance, true);
168  if(test == 1)
169  {
170  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
171  {
172  mMinValues[i] = std::max(rBV1.MinValues()[i], rBV2.MinValues()[i]);
173  mMaxValues[i] = std::min(rBV1.MaxValues()[i], rBV2.MaxValues()[i]);
174  }
175  return true;
176  }
177  return false;
178  }
179 
181  const std::vector<double>& MinValues() const {return mMinValues;}
182  const std::vector<double>& MaxValues() const {return mMaxValues;}
183 
185  std::size_t GetLongestAxis() const
186  {
187  std::size_t longest_axis = 0;
188  double length = 0.0;
189  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
190  {
191  double tmp = fabs(mMaxValues[i] - mMinValues[i]);
192  if(tmp > length)
193  {
194  longest_axis = i;
195  length = tmp;
196  }
197  }
198  return longest_axis;
199  }
200 
202  const double (&Direction(std::size_t i) const)[3] {return Direction()[i];}
203 
205  std::size_t GetType() const {return 2 * NumberOfDirections();}
206 
209 // void GetVertices(std::vector<std::vector<double> >& rCorners) const
210 // {
211 // // TODO
212 // }
213 
218  void GetInequalities(Matrix& rM, Vector& rB) const
219  {
220  // resize as needed
221  if(rM.size1() != 2 * NumberOfDirections() || rM.size2() != 3)
222  rM.resize(2 * NumberOfDirections(), 3, false);
223 
224  if(rB.size() != 2 * NumberOfDirections())
225  rB.resize(2 * NumberOfDirections(), false);
226 
227  for(std::size_t i = 0; i < NumberOfDirections(); ++i)
228  {
229  rM(2 * i, 0) = Direction()[i][0];
230  rM(2 * i, 1) = Direction()[i][1];
231  rM(2 * i, 2) = Direction()[i][2];
232  rB(2 * i) = mMaxValues[i];
233 
234  rM(2 * i + 1, 0) = -Direction()[i][0];
235  rM(2 * i + 1, 1) = -Direction()[i][1];
236  rM(2 * i + 1, 2) = -Direction()[i][2];
237  rB(2 * i + 1) = -mMinValues[i];
238  }
239  }
240 
241  void PrintInfo(std::ostream& rOStream) const
242  {
243  rOStream << this->GetType() << "-DOP:";
244  for(std::size_t i = 0; i < this->NumberOfDirections(); ++i)
245  rOStream << " (" << mMinValues[i] << ", " << mMaxValues[i] << ")";
246  }
247 
248 private:
249  std::vector<double> mMinValues;
250  std::vector<double> mMaxValues;
251  static ArrayType msDirection[];
252  virtual Array2DType Direction() const;
253  double NormalCoordinate(int i, const double& rX, const double& rY, const double& rZ) const
254  {
255  return rX * Direction()[i][0] + rY * Direction()[i][1] + rZ * Direction()[i][2];
256  }
257 };
258 
260 inline std::ostream& operator <<(std::ostream& rOStream, const kDOP& rThis)
261 {
262  rThis.PrintInfo(rOStream);
263  return rOStream;
264 }
265 
266 class _6DOP : public kDOP // AABB
267 {
268 public:
272  _6DOP() : kDOP() {this->Initialize();}
273  ~_6DOP() override {}
274  std::size_t NumberOfDirections() const override {return 3;}
275 
276 private:
277  static ArrayType msDirection[];
278  Array2DType Direction() const override;
279 };
280 
281 class _8DOP : public kDOP
282 {
283 public:
287  _8DOP() : kDOP() {this->Initialize();}
288  ~_8DOP() override {}
289  std::size_t NumberOfDirections() const override {return 4;}
290 private:
291  static ArrayType msDirection[];
292  Array2DType Direction() const override;
293 };
294 
295 class _12DOP : public kDOP
296 {
297 public:
301  _12DOP() : kDOP() {this->Initialize();}
302  ~_12DOP() override {}
303  std::size_t NumberOfDirections() const override {return 6;}
304 private:
305  static ArrayType msDirection[];
306  Array2DType Direction() const override;
307 };
308 
309 class _14DOP : public kDOP
310 {
311 public:
315  _14DOP() : kDOP() {this->Initialize();}
316  ~_14DOP() override {}
317  std::size_t NumberOfDirections() const override {return 7;}
318 private:
319  static ArrayType msDirection[];
320  Array2DType Direction() const override;
321 };
322 
323 class _18DOP : public kDOP
324 {
325 public:
329  _18DOP() : kDOP() {this->Initialize();}
330  ~_18DOP() override {}
331  std::size_t NumberOfDirections() const override {return 9;}
332 private:
333  static ArrayType msDirection[];
334  Array2DType Direction() const override;
335 };
336 
337 class _20DOP : public kDOP
338 {
339 public:
343  _20DOP() : kDOP() {this->Initialize();}
344  ~_20DOP() override {}
345  std::size_t NumberOfDirections() const override {return 10;}
346 private:
347  static ArrayType msDirection[];
348  Array2DType Direction() const override;
349 };
350 
351 class _26DOP : public kDOP
352 {
353 public:
357  _26DOP() : kDOP() {this->Initialize();}
358  ~_26DOP() override {}
359  std::size_t NumberOfDirections() const override {return 13;}
360 private:
361  static ArrayType msDirection[];
362  Array2DType Direction() const override;
363 };
364 
365 
369 
371 {
372 public:
376 
378  typedef Node NodeType;
381 
382  virtual void Partition(ConditionsContainerType& rAllConditions,
383  const kDOP& rBoundingVolume,
384  ConditionsContainerType& rOutputSet1,
385  ConditionsContainerType& rOutputSet2)
386  {
387  KRATOS_THROW_ERROR(std::logic_error, "Calling base function", "")
388  }
389 
390  void ComputeCentroid(GeometryType& rGeometry, double C[3])
391  {
392  C[0] = 0.0;
393  C[1] = 0.0;
394  C[2] = 0.0;
395  unsigned int n = rGeometry.size();
396 
397  for(std::size_t i = 0; i < n; ++i)
398  {
399 // C[0] += rGeometry[i].X0() + rGeometry[i].GetSolutionStepValue(DISPLACEMENT_X);
400 // C[1] += rGeometry[i].Y0() + rGeometry[i].GetSolutionStepValue(DISPLACEMENT_Y);
401 // C[2] += rGeometry[i].Z0() + rGeometry[i].GetSolutionStepValue(DISPLACEMENT_Z);
402  C[0] += rGeometry[i].X();
403  C[1] += rGeometry[i].Y();
404  C[2] += rGeometry[i].Z();
405  }
406 
407  C[0] /= n;
408  C[1] /= n;
409  C[2] /= n;
410  }
411 };
412 
413 
415 {
416 public:
420 
421  void Partition(ConditionsContainerType& rAllConditions,
422  const kDOP& rBoundingVolume,
423  ConditionsContainerType& rOutputSet1,
424  ConditionsContainerType& rOutputSet2) override;
425 };
426 
427 
429 {
430 public:
434 
435  void Partition(ConditionsContainerType& rAllConditions,
436  const kDOP& rBoundingVolume,
437  ConditionsContainerType& rOutputSet1,
438  ConditionsContainerType& rOutputSet2) override;
439 };
440 
441 
453 {
454 public:
456 
458 
460  {
461  if(type == 6)
462  mpBV = kDOP::Pointer(new _6DOP());
463  else if(type == 8)
464  mpBV = kDOP::Pointer(new _8DOP());
465  else if(type == 12)
466  mpBV = kDOP::Pointer(new _12DOP());
467  else if(type == 14)
468  mpBV = kDOP::Pointer(new _14DOP());
469  else if(type == 18)
470  mpBV = kDOP::Pointer(new _18DOP());
471  else if(type == 20)
472  mpBV = kDOP::Pointer(new _20DOP());
473  else if(type == 26)
474  mpBV = kDOP::Pointer(new _26DOP());
475  else
476  KRATOS_THROW_ERROR(std::logic_error, "Invalid k-DOP type", "")
477  }
478 
480  {}
481 
483  {
484  mGeometryIds.clear();
485  mpBV->Initialize();
486  this->AddGeometryFromConditions(rAllConditions);
487 
488  if(rAllConditions.size() < 2)
489  return;
490 
491  ConditionsContainerType ChildSet1;
492  ConditionsContainerType ChildSet2;
493  rPartitioner.Partition(rAllConditions, *mpBV, ChildSet1, ChildSet2);
494 
495  // size check
496  if( (ChildSet1.size() == 0 && ChildSet2.size() > 0)
497  || (ChildSet1.size() > 0 && ChildSet2.size() == 0) )
498  KRATOS_THROW_ERROR(std::logic_error, "There is something wrong with the partitioning. The size of the two sub-sets must be non-zero concurrently", "")
499 
500  if(ChildSet1.size() > 0)
501  {
502  mpLeft = BoundingVolumeTree::Pointer(new BoundingVolumeTree(mpBV->GetType()));
503  mpLeft->BuildTreeTopDown(ChildSet1, rPartitioner);
504  }
505  if(ChildSet2.size() > 0)
506  {
507  mpRight = BoundingVolumeTree::Pointer(new BoundingVolumeTree(mpBV->GetType()));
508  mpRight->BuildTreeTopDown(ChildSet2, rPartitioner);
509  }
510  }
511 
512  void UpdateTree(ModelPart& r_model_part)
513  {
514  this->UpdateTree(r_model_part.Conditions());
515  }
516 
517  void UpdateTree(ConditionsContainerType& rAllConditions)
518  {
519  if((mpLeft != NULL) && (mpRight != NULL))
520  {
521  mpLeft->UpdateTree(rAllConditions);
522  mpRight->UpdateTree(rAllConditions);
523  mpBV->SetVolume(mpLeft->GetBoundingVolume(), mpRight->GetBoundingVolume());
524  }
525  else
526  {
527  mpBV->Initialize();
528  for(std::set<std::size_t>::iterator it = mGeometryIds.begin(); it != mGeometryIds.end(); ++it)
529  mpBV->InsertGeometry<true>(rAllConditions(*it)->GetGeometry());
530  }
531  }
532 
534  {
535  for(ConditionsContainerType::ptr_iterator it = rAllConditions.ptr_begin(); it != rAllConditions.ptr_end(); ++it)
536  {
537  mpBV->InsertGeometry<true>((*it)->GetGeometry());
538  mGeometryIds.insert((*it)->Id());
539  }
540  }
541 
542  const kDOP& GetBoundingVolume() const {return *mpBV;}
543 
544  bool IsLeaf() const {return (mpLeft == NULL) && (mpRight == NULL);}
545 
546  bool CheckValidity() const
547  {
548  if(this->IsLeaf() && mGeometryIds.size() != 1)
549  return false;
550  else
551  {
552  bool valid = true;
553  if(mpLeft != NULL)
554  valid = valid && mpLeft->CheckValidity();
555  if(mpRight != NULL)
556  valid = valid && mpRight->CheckValidity();
557  return valid;
558  }
559  }
560 
561  std::size_t GetFirstGeometryId() const
562  {
563  return *(mGeometryIds.begin());
564  }
565 
566  const BoundingVolumeTree& GetLeftTree() const {return *mpLeft;}
567  BoundingVolumeTree::Pointer pGetLeftTree() const {return mpLeft;}
568 
569  const BoundingVolumeTree& GetRightTree() const {return *mpRight;}
570  BoundingVolumeTree::Pointer pGetRightTree() const {return mpRight;}
571 
572  void Print(std::ostream& rOStream, unsigned int level) const
573  {
574  mpBV->PrintInfo(rOStream);
575  rOStream << ", Geometry Id:";
576  for(std::set<std::size_t>::iterator it = mGeometryIds.begin(); it != mGeometryIds.end(); ++it)
577  rOStream << " " << *it;
578  rOStream << std::endl;
579  if(mpLeft != NULL)
580  {
581  for(unsigned int i = 0; i < level; ++i)
582  rOStream << "| ";
583  rOStream << "'->Left branch:";
584  mpLeft->Print(rOStream, level + 1);
585  }
586  if(mpRight != NULL)
587  {
588  for(unsigned int i = 0; i < level; ++i)
589  rOStream << "| ";
590  rOStream << "'->Right branch:";
591  mpRight->Print(rOStream, level + 1);
592  }
593  }
594 
595 private:
596  kDOP::Pointer mpBV;
597 
598  BoundingVolumeTree::Pointer mpLeft;
599  BoundingVolumeTree::Pointer mpRight;
600 
601  std::set<std::size_t> mGeometryIds;
602 };
603 
604 } // namespace Kratos.
605 
Definition: bounding_volume_tree.h:296
std::size_t NumberOfDirections() const override
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:303
_12DOP()
Definition: bounding_volume_tree.h:301
~_12DOP() override
Definition: bounding_volume_tree.h:302
kDOP::ArrayType ArrayType
Definition: bounding_volume_tree.h:298
kDOP::Array2DType Array2DType
Definition: bounding_volume_tree.h:299
KRATOS_CLASS_POINTER_DEFINITION(_12DOP)
Definition: bounding_volume_tree.h:310
KRATOS_CLASS_POINTER_DEFINITION(_14DOP)
_14DOP()
Definition: bounding_volume_tree.h:315
~_14DOP() override
Definition: bounding_volume_tree.h:316
std::size_t NumberOfDirections() const override
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:317
kDOP::Array2DType Array2DType
Definition: bounding_volume_tree.h:313
kDOP::ArrayType ArrayType
Definition: bounding_volume_tree.h:312
Definition: bounding_volume_tree.h:324
_18DOP()
Definition: bounding_volume_tree.h:329
kDOP::ArrayType ArrayType
Definition: bounding_volume_tree.h:326
kDOP::Array2DType Array2DType
Definition: bounding_volume_tree.h:327
~_18DOP() override
Definition: bounding_volume_tree.h:330
std::size_t NumberOfDirections() const override
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:331
KRATOS_CLASS_POINTER_DEFINITION(_18DOP)
Definition: bounding_volume_tree.h:338
~_20DOP() override
Definition: bounding_volume_tree.h:344
std::size_t NumberOfDirections() const override
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:345
KRATOS_CLASS_POINTER_DEFINITION(_20DOP)
_20DOP()
Definition: bounding_volume_tree.h:343
kDOP::ArrayType ArrayType
Definition: bounding_volume_tree.h:340
kDOP::Array2DType Array2DType
Definition: bounding_volume_tree.h:341
Definition: bounding_volume_tree.h:352
KRATOS_CLASS_POINTER_DEFINITION(_26DOP)
std::size_t NumberOfDirections() const override
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:359
kDOP::ArrayType ArrayType
Definition: bounding_volume_tree.h:354
~_26DOP() override
Definition: bounding_volume_tree.h:358
_26DOP()
Definition: bounding_volume_tree.h:357
kDOP::Array2DType Array2DType
Definition: bounding_volume_tree.h:355
Definition: bounding_volume_tree.h:267
kDOP::ArrayType ArrayType
Definition: bounding_volume_tree.h:269
kDOP::Array2DType Array2DType
Definition: bounding_volume_tree.h:270
~_6DOP() override
Definition: bounding_volume_tree.h:273
std::size_t NumberOfDirections() const override
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:274
KRATOS_CLASS_POINTER_DEFINITION(_6DOP)
_6DOP()
Definition: bounding_volume_tree.h:272
Definition: bounding_volume_tree.h:282
~_8DOP() override
Definition: bounding_volume_tree.h:288
std::size_t NumberOfDirections() const override
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:289
kDOP::ArrayType ArrayType
Definition: bounding_volume_tree.h:284
kDOP::Array2DType Array2DType
Definition: bounding_volume_tree.h:285
KRATOS_CLASS_POINTER_DEFINITION(_8DOP)
_8DOP()
Definition: bounding_volume_tree.h:287
Definition: bounding_volume_tree.h:371
KRATOS_CLASS_POINTER_DEFINITION(BoundingVolumePartitioner)
BoundingVolumePartitioner()
Definition: bounding_volume_tree.h:374
Node NodeType
Definition: bounding_volume_tree.h:378
NodeType::PointType PointType
Definition: bounding_volume_tree.h:380
void ComputeCentroid(GeometryType &rGeometry, double C[3])
Definition: bounding_volume_tree.h:390
~BoundingVolumePartitioner()
Definition: bounding_volume_tree.h:375
Geometry< NodeType > GeometryType
Definition: bounding_volume_tree.h:379
virtual void Partition(ConditionsContainerType &rAllConditions, const kDOP &rBoundingVolume, ConditionsContainerType &rOutputSet1, ConditionsContainerType &rOutputSet2)
Definition: bounding_volume_tree.h:382
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: bounding_volume_tree.h:377
Definition: bounding_volume_tree.h:453
const BoundingVolumeTree & GetRightTree() const
Definition: bounding_volume_tree.h:569
const BoundingVolumeTree & GetLeftTree() const
Definition: bounding_volume_tree.h:566
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: bounding_volume_tree.h:457
KRATOS_CLASS_POINTER_DEFINITION(BoundingVolumeTree)
virtual ~BoundingVolumeTree()
Definition: bounding_volume_tree.h:479
const kDOP & GetBoundingVolume() const
Definition: bounding_volume_tree.h:542
BoundingVolumeTree::Pointer pGetRightTree() const
Definition: bounding_volume_tree.h:570
BoundingVolumeTree(int type)
Definition: bounding_volume_tree.h:459
BoundingVolumeTree::Pointer pGetLeftTree() const
Definition: bounding_volume_tree.h:567
void UpdateTree(ConditionsContainerType &rAllConditions)
Definition: bounding_volume_tree.h:517
void BuildTreeTopDown(ConditionsContainerType &rAllConditions, BoundingVolumePartitioner &rPartitioner)
Definition: bounding_volume_tree.h:482
void Print(std::ostream &rOStream, unsigned int level) const
Definition: bounding_volume_tree.h:572
std::size_t GetFirstGeometryId() const
Definition: bounding_volume_tree.h:561
void UpdateTree(ModelPart &r_model_part)
Definition: bounding_volume_tree.h:512
bool IsLeaf() const
Definition: bounding_volume_tree.h:544
bool CheckValidity() const
Definition: bounding_volume_tree.h:546
void AddGeometryFromConditions(ConditionsContainerType &rAllConditions)
Definition: bounding_volume_tree.h:533
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
Definition: bounding_volume_tree.h:429
void Partition(ConditionsContainerType &rAllConditions, const kDOP &rBoundingVolume, ConditionsContainerType &rOutputSet1, ConditionsContainerType &rOutputSet2) override
Definition: bounding_volume_tree.cpp:47
~LineRegressionVolumePartitioner()
Definition: bounding_volume_tree.h:433
LineRegressionVolumePartitioner()
Definition: bounding_volume_tree.h:432
KRATOS_CLASS_POINTER_DEFINITION(LineRegressionVolumePartitioner)
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
This class defines the node.
Definition: node.h:65
Point class.
Definition: point.h:59
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
ptr_iterator ptr_end()
Returns an iterator pointing to the end of the underlying data container.
Definition: pointer_vector_set.h:404
ptr_iterator ptr_begin()
Returns an iterator pointing to the beginning of the underlying data container.
Definition: pointer_vector_set.h:386
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
typename TContainerType::iterator ptr_iterator
Definition: pointer_vector_set.h:104
Definition: bounding_volume_tree.h:415
void Partition(ConditionsContainerType &rAllConditions, const kDOP &rBoundingVolume, ConditionsContainerType &rOutputSet1, ConditionsContainerType &rOutputSet2) override
REF: https://github.com/brandonpelfrey/Fast-BVH.
Definition: bounding_volume_tree.cpp:68
SimpleBoundingVolumePartitioner()
Definition: bounding_volume_tree.h:418
~SimpleBoundingVolumePartitioner()
Definition: bounding_volume_tree.h:419
KRATOS_CLASS_POINTER_DEFINITION(SimpleBoundingVolumePartitioner)
Definition: bounding_volume_tree.h:39
const std::vector< double > & MaxValues() const
Definition: bounding_volume_tree.h:182
void InsertPoint(const double &rX, const double &rY, const double &rZ)
Add a point to the DOP /// This is mainly used for debugging.
Definition: bounding_volume_tree.h:119
void GetInequalities(Matrix &rM, Vector &rB) const
Definition: bounding_volume_tree.h:218
kDOP()
Definition: bounding_volume_tree.h:49
NodeType::PointType PointType
Definition: bounding_volume_tree.h:45
bool IsInside(const PointType &r_point, double tolerance) const
Definition: bounding_volume_tree.h:70
std::size_t GetLongestAxis() const
Get the longest axis.
Definition: bounding_volume_tree.h:185
KRATOS_CLASS_POINTER_DEFINITION(kDOP)
void PrintInfo(std::ostream &rOStream) const
Definition: bounding_volume_tree.h:241
virtual ~kDOP()
Definition: bounding_volume_tree.h:51
void Initialize()
Initialize the bounding volume to initial state.
Definition: bounding_volume_tree.h:60
void InsertGeometry(const GeometryType &rGeometry)
Add a geometry (from an element/a condition) to the k-DOP.
Definition: bounding_volume_tree.h:133
bool SetVolumeIntersection(const kDOP &rBV1, const kDOP &rBV2, double tolerance)
Set the bounding volume by intersecting two BVs. It will re-initialize all data of this kDOP.
Definition: bounding_volume_tree.h:165
Node NodeType
Definition: bounding_volume_tree.h:43
int TestOverlapped(const kDOP &rOther, double tolerance, bool test_tangent=true) const
Definition: bounding_volume_tree.h:88
const double ArrayType[3]
Definition: bounding_volume_tree.h:46
virtual std::size_t NumberOfDirections() const
Return the number of directions of the k-DOP.
Definition: bounding_volume_tree.h:54
void SetVolume(const kDOP &rBV1, const kDOP &rBV2)
Set the bounding volume by summing up two BVs. It will re-initialize all data of this kDOP.
Definition: bounding_volume_tree.h:152
const double(& Direction(std::size_t i) const)[3]
Get the i'th-direction.
Definition: bounding_volume_tree.h:202
std::size_t GetType() const
Get the type of this k-DOP.
Definition: bounding_volume_tree.h:205
Geometry< NodeType > GeometryType
Definition: bounding_volume_tree.h:44
const std::vector< double > & MinValues() const
Get the respective minimum values and maximum values of this bounding volume.
Definition: bounding_volume_tree.h:181
ArrayType * Array2DType
Definition: bounding_volume_tree.h:47
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: find_conditions_neighbours_process.h:45
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
v
Definition: generate_convection_diffusion_explicit_element.py:114
type
Definition: generate_gid_list_file.py:35
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
test
Definition: run_make_mesh_ethier_benchmark.py:26
string mode
Definition: sensitivityMatrix.py:23
integer i
Definition: TensorModule.f:17