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_static.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: clabra
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // External includes
18 
19 // Project includes
20 #include "tree.h"
22 
23 
24 namespace Kratos
25 {
26 
27 template< std::size_t TDimension,
28  class TPointType,
29  class TContainerType,
30  class TPointerType = typename TContainerType::value_type,
31  class TIteratorType = typename TContainerType::iterator,
32  class TDistanceIteratorType = typename std::vector<double>::iterator,
34 class Bins : public TreeNode<TDimension,TPointType, TPointerType, TIteratorType, TDistanceIteratorType>
35 {
36 
37 
38 public:
39 
40  enum { Dimension = TDimension };
41 
42  typedef TPointType PointType;
43  typedef TContainerType ContainerType;
44  typedef TIteratorType IteratorType;
45  typedef TDistanceIteratorType DistanceIteratorType;
46  typedef TPointerType PointerType;
47  typedef TDistanceFunction DistanceFunction;
48 
50 
51  typedef typename TreeNodeType::SizeType SizeType;
54 
58 
61 
62  // Local Container ( PointPointer Container per Cell )
63  // can be different to ContainerType
64  // not always LocalContainerType == ContainerType ( if ContainerType = C array )
65  typedef std::vector<PointerType> LocalContainerType;
66  typedef typename LocalContainerType::iterator LocalIterator;
67 
69 
70  typedef std::vector<IteratorType> IteratorVector;
71  typedef typename IteratorVector::iterator IteratorIterator;
72  typedef typename IteratorVector::const_iterator IteratorConstIterator;
73 
77 
78  // Legacy typedef ( to preserve compativility in case someone was using this definitions)
82 
85 
86 
87 public:
88 
92  Bins() : mPointBegin(this->NullIterator()), mPointEnd(this->NullIterator()) {};
93 
94 
102  Bins( IteratorType const& PointBegin, IteratorType const& PointEnd, SizeType BucketSize = 1 )
103  : mPointBegin(PointBegin), mPointEnd(PointEnd)
104  {
105  auto NumPoints = std::distance(mPointBegin, mPointEnd);
106 
107  if(mPointBegin==mPointEnd)
108  return;
109 
110  CalculateBoundingBox();
111  CalculateCellSize(NumPoints);
112  AllocateCellsContainer();
113  GenerateBins();
114  }
115 
125  Bins( IteratorType const& PointBegin, IteratorType const& PointEnd, PointType const& MinPoint, PointType const& MaxPoint, SizeType BucketSize = 1 )
126  : mPointBegin(PointBegin), mPointEnd(PointEnd)
127  {
128  auto NumPoints = std::distance(mPointBegin, mPointEnd);
129 
130  if(mPointBegin==mPointEnd)
131  return;
132 
133  for(SizeType i = 0 ; i < TDimension ; i++)
134  {
135  mMinPoint[i] = MinPoint[i];
136  mMaxPoint[i] = MaxPoint[i];
137  }
138 
139  CalculateCellSize(NumPoints);
140  AllocateCellsContainer();
141  GenerateBins();
142  }
143 
154  Bins( IteratorType const& PointBegin, IteratorType const& PointEnd, CoordinateType cellsize, SizeType BucketSize = 1 )
155  : mPointBegin(PointBegin), mPointEnd(PointEnd)
156  {
157  if(mPointBegin==mPointEnd)
158  return;
159 
160  CalculateBoundingBox();
161  AssignCellSize(cellsize);
162  AllocateCellsContainer();
163  GenerateBins();
164  }
165 
166  // Destructor
167  ~Bins() override { }
168 
169  //************************************************************************
170 
172  {
173  return mPointBegin;
174  }
175 
176  //************************************************************************
177 
179  {
180  return mPointBegin;
181  }
182 
183  //************************************************************************
184 
186  {
187  return mCellSize[iDim];
188  }
189 
190  //************************************************************************
191 
193  {
194  return mN[iDim];
195  }
196 
202  return mN;
203  }
204 
210  return mCellSize;
211  }
212 
218  return mMinPoint;
219  }
220 
226  return mMaxPoint;
227  }
228 
229  //************************************************************************
230 
231 private:
232 
233  //************************************************************************
234 
235  void CalculateBoundingBox()
236  {
237  for(SizeType i = 0 ; i < TDimension ; i++)
238  {
239  mMinPoint[i] = (**mPointBegin)[i];
240  mMaxPoint[i] = (**mPointBegin)[i];
241  }
242  for(IteratorType Point = mPointBegin ; Point != mPointEnd ; Point++)
243  for(SizeType i = 0 ; i < TDimension ; i++)
244  {
245  if( (**Point)[i] < mMinPoint[i] ) mMinPoint[i] = (**Point)[i];
246  if( (**Point)[i] > mMaxPoint[i] ) mMaxPoint[i] = (**Point)[i];
247  }
248  }
249 
250  //************************************************************************
251 
257  void CalculateCellSize(std::size_t ApproximatedSize)
258  {
259  std::size_t average_number_of_cells = static_cast<std::size_t>(std::pow(static_cast<double>(ApproximatedSize), 1.00 / Dimension));
260 
261  std::array<double, 3> lengths;
262  double average_length = 0.00;
263 
264  for (int i = 0; i < Dimension; i++) {
265  lengths[i] = mMaxPoint[i] - mMinPoint[i];
266  average_length += lengths[i];
267  }
268  average_length *= 1.00 / 3.00;
269 
270  if (average_length < std::numeric_limits<double>::epsilon()) {
271  for(int i = 0; i < Dimension; i++) {
272  mN[i] = 1;
273  }
274  return;
275  }
276 
277  for (int i = 0; i < Dimension; i++) {
278  mN[i] = static_cast<std::size_t>(lengths[i] / average_length * (double)average_number_of_cells) + 1;
279 
280  if (mN[i] > 1) {
281  mCellSize[i] = lengths[i] / mN[i];
282  } else {
283  mCellSize[i] = average_length;
284  }
285 
286  mInvCellSize[i] = 1.00 / mCellSize[i];
287  }
288  }
289 
290  //************************************************************************
291 
292  void AssignCellSize( CoordinateType BoxSize )
293  {
294  for(SizeType i = 0 ; i < TDimension ; i++)
295  {
296  mCellSize[i] = BoxSize;
297  mInvCellSize[i] = 1.00 / mCellSize[i];
298  mN[i] = static_cast<SizeType>( (mMaxPoint[i]-mMinPoint[i]) / mCellSize[i]) + 1;
299  }
300  }
301 
302  //************************************************************************
303 
304  void AllocateCellsContainer()
305  {
306  SizeType Size = 1;
307  for(SizeType i = 0 ; i < TDimension ; i++)
308  Size *= mN[i];
309  mIndexCell.resize(Size+1);
310  mIndexCellBegin = mIndexCell.begin();
311  mIndexCellEnd = mIndexCell.end();
312  }
313 
314  //************************************************************************
315 
316  void GenerateBins( )
317  {
318 
319  LocalContainerType TempPoint(mPointBegin,mPointEnd);
320 
321  // Reset index vector
322  for( IteratorIterator Iter = mIndexCell.begin(); Iter != mIndexCell.end(); Iter++)
323  *Iter = mPointBegin;
324 
325  // Update storage counter, storing ahead
326  for( IteratorType Point = mPointBegin ; Point != mPointEnd ; Point++)
327  mIndexCell[ CalculateIndex(**Point) + 1 ]++;
328 
329  // Storage/reshufing pass 1
330 
331  // Update storage counter and store
332  for( IteratorIterator Iter = mIndexCell.begin()+1 ; Iter != mIndexCell.end() ; Iter++)
333  *Iter = *(Iter-1) + SearchUtils::PointerDistance(mPointBegin,*Iter);
334 
335  // Point pass 2
336  // Store the points in lbin1
337 
338  // Update storage counter, storing in lbin1
339  for( LocalIterator Point = TempPoint.begin() ; Point != TempPoint.end() ; Point++)
340  *(mIndexCell[CalculateIndex(**Point)]++) = *Point;
341 
342  // Storage/reshuffing pass 2
343 
344  // Loop over bins, in reverse order
345  for(IteratorIterator Iter = mIndexCell.end()-1; Iter != mIndexCell.begin(); Iter--)
346  *Iter = *(Iter-1);
347  mIndexCell[0] = mPointBegin;
348 
349  }
350 
351  //************************************************************************
352 
353  IndexType CalculatePosition( CoordinateType const& ThisCoord, SizeType ThisDimension )
354  {
355  CoordinateType d_index = (ThisCoord - mMinPoint[ThisDimension]) * mInvCellSize[ThisDimension];
356  IndexType index = static_cast<SizeType>( (d_index < 0.00) ? 0.00 : d_index );
357  return (index > mN[ThisDimension]-1) ? mN[ThisDimension]-1 : index;
358  }
359 
360  //************************************************************************
361 
362  IndexType CalculateIndex( PointType const& ThisPoint )
363  {
364  IndexType Index = 0;
365  for(SizeType iDim = TDimension-1 ; iDim > 0 ; iDim--)
366  {
367  Index += CalculatePosition(ThisPoint[iDim],iDim);
368  Index *= mN[iDim-1];
369  }
370  Index += CalculatePosition(ThisPoint[0],0);
371  return Index;
372  }
373 
374  //************************************************************************
375 
376  IndexType CalculateIndex( CellType const& ThisIndex )
377  {
378  IndexType Index = 0;
379  for(SizeType iDim = TDimension-1 ; iDim > 0 ; iDim--)
380  {
381  Index += ThisIndex[iDim];
382  Index *= mN[iDim-1];
383  }
384  Index += ThisIndex[0];
385  return Index;
386  }
387 
388  //************************************************************************
389 
390  CellType CalculateCell( PointType const& ThisPoint )
391  {
392  CellType Cell;
393  for(SizeType i = 0 ; i < TDimension ; i++)
394  Cell[i] = CalculatePosition(ThisPoint[i],i);
395  return Cell;
396  }
397 
398  CellType CalculateCell( PointType const& ThisPoint, CoordinateType Radius )
399  {
400  CellType Cell;
401  for(SizeType i = 0 ; i < TDimension ; i++)
402  Cell[i] = CalculatePosition(ThisPoint[i]+Radius,i);
403  return Cell;
404  }
405 
406  //************************************************************************
407 
408 public:
409 
410  //************************************************************************
411  //************************************************************************
412 
419  PointerType ExistPoint( PointerType const& ThisPoint, CoordinateType const Tolerance = static_cast<CoordinateType>(10.0*DBL_EPSILON) )
420  {
421  PointerType Nearest;
422  CoordinateType Distance = static_cast<CoordinateType>(DBL_MAX);
423  bool Found;
424  SearchStructureType Box( CalculateCell(*ThisPoint), mN, mIndexCellBegin );
425  SearchNearestInBox( *ThisPoint, Nearest, Distance, Box, Found );
426  if(Found)
427  return Nearest;
428  return this->NullPointer();
429  }
430 
436  PointerType SearchNearestPointInner( PointerType& ThisPoint )
437  {
438  PointerType Result = *mPointBegin; //static_cast<PointerType>(NULL);
439  CoordinateType ResultDistance = static_cast<CoordinateType>(DBL_MAX);
440  SearchStructureType Box( CalculateCell(*ThisPoint), mN, mIndexCellBegin );
441  SearchNearestPointLocalInner( ThisPoint, Result, ResultDistance, Box );
442  return Result;
443  }
444 
451  {
452  PointerType Result = *mPointBegin; //static_cast<PointerType>(NULL);
453  CoordinateType ResultDistance = static_cast<CoordinateType>(DBL_MAX);
454  SearchStructureType Box( CalculateCell(ThisPoint), mN, mIndexCellBegin );
455  SearchNearestPointLocal( ThisPoint, Result, ResultDistance, Box );
456  return Result;
457  }
458 
459  //************************************************************************
460 
461  PointerType SearchNearestPoint( PointType const& ThisPoint, CoordinateType& rResultDistance )
462  {
463  PointerType Result = *mPointBegin; //static_cast<PointerType>(NULL);
464  rResultDistance = static_cast<CoordinateType>(DBL_MAX);
465  SearchStructureType Box( CalculateCell(ThisPoint), mN, mIndexCellBegin );
466  SearchNearestPointLocal( ThisPoint, Result, rResultDistance, Box);
467  return Result;
468  }
469 
470  //************************************************************************
471 
472  // New Thread Safe!!!
473  PointerType SearchNearestPoint( PointType const& ThisPoint, CoordinateType& rResultDistance, SearchStructureType& Box )
474  {
475  PointerType Result = *mPointBegin; //static_cast<PointerType>(NULL);
476  rResultDistance = static_cast<CoordinateType>(DBL_MAX);
477  Box.Set( CalculateCell(ThisPoint), mN, mIndexCellBegin );
478  SearchNearestPointLocal( ThisPoint, Result, rResultDistance, Box);
479  return Result;
480  }
481 
482  //************************************************************************
483  //************************************************************************
484 
485  void SearchNearestPoint( PointType const& ThisPoint, PointerType& rResult, CoordinateType& rResultDistance ) override
486  {
487  SearchStructureType Box( CalculateCell(ThisPoint), mN, mIndexCellBegin );
488  SearchNearestPointLocal(ThisPoint,rResult,rResultDistance,Box);
489  }
490 
491  //************************************************************************
492 
493  void SearchNearestPoint( PointType const& ThisPoint, PointerType& rResult, CoordinateType& rResultDistance, SearchStructureType& Box ) override
494  {
495  // This case is when BinStatic is a LeafType in Other Spacial Structure
496  // Then, it is possible a better Result before this search
497  Box.Set( CalculateCell(ThisPoint), mN, mIndexCellBegin );
498  SearchNearestPointLocal( ThisPoint, rResult, rResultDistance, Box );
499  }
500 
501  //************************************************************************
502 
503  void SearchNearestPoint( PointerType const& ThisPoints, SizeType const& NumberOfPoints, IteratorType &Results, std::vector<CoordinateType> ResultsDistances)
504  {
505  IndexPartition<SizeType>(NumberOfPoints).for_each(
506  [&](SizeType iPoint)
507  { Results[iPoint] = SearchNearestPoint((&(*ThisPoints))[iPoint],ResultsDistances[iPoint]); }
508  );
509  }
510 
511  //************************************************************************
512  //************************************************************************
513 
514  // **** THREAD SAFE -> The user pass the SearchStructure (BinBox)
515  void SearchNearestPointLocal( PointType const& ThisPoint, PointerType& rResult, CoordinateType& rResultDistance, SearchStructureType& Box )
516  {
517  if( mPointBegin == mPointEnd )
518  return;
519 
520  bool Found;
521 
522  // initial search
523  ++Box;
524  SearchNearestInBox( ThisPoint, rResult, rResultDistance, Box, Found );
525 
526  // increase mBox and try again
527  while(!Found)
528  {
529  ++Box;
530  SearchNearestInBox( ThisPoint, rResult, rResultDistance, Box, Found );
531  }
532 
533  }
534 
535  //************************************************************************
536  //************************************************************************
537 
538  // **** THREAD SAFE -> The user pass the SearchStructure (BinBox)
539  void SearchNearestPointLocalInner( PointerType& ThisPoint, PointerType& rResult, CoordinateType& rResultDistance, SearchStructureType& Box )
540  {
541  if( mPointBegin == mPointEnd )
542  return;
543 
544  bool Found;
545 
546  // initial search
547  ++Box;
548  SearchNearestInBoxInner( ThisPoint, rResult, rResultDistance, Box, Found );
549  // increase mBox and try again
550  while(!Found)
551  {
552  ++Box;
553  SearchNearestInBoxInner( ThisPoint, rResult, rResultDistance, Box, Found );
554  }
555 
556  }
557 
558  //************************************************************************
559  //************************************************************************
560 
561  SizeType SearchInRadius( PointType const& ThisPoint, CoordinateType const& Radius, IteratorType Results,
562  DistanceIteratorType ResultsDistances, SizeType const& MaxNumberOfResults )
563  {
564  CoordinateType Radius2 = Radius * Radius;
565  SizeType NumberOfResults = 0;
566  SearchStructureType Box( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
567  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, ResultsDistances, NumberOfResults, MaxNumberOfResults, Box );
568  return NumberOfResults;
569  }
570 
571  //************************************************************************
572 
573  SizeType SearchInRadius( PointType const& ThisPoint, CoordinateType const& Radius, IteratorType Results,
574  DistanceIteratorType ResultsDistances, SizeType const& MaxNumberOfResults, SearchStructureType& Box )
575  {
576  CoordinateType Radius2 = Radius * Radius;
577  SizeType NumberOfResults = 0;
578  Box.Set( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
579  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, ResultsDistances, NumberOfResults, MaxNumberOfResults, Box );
580  return NumberOfResults;
581  }
582 
583  //************************************************************************
584 
585  void SearchInRadius( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
586  DistanceIteratorType& ResultsDistances, SizeType& NumberOfResults, SizeType const& MaxNumberOfResults ) override
587  {
588  SearchStructureType Box( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
589  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, ResultsDistances, NumberOfResults, MaxNumberOfResults, Box);
590  }
591 
592  //************************************************************************
593 
594  void SearchInRadius( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
595  DistanceIteratorType& ResultsDistances, SizeType& NumberOfResults, SizeType const& MaxNumberOfResults, SearchStructureType& Box ) override
596  {
597  Box.Set( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
598  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, ResultsDistances, NumberOfResults, MaxNumberOfResults, Box);
599  }
600 
601  //************************************************************************
602 
603  void SearchInRadius( PointerType const& ThisPoints, SizeType const& NumberOfPoints, std::vector<CoordinateType> const& Radius, std::vector<IteratorType> Results,
604  std::vector<DistanceIteratorType> ResultsDistances, std::vector<SizeType>& NumberOfResults, SizeType const& MaxNumberOfResults )
605  {
606  IndexPartition<SizeType>(NumberOfPoints).for_each(
607  [&](SizeType iPoint)
608  { NumberOfResults[iPoint] = SearchInRadius((&(*ThisPoints))[iPoint],Radius[iPoint],Results[iPoint],ResultsDistances[iPoint],MaxNumberOfResults); }
609  );
610  }
611 
612  //************************************************************************
613 
614  // **** THREAD SAFE
615 
616  // Dimension = 1
617  void SearchInRadiusLocal( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
618  DistanceIteratorType& ResultsDistances, SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
620  {
621  SearchRadiusInRange()(*(Box.RowBegin),*(Box.RowEnd),ThisPoint,Radius2,Results,ResultsDistances,NumberOfResults,MaxNumberOfResults);
622  }
623 
624  // Dimension = 2
625  void SearchInRadiusLocal( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
626  DistanceIteratorType& ResultsDistances, SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
628  {
629  for(IndexType I = Box.Axis[1].Begin() ; I <= Box.Axis[1].End() ; I += Box.Axis[1].Block )
630  SearchRadiusInRange()(Box.RowBegin[I],Box.RowEnd[I],ThisPoint,Radius2,Results,ResultsDistances,NumberOfResults,MaxNumberOfResults);
631  }
632 
633  // Dimension = 3
634  void SearchInRadiusLocal( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
635  DistanceIteratorType& ResultsDistances, SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
637  {
638  for(IndexType II = Box.Axis[2].Begin() ; II <= Box.Axis[2].End() ; II += Box.Axis[2].Block )
639  for(IndexType I = II + Box.Axis[1].Begin() ; I <= II + Box.Axis[1].End() ; I += Box.Axis[1].Block )
640  SearchRadiusInRange()(Box.RowBegin[I],Box.RowEnd[I],ThisPoint,Radius2,Results,ResultsDistances,NumberOfResults,MaxNumberOfResults);
641  }
642 
643  //************************************************************************
644  //************************************************************************
645 
646  SizeType SearchInRadius( PointType const& ThisPoint, CoordinateType Radius, IteratorType Results, SizeType MaxNumberOfResults )
647  {
648  CoordinateType Radius2 = Radius * Radius;
649  SizeType NumberOfResults = 0;
650  SearchStructureType Box( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
651  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, NumberOfResults, MaxNumberOfResults, Box );
652  return NumberOfResults;
653  }
654 
655  //************************************************************************
656 
657  SizeType SearchInRadius( PointType const& ThisPoint, CoordinateType Radius, IteratorType Results,
658  SizeType MaxNumberOfResults, SearchStructureType& Box )
659  {
660  CoordinateType Radius2 = Radius * Radius;
661  SizeType NumberOfResults = 0;
662  Box.Set( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
663  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, NumberOfResults, MaxNumberOfResults, Box );
664  return NumberOfResults;
665  }
666 
667  //************************************************************************
668 
669  void SearchInRadius( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
670  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults ) override
671  {
672  SearchStructureType Box( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
673  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, NumberOfResults, MaxNumberOfResults, Box );
674  }
675 
676  //************************************************************************
677 
678  void SearchInRadius( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
679  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults, SearchStructureType& Box ) override
680  {
681  Box.Set( CalculateCell(ThisPoint,-Radius), CalculateCell(ThisPoint,Radius), mN, mIndexCellBegin );
682  SearchInRadiusLocal( ThisPoint, Radius, Radius2, Results, NumberOfResults, MaxNumberOfResults, Box );
683  }
684 
685  //************************************************************************
686 
687  // Dimension = 1
688  void SearchInRadiusLocal( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
689  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
691  {
692  SearchRadiusInRange()(*(Box.RowBegin),*(Box.RowEnd),ThisPoint,Radius2,Results,NumberOfResults,MaxNumberOfResults);
693  }
694 
695  // Dimension = 2
696  void SearchInRadiusLocal( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
697  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
699  {
700  for(IndexType I = Box.Axis[1].Begin() ; I <= Box.Axis[1].End() ; I += Box.Axis[1].Block )
701  SearchRadiusInRange()(Box.RowBegin[I],Box.RowEnd[I],ThisPoint,Radius2,Results,NumberOfResults,MaxNumberOfResults);
702  }
703 
704  // Dimension = 3
705  void SearchInRadiusLocal( PointType const& ThisPoint, CoordinateType const& Radius, CoordinateType const& Radius2, IteratorType& Results,
706  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
708  {
709  for(IndexType II = Box.Axis[2].Begin() ; II <= Box.Axis[2].End() ; II += Box.Axis[2].Block )
710  for(IndexType I = II + Box.Axis[1].Begin() ; I <= II + Box.Axis[1].End() ; I += Box.Axis[1].Block )
711  SearchRadiusInRange()(Box.RowBegin[I],Box.RowEnd[I],ThisPoint,Radius2,Results,NumberOfResults,MaxNumberOfResults);
712  }
713 
714  //************************************************************************
715  //************************************************************************
716 
717  // Dimension = 1
718  void SearchNearestInBox( PointType const& ThisPoint, PointerType& ResultPoint, CoordinateType& ResultDistance,
720  {
721  Found = false;
722  SearchNearestInRange()( *(Box.RowBegin), *(Box.RowEnd), ThisPoint, ResultPoint, ResultDistance, Found );
723  }
724 
725  // Dimension = 2
726  void SearchNearestInBox( PointType const& ThisPoint, PointerType& ResultPoint, CoordinateType& ResultDistance,
728  {
729  Found = false;
730  for(IndexType I = Box.Axis[1].Begin() ; I <= Box.Axis[1].End() ; I += Box.Axis[1].Block )
731  SearchNearestInRange()( Box.RowBegin[I], Box.RowEnd[I], ThisPoint, ResultPoint, ResultDistance, Found );
732  }
733 
734  // Dimension = 3
735  void SearchNearestInBox( PointType const& ThisPoint, PointerType& ResultPoint, CoordinateType& ResultDistance,
737  {
738  Found = false;
739  for(IndexType II = Box.Axis[2].Begin() ; II <= Box.Axis[2].End() ; II += Box.Axis[2].Block )
740  for(IndexType I = II + Box.Axis[1].Begin() ; I <= II + Box.Axis[1].End() ; I += Box.Axis[1].Block )
741  SearchNearestInRange()( Box.RowBegin[I], Box.RowEnd[I], ThisPoint, ResultPoint, ResultDistance, Found );
742  }
743 
744  //************************************************************************
745  //************************************************************************
746 
747  // Dimension = 1
748  void SearchNearestInBoxInner( PointerType& ThisPoint, PointerType& ResultPoint, CoordinateType& ResultDistance,
750  {
751  Found = false;
752  SearchNearestInnerInRange( *(Box.RowBegin), *(Box.RowEnd), ThisPoint, ResultPoint, ResultDistance, Found );
753  }
754 
755  // Dimension = 2
756  void SearchNearestInBoxInner( PointerType& ThisPoint, PointerType& ResultPoint, CoordinateType& ResultDistance,
758  {
759  Found = false;
760  for(IndexType I = Box.Axis[1].Begin() ; I <= Box.Axis[1].End() ; I += Box.Axis[1].Block )
761  SearchNearestInnerInRange( Box.RowBegin[I], Box.RowEnd[I], ThisPoint, ResultPoint, ResultDistance, Found );
762  }
763 
764  // Dimension = 3
765  void SearchNearestInBoxInner( PointerType& ThisPoint, PointerType& ResultPoint, CoordinateType& ResultDistance,
767  {
768  Found = false;
769  for(IndexType II = Box.Axis[2].Begin() ; II <= Box.Axis[2].End() ; II += Box.Axis[2].Block )
770  for(IndexType I = II + Box.Axis[1].Begin() ; I <= II + Box.Axis[1].End() ; I += Box.Axis[1].Block )
771  SearchNearestInnerInRange( Box.RowBegin[I], Box.RowEnd[I], ThisPoint, ResultPoint, ResultDistance, Found );
772  }
773 
774  //************************************************************************
775  //************************************************************************
776 
777  void SearchNearestInnerInRange( const IteratorType& RangeBegin, const IteratorType& RangeEnd, PointerType& ThisPoint,
778  PointerType& Result, CoordinateType& Distance, bool& Found )
779  {
780  CoordinateType NewDistance;
781  for(IteratorType Point = RangeBegin ; Point != RangeEnd ; Point++)
782  {
783  NewDistance = TDistanceFunction()(**Point,*ThisPoint);
784  if( NewDistance < Distance && *Point != ThisPoint)
785  {
786  Result = *Point;
787  Distance = NewDistance;
788  Found = true;
789  }
790  }
791  }
792 
793  //************************************************************************
794  //************************************************************************
795 
796  SizeType SearchInBox( PointType const& SearchMinPoint, PointType const& SearchMaxPoint, IteratorType Results,
797  SizeType MaxNumberOfResults )
798  {
799  SizeType NumberOfResults = 0;
800  SearchStructureType Box( CalculateCell(SearchMinPoint), CalculateCell(SearchMaxPoint), mN, mIndexCellBegin );
801  SearchInBoxLocal( SearchMinPoint, SearchMaxPoint, Results, NumberOfResults, MaxNumberOfResults, Box );
802  return NumberOfResults;
803  }
804 
805  //************************************************************************
806 
807  void SearchInBox(PointType const& SearchMinPoint, PointType const& SearchMaxPoint, IteratorType& Results, SizeType& NumberOfResults,
808  SizeType const& MaxNumberOfResults ) override
809  {
810  NumberOfResults = 0;
811  SearchStructureType Box( CalculateCell(SearchMinPoint), CalculateCell(SearchMaxPoint), mN, mIndexCellBegin );
812  SearchInBoxLocal( SearchMinPoint, SearchMaxPoint, Results, NumberOfResults, MaxNumberOfResults, Box );
813  }
814 
815  //************************************************************************
816 
817  // Dimension = 1
818  void SearchInBoxLocal( PointType const& SearchMinPoint, PointType const& SearchMaxPoint, IteratorType& ResultsPoint,
819  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
821  {
822  SearchBoxInRange()(SearchMinPoint,SearchMaxPoint,*(Box.RowBegin),*(Box.RowEnd),ResultsPoint,NumberOfResults,MaxNumberOfResults);
823  }
824 
825  // Dimension = 2
826  void SearchInBoxLocal( PointType const& SearchMinPoint, PointType const& SearchMaxPoint, IteratorType& ResultsPoint,
827  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
829  {
830  for(IndexType I = Box.Axis[1].Begin() ; I <= Box.Axis[1].End() ; I += Box.Axis[1].Block )
831  SearchBoxInRange()(SearchMinPoint,SearchMaxPoint,Box.RowBegin[I],Box.RowEnd[I],ResultsPoint,NumberOfResults,MaxNumberOfResults);
832  }
833 
834  // Dimension = 3
835  void SearchInBoxLocal( PointType const& SearchMinPoint, PointType const& SearchMaxPoint, IteratorType& ResultsPoint,
836  SizeType& NumberOfResults, SizeType const& MaxNumberOfResults,
838  {
839  for(IndexType II = Box.Axis[2].Begin() ; II <= Box.Axis[2].End() ; II += Box.Axis[2].Block )
840  for(IndexType I = II + Box.Axis[1].Begin() ; I <= II + Box.Axis[1].End() ; I += Box.Axis[1].Block )
841  SearchBoxInRange()(SearchMinPoint,SearchMaxPoint,Box.RowBegin[I],Box.RowEnd[I],ResultsPoint,NumberOfResults,MaxNumberOfResults);
842  }
843 
844  //************************************************************************
845  //************************************************************************
846 
848  virtual std::string Info() const
849  {
850  return "BinsContainer";
851  }
852 
854  virtual void PrintInfo(std::ostream& rOStream) const
855  {
856  rOStream << "BinsContainer";
857  }
858 
860  void PrintData(std::ostream& rOStream, std::string const& Perfix = std::string()) const override
861  {
862  rOStream << Perfix << "Bin[" << SearchUtils::PointerDistance(mPointBegin, mPointEnd) << "] : " << std::endl;
863  for(IteratorConstIterator i_cell = mIndexCell.begin() ; i_cell != mIndexCell.end()-1 ; i_cell++)
864  {
865  rOStream << Perfix << "[ " ;
866  for(IteratorType i_point = *i_cell ; i_point != *(i_cell+1) ; i_point++)
867  rOStream << **i_point << " ";
868  rOStream << "]" << std::endl;
869  }
870  rOStream << std::endl;
871  }
872 
874  void PrintSize( std::ostream& rout )
875  {
876  rout << " BinsSize: ";
877  for(SizeType i = 0 ; i < TDimension ; i++)
878  rout << "[" << mN[i] << "]";
879  rout << std::endl;
880  }
881 
883  void PrintBox( std::ostream& rout )
884  {
885  rout << " BinsBox: Min [";
886  mMinPoint.Print(rout);
887  rout << "]; Max [";
888  mMaxPoint.Print(rout);
889  rout << "]; Size [";
890  mCellSize.Print(rout);
891  rout << "]" << std::endl;
892  }
893 
895  Bins& operator=(Bins const& rOther);
896 
898  Bins(Bins const& rOther);
899 
900 private:
901 
902  // Point Access Iterators (vector reordered!!)
903  IteratorType mPointBegin;
904  IteratorType mPointEnd;
905 
906  // Bin Parameters (Sizes,BoundingBox,...)
907  PointType mMinPoint;
908  PointType mMaxPoint;
909  CoordinateArray mCellSize;
910  CoordinateArray mInvCellSize;
911  SizeArray mN;
912 
913  // Bins Access Vector ( vector<Iterator> )
914  IteratorVector mIndexCell;
915  IteratorIterator mIndexCellBegin;
916  IteratorIterator mIndexCellEnd;
917 
918  // Work Variables ( For non-copy of Search Variables )
919  //SearchStructureType mBox;
920 
921 public:
922 
923  //TODO: check -- changed to avoid copy construction
924 // static TreeNodeType* Construct(IteratorType PointsBegin, IteratorType PointsEnd, PointType MaxPoint, PointType MinPoint, SizeType BucketSize)
925  static TreeNodeType* Construct(IteratorType PointsBegin, IteratorType PointsEnd, const PointType& MaxPoint, const PointType& MinPoint, SizeType BucketSize)
926  {
927  SizeType number_of_points = SearchUtils::PointerDistance(PointsBegin,PointsEnd);
928  if (number_of_points == 0)
929  return NULL;
930  else
931  {
932  return new Bins( PointsBegin, PointsEnd, MinPoint, MaxPoint, BucketSize );
933  }
934  }
935 
936 
937 };
938 
939 template< std::size_t TDimension, class TPointType, class TContainerType, class TPointerType,
940  class TIteratorType, class TDistanceIteratorType, class TDistanceFunction >
942 {
943  rThis.PrintInfo(rOStream);
944  rOStream << std::endl;
945  rThis.PrintSize(rOStream);
946  rThis.PrintData(rOStream);
947  return rOStream;
948 }
949 
950 }
Definition: bins_static.h:35
void SearchNearestPointLocalInner(PointerType &ThisPoint, PointerType &rResult, CoordinateType &rResultDistance, SearchStructureType &Box)
Definition: bins_static.h:539
static TreeNodeType * Construct(IteratorType PointsBegin, IteratorType PointsEnd, const PointType &MaxPoint, const PointType &MinPoint, SizeType BucketSize)
Definition: bins_static.h:925
SizeType SearchInRadius(PointType const &ThisPoint, CoordinateType Radius, IteratorType Results, SizeType MaxNumberOfResults)
Definition: bins_static.h:646
TreeNodeType::CoordinateType CoordinateType
Definition: bins_static.h:53
void SearchNearestPoint(PointType const &ThisPoint, PointerType &rResult, CoordinateType &rResultDistance, SearchStructureType &Box) override
Definition: bins_static.h:493
SizeArray & GetDivisions()
Get the Divisions object.
Definition: bins_static.h:201
LocalContainerType::iterator LocalIterator
Definition: bins_static.h:66
IteratorType End()
Definition: bins_static.h:178
TreeNodeType::SizeType SizeType
Definition: bins_static.h:51
void PrintBox(std::ostream &rout)
Print Limits Points of the Container.
Definition: bins_static.h:883
PointerType SearchNearestPointInner(PointerType &ThisPoint)
Return the nearest point to ThisPoint. This function can not return the same point.
Definition: bins_static.h:436
void SearchInBoxLocal(PointType const &SearchMinPoint, PointType const &SearchMaxPoint, IteratorType &ResultsPoint, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_static.h:818
IteratorVector::const_iterator IteratorConstIterator
Definition: bins_static.h:72
void SearchNearestInBox(PointType const &ThisPoint, PointerType &ResultPoint, CoordinateType &ResultDistance, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box, bool &Found)
Definition: bins_static.h:718
TPointType PointType
Definition: bins_static.h:42
void SearchNearestInBox(PointType const &ThisPoint, PointerType &ResultPoint, CoordinateType &ResultDistance, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box, bool &Found)
Definition: bins_static.h:726
Tvector< IndexType, Dimension > IndexArray
Definition: bins_static.h:57
void SearchNearestInBoxInner(PointerType &ThisPoint, PointerType &ResultPoint, CoordinateType &ResultDistance, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box, bool &Found)
Definition: bins_static.h:765
KRATOS_CLASS_POINTER_DEFINITION(Bins)
Pointer definition of Bins.
CoordinateArray & GetCellSize()
Get the Cell Size object.
Definition: bins_static.h:209
Bins & operator=(Bins const &rOther)
Assignment operator.
Bins(Bins const &rOther)
Copy constructor.
PointerType SearchNearestPoint(PointType const &ThisPoint)
Return the nearest point to ThisPoint. This function can return the same point with distance 0.
Definition: bins_static.h:450
std::vector< PointerType > LocalContainerType
Definition: bins_static.h:65
TPointerType PointerType
Definition: bins_static.h:46
void SearchNearestInnerInRange(const IteratorType &RangeBegin, const IteratorType &RangeEnd, PointerType &ThisPoint, PointerType &Result, CoordinateType &Distance, bool &Found)
Definition: bins_static.h:777
void SearchInRadiusLocal(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_static.h:705
void SearchInRadiusLocal(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_static.h:696
void PrintData(std::ostream &rOStream, std::string const &Perfix=std::string()) const override
Print object's data.
Definition: bins_static.h:860
SizeType SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, IteratorType Results, DistanceIteratorType ResultsDistances, SizeType const &MaxNumberOfResults)
Definition: bins_static.h:561
LocalContainerType PointVector
Definition: bins_static.h:79
PointerType SearchNearestPoint(PointType const &ThisPoint, CoordinateType &rResultDistance)
Definition: bins_static.h:461
TreeNode< Dimension, PointType, PointerType, IteratorType, DistanceIteratorType > TreeNodeType
Definition: bins_static.h:49
void SearchNearestPoint(PointType const &ThisPoint, PointerType &rResult, CoordinateType &rResultDistance) override
Definition: bins_static.h:485
void SearchInRadius(PointerType const &ThisPoints, SizeType const &NumberOfPoints, std::vector< CoordinateType > const &Radius, std::vector< IteratorType > Results, std::vector< DistanceIteratorType > ResultsDistances, std::vector< SizeType > &NumberOfResults, SizeType const &MaxNumberOfResults)
Definition: bins_static.h:603
Kratos::SearchUtils::SearchBoxInRange< PointType, IteratorType, SizeType, TDimension > SearchBoxInRange
Definition: bins_static.h:76
virtual std::string Info() const
Turn back information as a string.
Definition: bins_static.h:848
void SearchInRadiusLocal(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, DistanceIteratorType &ResultsDistances, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_static.h:625
PointType & GetMaxPoint()
Get the Max Point object.
Definition: bins_static.h:225
Tvector< SizeType, Dimension > SizeArray
Definition: bins_static.h:56
void SearchInRadiusLocal(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, DistanceIteratorType &ResultsDistances, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_static.h:634
void SearchNearestPoint(PointerType const &ThisPoints, SizeType const &NumberOfPoints, IteratorType &Results, std::vector< CoordinateType > ResultsDistances)
Definition: bins_static.h:503
void SearchInBoxLocal(PointType const &SearchMinPoint, PointType const &SearchMaxPoint, IteratorType &ResultsPoint, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box)
Definition: bins_static.h:835
void SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructureType &Box) override
Definition: bins_static.h:678
void SearchNearestInBoxInner(PointerType &ThisPoint, PointerType &ResultPoint, CoordinateType &ResultDistance, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box, bool &Found)
Definition: bins_static.h:748
void SearchNearestInBoxInner(PointerType &ThisPoint, PointerType &ResultPoint, CoordinateType &ResultDistance, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box, bool &Found)
Definition: bins_static.h:756
Kratos::SearchUtils::SearchNearestInRange< PointType, PointerType, IteratorType, DistanceFunction, CoordinateType > SearchNearestInRange
Definition: bins_static.h:74
LocalIterator PointIterator
Definition: bins_static.h:80
Bins(IteratorType const &PointBegin, IteratorType const &PointEnd, SizeType BucketSize=1)
Constructs a new BinsStatic Construct a new BinsStatic using a list of points and an automatically ca...
Definition: bins_static.h:102
SizeType SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, IteratorType Results, DistanceIteratorType ResultsDistances, SizeType const &MaxNumberOfResults, SearchStructureType &Box)
Definition: bins_static.h:573
Bins()
Default Constructor.
Definition: bins_static.h:92
TIteratorType IteratorType
Definition: bins_static.h:44
PointerType SearchNearestPoint(PointType const &ThisPoint, CoordinateType &rResultDistance, SearchStructureType &Box)
Definition: bins_static.h:473
SizeType SearchInBox(PointType const &SearchMinPoint, PointType const &SearchMaxPoint, IteratorType Results, SizeType MaxNumberOfResults)
Definition: bins_static.h:796
KRATOS_DEPRECATED CoordinateType CellSize(SizeType const &iDim)
Definition: bins_static.h:185
void SearchNearestInBox(PointType const &ThisPoint, PointerType &ResultPoint, CoordinateType &ResultDistance, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 3 > &Box, bool &Found)
Definition: bins_static.h:735
Tvector< CoordinateType, Dimension > CoordinateArray
Definition: bins_static.h:55
void SearchInBox(PointType const &SearchMinPoint, PointType const &SearchMaxPoint, IteratorType &Results, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults) override
Definition: bins_static.h:807
TreeNodeType LeafType
Definition: bins_static.h:81
void SearchInRadiusLocal(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, DistanceIteratorType &ResultsDistances, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_static.h:617
SizeType SearchInRadius(PointType const &ThisPoint, CoordinateType Radius, IteratorType Results, SizeType MaxNumberOfResults, SearchStructureType &Box)
Definition: bins_static.h:657
void SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults) override
Definition: bins_static.h:669
void SearchNearestPointLocal(PointType const &ThisPoint, PointerType &rResult, CoordinateType &rResultDistance, SearchStructureType &Box)
Definition: bins_static.h:515
Bins(IteratorType const &PointBegin, IteratorType const &PointEnd, PointType const &MinPoint, PointType const &MaxPoint, SizeType BucketSize=1)
Constructs a new BinsStatic Construct a new BinsStatic using a list of points and an automatically ca...
Definition: bins_static.h:125
Kratos::SearchUtils::SearchRadiusInRange< PointType, IteratorType, DistanceIteratorType, DistanceFunction, SizeType, CoordinateType > SearchRadiusInRange
Definition: bins_static.h:75
void SearchInBoxLocal(PointType const &SearchMinPoint, PointType const &SearchMaxPoint, IteratorType &ResultsPoint, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 2 > &Box)
Definition: bins_static.h:826
void SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, DistanceIteratorType &ResultsDistances, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructureType &Box) override
Definition: bins_static.h:594
TreeNodeType::IteratorIteratorType IteratorIteratorType
Definition: bins_static.h:59
TDistanceFunction DistanceFunction
Definition: bins_static.h:47
IteratorType Begin()
Definition: bins_static.h:171
void SearchInRadiusLocal(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults, SearchStructure< IndexType, SizeType, CoordinateType, IteratorType, IteratorIteratorType, 1 > &Box)
Definition: bins_static.h:688
~Bins() override
Definition: bins_static.h:167
Bins(IteratorType const &PointBegin, IteratorType const &PointEnd, CoordinateType cellsize, SizeType BucketSize=1)
Constructs a new BinsStatic.
Definition: bins_static.h:154
void PrintSize(std::ostream &rout)
Print Size of Container.
Definition: bins_static.h:874
TDistanceIteratorType DistanceIteratorType
Definition: bins_static.h:45
Tvector< IndexType, TDimension > CellType
Definition: bins_static.h:68
KRATOS_DEPRECATED SizeType NumCell(SizeType const &iDim)
Definition: bins_static.h:192
void SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, DistanceIteratorType &ResultsDistances, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults) override
Definition: bins_static.h:585
@ Dimension
Definition: bins_static.h:40
TreeNodeType::SearchStructureType SearchStructureType
Definition: bins_static.h:60
PointType & GetMinPoint()
Get the Min Point object.
Definition: bins_static.h:217
PointerType ExistPoint(PointerType const &ThisPoint, CoordinateType const Tolerance=static_cast< CoordinateType >(10.0 *DBL_EPSILON))
Return the closest point to ThisPoint in case it exists or a null pointer otherwise.
Definition: bins_static.h:419
TContainerType ContainerType
Definition: bins_static.h:43
TreeNodeType::IndexType IndexType
Definition: bins_static.h:52
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: bins_static.h:854
std::vector< IteratorType > IteratorVector
Definition: bins_static.h:70
IteratorVector::iterator IteratorIterator
Definition: bins_static.h:71
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
Point class.
Definition: point.h:59
Definition: search_structure.h:309
void Set(IndexVector const &IndexCell, SizeVector const &_MaxSize, IteratorIteratorType const &IteratorBegin)
Definition: search_structure.h:363
IteratorIteratorType RowBegin
Definition: search_structure.h:327
SubBinAxis< IndexType, SizeType > Axis[3]
Definition: search_structure.h:326
IteratorIteratorType RowEnd
Definition: search_structure.h:328
Definition: search_structure.h:142
Definition: search_structure.h:160
Definition: search_structure.h:194
Definition: search_structure.h:109
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_DEPRECATED
Definition: define.h:738
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::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
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
integer i
Definition: TensorModule.f:17
#define DBL_MAX
Definition: search_structure.h:23
Configure::IteratorType IteratorType
Definition: transfer_utility.h:249
Configure::PointType PointType
Definition: transfer_utility.h:245