28 #define BOOST_TEST_MODULE ( PointIsolationAlg_test ) 30 #include <boost/test/test_tools.hpp> 56 template <
typename Engine,
typename Coord =
float>
58 Engine&
generator,
unsigned int nPoints, std::vector<Coord>
const& radii
66 std::uniform_real_distribution<Coord_t> uniform(-1., +1.);
67 auto randomCoord = std::bind(uniform, generator);
69 using Point_t = std::array<Coord_t, 3U>;
70 std::vector<Point_t> points;
72 points.reserve(nPoints);
73 for (
unsigned int i = 0; i < nPoints; ++i)
74 points.push_back({{ randomCoord(), randomCoord(), randomCoord() }});
77 <<
"\nTest with " << nPoints <<
" points" 86 typename PointIsolationAlg_t::Configuration_t
config;
87 config.rangeX = { -2., +2. };
88 config.rangeY = { -2., +2. };
89 config.rangeZ = { -2., +2. };
92 PointIsolationAlg_t algo(
config);
108 std::cout <<
"Isolation radius: " << radius <<
std::endl;
115 = algo.bruteRemoveIsolatedPoints(points.begin(), points.end());
116 auto elapsed = timer.
elapsed();
118 std::cout <<
" brute force: " << elapsed <<
" ms" 125 auto actual = algo.removeIsolatedPoints(points);
127 std::sort(actual.begin(), actual.end());
128 std::cout <<
" regular: " << elapsed <<
" ms" 134 BOOST_TEST(actual ==
expected, boost::test_tools::per_element());
159 auto seed = std::default_random_engine::default_seed;
162 std::istringstream sstr;
166 throw std::runtime_error
172 std::default_random_engine
generator(seed);
173 std::cout <<
"Random seed: " << seed <<
std::endl;
176 std::vector<float>
const Radii { 0.05, 0.1, 0.5, 2.0 };
177 std::vector<unsigned int>
const DataSizes { 100, 10000 };
179 for (
unsigned int nPoints: DataSizes)
Algorithm to detect isolated space points.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >> Point_t
ElapsedTime_t elapsed() const
Returns the total time spent running since the last restart.
enum geo::coordinates Coord_t
void restart()
Restarts the watch; previous time is forgotten.
Provides time interval measurements.
Algorithm(s) dealing with point isolation in space.
void PointIsolationTest(Engine &generator, unsigned int nPoints, std::vector< Coord > const &radii)
BOOST_FIXTURE_TEST_CASE(PointIsolationTestCase, ArgsFixture)
QTextStream & endl(QTextStream &s)