28 #define BOOST_TEST_MODULE ( BulkAllocator_test ) 29 #include "boost/test/unit_test.hpp" 58 constexpr
unsigned int NPoints = 1000;
59 constexpr
unsigned int NAngles = 10800;
60 constexpr
unsigned int NDist = 2500;
62 typedef std::map<int, int> BaseMap_t;
66 int,
int, BaseMap_t::key_compare,
67 std::allocator<BaseMap_t::value_type>
68 >> stl_image(NAngles);
83 int,
int, BaseMap_t::key_compare,
85 >> bulk_image(NAngles);
91 ::SetChunkSize(500000);
93 static std::default_random_engine random_engine(
RandomSeed);
94 std::uniform_real_distribution<float> uniform(-1., 1.);
96 for (
unsigned int iPoint = 0; iPoint != NPoints; ++iPoint) {
99 const float offset = uniform(random_engine) * NDist;
100 const float slope = uniform(random_engine);
102 for (
size_t iAngle = 0; iAngle < NAngles; ++iAngle) {
104 ++(stl_image[iAngle][
int(d)]);
105 ++(bulk_image[iAngle][
int(d)]);
108 while (d >= (
float) NDist) d -= 2*NDist;
109 while (d < 0) d += 2*NDist;
116 auto stl_begin = stl_image.cbegin();
117 for (
const auto& bulk_map: bulk_image) {
119 if (std::equal(bulk_map.begin(), bulk_map.end(), (stl_begin++)->
begin()))
constexpr unsigned int RandomSeed
The seed for the default random engine.
void RunHoughTransformTreeTest()
Tests bulk allocator with a vector of maps (Hough transfort use case)
BOOST_AUTO_TEST_CASE(RunHoughTransformTree)
Aggressive allocator reserving a lot of memory in advance.
Memory allocator for large amount of (small) objects.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
QTextStream & endl(QTextStream &s)