56TEST_CASE(
"Simple HyperRectDomain",
"[domain][4D]" )
59 typedef Space4Type::Point
Point;
62 Space4Type::Integer t [] = { 1, 2, 3 , 4};
64 Space4Type::Integer t2[] = { 5, 5, 3 , 4};
66 double td [] = { 1.1, 2.5, 3 , 4};
68 double td2[] = { 4.9, 4.5, 3 , 4};
79 trace.
info() <<
"Empty domain using the default constructor" << std::endl;
82 trace.
info() <<
"Empty domain = " << myEmptyDomain << std::endl;
92 trace.
info() <<
"Domain characterized by points a and b" << std::endl;
95 trace.
info() <<
"Domain = " << myHyperRectDomain << std::endl;
100 trace.
info() <<
"Domain size = " << myHyperRectDomain.
size() << std::endl;
102 REQUIRE( (myHyperRectDomain.
end() - myHyperRectDomain.
begin()) == 20 );
103 REQUIRE( (myHyperRectDomain.
begin() - myHyperRectDomain.
end()) == -20 );
108 trace.
info() <<
"Domain initialized with RealPoint" << std::endl;
110 trace.
info() <<
"Domain = " << myHyperRectDomain_rr << std::endl;
116 trace.
info() <<
"Domain = " << myHyperRectDomain_ir << std::endl;
122 trace.
info() <<
"Domain = " << myHyperRectDomain_ri << std::endl;
132 trace.
info() <<
"Domain = " << myHyperRectDomainBis << std::endl;
133 trace.
info() <<
"Domain size = " << myHyperRectDomainBis.
size() << std::endl;
143 myHyperRectDomainTer = myHyperRectDomain;
144 trace.
info() <<
"Domain = " << myHyperRectDomainTer << std::endl;
145 trace.
info() <<
"Domain size = " << myHyperRectDomainTer.
size() << std::endl;
164 Iterator & it, Iterator
const& it_begin, Iterator
const& it_end,
165 typename std::iterator_traits<Iterator>::difference_type & cnt_begin,
166 Point & pt,
Domain const&
domain, std::vector<Dimension>
const& dimensions, std::size_t
id,
174 REQUIRE( std::distance(it_begin, it) == cnt_begin );
175 REQUIRE( std::distance(it, it_begin) == -cnt_begin );
176 INFO( *(it_begin + cnt_begin) <<
" == " << *it );
177 REQUIRE( it_begin + cnt_begin == it );
178 INFO( *(it - cnt_begin) <<
" == " << *it_begin);
179 REQUIRE( it - cnt_begin == it_begin );
187 const auto d = dimensions[id];
218 Iterator
const& it_begin, Iterator
const& it_end,
222 Iterator it = it_begin;
223 typename std::iterator_traits<Iterator>::difference_type cnt_begin = 0;
226 it, it_begin, it_end, cnt_begin,
227 pt,
domain, dimensions, dimensions.size(),
264 trace.
emphase() <<
"Iterator from starting point" << std::endl;
267 trace.
emphase() <<
"Reverse iterator from starting point" << std::endl;
270 trace.
emphase() <<
"Iterator on reversed dimension order: " << std::endl;
271 std::vector<Dimension> dimensions(Point::dimension);
272 std::iota(dimensions.rbegin(), dimensions.rend(),
Dimension(0));
276 trace.
emphase() <<
"Reverse iterator on reversed dimension order: " << std::endl;
279 trace.
emphase() <<
"Iterator on reversed dimension order and from a starting point: " << std::endl;
283 trace.
emphase() <<
"Reverse iterator on reversed dimension order and from a starting point: " << std::endl;
286 trace.
emphase() <<
"Iterator along one dimension: " << std::endl;
288 const std::vector<Dimension> one_dimension({1});
291 trace.
emphase() <<
"Reverse iterator along one dimension: " << std::endl;
296 trace.
emphase() <<
"Iterator along one dimension and from a starting point: " << std::endl;
300 trace.
emphase() <<
"Reverse iterator along one dimension and from a starting point: " << std::endl;
351 typedef TSpace4D::Point Point4D;
352 TSpace4D::Integer t[] = {1, 1, 1, 1};
354 TSpace4D::Integer t2[] = {3, 3, 3, 3};
362 std::copy ( myHyperRectDomain4D.
begin(),
363 myHyperRectDomain4D.
end(),
364 ostream_iterator<Point4D> (
trace.
info(),
" " ) );
373 typedef TSpace::Point TPoint;
376 const TDomain nonempty_domain( TPoint::diagonal(0), TPoint::diagonal(0) );
377 REQUIRE( !nonempty_domain.isEmpty() );
379 const TDomain default_domain;
380 REQUIRE( default_domain.isEmpty() );
382 const TDomain
domain( TPoint::diagonal(1), TPoint::diagonal(0) );
389 REQUIRE( range.begin() == range.end() );
390 REQUIRE( range.rbegin() == range.rend() );
393 REQUIRE( range.begin() == range.end() );
394 REQUIRE( range.rbegin() == range.rend() );
397 REQUIRE( range.begin() == range.end() );
398 REQUIRE( range.rbegin() == range.rend() );
401 REQUIRE( range.begin() == range.end() );
402 REQUIRE( range.rbegin() == range.rend() );
405 REQUIRE( range.begin() == range.end() );
406 REQUIRE( range.rbegin() == range.rend() );
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
const ConstIterator & begin() const
const Point & lowerBound() const
ConstReverseIterator rbegin() const
const Point & upperBound() const
ConstSubRange subRange(const std::vector< Dimension > &permutation) const
ConstReverseIterator rend() const
const ConstIterator & end() const
Self & partialCopy(const PointVector< dim, OtherComponent, OtherContainer > &pv, const std::vector< Dimension > &dimensions)
Partial copy of a given PointVector.
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
void testIterator(Point const &a, Point const &b, Point const &c)
void testIteratorHelper(Iterator const &it_begin, Iterator const &it_end, Point pt, Domain const &domain, std::vector< Dimension > const &dimensions, bool forward=true)
TEST_CASE("Simple HyperRectDomain", "[domain][4D]")
void testIteratorHelperImpl(Iterator &it, Iterator const &it_begin, Iterator const &it_end, typename std::iterator_traits< Iterator >::difference_type &cnt_begin, Point &pt, Domain const &domain, std::vector< Dimension > const &dimensions, std::size_t id, bool forward)
Checking iterator given then span domain and dimensions order.