@@ -108,11 +108,6 @@ namespace
108
108
std::mt19937 g (rd ());
109
109
g.seed ();
110
110
std::shuffle (next (begin (aPoint), nNumberPre), end (aPoint), g);
111
-
112
- [[maybe_unused]] autoc box = Adaptor::GetBoxOfPoints (aPoint);
113
- assert (Adaptor::ArePointsEqual (box.Max , ptMax, 0.0001 ));
114
- assert (Adaptor::ArePointsEqual (box.Min , PointND<nDim>{}, 0.0001 ));
115
-
116
111
return aPoint;
117
112
}
118
113
@@ -147,10 +142,6 @@ namespace
147
142
148
143
}
149
144
150
- [[maybe_unused]] autoc box = Adaptor::GetBoxOfPoints (aPoint);
151
- assert (Adaptor::ArePointsEqual (box.Max , ptMax, 0.0001 ));
152
- assert (Adaptor::ArePointsEqual (box.Min , PointND<nDim>{}, 0.0001 ));
153
-
154
145
return aPoint;
155
146
}
156
147
@@ -190,10 +181,6 @@ namespace
190
181
}
191
182
}
192
183
193
- [[maybe_unused]] autoc box = Adaptor::GetBoxOfPoints (aPoint);
194
- assert (Adaptor::ArePointsEqual (box.Max , ptMax, 0.0001 ));
195
- assert (Adaptor::ArePointsEqual (box.Min , PointND<nDim>{}, 0.0001 ));
196
-
197
184
return aPoint;
198
185
}
199
186
@@ -591,7 +578,7 @@ namespace
591
578
592
579
593
580
template <dim_t N>
594
- vector<MeasurementTask<BoundingBoxND<N>>> SearchTreeBoxTasks (depth_t nDepth, string const & szName, span<BoundingBoxND<N> const > const & aBox_)
581
+ vector<MeasurementTask<BoundingBoxND<N>>> CollisionDetectionBoxTasks (depth_t nDepth, string const & szName, span<BoundingBoxND<N> const > const & aBox_)
595
582
{
596
583
auto vTask = vector<MeasurementTask<BoundingBoxND<N>>>();
597
584
for (autoc fPar : { false , true })
@@ -619,33 +606,64 @@ namespace
619
606
{
620
607
TreeBoxND<N, nSplit>::template Create<std::execution::parallel_unsequenced_policy>(nt, aBox, nDepth, boxMax);
621
608
autoc vPair = nt.template CollisionDetection <std::execution::parallel_unsequenced_policy>(aBox);
622
- return size_t {};
623
- // return nt.GetNodes().size();
609
+ return nt.GetNodes ().size ();
624
610
}
625
611
else
626
612
{
627
613
TreeBoxND<N, nSplit>::Create (nt, aBox, nDepth, boxMax);
628
614
autoc vPair = nt.CollisionDetection (aBox);
629
615
return vPair.size ();
630
- // return nt.GetNodes().size();
631
- /*
632
- size_t nFound = 0;
633
- autoc n = aBox.size();
634
- for (size_t i = 0; i < n; ++i)
635
- {
636
- autoc vElem = nt.RangeSearch<false>(aBox[i], aBox);
637
- nFound += vElem.size();
638
- assert(vElem.size());
639
- }
640
- return nFound;
641
- */
642
616
}
643
617
}
644
618
});
645
619
}
646
620
return vTask;
647
621
}
648
622
623
+ template <dim_t N>
624
+ vector<MeasurementTask<BoundingBoxND<N>>> SearchTreeBoxTasks (depth_t nDepth, string const & szName, span<BoundingBoxND<N> const > const & aBox_)
625
+ {
626
+ auto vTask = vector<MeasurementTask<BoundingBoxND<N>>>();
627
+ for (size_t iSize = 0 ; iSize < nSizeNonLog; ++iSize)
628
+ {
629
+ auto nDepthActual = nDepth;
630
+ if (nDepth == -1 ) // Adapt to the size
631
+ {
632
+ if (aSizeNonLog[iSize] <= 100 )
633
+ nDepthActual = 3 ;
634
+ else if (aSizeNonLog[iSize] <= 500 )
635
+ nDepthActual = 3 ;
636
+ else if (aSizeNonLog[iSize] <= 1000 )
637
+ nDepthActual = 4 ;
638
+ else if (aSizeNonLog[iSize] <= 10000 )
639
+ nDepthActual = 5 ;
640
+ else
641
+ nDepthActual = 6 ;
642
+ }
643
+ vTask.push_back (MeasurementTask<BoundingBoxND<N>>{ szName,
644
+ aSizeNonLog[iSize],
645
+ aRepeatNonLog[iSize],
646
+ nDepthActual,
647
+ false ,
648
+ aBox_.subspan (0 , aSizeNonLog[iSize]),
649
+ [](depth_t nDepth, span<BoundingBoxND<N> const > const & aBox, bool fPar ) {
650
+ autoce nSplit = 2 ;
651
+ auto nt = TreeBoxND<N, nSplit>{};
652
+ TreeBoxND<N, nSplit>::Create (nt, aBox, nDepth, boxMax);
653
+ size_t nFound = 0 ;
654
+ autoc n = aBox.size ();
655
+ for (size_t i = 0 ; i < n; ++i)
656
+ {
657
+ autoc vElem = nt.template RangeSearch <false >(aBox[i], aBox);
658
+ nFound += vElem.size ();
659
+ assert (vElem.size ());
660
+ }
661
+ return nFound;
662
+ } });
663
+ }
664
+ return vTask;
665
+ }
666
+
649
667
template <dim_t N>
650
668
vector<MeasurementTask<BoundingBoxND<N>>> SearchBruteForceBoxTasks (depth_t nDepth, string const & szName, span<BoundingBoxND<N> const > const & aBox_)
651
669
{
@@ -821,10 +839,12 @@ int main()
821
839
autoc szName = string (" Search: Cylindrical semi-random placed point NoPt/NoBox:100%" );
822
840
autoc aBox = GenerateGeometry<N, vector<BoundingBoxND<N>>>([&] { return CreateBoxes_CylindricalSemiRandom<N, static_cast <size_t >(aSizeNonLog.back ())>(); }, szName, aSizeNonLog.back (), report);
823
841
autoc vTaskBruteForce = SelfConflictBruteForceBoxTasks<N>(" Box self conflict by brute force" , aBox);
824
- autoc vTaskTree = SearchTreeBoxTasks<N>(3 , " Box self conflict by octree" , aBox);
842
+ autoc vTaskTreeCollisionDetection = CollisionDetectionBoxTasks<N>(3 , " Box self conflict by octree" , aBox);
843
+ autoc vTaskTreeSearch = SearchTreeBoxTasks<N>(3 , " Box search by octree" , aBox);
825
844
826
845
RunTasks (vTaskBruteForce, report);
827
- RunTasks (vTaskTree, report);
846
+ RunTasks (vTaskTreeCollisionDetection, report);
847
+ RunTasks (vTaskTreeSearch, report);
828
848
}
829
849
830
850
report.close ();
0 commit comments