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.
bins_dynamic_objects.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 // Carlos A. Roig
12 
13 #pragma once
14 
15 // System includes
16 #include <string>
17 #include <iostream>
18 #include <cmath>
19 #include <algorithm>
20 #include <array>
21 
22 // Project includes
23 #include "tree.h"
24 #include "cell.h"
25 
26 #ifdef _OPENMP
27 #include <omp.h>
28 #endif
29 
30 namespace Kratos
31 {
32 
35 
39 
43 
47 
51 
52 
54 
56 template<class TConfigure>
58 public:
61 
62  enum { Dimension = TConfigure::Dimension };
63 
64  typedef TConfigure Configure;
65  typedef typename TConfigure::PointType PointType;
66  typedef typename TConfigure::PointerType PointerType;
71  typedef typename TConfigure::DistanceIteratorType DistanceIteratorType;
72 
74 
75  typedef typename TreeNodeType::CoordinateType CoordinateType; // double
76  typedef typename TreeNodeType::SizeType SizeType; // std::size_t
77  typedef typename TreeNodeType::IndexType IndexType; // std::size_t
78 
82 
86 
87  // Global Container
89  typedef std::vector<CellType> CellContainerType;
90  typedef typename CellContainerType::iterator CellContainerIterator;
91 
94 
98 
102 
111  BinsObjectDynamic (IteratorType const& ObjectsBegin, IteratorType const& ObjectsEnd)
112  : mObjectsBegin(ObjectsBegin), mObjectsEnd(ObjectsEnd) {
113 
115 
116  CalculateBoundingBox(); // Calculate mMinPoint, mMaxPoint
117  CalculateCellSize(mObjectsSize); // Calculate number of Cells
118  AllocateContainer(); // Allocate cell list
119  GenerateBins(); // Fill Cells with objects
120  }
121 
131  BinsObjectDynamic (IteratorType const& ObjectsBegin, IteratorType const& ObjectsEnd, CoordinateType CellSize)
132  : mObjectsBegin(ObjectsBegin), mObjectsEnd(ObjectsEnd) {
133 
135 
136  CalculateBoundingBox(); // Calculate mMinPoint, mMaxPoint
137  AssignCellSize(CellSize); // Calculate number of Cells
138  AllocateContainer(); // Allocate cell list
139  GenerateBins(); // Fill Cells with objects
140  }
141 
151  BinsObjectDynamic (const PointType& MinPoint, const PointType& MaxPoint, CoordinateType CellSize)
152  : mObjectsSize(0), mObjectsBegin(0), mObjectsEnd(0) {
153 
154  for(SizeType i = 0; i < Dimension; i++) {
155  mMinPoint[i] = MinPoint[i];
156  mMaxPoint[i] = MaxPoint[i];
157  }
158 
159  AssignCellSize(CellSize); // Calculate number of Cells
160  AllocateContainer(); // Allocate cell list
161  }
162 
173  BinsObjectDynamic (const PointType& MinPoint, const PointType& MaxPoint, SizeType NumPoints)
174  : mObjectsSize(0), mObjectsBegin(0), mObjectsEnd(0) {
175 
176  for(SizeType i = 0; i < Dimension; i++) {
177  mMinPoint[i] = MinPoint[i];
178  mMaxPoint[i] = MaxPoint[i];
179  }
180 
181  CalculateCellSize(NumPoints); // Calculate number of Cells
182  AllocateContainer(); // Allocate cell list
183  }
184 
186  virtual ~BinsObjectDynamic() {}
187 
189 
197  PointType Low, High;
199 
200  TConfigure::CalculateBoundingBox(ThisObject, Low, High);
201  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
202  SearchInBoxLocal(ThisObject, Result, Box );
203 
204  return Result.size();
205  }
206 
214  SizeType SearchObjects(PointerType& ThisObject, ResultIteratorType& Result, const SizeType& MaxNumberOfResults) {
215  PointType Low, High;
217  SizeType NumberOfResults = 0;
218 
219  TConfigure::CalculateBoundingBox(ThisObject, Low, High);
220  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
221  SearchInBoxLocal(ThisObject, Result, NumberOfResults, MaxNumberOfResults, Box );
222 
223  return NumberOfResults;
224  }
225 
234  KRATOS_ERROR << "Missing implementation of SearchObjectsInCell(PointerType, ResultIteratorType)" << std::endl;
235  }
236 
244  SizeType SearchObjectsInCell(const PointType& ThisPoint, ResultIteratorType Result, const SizeType& MaxNumberOfResults) {
245  IndexType icell = CalculateIndex(ThisPoint);
246 
247  if(mCells[icell].Size() < MaxNumberOfResults) {
248  for(IteratorType i_object = mCells[icell].Begin() ; i_object != mCells[icell].End(); i_object++, Result++) {
249  *Result = *i_object;
250  }
251  return mCells[icell].Size();
252  } else {
254  }
255  }
256 
265  PointType Low, High;
267 
268  TConfigure::CalculateBoundingBox(ThisObject, Low, High);
269  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
270  SearchObjectLocalExclusive(ThisObject, Result, Box );
271 
272  return Result.size();
273  }
274 
282  SizeType SearchObjectsExclusive(PointerType& ThisObject, ResultIteratorType& Result, const SizeType& MaxNumberOfResults) {
283  PointType Low, High;
285  SizeType NumberOfResults = 0;
286 
287  TConfigure::CalculateBoundingBox(ThisObject, Low, High);
288  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
289  SearchObjectLocalExclusive(ThisObject, Result, NumberOfResults, MaxNumberOfResults, Box );
290 
291  return NumberOfResults;
292  }
293 
301  SizeType SearchObjectsInRadius(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results) {
303  KRATOS_ERROR << "Missing implementation of SearchObjectsInRadius(PointerType, const double, ResultIteratorType)" << std::endl;
304  }
305 
314  SizeType SearchObjectsInRadius(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results, const SizeType& MaxNumberOfResults) {
315  PointType Low, High;
317  SizeType NumberOfResults = 0;
318 
319  TConfigure::CalculateBoundingBox(ThisObject, Low, High, Radius);
320  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
321  SearchInRadius(ThisObject, Radius, Results, NumberOfResults, MaxNumberOfResults, Box );
322 
323  return NumberOfResults;
324  }
325 
334  SizeType SearchObjectsInRadius(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results, DistanceIteratorType ResultDistances) {
336  KRATOS_ERROR << "Missing implementation of SearchObjectsInRadius(PointerType, const double, ResultIteratorType, DistanceIteratorType)" << std::endl;
337  }
338 
348  SizeType SearchObjectsInRadius(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results, DistanceIteratorType ResultDistances, const SizeType& MaxNumberOfResults) {
349  PointType Low, High;
351  SizeType NumberOfResults = 0;
352 
353  TConfigure::CalculateBoundingBox(ThisObject, Low, High, Radius);
354  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
355  SearchInRadius(ThisObject, Radius, Results, ResultDistances, NumberOfResults, MaxNumberOfResults, Box );
356 
357  return NumberOfResults;
358  }
359 
368  virtual SizeType SearchObjectsInRadiusExclusive(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results) {
370  KRATOS_ERROR << "Missing implementation of SearchObjectsInRadiusExclusive(PointerType, const double, ResultIteratorType)" << std::endl;
371  }
372 
381  virtual SizeType SearchObjectsInRadiusExclusive(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results, const SizeType& MaxNumberOfResults) {
382  PointType Low, High;
384  SizeType NumberOfResults = 0;
385 
386  TConfigure::CalculateBoundingBox(ThisObject, Low, High, Radius);
387  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
388  SearchInRadiusExclusive(ThisObject, Radius, Results, NumberOfResults, MaxNumberOfResults, Box );
389 
390  return NumberOfResults;
391  }
392 
401  virtual SizeType SearchObjectsInRadiusExclusive(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results, DistanceIteratorType ResultDistances) {
403  KRATOS_ERROR << "Missing implementation of SearchObjectsInRadiusExclusive(PointerType, const double, ResultIteratorType, DistanceIteratorType)" << std::endl;
404  }
405 
415  virtual SizeType SearchObjectsInRadiusExclusive(PointerType& ThisObject, const double& Radius, ResultIteratorType& Results, DistanceIteratorType ResultDistances, const SizeType& MaxNumberOfResults) {
416  PointType Low, High;
418  SizeType NumberOfResults = 0;
419 
420  TConfigure::CalculateBoundingBox(ThisObject, Low, High, Radius);
421  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
422  SearchInRadiusExclusive(ThisObject, Radius, Results, ResultDistances, NumberOfResults, MaxNumberOfResults, Box );
423 
424  return NumberOfResults;
425  }
426 
428 
438  void SearchObjectsInRadius(IteratorType const& ThisObjects, SizeType const& NumberOfObjects, const std::vector<double>& Radius, std::vector<std::vector<PointerType> >& Results, std::vector<SizeType>& NumberOfResults, SizeType const& MaxNumberOfResults) {
439 
440  struct tls_type
441  {
442  PointType Low;
443  PointType High;
445  };
446 
447  IndexPartition<std::size_t>(NumberOfObjects).for_each(tls_type(), [&](std::size_t i, tls_type& rTLS){
448  ResultIteratorType ResultsPointer = Results[i].begin();
449  NumberOfResults[i] = 0;
450 
451  TConfigure::CalculateBoundingBox(ThisObjects[i], rTLS.Low, rTLS.High, Radius[i]);
452  rTLS.Box.Set( CalculateCell(rTLS.Low), CalculateCell(rTLS.High), mN );
453 
454  SearchInRadius(ThisObjects[i], Radius[i], ResultsPointer, NumberOfResults[i], MaxNumberOfResults, rTLS.Box );
455  });
456  }
457 
468  void SearchObjectsInRadius(IteratorType const& ThisObjects, SizeType const& NumberOfObjects, const std::vector<double>& Radius, std::vector<std::vector<PointerType> >& Results, std::vector<std::vector<double> >& ResultsDistances, std::vector<SizeType>& NumberOfResults, SizeType const& MaxNumberOfResults) {
469  PointType Low, High;
471 
472  #pragma omp parallel for private(Low,High,Box)
473  for(int i = 0; i < static_cast<int>(NumberOfObjects); i++) {
474  ResultIteratorType ResultsPointer = Results[i].begin();
475  DistanceIteratorType ResultsDistancesPointer = ResultsDistances[i].begin();
476 
477  NumberOfResults[i] = 0;
478 
479  TConfigure::CalculateBoundingBox(ThisObjects[i], Low, High, Radius[i]);
480  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
481 
482  SearchInRadius(ThisObjects[i], Radius[i], ResultsPointer, ResultsDistancesPointer, NumberOfResults[i], MaxNumberOfResults, Box );
483  }
484  }
485 
495 virtual void SearchObjectsInRadiusExclusive(IteratorType const& ThisObjects, SizeType const& NumberOfObjects, const std::vector<double>& Radius, std::vector<std::vector<PointerType> >& Results, std::vector<SizeType>& NumberOfResults, SizeType const& MaxNumberOfResults) {
496  PointType Low, High;
498 
499  #pragma omp parallel for private(Low,High,Box)
500  for(int i = 0; i < static_cast<int>(NumberOfObjects); i++) {
501  ResultIteratorType ResultsPointer = Results[i].begin();
502 
503  NumberOfResults[i] = 0;
504 
505  TConfigure::CalculateBoundingBox(ThisObjects[i], Low, High, Radius[i]);
506  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
507 
508  SearchInRadiusExclusive(ThisObjects[i], Radius[i], ResultsPointer, NumberOfResults[i], MaxNumberOfResults, Box );
509  }
510  }
511 
522 virtual void SearchObjectsInRadiusExclusive(IteratorType const& ThisObjects, SizeType const& NumberOfObjects, const std::vector<double>& Radius, std::vector<std::vector<PointerType> >& Results, std::vector<std::vector<double> >& ResultsDistances, std::vector<SizeType>& NumberOfResults, SizeType const& MaxNumberOfResults) {
523  PointType Low, High;
525 
526  #pragma omp parallel for private(Low,High,Box)
527  for(int i = 0; i < static_cast<int>(NumberOfObjects); i++) {
528  ResultIteratorType ResultsPointer = Results[i].begin();
529  DistanceIteratorType ResultsDistancesPointer = ResultsDistances[i].begin();
530 
531  NumberOfResults[i] = 0;
532 
533  TConfigure::CalculateBoundingBox(ThisObjects[i], Low, High, Radius[i]);
534  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
535 
536  SearchInRadiusExclusive(ThisObjects[i], Radius[i], ResultsPointer, ResultsDistancesPointer, NumberOfResults[i], MaxNumberOfResults, Box );
537  }
538  }
539 
541 
546  virtual void AddObject(const PointerType& ThisObject) {
547  PointType Low, High;
549 
550  TConfigure::CalculateBoundingBox(ThisObject, Low, High);
551  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
552  FillObject(Box,ThisObject);
553 
554  mObjectsSize++;
555  }
556 
561  void RemoveObject(const PointerType& ThisObject) {
562  PointType Low, High;
564 
565  TConfigure::CalculateBoundingBox(ThisObject, Low, High);
566  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
567  RemoveObjectLocal(Box,ThisObject);
568 
569  mObjectsSize--;
570  }
571 
575 
576 
580 
587  template<class GenericCoordType>
588  IndexArray CalculateCell(const GenericCoordType& ThisObject) {
589  IndexArray IndexCell;
590 
591  for(SizeType i = 0 ; i < Dimension ; i++) {
592  IndexCell[i] = CalculatePosition(ThisObject[i],i);
593  }
594 
595  return IndexCell;
596  }
597 
604  template<class GenericCoordType>
605  IndexType CalculateIndex(const GenericCoordType& ThisObject) {
606  IndexType Index = 0;
607 
608  for(SizeType iDim = Dimension-1 ; iDim > 0 ; iDim--) {
609  Index += CalculatePosition(ThisObject[iDim],iDim);
610  Index *= mN[iDim-1];
611  }
612 
613  Index += CalculatePosition(ThisObject[0],0);
614 
615  return Index;
616  }
617 
624  virtual IndexType CalculatePosition(CoordinateType const& ThisCoord, const SizeType& ThisDimension) {
625  CoordinateType d_index = (ThisCoord - mMinPoint[ThisDimension]) * mInvCellSize[ThisDimension];
626  IndexType index = static_cast<IndexType>( (d_index < 0.00) ? 0.00 : d_index );
627 
628  return (index > mN[ThisDimension]-1) ? mN[ThisDimension]-1 : index;
629  }
630 
634 
641  return mCells;
642  }
643 
650  return mN;
651  }
652 
659  return mCellSize;
660  }
661 
668  return mMinPoint;
669  }
670 
677  return mMaxPoint;
678  }
679 
683 
684 
688 
690  virtual std::string Info() const {
691  return "BinsObjectDynamic" ;
692  }
693 
698  virtual void PrintInfo(std::ostream& rOStream) const {
699  rOStream << Info();
700  }
701 
707  virtual void PrintData(std::ostream& rOStream, std::string const& Perfix = std::string()) const {
708  rOStream << " BinsSize: ";
709  for(SizeType i = 0 ; i < Dimension ; i++) {
710  rOStream << "[" << mN[i] << "]";
711  }
712  rOStream << std::endl;
713  rOStream << " CellSize: ";
714  for(SizeType i = 0 ; i < Dimension ; i++) {
715  rOStream << "[" << mCellSize[i] << "]";
716  }
717  rOStream << std::endl;
718  SizeType nn = 0;
719  for(SizeType i = 0 ; i < mCells.size(); i++) {
720  nn += mCells[i].Size();
721  }
722  rOStream << "NumPointers: " << nn << std::endl;
723  }
724 
729  void PrintSize(std::ostream& rout) {
730  rout << " BinsSize: ";
731  for(SizeType i = 0 ; i < Dimension ; i++) {
732  rout << "[" << mN[i] << "]";
733  }
734  rout << std::endl;
735  }
736 
741  void PrintBox(std::ostream& rout) {
742  rout << " BinsBox: Min [";
743  mMinPoint.Print(rout);
744  rout << "]; Max [";
745  mMaxPoint.Print(rout);
746  rout << "]; Size [";
747  mCellSize.Print(rout);
748  rout << "]" << std::endl;
749  }
750 
751 protected:
752 
756 
757 
759 
762 
763 
767 
768 
772 
774  virtual void CalculateBoundingBox()
775  {
776  PointType Low, High;
777  TConfigure::CalculateBoundingBox(*mObjectsBegin,mMinPoint,mMaxPoint);
778 
779 #ifdef _OPENMP
780  SizeType number_of_threads = omp_get_max_threads();
781 #else
782  SizeType number_of_threads = 1;
783 #endif
784 
785  std::vector<SizeType> node_partition;
786  CreatePartition(number_of_threads, mObjectsSize, node_partition);
787 
788  std::vector<PointType> Max(number_of_threads);
789  std::vector<PointType> Min(number_of_threads);
790 
791  for(SizeType k=0; k<number_of_threads; k++ )
792  {
793  Max[k] = mMaxPoint;
794  Min[k] = mMinPoint;
795  }
796 
797  IteratorType i_begin = mObjectsBegin;
798  IteratorType i_end = mObjectsEnd;
799 
800  for (IteratorType i_object = i_begin ; i_object != i_end ; i_object++ )
801  {
802  TConfigure::CalculateBoundingBox(*i_object, Low, High);
803  for(SizeType i = 0 ; i < Dimension ; i++)
804  {
805  mMaxPoint[i] = (mMaxPoint[i] < High[i]) ? High[i] : mMaxPoint[i];
806  mMinPoint[i] = (mMinPoint[i] > Low[i]) ? Low[i] : mMinPoint[i];
807  }
808  }
809 
810  auto Epsilon = PointType{mMaxPoint - mMinPoint};
811 
812  for(SizeType i = 0 ; i < Dimension ; i++)
813  {
814  mMaxPoint[i] += Epsilon[i] * 0.01;
815  mMinPoint[i] -= Epsilon[i] * 0.01;
816  }
817  }
818 
826  void CalculateCellSize(std::size_t ApproximatedSize)
827  {
828  std::size_t average_number_of_cells = static_cast<std::size_t>(std::pow(static_cast<double>(ApproximatedSize), 1.00 / Dimension));
829 
830  std::array<double, 3> lengths;
831  double average_length = 0.00;
832 
833  for (int i = 0; i < Dimension; i++) {
834  lengths[i] = mMaxPoint[i] - mMinPoint[i];
835  average_length += lengths[i];
836  }
837  average_length *= 1.00 / 3.00;
838 
839  if (average_length < std::numeric_limits<double>::epsilon()) {
840  for(int i = 0; i < Dimension; i++) {
841  mN[i] = 1;
842  }
843  return;
844  }
845 
846  for (int i = 0; i < Dimension; i++) {
847  mN[i] = static_cast<std::size_t>(lengths[i] / average_length * (double)average_number_of_cells) + 1;
848 
849  if (mN[i] > 1) {
850  mCellSize[i] = lengths[i] / mN[i];
851  } else {
852  mCellSize[i] = average_length;
853  }
854 
855  mInvCellSize[i] = 1.00 / mCellSize[i];
856  }
857  }
858 
867  {
868  for(SizeType i = 0 ; i < Dimension ; i++)
869  {
870  mCellSize[i] = CellSize;
871  mInvCellSize[i] = 1.00 / mCellSize[i];
872  mN[i] = static_cast<SizeType>( (mMaxPoint[i]-mMinPoint[i]) / mCellSize[i]) + 1;
873  }
874  }
875 
876  virtual void GenerateBins()
877  {
878  PointType Low, High;
881  for(IteratorType i_object = mObjectsBegin ; i_object != mObjectsEnd ; i_object++)
882  {
883  TConfigure::CalculateBoundingBox(*i_object, Low, High);
884  Box.Set( CalculateCell(Low), CalculateCell(High), mN );
885  FillObject(Box, *i_object);
886  }
887  }
888 
889  // **** THREAD SAFE
890  // Dimension = 1
891  void SearchInBoxLocal(PointerType& ThisObject, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
893  {
894  PointType MinCell, MaxCell;
895  PointType MinBox, MaxBox;
896  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
897  MaxCell[0] = MinCell[0] + mCellSize[0];
898  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0])
899  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
900  mCells[I].SearchObjects(ThisObject, Result, NumberOfResults, MaxNumberOfResults);
901  }
902 
903  // Dimension = 2
904  void SearchInBoxLocal(PointerType& ThisObject, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
906  {
907  PointType MinCell, MaxCell;
908  PointType MinBox, MaxBox;
909 
910  for(SizeType i = 0; i < 2; i++)
911  {
912  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
913  MaxBox[i] = MinBox[i] + mCellSize[i];
914  }
915 
916  MinCell[1] = MinBox[1];
917  MaxCell[1] = MaxBox[1];
918  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
919  {
920  MinCell[0] = MinBox[0];
921  MaxCell[0] = MaxBox[0];
922  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
923  {
924  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
925  mCells[I].SearchObjects(ThisObject, Result, NumberOfResults, MaxNumberOfResults);
926  }
927  }
928  }
929 
930  // Dimension = 3
932  SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
934  {
935 
936  PointType MinCell, MaxCell;
937  PointType MinBox, MaxBox;
938 
939  for(SizeType i = 0; i < 3; i++)
940  {
941  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
942  MaxBox[i] = MinBox[i] + mCellSize[i];
943  }
944 
945  MinCell[2] = MinBox[2];
946  MaxCell[2] = MaxBox[2];
947  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2] += mCellSize[2], MaxCell[2] += mCellSize[2] )
948  {
949  MinCell[1] = MinBox[1];
950  MaxCell[1] = MaxBox[1];
951  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
952  {
953  MinCell[0] = MinBox[0];
954  MaxCell[0] = MaxBox[0];
955  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
956  {
957  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
958  {
959  mCells[I].SearchObjects(ThisObject, Result, NumberOfResults, MaxNumberOfResults);
960  }
961  }
962  }
963  }
964  }
965 
966  // **** THREAD SAFE
967 
968  // Dimension = 1
971  {
972 
973  PointType MinCell, MaxCell;
974  PointType MinBox, MaxBox;
975  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
976  MaxCell[0] = MinCell[0] + mCellSize[0];
977  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block )
978  {
979  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
980  mCells[I].SearchObjects(ThisObject, Result);
981  }
982  }
983 
984  // Dimension = 2
987  {
988  PointType MinCell, MaxCell;
989  PointType MinBox, MaxBox;
990 
991  for(SizeType i = 0; i < 2; i++)
992  {
993  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
994  MaxBox[i] = MinBox[i] + mCellSize[i];
995  }
996 
997  MinCell[1] = MinBox[1];
998  MaxCell[1] = MaxBox[1];
999 
1000  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block )
1001  {
1002  MinCell[0] = MinBox[0];
1003  MaxCell[0] = MaxBox[0];
1004  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block )
1005  {
1006  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1007  mCells[I].SearchObjects(ThisObject, Result);
1008  }
1009  }
1010  }
1011 
1012  // Dimension = 3
1015  {
1016  PointType MinCell, MaxCell;
1017  PointType MinBox, MaxBox;
1018 
1019  for(SizeType i = 0; i < 3; i++)
1020  {
1021  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1022  MaxBox[i] = MinBox[i] + mCellSize[i];
1023  }
1024 
1025  MinCell[2] = MinBox[2];
1026  MaxCell[2] = MaxBox[2];
1027 
1028  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block )
1029  {
1030  MinCell[1] = MinBox[1];
1031  MaxCell[1] = MaxBox[1];
1032  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block )
1033  {
1034  MinCell[0] = MinBox[0];
1035  MaxCell[0] = MaxBox[0];
1036  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block )
1037  {
1038  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1039  {
1040  mCells[I].SearchObjects(ThisObject, Result);
1041  }
1042  }
1043  }
1044  }
1045  }
1046 
1047  // **** THREAD SAFE
1048 
1049  // Dimension = 1
1050  void SearchObjectLocalExclusive(PointerType& ThisObject, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1052  {
1053  PointType MinCell, MaxCell;
1054  PointType MinBox, MaxBox;
1055  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1056  MaxCell[0] = MinCell[0] + mCellSize[0];
1057  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0])
1058  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1059  mCells[I].SearchObjectsExclusive(ThisObject, Result, NumberOfResults, MaxNumberOfResults);
1060  }
1061 
1062  // Dimension = 2
1063  void SearchObjectLocalExclusive(PointerType& ThisObject, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1065  {
1066  PointType MinCell, MaxCell;
1067  PointType MinBox, MaxBox;
1068 
1069  for(SizeType i = 0; i < 2; i++)
1070  {
1071  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1072  MaxBox[i] = MinBox[i] + mCellSize[i];
1073  }
1074 
1075  MinCell[1] = MinBox[1];
1076  MaxCell[1] = MaxBox[1];
1077  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1078  {
1079  MinCell[0] = MinBox[0];
1080  MaxCell[0] = MaxBox[0];
1081  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1082  {
1083  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1084  mCells[I].SearchObjectsExclusive(ThisObject, Result, NumberOfResults, MaxNumberOfResults);
1085  }
1086  }
1087  }
1088 
1089  // Dimension = 3
1091  SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1093  {
1094 
1095  PointType MinCell, MaxCell;
1096  PointType MinBox, MaxBox;
1097 
1098  for(SizeType i = 0; i < 3; i++)
1099  {
1100  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1101  MaxBox[i] = MinBox[i] + mCellSize[i];
1102  }
1103 
1104  MinCell[2] = MinBox[2];
1105  MaxCell[2] = MaxBox[2];
1106  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2] += mCellSize[2], MaxCell[2] += mCellSize[2] )
1107  {
1108  MinCell[1] = MinBox[1];
1109  MaxCell[1] = MaxBox[1];
1110  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1111  {
1112  MinCell[0] = MinBox[0];
1113  MaxCell[0] = MaxBox[0];
1114  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1115  {
1116  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1117  {
1118  mCells[I].SearchObjectsExclusive(ThisObject, Result, NumberOfResults, MaxNumberOfResults);
1119  }
1120  }
1121  }
1122  }
1123  }
1124 
1125  // **** THREAD SAFE
1126 
1127  // Dimension = 1
1130  {
1131  PointType MinCell, MaxCell;
1132  PointType MinBox, MaxBox;
1133  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1134  MaxCell[0] = MinCell[0] + mCellSize[0];
1135  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block )
1136  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1137  mCells[I].SearchObjectsExclusive(ThisObject, Result);
1138 
1139  }
1140 
1141  // Dimension = 2
1144  {
1145  PointType MinCell, MaxCell;
1146  PointType MinBox, MaxBox;
1147 
1148  for(SizeType i = 0; i < 2; i++)
1149  {
1150  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1151  MaxBox[i] = MinBox[i] + mCellSize[i];
1152  }
1153 
1154  MinCell[1] = MinBox[1];
1155  MaxCell[1] = MaxBox[1];
1156 
1157  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block )
1158  {
1159  MinCell[0] = MinBox[0];
1160  MaxCell[0] = MaxBox[0];
1161  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block )
1162  {
1163  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1164  mCells[I].SearchObjectsExclusive(ThisObject, Result);
1165  }
1166  }
1167  }
1168 
1169  // Dimension = 3
1172  {
1173  PointType MinCell, MaxCell;
1174  PointType MinBox, MaxBox;
1175 
1176  for(SizeType i = 0; i < 3; i++)
1177  {
1178  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1179  MaxBox[i] = MinBox[i] + mCellSize[i];
1180  }
1181 
1182  MinCell[2] = MinBox[2];
1183  MaxCell[2] = MaxBox[2];
1184 
1185  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block )
1186  {
1187  MinCell[2] = MinBox[2];
1188  MaxCell[2] = MaxBox[2];
1189  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block )
1190  {
1191  MinCell[0] = MinBox[0];
1192  MaxCell[0] = MaxBox[0];
1193  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block )
1194  {
1195  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell))
1196  {
1197  mCells[I].SearchObjectsExclusive(ThisObject, Result);
1198  }
1199  }
1200  }
1201  }
1202  }
1203 
1204  // **** THREAD SAFE
1205 
1206  // Dimension = 1
1207  void SearchInRadius(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1209  {
1210  PointType MinCell, MaxCell;
1211  PointType MinBox, MaxBox;
1212 
1213  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1214  MaxCell[0] = MinCell[0] + mCellSize[0];
1215 
1216  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0])
1217  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1218  mCells[I].SearchObjectsInRaius(ThisObject, Radius, Result, NumberOfResults, MaxNumberOfResults);
1219  }
1220 
1221  // Dimension = 2
1222  void SearchInRadius(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1224  {
1225  PointType MinCell, MaxCell;
1226  PointType MinBox, MaxBox;
1227 
1228  for(SizeType i = 0; i < 2; i++)
1229  {
1230  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1231  MaxBox[i] = MinBox[i] + mCellSize[i];
1232  }
1233 
1234  MinCell[1] = MinBox[1];
1235  MaxCell[1] = MaxBox[1];
1236  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1237  {
1238  MinCell[0] = MinBox[0];
1239  MaxCell[0] = MaxBox[0];
1240  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1241  {
1242  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1243  mCells[I].SearchObjectsInRaius(ThisObject, Radius, Result, NumberOfResults, MaxNumberOfResults);
1244  }
1245  }
1246  }
1247 
1248  // Dimension = 3
1249  void SearchInRadius(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1251  {
1252 
1253  PointType MinCell, MaxCell;
1254  PointType MinBox, MaxBox;
1255 
1256  for(SizeType i = 0; i < 3; i++)
1257  {
1258  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1259  MaxBox[i] = MinBox[i] + mCellSize[i];
1260  }
1261 
1262  MinCell[2] = MinBox[2];
1263  MaxCell[2] = MaxBox[2];
1264  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2] += mCellSize[2], MaxCell[2] += mCellSize[2] )
1265  {
1266  MinCell[1] = MinBox[1];
1267  MaxCell[1] = MaxBox[1];
1268  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1269  {
1270  MinCell[0] = MinBox[0];
1271  MaxCell[0] = MaxBox[0];
1272  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1273  {
1274  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1275  {
1276  mCells[I].SearchObjectsInRadius(ThisObject, Radius, Result, NumberOfResults, MaxNumberOfResults);
1277  }
1278  }
1279  }
1280  }
1281  }
1282 
1283  // **** THREAD SAFE
1284 
1285  // Dimension = 1
1286  void SearchInRadius(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, DistanceIteratorType ResultDistances, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1288  {
1289  PointType MinCell, MaxCell;
1290  PointType MinBox, MaxBox;
1291 
1292  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1293  MaxCell[0] = MinCell[0] + mCellSize[0];
1294 
1295  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0])
1296  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1297  mCells[I].SearchObjectsInRaius(ThisObject, Radius, Result, ResultDistances, NumberOfResults, MaxNumberOfResults);
1298  }
1299 
1300  // Dimension = 2
1301  void SearchInRadius(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, DistanceIteratorType ResultDistances, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1303  {
1304  PointType MinCell, MaxCell;
1305  PointType MinBox, MaxBox;
1306 
1307  for(SizeType i = 0; i < 2; i++)
1308  {
1309  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1310  MaxBox[i] = MinBox[i] + mCellSize[i];
1311  }
1312 
1313  MinCell[1] = MinBox[1];
1314  MaxCell[1] = MaxBox[1];
1315  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1316  {
1317  MinCell[0] = MinBox[0];
1318  MaxCell[0] = MaxBox[0];
1319  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1320  {
1321  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1322  mCells[I].SearchObjectsInRaius(ThisObject, Radius, Result, ResultDistances, NumberOfResults, MaxNumberOfResults);
1323  }
1324  }
1325  }
1326 
1327  // Dimension = 3
1328  void SearchInRadius(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, DistanceIteratorType ResultDistances, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1330  {
1331 
1332  PointType MinCell, MaxCell;
1333  PointType MinBox, MaxBox;
1334 
1335  for(SizeType i = 0; i < 3; i++)
1336  {
1337  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1338  MaxBox[i] = MinBox[i] + mCellSize[i];
1339  }
1340 
1341  MinCell[2] = MinBox[2];
1342  MaxCell[2] = MaxBox[2];
1343  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2] += mCellSize[2], MaxCell[2] += mCellSize[2] )
1344  {
1345  MinCell[1] = MinBox[1];
1346  MaxCell[1] = MaxBox[1];
1347  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1348  {
1349  MinCell[0] = MinBox[0];
1350  MaxCell[0] = MaxBox[0];
1351  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1352  {
1353  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1354  {
1355  mCells[I].SearchObjectsInRadius(ThisObject, Radius, Result, ResultDistances, NumberOfResults, MaxNumberOfResults);
1356  }
1357  }
1358  }
1359  }
1360  }
1361 
1362  // **** THREAD SAFE
1363 
1364  // Dimension = 1
1365  virtual void SearchInRadiusExclusive(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1367  {
1368  PointType MinCell, MaxCell;
1369  PointType MinBox, MaxBox;
1370 
1371  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1372  MaxCell[0] = MinCell[0] + mCellSize[0];
1373 
1374  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0])
1375  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1376  mCells[I].SearchObjectsInRadiusExclusive(ThisObject, Radius, Result, NumberOfResults, MaxNumberOfResults);
1377  }
1378 
1379  // Dimension = 2
1380  virtual void SearchInRadiusExclusive(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1382  {
1383  PointType MinCell, MaxCell;
1384  PointType MinBox, MaxBox;
1385 
1386  for(SizeType i = 0; i < 2; i++)
1387  {
1388  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1389  MaxBox[i] = MinBox[i] + mCellSize[i];
1390  }
1391 
1392  MinCell[1] = MinBox[1];
1393  MaxCell[1] = MaxBox[1];
1394  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1395  {
1396  MinCell[0] = MinBox[0];
1397  MaxCell[0] = MaxBox[0];
1398  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1399  {
1400  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1401  mCells[I].SearchObjectsInRadiusExclusive(ThisObject, Radius, Result, NumberOfResults, MaxNumberOfResults);
1402  }
1403  }
1404  }
1405 
1406  // Dimension = 3
1407  virtual void SearchInRadiusExclusive(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1409  {
1410 
1411  PointType MinCell, MaxCell;
1412  PointType MinBox, MaxBox;
1413 
1414  for(SizeType i = 0; i < 3; i++)
1415  {
1416  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1417  MaxBox[i] = MinBox[i] + mCellSize[i];
1418  }
1419 
1420  MinCell[2] = MinBox[2];
1421  MaxCell[2] = MaxBox[2];
1422  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2] += mCellSize[2], MaxCell[2] += mCellSize[2] )
1423  {
1424  MinCell[1] = MinBox[1];
1425  MaxCell[1] = MaxBox[1];
1426  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1427  {
1428  MinCell[0] = MinBox[0];
1429  MaxCell[0] = MaxBox[0];
1430  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1431  {
1432  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1433  {
1434  mCells[I].SearchObjectsInRadiusExclusive(ThisObject, Radius, Result, NumberOfResults, MaxNumberOfResults);
1435  }
1436  }
1437  }
1438  }
1439  }
1440 
1441  // **** THREAD SAFE
1442 
1443  // Dimension = 1
1444  virtual void SearchInRadiusExclusive(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, DistanceIteratorType ResultDistances, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1446  {
1447  PointType MinCell, MaxCell;
1448  PointType MinBox, MaxBox;
1449 
1450  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1451  MaxCell[0] = MinCell[0] + mCellSize[0];
1452 
1453  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0])
1454  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1455  mCells[I].SearchObjectsInRadiusExclusive(ThisObject, Radius, Result, ResultDistances, NumberOfResults, MaxNumberOfResults);
1456  }
1457 
1458  // Dimension = 2
1459  virtual void SearchInRadiusExclusive(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, DistanceIteratorType ResultDistances, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1461  {
1462  PointType MinCell, MaxCell;
1463  PointType MinBox, MaxBox;
1464 
1465  for(SizeType i = 0; i < 2; i++)
1466  {
1467  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1468  MaxBox[i] = MinBox[i] + mCellSize[i];
1469  }
1470 
1471  MinCell[1] = MinBox[1];
1472  MaxCell[1] = MaxBox[1];
1473  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1474  {
1475  MinCell[0] = MinBox[0];
1476  MaxCell[0] = MaxBox[0];
1477  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1478  {
1479  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1480  mCells[I].SearchObjectsInRadiusExclusive(ThisObject, Radius, Result, ResultDistances, NumberOfResults, MaxNumberOfResults);
1481  }
1482  }
1483  }
1484 
1485  // Dimension = 3
1486  virtual void SearchInRadiusExclusive(PointerType& ThisObject, CoordinateType const& Radius, ResultIteratorType& Result, DistanceIteratorType ResultDistances, SizeType& NumberOfResults, const SizeType& MaxNumberOfResults,
1488  {
1489 
1490  PointType MinCell, MaxCell;
1491  PointType MinBox, MaxBox;
1492 
1493  for(SizeType i = 0; i < 3; i++)
1494  {
1495  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1496  MaxBox[i] = MinBox[i] + mCellSize[i];
1497  }
1498 
1499  MinCell[2] = MinBox[2];
1500  MaxCell[2] = MaxBox[2];
1501  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2] += mCellSize[2], MaxCell[2] += mCellSize[2] )
1502  {
1503  MinCell[1] = MinBox[1];
1504  MaxCell[1] = MaxBox[1];
1505  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1] += mCellSize[1], MaxCell[1] += mCellSize[1] )
1506  {
1507  MinCell[0] = MinBox[0];
1508  MaxCell[0] = MaxBox[0];
1509  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0] += mCellSize[0], MaxCell[0] += mCellSize[0] )
1510  {
1511  if(TConfigure::IntersectionBox(ThisObject, MinCell, MaxCell, Radius))
1512  {
1513  mCells[I].SearchObjectsInRadiusExclusive(ThisObject, Radius, Result, ResultDistances, NumberOfResults, MaxNumberOfResults);
1514  }
1515  }
1516  }
1517  }
1518  }
1519 
1520  // Dimension = 1
1522  {
1523  PointType MinCell, MaxCell;
1524 
1525  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1526  MaxCell[0] = MinCell[0] + mCellSize[0];
1527  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0]+=mCellSize[0], MaxCell[0]+=mCellSize[0] )
1528  {
1529  if(TConfigure::IntersectionBox(i_object, MinCell, MaxCell))
1530  mCells[I].Add(i_object);
1531  }
1532  }
1533 
1534  // Dimension = 2
1536  {
1537  PointType MinCell, MaxCell;
1538  PointType MinBox, MaxBox;
1539 
1540  for(SizeType i = 0; i < 2; i++)
1541  {
1542  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1543  MaxBox[i] = MinBox[i] + mCellSize[i];
1544  }
1545 
1546  MinCell[1] = MinBox[1];
1547  MaxCell[1] = MaxBox[1];
1548  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1]+=mCellSize[1], MaxCell[1]+=mCellSize[1] )
1549  {
1550  MinCell[0] = MinBox[0];
1551  MaxCell[0] = MaxBox[0];
1552  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0]+=mCellSize[0], MaxCell[0]+=mCellSize[0] )
1553  {
1554  if(TConfigure::IntersectionBox(i_object,MinCell,MaxCell))
1555  mCells[I].Add(i_object);
1556  }
1557  }
1558  }
1559 
1560  // Dimension = 3
1562  {
1563  PointType MinCell, MaxCell;
1564  PointType MinBox, MaxBox;
1565 
1566  for(SizeType i = 0; i < 3; i++)
1567  {
1568  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1569  MaxBox[i] = MinBox[i] + mCellSize[i];
1570  }
1571 
1572  MinCell[2] = MinBox[2];
1573  MaxCell[2] = MaxBox[2];
1574  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2]+=mCellSize[2], MaxCell[2]+=mCellSize[2] )
1575  {
1576  MinCell[1] = MinBox[1];
1577  MaxCell[1] = MaxBox[1];
1578  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1]+=mCellSize[1], MaxCell[1]+=mCellSize[1] )
1579  {
1580  MinCell[0] = MinBox[0];
1581  MaxCell[0] = MaxBox[0];
1582  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0]+=mCellSize[0], MaxCell[0]+=mCellSize[0] )
1583  {
1584  if(TConfigure::IntersectionBox(i_object,MinCell,MaxCell))
1585  mCells[I].Add(i_object);
1586  }
1587  }
1588  }
1589  }
1590 
1591  // Dimension = 1
1593  {
1594  PointType MinCell, MaxCell;
1595 
1596  MinCell[0] = static_cast<CoordinateType>(Box.Axis[0].Min) * mCellSize[0] + mMinPoint[0]; //
1597  MaxCell[0] = MinCell[0] + mCellSize[0];
1598  for(IndexType I = Box.Axis[0].Begin() ; I <= Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0]+=mCellSize[0], MaxCell[0]+=mCellSize[0] )
1599  {
1600  if(TConfigure::IntersectionBox(i_object, MinCell, MaxCell))
1601  mCells[I].Remove(i_object);
1602  }
1603  }
1604 
1605  // Dimension = 2
1607  {
1608  PointType MinCell, MaxCell;
1609  PointType MinBox, MaxBox;
1610 
1611  for(SizeType i = 0; i < 2; i++)
1612  {
1613  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i];
1614  MaxBox[i] = MinBox[i] + mCellSize[i];
1615  }
1616 
1617  MinCell[1] = MinBox[1];
1618  MaxCell[1] = MaxBox[1];
1619  for(IndexType II = Box.Axis[1].Begin() ; II <= Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1]+=mCellSize[1], MaxCell[1]+=mCellSize[1] )
1620  {
1621  MinCell[0] = MinBox[0];
1622  MaxCell[0] = MaxBox[0];
1623  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0]+=mCellSize[0], MaxCell[0]+=mCellSize[0] )
1624  {
1625  if(TConfigure::IntersectionBox(i_object,MinCell,MaxCell))
1626  mCells[I].Remove(i_object);
1627  }
1628  }
1629  }
1630 
1631  // Dimension = 3
1633  {
1634  PointType MinCell, MaxCell;
1635  PointType MinBox, MaxBox;
1636 
1637  for(SizeType i = 0; i < 3; i++)
1638  {
1639  MinBox[i] = static_cast<CoordinateType>(Box.Axis[i].Min) * mCellSize[i] + mMinPoint[i]; //
1640  MaxBox[i] = MinBox[i] + mCellSize[i];
1641  }
1642 
1643  MinCell[2] = MinBox[2];
1644  MaxCell[2] = MaxBox[2];
1645  for(IndexType III = Box.Axis[2].Begin() ; III <= Box.Axis[2].End() ; III += Box.Axis[2].Block, MinCell[2]+=mCellSize[2], MaxCell[2]+=mCellSize[2] )
1646  {
1647  MinCell[1] = MinBox[1];
1648  MaxCell[1] = MaxBox[1];
1649  for(IndexType II = III + Box.Axis[1].Begin() ; II <= III + Box.Axis[1].End() ; II += Box.Axis[1].Block, MinCell[1]+=mCellSize[1], MaxCell[1]+=mCellSize[1] )
1650  {
1651  MinCell[0] = MinBox[0];
1652  MaxCell[0] = MaxBox[0];
1653  for(IndexType I = II + Box.Axis[0].Begin() ; I <= II + Box.Axis[0].End() ; I += Box.Axis[0].Block, MinCell[0]+=mCellSize[0], MaxCell[0]+=mCellSize[0] )
1654  {
1655  if(TConfigure::IntersectionBox(i_object,MinCell,MaxCell))
1656  mCells[I].Remove(i_object);
1657  }
1658  }
1659  }
1660  }
1661 
1663  {
1664  SizeType Size = mN[0];
1665  for(SizeType i = 1 ; i < Dimension ; i++)
1666  Size *= mN[i];
1667  mCells.resize(Size);
1668  }
1669 
1670  inline void CreatePartition(SizeType number_of_threads, const SizeType number_of_rows, std::vector<SizeType>& partitions)
1671  {
1672  partitions.resize(number_of_threads+1);
1673  SizeType partition_size = number_of_rows / number_of_threads;
1674  partitions[0] = 0;
1675  partitions[number_of_threads] = number_of_rows;
1676  for(SizeType i = 1; i<number_of_threads; i++)
1677  partitions[i] = partitions[i-1] + partition_size ;
1678  }
1679 
1683 
1684 
1688 
1689 
1693 
1694 
1698 
1699 
1701 
1704 
1705 
1709 
1712 
1716 
1720 
1722 
1723 private:
1724 
1728 
1729 
1733 
1734 
1735 
1739 
1740 
1744 
1745 
1750 
1751 
1752 public:
1755  {
1756  mMinPoint = rOther.mMinPoint;
1757  mMaxPoint = rOther.mMaxPoint;
1758  mObjectsBegin = rOther.mObjectsBegin;
1759  mObjectsEnd = rOther.mObjectsEnd;
1760  mObjectsSize = rOther.mObjectsSize;
1761  mCellSize = rOther.mCellSize;
1762  mInvCellSize = rOther.mInvCellSize;
1763  mN = rOther.mN;
1764  mCells = rOther.mCells;
1765  return *this;
1766  }
1767 
1770  {
1771  *this = rOther;
1772  }
1773 
1775  template<class T>
1777  {
1778  *this = rOther;
1779  }
1780 
1781 }; // Class BinsObjectDynamic
1782 
1784 
1787 
1788 
1792 
1793 
1795 template<class TConfigure>
1796 inline std::istream& operator >> (std::istream& rIStream,
1798 {
1799  return rIStream;
1800 }
1801 
1802 
1804 template<class TConfigure>
1805 inline std::ostream& operator << (std::ostream& rOStream,
1806  const BinsObjectDynamic<TConfigure> & rThis)
1807 {
1808  rThis.PrintInfo(rOStream);
1809  rOStream << std::endl;
1810  rThis.PrintData(rOStream);
1811 
1812  return rOStream;
1813 }
1815 
1816 
1817 } // namespace Kratos.
Short class definition.
Definition: bins_dynamic_objects.h:57
BinsObjectDynamic(const BinsObjectDynamic< T > &rOther)
Copy constructor.
Definition: bins_dynamic_objects.h:1776
virtual void CalculateBoundingBox()
It computes each object's boundinx box and uses it to find the max and min points.
Definition: bins_dynamic_objects.h:774
void FillObject(SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box, const PointerType &i_object)
Definition: bins_dynamic_objects.h:1521
void RemoveObject(const PointerType &ThisObject)
Definition: bins_dynamic_objects.h:561
TreeNodeType::CoordinateType CoordinateType
Definition: bins_dynamic_objects.h:75
SizeType SearchObjectsInRadius(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results, const SizeType &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:314
TreeNode< Dimension, PointType, PointerType, IteratorType, typename TConfigure::DistanceIteratorType > TreeNodeType
Definition: bins_dynamic_objects.h:73
CellContainerType mCells
Definition: bins_dynamic_objects.h:1721
void SearchInBoxLocal(PointerType &ThisObject, ResultContainerType &Result, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:985
virtual void SearchInRadiusExclusive(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:1407
virtual SizeType SearchObjectsInRadiusExclusive(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results, const SizeType &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:381
Tvector< SizeType, Dimension > SizeArray
Definition: bins_dynamic_objects.h:80
virtual void FillObject(SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box, const PointerType &i_object)
Definition: bins_dynamic_objects.h:1561
void SearchInRadius(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, DistanceIteratorType ResultDistances, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:1301
void SearchInRadius(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:1222
BinsObjectDynamic< TConfigure > & operator=(const BinsObjectDynamic< TConfigure > &rOther)
Assignment operator.
Definition: bins_dynamic_objects.h:1754
void SearchInBoxLocal(PointerType &ThisObject, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:931
TConfigure::ContainerType ContainerType
Definition: bins_dynamic_objects.h:67
virtual SizeType SearchObjectsInRadiusExclusive(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results, DistanceIteratorType ResultDistances)
Definition: bins_dynamic_objects.h:401
virtual void SearchObjectsInRadiusExclusive(IteratorType const &ThisObjects, SizeType const &NumberOfObjects, const std::vector< double > &Radius, std::vector< std::vector< PointerType > > &Results, std::vector< std::vector< double > > &ResultsDistances, std::vector< SizeType > &NumberOfResults, SizeType const &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:522
IteratorType mObjectsEnd
Definition: bins_dynamic_objects.h:1715
TConfigure::PointerType PointerType
Definition: bins_dynamic_objects.h:66
IndexArray CalculateCell(const GenericCoordType &ThisObject)
Definition: bins_dynamic_objects.h:588
TConfigure::PointType PointType
Definition: bins_dynamic_objects.h:65
PointType & GetMaxPoint()
Get the Max Point object.
Definition: bins_dynamic_objects.h:676
PointType mMinPoint
Definition: bins_dynamic_objects.h:1710
void SearchInBoxLocal(PointerType &ThisObject, ResultContainerType &Result, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:1013
void SearchInRadius(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, DistanceIteratorType ResultDistances, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:1328
CoordinateArray mCellSize
Definition: bins_dynamic_objects.h:1717
void SearchObjectLocalExclusive(PointerType &ThisObject, ResultContainerType &Result, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:1142
void SearchInBoxLocal(PointerType &ThisObject, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:891
void SearchObjectLocalExclusive(PointerType &ThisObject, ResultContainerType &Result, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:1170
void SearchInRadius(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, DistanceIteratorType ResultDistances, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:1286
virtual SizeType SearchObjectsInRadiusExclusive(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results, DistanceIteratorType ResultDistances, const SizeType &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:415
BinsObjectDynamic(const PointType &MinPoint, const PointType &MaxPoint, SizeType NumPoints)
Constructs a new BinsObjectDynamic object.
Definition: bins_dynamic_objects.h:173
Cell< Configure > CellType
Definition: bins_dynamic_objects.h:88
virtual void PrintData(std::ostream &rOStream, std::string const &Perfix=std::string()) const
Definition: bins_dynamic_objects.h:707
TreeNodeType::SearchStructureType SearchStructureType
Definition: bins_dynamic_objects.h:85
SizeType SearchObjectsInRadius(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results, DistanceIteratorType ResultDistances)
Definition: bins_dynamic_objects.h:334
BinsObjectDynamic(const BinsObjectDynamic &rOther)
Copy constructor.
Definition: bins_dynamic_objects.h:1769
void RemoveObjectLocal(SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box, const PointerType &i_object)
Definition: bins_dynamic_objects.h:1632
void SearchObjectLocalExclusive(PointerType &ThisObject, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:1050
virtual void PrintInfo(std::ostream &rOStream) const
Definition: bins_dynamic_objects.h:698
TConfigure::IteratorType IteratorType
Definition: bins_dynamic_objects.h:68
Tvector< IndexType, Dimension > IndexArray
Definition: bins_dynamic_objects.h:81
SizeType SearchObjectsInCell(const PointType &ThisPoint, ResultIteratorType Result)
Definition: bins_dynamic_objects.h:232
PointType mMaxPoint
Definition: bins_dynamic_objects.h:1711
virtual void SearchInRadiusExclusive(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, DistanceIteratorType ResultDistances, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:1486
TConfigure::ResultContainerType ResultContainerType
Definition: bins_dynamic_objects.h:69
SizeType SearchObjectsExclusive(PointerType &ThisObject, ResultIteratorType &Result, const SizeType &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:282
void AllocateContainer()
Definition: bins_dynamic_objects.h:1662
void SearchObjectsInRadius(IteratorType const &ThisObjects, SizeType const &NumberOfObjects, const std::vector< double > &Radius, std::vector< std::vector< PointerType > > &Results, std::vector< std::vector< double > > &ResultsDistances, std::vector< SizeType > &NumberOfResults, SizeType const &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:468
void SearchObjectLocalExclusive(PointerType &ThisObject, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:1063
TConfigure::ResultIteratorType ResultIteratorType
Definition: bins_dynamic_objects.h:70
void SearchInRadius(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:1249
void SearchInBoxLocal(PointerType &ThisObject, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:904
void FillObject(SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box, const PointerType &i_object)
Definition: bins_dynamic_objects.h:1535
SizeType SearchObjectsInCell(const PointType &ThisPoint, ResultIteratorType Result, const SizeType &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:244
TConfigure::DistanceIteratorType DistanceIteratorType
Definition: bins_dynamic_objects.h:71
void PrintBox(std::ostream &rout)
Definition: bins_dynamic_objects.h:741
TreeNodeType::IndexType IndexType
Definition: bins_dynamic_objects.h:77
TreeNodeType::IteratorIteratorType IteratorIteratorType
typedef TreeNodeType LeafType;
Definition: bins_dynamic_objects.h:84
IteratorType mObjectsBegin
Definition: bins_dynamic_objects.h:1714
PointType & GetMinPoint()
Get the Min Point object.
Definition: bins_dynamic_objects.h:667
void CalculateCellSize(std::size_t ApproximatedSize)
Calculates the cell size of the bins.
Definition: bins_dynamic_objects.h:826
BinsObjectDynamic()
Default constructor.
Definition: bins_dynamic_objects.h:100
SizeType SearchObjects(PointerType &ThisObject, ResultContainerType &Result)
Single search API.
Definition: bins_dynamic_objects.h:196
SizeArray mN
Definition: bins_dynamic_objects.h:1719
BinsObjectDynamic(IteratorType const &ObjectsBegin, IteratorType const &ObjectsEnd, CoordinateType CellSize)
Constructs a new BinsObjectDynamic.
Definition: bins_dynamic_objects.h:131
void RemoveObjectLocal(SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box, const PointerType &i_object)
Definition: bins_dynamic_objects.h:1606
void PrintSize(std::ostream &rout)
Definition: bins_dynamic_objects.h:729
virtual void SearchInRadiusExclusive(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:1380
SizeType SearchObjectsInRadius(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results)
Definition: bins_dynamic_objects.h:301
virtual void AddObject(const PointerType &ThisObject)
Add/Remove.
Definition: bins_dynamic_objects.h:546
CellContainerType & GetCellContainer()
Get the Cell Container object.
Definition: bins_dynamic_objects.h:640
void SearchInRadius(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:1207
void SearchInBoxLocal(PointerType &ThisObject, ResultContainerType &Result, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:969
SizeType mObjectsSize
Definition: bins_dynamic_objects.h:1713
void AssignCellSize(CoordinateType CellSize)
Assigns the cell size of the bins using the provided CellSize.
Definition: bins_dynamic_objects.h:866
CoordinateArray mInvCellSize
Definition: bins_dynamic_objects.h:1718
virtual std::string Info() const
Turn back information as a string.
Definition: bins_dynamic_objects.h:690
virtual SizeType SearchObjectsInRadiusExclusive(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results)
Definition: bins_dynamic_objects.h:368
virtual void SearchInRadiusExclusive(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, DistanceIteratorType ResultDistances, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:1444
virtual void SearchInRadiusExclusive(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, DistanceIteratorType ResultDistances, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_dynamic_objects.h:1459
virtual ~BinsObjectDynamic()
Destructor.
Definition: bins_dynamic_objects.h:186
virtual IndexType CalculatePosition(CoordinateType const &ThisCoord, const SizeType &ThisDimension)
Definition: bins_dynamic_objects.h:624
virtual void SearchInRadiusExclusive(PointerType &ThisObject, CoordinateType const &Radius, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:1365
void SearchObjectLocalExclusive(PointerType &ThisObject, ResultIteratorType &Result, SizeType &NumberOfResults, const SizeType &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_dynamic_objects.h:1090
BinsObjectDynamic(IteratorType const &ObjectsBegin, IteratorType const &ObjectsEnd)
Constructor de bins a bounding box.
Definition: bins_dynamic_objects.h:111
KRATOS_CLASS_POINTER_DEFINITION(BinsObjectDynamic)
Pointer definition of BinsObjectDynamic.
TConfigure Configure
Definition: bins_dynamic_objects.h:64
void RemoveObjectLocal(SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box, const PointerType &i_object)
Definition: bins_dynamic_objects.h:1592
@ Dimension
Definition: bins_dynamic_objects.h:62
BinsObjectDynamic(const PointType &MinPoint, const PointType &MaxPoint, CoordinateType CellSize)
Constructs a new BinsObjectDynamic.
Definition: bins_dynamic_objects.h:151
void SearchObjectsInRadius(IteratorType const &ThisObjects, SizeType const &NumberOfObjects, const std::vector< double > &Radius, std::vector< std::vector< PointerType > > &Results, std::vector< SizeType > &NumberOfResults, SizeType const &MaxNumberOfResults)
Batch search API (needs to be extended with the missing functions)
Definition: bins_dynamic_objects.h:438
std::vector< CellType > CellContainerType
Definition: bins_dynamic_objects.h:89
SizeType SearchObjectsInRadius(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results, DistanceIteratorType ResultDistances, const SizeType &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:348
virtual void SearchObjectsInRadiusExclusive(IteratorType const &ThisObjects, SizeType const &NumberOfObjects, const std::vector< double > &Radius, std::vector< std::vector< PointerType > > &Results, std::vector< SizeType > &NumberOfResults, SizeType const &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:495
Tvector< CoordinateType, Dimension > CoordinateArray
Definition: bins_dynamic_objects.h:79
void SearchObjectLocalExclusive(PointerType &ThisObject, ResultContainerType &Result, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_dynamic_objects.h:1128
CellContainerType::iterator CellContainerIterator
Definition: bins_dynamic_objects.h:90
IndexType CalculateIndex(const GenericCoordType &ThisObject)
Definition: bins_dynamic_objects.h:605
SizeArray & GetDivisions()
Get the Divisions object.
Definition: bins_dynamic_objects.h:649
SizeType SearchObjects(PointerType &ThisObject, ResultIteratorType &Result, const SizeType &MaxNumberOfResults)
Definition: bins_dynamic_objects.h:214
CoordinateArray & GetCellSize()
Get the Cell Size object.
Definition: bins_dynamic_objects.h:658
void CreatePartition(SizeType number_of_threads, const SizeType number_of_rows, std::vector< SizeType > &partitions)
Definition: bins_dynamic_objects.h:1670
virtual void GenerateBins()
Definition: bins_dynamic_objects.h:876
SizeType SearchObjectsExclusive(PointerType &ThisObject, ResultIteratorType &Result)
Definition: bins_dynamic_objects.h:264
TreeNodeType::SizeType SizeType
Definition: bins_dynamic_objects.h:76
Definition: cell.h:49
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
Definition: search_structure.h:309
void Set(IndexVector const &IndexCell, SizeVector const &_MaxSize, IteratorIteratorType const &IteratorBegin)
Definition: search_structure.h:363
SubBinAxis< IndexType, SizeType > Axis[3]
Definition: search_structure.h:326
Short class definition.
Definition: tree.h:61
typename std::vector< IteratorType >::iterator IteratorIteratorType
Define IteratorIteratorType as an iterator type for a vector of IteratorType.
Definition: tree.h:94
double CoordinateType
Define CoordinateType as double.
Definition: tree.h:76
std::size_t IndexType
Define IndexType as std::size_t.
Definition: tree.h:73
std::size_t SizeType
Define SizeType as std::size_t.
Definition: tree.h:70
#define KRATOS_ERROR
Definition: exception.h:161
static double max(double a, double b)
Definition: GeometryFunctions.h:79
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
std::size_t PointerDistance(TPointerType const &PointerBegin, TPointerType const &PointerEnd)
Definition: search_structure.h:91
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
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
def Index()
Definition: hdf5_io_tools.py:38
int k
Definition: quadrature.py:595
integer i
Definition: TensorModule.f:17
Configure::ResultIteratorType ResultIteratorType
Definition: transfer_utility.h:252
Configure::IteratorType IteratorType
Definition: transfer_utility.h:249
Configure::PointType PointType
Definition: transfer_utility.h:245
Configure::ResultContainerType ResultContainerType
Definition: transfer_utility.h:250
Configure::ContainerType ContainerType
Definition: transfer_utility.h:247