36 #include "DGtal/base/Common.h"
37 #include "DGtal/kernel/SpaceND.h"
38 #include "DGtal/kernel/PointVector.h"
39 #include "DGtal/kernel/domains/HyperRectDomain.h"
41 #include "DGtalCatch.h"
43 using namespace DGtal;
47 auto tic_timer = std::chrono::high_resolution_clock::now();
52 tic_timer = std::chrono::high_resolution_clock::now();
58 const auto toc_timer = std::chrono::high_resolution_clock::now();
59 const std::chrono::duration<double> time_span = toc_timer -
tic_timer;
60 return time_span.count();
66 static constexpr std::size_t
dim = 3;
67 static constexpr
signed long long int size = 200;
68 static constexpr std::size_t N = 100;
78 , dimensions(
Point::dimension)
80 std::iota(dimensions.begin(), dimensions.end(),
Dimension(0));
85 std::vector<Point::Dimension> dimensions;
89 TEST_CASE_METHOD( BenchDomain,
"Benchmarking HyperRectDomain iterators using custom implementation" )
91 SECTION(
"Domain forward traversal")
96 for (std::size_t i = 0; i < N; ++i)
99 for (
auto const& pt :
domain)
104 trace.
info() <<
"Domain traversal: " << duration <<
" s ; " << (
domain.
size()/duration*1e-9) <<
" Gpts/s ; check = " << check << std::endl;
107 SECTION(
"Domain reverse traversal")
112 for (std::size_t i = 0; i < N; ++i)
120 trace.
info() <<
"Domain reverse traversal: " << duration <<
" s ; " << (
domain.
size()/duration*1e-9) <<
" Gpts/s ; check = " << check << std::endl;
123 SECTION(
"Benchmarking domain traversal using subRange")
128 for (std::size_t i = 0; i < N; ++i)
136 trace.
info() <<
"Domain traversal using subRange: " << duration <<
" s ; " << (
domain.
size()/duration*1e-9) <<
" Gpts/s ; check = " << check << std::endl;
139 SECTION(
"Benchmarking domain reverse traversal using subRange")
145 for (std::size_t i = 0; i < N; ++i)
148 for (
auto it = range.rbegin(), it_end = range.rend(); it != it_end; ++it)
153 trace.
info() <<
"Domain reverse traversal using subRange: " << duration <<
" s ; " << (
domain.
size()/duration*1e-9) <<
" Gpts/s ; check = " << check << std::endl;
double toc()
Ends timer and return elapsed time.
auto tic_timer
Timer used in tic and toc.
TEST_CASE_METHOD(BenchDomain, "Benchmarking HyperRectDomain iterators using custom implementation")
ConstReverseIterator rbegin() const
ConstSubRange subRange(const std::vector< Dimension > &permutation) const
ConstReverseIterator rend() const
DGtal::LinearOperator< Calculus, dim, duality, dim, duality > diagonal(const DGtal::KForm< Calculus, dim, duality > &kform)
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
SECTION("Testing constant forward iterators")
unsigned int dim(const Vector &z)