75 #ifndef SLIP_COMPONENT_ITERATOR4D_BOX_HPP
76 #define SLIP_COMPONENT_ITERATOR4D_BOX_HPP
107 template <
class MultiComponentContainer4D, std::
size_t N>
114 typedef typename MultiComponentContainer4D::value_type
Block;
122 typedef typename MultiComponentContainer4D::size_type
size_type;
133 cont4d_(0),pos_(0),x1_(0),x2_(0),x3_(0),x4_(0),cp_(0),box_(0,0,0,0,0)
145 cont4d_(c),pos_(&(*c)[0][0][0][0][cp] +
146 ((b.first_front_upper_left())[0] * static_cast<int>(c->slices()) * static_cast<int>(c->rows()) * static_cast<int>(c->cols()) * N) +
147 ((b.first_front_upper_left())[1] * static_cast<int>(c->rows()) * static_cast<int>(c->cols()) * N) +
148 ((b.first_front_upper_left())[2] * static_cast<int>(c->cols()) * N) +
149 ((b.first_front_upper_left())[3] * N)),
150 x1_((b.first_front_upper_left())[0]),x2_((b.first_front_upper_left())[1]),
151 x3_((b.first_front_upper_left())[2]),x4_((b.first_front_upper_left())[3]),cp_(cp),box_(b)
160 cont4d_(o.cont4d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),x3_(o.x3_),x4_(o.x4_),cp_(o.cp_),box_(o.box_)
181 this->cont4d_ = o.cont4d_;
234 this->pos_+= N * (
static_cast<int>(cont4d_->cols()) - box_.
width() + 1) ;
240 this->pos_ += N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows()) -
247 this->pos_ += N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows())
248 *(static_cast<int>(cont4d_->slices()) - box_.
depth() + 1)
256 this->pos_ += N * (
static_cast<int>(cont4d_->cols()) * (static_cast<int>(cont4d_->rows())
257 * (static_cast<int>(cont4d_->slices()) + 1) + 1) + 1);
297 this->pos_ -= N * (
static_cast<int>(cont4d_->cols()) - box_.
width() + 1);
304 this->pos_ -= N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows()) -
313 this->pos_ -= N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows())
314 * (static_cast<int>(cont4d_->slices()) - box_.
depth() + 1)
322 this->pos_ -= N * (
static_cast<int>(cont4d_->cols()) * (static_cast<int>(cont4d_->rows())
323 * (static_cast<int>(cont4d_->slices()) + 1) + 1) + 1);
359 return ( (i1.cont4d_ == i2.cont4d_) && (i1.pos_ == i2.pos_)
360 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.x3_ == i2.x3_)
361 && (i1.x4_ == i2.x4_) && (i1.cp_ == i2.cp_));
374 return ( (i1.cont4d_ != i2.cont4d_) || (i1.pos_ != i2.pos_)
375 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) || (i1.x3_ != i2.x3_)
376 || (i1.x4_ != i2.x4_) || (i1.cp_ != i2.cp_));
397 return ( i1.pos_ < i2.pos_);
457 this->x1_ += d.
dx1();
458 this->x2_ += d.
dx2();
459 this->x3_ += d.
dx3();
460 this->x4_ += d.
dx4();
461 this->pos_ = &(*cont4d_)[0][0][0][0][this->cp_] +
462 (this->x1_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) *
463 static_cast<int>(cont4d_->slices()) * N) +
464 (this->x2_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) * N) +
465 (this->x3_ *
static_cast<int>(cont4d_->cols()) * N) +
482 this->x1_ -= d.
dx1();
483 this->x2_ -= d.
dx2();
484 this->x3_ -= d.
dx3();
485 this->x4_ -= d.
dx4();
486 this->pos_ = &(*cont4d_)[0][0][0][0][this->cp_] +
487 (this->x1_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) *
488 static_cast<int>(cont4d_->slices()) * N) +
489 (this->x2_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) * N) +
490 (this->x3_ *
static_cast<int>(cont4d_->cols()) * N) +
537 return difference_type(static_cast<int>(i1.x1_ - i2.x1_),static_cast<int>(i1.x2_ - i2.x2_),
538 static_cast<int>(i1.x3_ - i2.x3_),static_cast<int>(i1.x4_ - i2.x4_));
553 assert( (this->x1_+d.
dx1()) < cont4d_->dim1() );
554 assert( (this->x2_+d.
dx2()) < cont4d_->dim2() );
555 assert( (this->x3_+d.
dx3()) < cont4d_->dim3() );
556 assert( (this->x4_+d.
dx4()) < cont4d_->dim4() );
557 return (*cont4d_)[this->x1_+d.
dx1()][this->x2_+d.
dx2()][this->x3_+d.
dx3()][this->x4_+d.
dx4()][cp_];
572 return cont4d_->slab_begin(this->cp_,
607 return cont4d_->slice_begin(this->cp_,
642 return cont4d_->row_begin(this->cp_,
678 return cont4d_->col_begin(this->cp_,
803 MultiComponentContainer4D* cont4d_;
832 template <
class MultiComponentContainer4D, std::
size_t N>
840 typedef typename MultiComponentContainer4D::value_type
Block;
848 typedef typename MultiComponentContainer4D::size_type
size_type;
859 cont4d_(0),pos_(0),x1_(0),x2_(0),x3_(0),x4_(0),cp_(0),box_(0,0,0,0,0)
871 cont4d_(c),pos_(&(*c)[0][0][0][0][cp] +
872 ((b.first_front_upper_left())[0] * static_cast<int>(c->slices()) * static_cast<int>(c->rows())
873 * static_cast<int>(c->cols()) * N) +
874 ((b.first_front_upper_left())[1] * static_cast<int>(c->rows()) * static_cast<int>(c->cols()) * N) +
875 ((b.first_front_upper_left())[2] * static_cast<int>(c->cols()) * N) +
876 ((b.first_front_upper_left())[3] * N)),
877 x1_((b.first_front_upper_left())[0]),x2_((b.first_front_upper_left())[1]),
878 x3_((b.first_front_upper_left())[2]),x4_((b.first_front_upper_left())[3]),cp_(cp),box_(b)
887 cont4d_(o.cont4d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),x3_(o.x3_),x4_(o.x4_),cp_(o.cp_),box_(o.box_)
908 this->cont4d_ = o.cont4d_;
961 this->pos_+= N * (
static_cast<int>(cont4d_->cols()) - box_.
width() + 1) ;
967 this->pos_ += N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows()) -
974 this->pos_ += N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows())
975 *(static_cast<int>(cont4d_->slices()) - box_.
depth() + 1)
983 this->pos_ += N * (
static_cast<int>(cont4d_->cols()) * (static_cast<int>(cont4d_->rows())
984 * (static_cast<int>(cont4d_->slices()) + 1) + 1) + 1);
1024 this->pos_ -= N * (
static_cast<int>(cont4d_->cols()) - box_.
width() + 1);
1031 this->pos_ -= N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows()) -
1040 this->pos_ -= N * (
static_cast<int>(cont4d_->cols())*(static_cast<int>(cont4d_->rows())
1041 * (static_cast<int>(cont4d_->slices()) - box_.
depth() + 1)
1049 this->pos_ -= N * (
static_cast<int>(cont4d_->cols()) * (static_cast<int>(cont4d_->rows())
1050 * (static_cast<int>(cont4d_->slices()) + 1) + 1) + 1);
1086 return ( (i1.cont4d_ == i2.cont4d_) && (i1.pos_ == i2.pos_)
1087 && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.x3_ == i2.x3_)
1088 && (i1.x4_ == i2.x4_) && (i1.cp_ == i2.cp_));
1101 return ( (i1.cont4d_ != i2.cont4d_) || (i1.pos_ != i2.pos_)
1102 || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) || (i1.x3_ != i2.x3_)
1103 || (i1.x4_ != i2.x4_) || (i1.cp_ != i2.cp_));
1124 return ( i1.pos_ < i2.pos_);
1184 this->x1_ += d.
dx1();
1185 this->x2_ += d.
dx2();
1186 this->x3_ += d.
dx3();
1187 this->x4_ += d.
dx4();
1188 this->pos_ = &(*cont4d_)[0][0][0][0][this->cp_] +
1189 (this->x1_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) *
1190 static_cast<int>(cont4d_->slices()) * N) +
1191 (this->x2_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) * N) +
1192 (this->x3_ *
static_cast<int>(cont4d_->cols()) * N) +
1209 this->x1_ -= d.
dx1();
1210 this->x2_ -= d.
dx2();
1211 this->x3_ -= d.
dx3();
1212 this->x4_ -= d.
dx4();
1213 this->pos_ = &(*cont4d_)[0][0][0][0][this->cp_] +
1214 (this->x1_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) *
1215 static_cast<int>(cont4d_->slices()) * N) +
1216 (this->x2_ *
static_cast<int>(cont4d_->cols()) * static_cast<int>(cont4d_->rows()) * N) +
1217 (this->x3_ *
static_cast<int>(cont4d_->cols()) * N) +
1264 return difference_type(
int(i1.x1_ - i2.x1_),
int(i1.x2_ - i2.x2_),
int(i1.x3_ - i2.x3_)
1265 ,
int(i1.x4_ - i2.x4_));
1280 assert( (this->x1_+d.
dx1()) < cont4d_->dim1() );
1281 assert( (this->x2_+d.
dx2()) < cont4d_->dim2() );
1282 assert( (this->x3_+d.
dx3()) < cont4d_->dim3() );
1283 assert( (this->x4_+d.
dx4()) < cont4d_->dim4() );
1284 return (*cont4d_)[this->x1_+d.
dx1()][this->x2_+d.
dx2()][this->x3_+d.
dx3()][this->x4_+d.
dx4()][cp_];
1299 return cont4d_->slab_begin(this->cp_,
1334 return cont4d_->slice_begin(this->cp_,
1369 return cont4d_->row_begin(this->cp_,
1405 return cont4d_->col_begin(this->cp_,
1531 MultiComponentContainer4D* cont4d_;
1543 #endif //SLIP_COMPONENT_ITERATOR4D_BOX_HPP
friend bool operator<(const self &i1, const self &i2)
< operator.
friend bool operator>(const self &i1, const self &i2)
operator.
MultiComponentContainer4D::const_component_slab_iterator slab_end(size_type slice, size_type row, size_type col)
const_component_iterator4d_box element assignment operator.
void first_front_upper_left(slip::Point< CoordType, 4 >)
Accessor/Mutator of the first_front_upper_left point (p1) of Box4d.
self & operator=(const self &o)
Assign a const_component_iterator4d_box.
friend bool operator>(const self &i1, const self &i2)
operator.
MultiComponentContainer4D::component_row_iterator row_begin(size_type slab, size_type slice, size_type row)
component_iterator4d_box element assignment operator.
self operator--(int)
Postdecrement a component_iterator4d_box. Iterate to the previous location inside the Box4d...
MultiComponentContainer4D::const_component_slice_iterator slice_begin(size_type slab, size_type row, size_type col)
const_component_iterator4d_box element assignment operator.
self operator+(const difference_type &d)
const_component_iterator4d_box addition.
MultiComponentContainer4D::const_component_col_iterator col_end(size_type slab, size_type slice, size_type col)
const_component_iterator4d_box element assignment operator.
value_type const & reference
MultiComponentContainer4D::const_component_row_iterator row_begin(size_type slab, size_type slice, size_type row)
const_component_iterator4d_box element assignment operator.
friend difference_type operator-(const self &i1, const self &i2)
const_component_iterator4d_box difference operator.
CoordType depth() const
compute the depth of the Box4d (second dimension size).
int k() const
Access to the second index of the current const_component_iterator4d_box.
MultiComponentContainer4D::component_slab_iterator slab_begin(size_type slice, size_type row, size_type col)
component_iterator4d_box element assignment operator.
self operator--(int)
Postdecrement a const_component_iterator4d_box. Iterate to the previous location inside the Box4d...
self & operator++()
Preincrement a component_iterator4d_box. Iterate to the next location inside the Box4d.
MultiComponentContainer4D::const_component_slice_iterator slice_end(size_type slab, size_type row, size_type col)
const_component_iterator4d_box element assignment operator.
MultiComponentContainer4D::value_type Block
friend bool operator<(const self &i1, const self &i2)
< operator.
Provides a class to tag SLIP iterators.
This is some iterator to iterate a 4d MultiComponentContainer into a Box area defined by the indices ...
self operator++(int)
Postincrement a component_iterator4d_box. Iterate to the next location inside the Box4d...
Provides a class to modelize 4d points.
size_type cp() const
Access to the component index of the current const_component_iterator4d_box.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
size_type cp() const
Access to the component index of the current component_iterator4d_box.
self operator++(int)
Postincrement a const_component_iterator4d_box. Iterate to the next location inside the Box4d...
MultiComponentContainer4D::component_slice_iterator slice_end(size_type slab, size_type row, size_type col)
component_iterator4d_box element assignment operator.
self & operator=(const self &o)
Assign a component_iterator4d_box.
int x2() const
Access to the second index of the current component_iterator4d_box.
int x3() const
Access to the third index of the current component_iterator4d_box.
int x2() const
Access to the second index of the current const_component_iterator4d_box.
int x4() const
Access to the fourth index of the current component_iterator4d_box.
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint4d.
int i() const
Access to the third index of the current const_component_iterator4d_box.
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint4d.
Difference of Point4D class, specialization of DPoint<CoordType,DIM> with DIM = 4.
int x1() const
Access to the first index of the current component_iterator4d_box.
Provides a class to modelize the difference of 4d points.
MultiComponentContainer4D::const_component_slab_iterator slab_begin(size_type slice, size_type row, size_type col)
const_component_iterator4d_box element assignment operator.
int x3() const
Access to the third index of the current const_component_iterator4d_box.
reference operator[](difference_type d) const
const_component_iterator4d_box element assignment operator. Equivalent to *(i + d) = t...
void last_back_bottom_right(slip::Point< CoordType, 4 >)
Accessor/Mutator of the last_back_bottom_right point (p2) of Box4d.
int t() const
Access to the first index of the current const_component_iterator4d_box.
friend bool operator>=(const self &i1, const self &i2)
>= operator.
MultiComponentContainer4D::component_slab_iterator slab_end(size_type slice, size_type row, size_type col)
component_iterator4d_box element assignment operator.
MultiComponentContainer4D::component_slice_iterator slice_begin(size_type slab, size_type row, size_type col)
component_iterator4d_box element assignment operator.
MultiComponentContainer4D::component_col_iterator col_end(size_type slab, size_type slice, size_type col)
component_iterator4d_box element assignment operator.
Block::value_type value_type
reference operator*()
Dereference assignment operator. Returns the element that the current component_iterator4d_box i poin...
component_iterator4d_box()
Constructs a component_iterator4d_box.
const_component_iterator4d_box(const self &o)
Constructs a copy of the const_component_iterator4d_box o.
void dx3(const CoordType &dx)
Accessor of the third coordinate of DPoint4d.
MultiComponentContainer4D::value_type Block
value_type const * pointer
DPoint4d< int > difference_type
self operator-(const difference_type &d)
component_iterator4d_box substraction.
friend bool operator<=(const self &i1, const self &i2)
<= operator.
self & operator--()
Predecrement a component_iterator4d_box. Iterate to the previous location inside the Box4d...
component_iterator4d_box(MultiComponentContainer4D *c, std::size_t cp, const Box4d< int > &b)
Constructs a component_iterator4d_box.
Block::value_type value_type
self & operator++()
Preincrement a const_component_iterator4d_box. Iterate to the next location inside the Box4d...
MultiComponentContainer4D::size_type size_type
reference operator*() const
Dereference assignment operator. Returns the element that the current const_component_iterator4d_box ...
const_component_iterator4d_box()
Constructs a const_component_iterator4d_box.
CoordType width() const
compute the width of the Box4d (fourth dimension size).
MultiComponentContainer4D::const_component_col_iterator col_begin(size_type slab, size_type slice, size_type col)
const_component_iterator4d_box element assignment operator.
self & operator+=(const difference_type &d)
const_component_iterator4d_box addition.
Provides a class to manipulate 4d box.
friend bool operator>=(const self &i1, const self &i2)
>= operator.
pointer operator->() const
void dx4(const CoordType &dx)
Accessor of the fourth coordinate of DPoint4d.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
int i() const
Access to the third index of the current component_iterator4d_box.
std::random_access_iterator4d_tag iterator_category
int j() const
Access to the fourth index of the current component_iterator4d_box.
MultiComponentContainer4D::component_row_iterator row_end(size_type slab, size_type slice, size_type row)
component_iterator4d_box element assignment operator.
MultiComponentContainer4D::component_col_iterator col_begin(size_type slab, size_type slice, size_type col)
component_iterator4d_box element assignment operator.
DPoint4d< int > difference_type
reference operator[](difference_type d)
component_iterator4d_box element assignment operator. Equivalent to *(i + d) = t. ...
friend bool operator<=(const self &i1, const self &i2)
<= operator.
CoordType duration() const
compute the duration of the Box4d (first dimension size).
int j() const
Access to the fourth index of the current const_component_iterator4d_box.
self & operator-=(const difference_type &d)
component_iterator4d_box substraction.
self & operator-=(const difference_type &d)
const_component_iterator4d_box substraction.
self operator-(const difference_type &d)
const_component_iterator4d_box substraction.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
std::random_access_iterator4d_tag iterator_category
const_component_iterator4d_box(MultiComponentContainer4D *c, std::size_t cp, const Box4d< int > &b)
Constructs a const_component_iterator4d_box.
component_iterator4d_box(const self &o)
Constructs a copy of the component_iterator4d_box o.
int t() const
Access to the first index of the current component_iterator4d_box.
friend difference_type operator-(const self &i1, const self &i2)
component_iterator4d_box difference operator.
CoordType height() const
compute the height of the Box4d (third dimension size).
friend bool operator==(const self &i1, const self &i2)
Equality operator.
self & operator--()
Predecrement a const_component_iterator4d_box. Iterate to the previous location inside the Box4d...
int k() const
Access to the second index of the current component_iterator4d_box.
self & operator+=(const difference_type &d)
component_iterator4d_box addition.
MultiComponentContainer4D::const_component_row_iterator row_end(size_type slab, size_type slice, size_type row)
const_component_iterator4d_box element assignment operator.
int x4() const
Access to the fourth index of the current const_component_iterator4d_box.
int x1() const
Access to the first index of the current const_component_iterator4d_box.
self operator+(const difference_type &d)
component_iterator4d_box addition.
MultiComponentContainer4D::size_type size_type
This is some iterator to iterate a 4d MultiComponentContainer into a Box area defined by the indices ...