SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
iterator3d_range.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
74 #ifndef SLIP_ITERATOR3D_RANGE_HPP
75 #define SLIP_ITERATOR3D_RANGE_HPP
76 
77 #include <iterator>
78 #include <cassert>
79 
80 #include "Point3d.hpp"
81 #include "DPoint3d.hpp"
82 #include "DPoint2d.hpp"
83 #include "Range.hpp"
84 #include "iterator_types.hpp"
85 
86 namespace slip
87 {
120  template <class Container3D>
121  class iterator3d_range
122  {
123  public:
124  //typedef std::random_access_iterator_tag iterator_category;
126  typedef typename Container3D::value_type value_type;
129  typedef typename Container3D::pointer pointer;
130  typedef typename Container3D::reference reference;
131 
132  typedef iterator3d_range self;
133 
134  typedef typename Container3D::size_type size_type;
139 
146  cont3d_(0),pos_(0),x1_(0),x2_(0),x3_(0),range_x1_(0,0),range_x2_(0,0),range_x3_(0,0)
147  {}
148 
160  iterator3d_range(Container3D* c,
161  const slip::Range<int>& r1,
162  const slip::Range<int>& r2,
163  const slip::Range<int>& r3):
164  cont3d_(c),pos_((*c)[r1.start()][r2.start()] + r3.start())
165  ,x1_(r1.start()),x2_(r2.start()),x3_(r3.start())
166  ,range_x1_(r1),range_x2_(r2),range_x3_(r3)
167  {}
168 
174  iterator3d_range(const self& o):
175  cont3d_(o.cont3d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),x3_(o.x3_),
176  range_x1_(o.range_x1_),range_x2_(o.range_x2_),range_x3_(o.range_x3_)
177  {}
178 
193  self& operator=(const self& o)
194  {
195  if(this != &o)
196  {
197  this->cont3d_ = o.cont3d_;
198  this->pos_ = o.pos_;
199  this->x1_ = o.x1_;
200  this->x2_ = o.x2_;
201  this->x3_ = o.x3_;
202  this->range_x1_ = o.range_x1_;
203  this->range_x2_ = o.range_x2_;
204  this->range_x3_ = o.range_x3_;
205  }
206  return *this;
207  }
216  inline
218  {
219  return *pos_;
220  }
221 
222  inline
224  {
225  return &(operator*());
226  }
227 
232 
238  inline
239  self& operator++()
240  {
241  if((x3_ < int(range_x3_.start() + (range_x3_.iterations() * range_x3_.stride()))) && (x2_ <= int(range_x2_.start() + (range_x2_.iterations() * range_x2_.stride()))) && (x1_ <= int(range_x1_.start() + (range_x1_.iterations() * range_x1_.stride()))))
242  {
243  this->x3_+= range_x3_.stride();
244  this->pos_+= range_x3_.stride();
245  }
246  else if(x2_ < int(range_x2_.start() + (range_x2_.iterations() * range_x2_.stride())) && (x1_ <= int(range_x1_.start() + (range_x1_.iterations() * range_x1_.stride()))))
247  {
248  this->x2_+= range_x2_.stride();
249  this->x3_ = range_x3_.start();
250  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
251  }
252  else if(x1_ < int(range_x1_.start() + (range_x1_.iterations() * range_x1_.stride())))
253  {
254  this->x1_+= range_x1_.stride();
255  this->x2_ = range_x2_.start();
256  this->x3_ = range_x3_.start();
257  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
258  }
259  else
260  {
261  this->x1_ = range_x1_.start() + range_x1_.stride() * (range_x1_.iterations() + 1);
262  this->x2_ = range_x2_.start() + range_x2_.stride() * (range_x2_.iterations() + 1);
263  this->x3_ = range_x3_.start() + range_x3_.stride() * (range_x3_.iterations() + 1);
264  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
265  }
266  return *this;
267  }
268 
274  inline
275  self operator++(int)
276  {
277  self tmp = *this;
278  ++(*this);
279  return tmp;
280  }
281 
293  inline
294  self& operator--()
295  {
296  if((x3_ > int(range_x3_.start())) && (x2_ >= int(range_x2_.start())) && (x1_ >= int(range_x1_.start())))
297  {
298  this->x3_-= range_x3_.stride();
299  this->pos_-= range_x3_.stride();
300  }
301  else if((x2_ > int(range_x2_.start())) && (x1_ >= int(range_x1_.start())))
302  {
303  this->x2_-= range_x2_.stride();
304  this->x3_ = range_x3_.start() + range_x3_.stride() * range_x3_.iterations();
305  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
306  }
307  else if(x1_ > int(range_x2_.start()))
308  {
309  this->x1_-= range_x1_.stride();
310  this->x2_ = range_x2_.start() + range_x2_.stride() * range_x2_.iterations();
311  this->x3_ = range_x3_.start() + range_x3_.stride() * range_x3_.iterations();
312  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
313  }
314  else
315  {
316  this->x1_ = int(range_x1_.start()-range_x1_.stride());
317  this->x2_ = int(range_x2_.start()-range_x2_.stride());
318  this->x3_ = int(range_x3_.start()-range_x3_.stride());
319  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
320  }
321  return *this;
322  }
323 
329  inline
330  self operator--(int)
331  {
332  self tmp = *this;
333  --(*this);
334  return tmp;
335  }
336 
350  inline
351  friend bool operator==(const self& i1,
352  const self& i2)
353  {
354 
355  return ( (i1.cont3d_ == i2.cont3d_) && (i1.pos_ == i2.pos_)
356  && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.x3_ == i2.x3_));
357  }
358 
365  inline
366  friend bool operator!=(const self& i1,
367  const self& i2)
368  {
369  return ( (i1.cont3d_ != i2.cont3d_) || (i1.pos_ != i2.pos_)
370  || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_)|| (i1.x3_ != i2.x3_) );
371  }
384  inline
385  friend bool operator<(const self& i1,
386  const self& i2)
387  {
388 
389  return ( i1.pos_ < i2.pos_);
390  }
391 
398  inline
399  friend bool operator>(const self& i1,
400  const self& i2)
401  {
402 
403  return (i2 < i1);
404  }
405 
412  inline
413  friend bool operator<=(const self& i1,
414  const self& i2)
415  {
416 
417  return !(i2 < i1);
418  }
419 
426  inline
427  friend bool operator>=(const self& i1,
428  const self& i2)
429  {
430 
431  return !(i1 < i2);
432  }
446  inline
447  self& operator+=(const difference_type& d)
448  {
449  this->x1_ += this->range_x1_.stride() * d.dx1();
450  this->x2_ += this->range_x2_.stride() * d.dx2();
451  this->x3_ += this->range_x3_.stride() * d.dx3();
452  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
453  return *this;
454  }
455 
463  inline
464  self& operator-=(const difference_type& d)
465  {
466  this->x1_ -= this->range_x1_.stride() * d.dx1();
467  this->x2_ -= this->range_x2_.stride() * d.dx2();
468  this->x3_ -= this->range_x3_.stride() * d.dx3();
469  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
470  return *this;
471  }
472 
480  inline
481  self operator+(const difference_type& d)
482  {
483  self tmp = *this;
484  tmp += d;
485  return tmp;
486  }
487 
495  inline
496  self operator-(const difference_type& d)
497  {
498  self tmp = *this;
499  tmp -= d;
500  return tmp;
501  }
502 
511  inline
512  friend difference_type operator-(const self& i1,
513  const self& i2)
514  {
515  assert(i1.range_x1_.stride() == i2.range_x1_.stride());
516  assert(i1.range_x2_.stride() == i2.range_x2_.stride());
517  assert(i1.range_x3_.stride() == i2.range_x3_.stride());
518  return difference_type(int((i1.x1_ - i2.x1_)/i1.range_x1_.stride()),
519  int((i1.x2_ - i2.x2_))/i1.range_x2_.stride(),
520  int((i1.x3_ - i2.x3_))/i1.range_x3_.stride());
521  }
522 
523 
532  inline
534  {
535  return (*cont3d_)[this->x1_+ this->range_x1_.stride() * d.dx1()]
536  [this->x2_+ this->range_x2_.stride() * d.dx2()]
537  [this->x3_+ this->range_x3_.stride() * d.dx3()];
538  }
539 
549  inline
551  {
552  return (*cont3d_)[this->x1_+ this->range_x1_.stride() * d.dx1()]
553  [this->x2_ + this->range_x2_.stride() * d.dx2()];
554  }
555 
565  inline
567  {
568  return (*cont3d_)[this->x1_+ this->range_x1_.stride() * n];
569  }
570 
576 
585  inline
586  typename Container3D::row_range_iterator row_begin(size_type slice, size_type row)
587  {
588  return cont3d_->row_begin(range_x1_.start() + slice * range_x1_.stride(), range_x2_.start()
589  + row * range_x2_.stride(), range_x3_);
590  }
591 
600  inline
601  typename Container3D::row_range_iterator row_end(size_type slice, size_type row)
602  {
603  return this->row_begin(slice,row) + (range_x3_.iterations() + 1);
604  }
605 
614  inline
615  typename Container3D::col_range_iterator col_begin(size_type slice, size_type col)
616  {
617  return cont3d_->col_begin(range_x1_.start() + slice * range_x1_.stride()
618  , range_x3_.start()
619  + col * range_x3_.stride(), range_x2_);
620  }
621 
630  inline
631  typename Container3D::col_range_iterator col_end(size_type slice, size_type col)
632  {
633  return this->col_begin(slice,col) + (range_x2_.iterations() + 1);
634  }
635 
641 
646  inline
647  int x1() const
648  {
649  return this->x1_;
650  }
655  inline
656  int k() const
657  {
658  return this->x1_;
659  }
664  inline
665  int x2() const
666  {
667  return this->x2_;
668  }
673  inline
674  int i() const
675  {
676  return this->x2_;
677  }
678 
683  inline
684  int x3() const
685  {
686  return this->x3_;
687  }
692  inline
693  int j() const
694  {
695  return this->x3_;
696  }
697 
701  private:
702  Container3D* cont3d_; // pointer to the 3d container
703  pointer pos_; // linear position within the container
704  int x1_; // first subscript position
705  int x2_; // second subscript position
706  int x3_; // third subscript position
707  slip::Range<int> range_x1_; // range to iterate on the first axis
708  slip::Range<int> range_x2_; //range to iterate on the second axis
709  slip::Range<int> range_x3_; //range to iterate on the third axis
710  };
711 
712 
746  template <class Container3D>
747  class const_iterator3d_range
748  {
749  public:
750  //typedef std::random_access_iterator_tag iterator_category;
752  typedef typename Container3D::value_type value_type;
755  typedef typename Container3D::const_pointer pointer;
756  typedef typename Container3D::const_reference reference;
757 
759 
760  typedef typename Container3D::size_type size_type;
765 
772  cont3d_(0),pos_(0),x1_(0),x2_(0),x3_(0),range_x1_(0,0),range_x2_(0,0),range_x3_(0,0)
773  {}
774 
787  const_iterator3d_range(Container3D* c,
788  const slip::Range<int>& r1,
789  const slip::Range<int>& r2,
790  const slip::Range<int>& r3):
791  cont3d_(c),pos_((*c)[r1.start()][r2.start()] + r3.start())
792  ,x1_(r1.start()),x2_(r2.start()),x3_(r3.start())
793  ,range_x1_(r1),range_x2_(r2),range_x3_(r3)
794  {}
795 
801  const_iterator3d_range(const self& o):
802  cont3d_(o.cont3d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),x3_(o.x3_)
803  ,range_x1_(o.range_x1_),range_x2_(o.range_x2_),range_x3_(o.range_x3_)
804  {}
805 
820  self& operator=(const self& o)
821  {
822  if(this != &o)
823  {
824  this->cont3d_ = o.cont3d_;
825  this->pos_ = o.pos_;
826  this->x1_ = o.x1_;
827  this->x2_ = o.x2_;
828  this->x3_ = o.x3_;
829  this->range_x1_ = o.range_x1_;
830  this->range_x2_ = o.range_x2_;
831  this->range_x3_ = o.range_x3_;
832  }
833  return *this;
834  }
844  inline
846  {
847  return *pos_;
848  }
849 
850  inline
852  {
853  return &(operator*());
854  }
855 
856 
857 
862 
868  inline
869  self& operator++()
870  {
871  if((x3_ < int(range_x3_.start() + (range_x3_.iterations() * range_x3_.stride()))) && (x2_ <= int(range_x2_.start() + (range_x2_.iterations() * range_x2_.stride()))) && (x1_ <= int(range_x1_.start() + (range_x1_.iterations() * range_x1_.stride()))))
872  {
873  this->x3_+= range_x3_.stride();
874  this->pos_+= range_x3_.stride();
875  }
876  else if(x2_ < int(range_x2_.start() + (range_x2_.iterations() * range_x2_.stride())) && (x1_ <= int(range_x1_.start() + (range_x1_.iterations() * range_x1_.stride()))))
877  {
878  this->x2_+= range_x2_.stride();
879  this->x3_ = range_x3_.start();
880  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
881  }
882  else if(x1_ < int(range_x1_.start() + (range_x1_.iterations() * range_x1_.stride())))
883  {
884  this->x1_+= range_x1_.stride();
885  this->x2_ = range_x2_.start();
886  this->x3_ = range_x3_.start();
887  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
888  }
889  else
890  {
891  this->x1_ = range_x1_.start() + range_x1_.stride() * (range_x1_.iterations() + 1);
892  this->x2_ = range_x2_.start() + range_x2_.stride() * (range_x2_.iterations() + 1);
893  this->x3_ = range_x3_.start() + range_x3_.stride() * (range_x3_.iterations() + 1);
894  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
895  }
896  return *this;
897  }
898 
904  inline
905  self operator++(int)
906  {
907  self tmp = *this;
908  ++(*this);
909  return tmp;
910  }
911 
923  inline
924  self& operator--()
925  {
926  if((x3_ > int(range_x3_.start())) && (x2_ >= int(range_x2_.start())) && (x1_ >= int(range_x1_.start())))
927  {
928  this->x3_-= range_x3_.stride();
929  this->pos_-= range_x3_.stride();
930  }
931  else if((x2_ > int(range_x2_.start())) && (x1_ >= int(range_x1_.start())))
932  {
933  this->x2_-= range_x2_.stride();
934  this->x3_ = range_x3_.start() + range_x3_.stride() * range_x3_.iterations();
935  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
936  }
937  else if(x1_ > int(range_x2_.start()))
938  {
939  this->x1_-= range_x1_.stride();
940  this->x2_ = range_x2_.start() + range_x2_.stride() * range_x2_.iterations();
941  this->x3_ = range_x3_.start() + range_x3_.stride() * range_x3_.iterations();
942  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
943  }
944  else
945  {
946  this->x1_ = int(range_x1_.start()-range_x1_.stride());
947  this->x2_ = int(range_x2_.start()-range_x2_.stride());
948  this->x3_ = int(range_x3_.start()-range_x3_.stride());
949  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
950  }
951  return *this;
952  }
953 
959  inline
960  self operator--(int)
961  {
962  self tmp = *this;
963  --(*this);
964  return tmp;
965  }
966 
980  inline
981  friend bool operator==(const self& i1,
982  const self& i2)
983  {
984 
985  return ( (i1.cont3d_ == i2.cont3d_) && (i1.pos_ == i2.pos_)
986  && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.x3_ == i2.x3_));
987  }
988 
995  inline
996  friend bool operator!=(const self& i1,
997  const self& i2)
998  {
999  return ( (i1.cont3d_ != i2.cont3d_) || (i1.pos_ != i2.pos_)
1000  || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) || (i1.x3_ != i2.x3_));
1001  }
1014  inline
1015  friend bool operator<(const self& i1,
1016  const self& i2)
1017  {
1018 
1019  return ( i1.pos_ < i2.pos_);
1020  }
1021 
1028  inline
1029  friend bool operator>(const self& i1,
1030  const self& i2)
1031  {
1032 
1033  return (i2 < i1);
1034  }
1035 
1042  inline
1043  friend bool operator<=(const self& i1,
1044  const self& i2)
1045  {
1046 
1047  return !(i2 < i1);
1048  }
1049 
1056  inline
1057  friend bool operator>=(const self& i1,
1058  const self& i2)
1059  {
1060 
1061  return !(i1 < i2);
1062  }
1077  inline
1078  self& operator+=(const difference_type& d)
1079  {
1080  this->x1_ += this->range_x1_.stride() * d.dx1();
1081  this->x2_ += this->range_x2_.stride() * d.dx2();
1082  this->x3_ += this->range_x3_.stride() * d.dx3();
1083  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
1084  return *this;
1085  }
1086 
1094  inline
1095  self& operator-=(const difference_type& d)
1096  {
1097  this->x1_ -= this->range_x1_.stride() * d.dx1();
1098  this->x2_ -= this->range_x2_.stride() * d.dx2();
1099  this->x3_ -= this->range_x3_.stride() * d.dx3();
1100  this->pos_ = cont3d_->begin() + (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) + (this->x2_* int(cont3d_->cols())) + this->x3_;
1101  return *this;
1102  }
1103 
1111  inline
1113  {
1114  self tmp = *this;
1115  tmp += d;
1116  return tmp;
1117  }
1118 
1126  inline
1128  {
1129  self tmp = *this;
1130  tmp -= d;
1131  return tmp;
1132  }
1133 
1142  inline
1143  friend difference_type operator-(const self& i1,
1144  const self& i2)
1145  {
1146  assert(i1.range_x1_.stride() == i2.range_x1_.stride());
1147  assert(i1.range_x2_.stride() == i2.range_x2_.stride());
1148  assert(i1.range_x3_.stride() == i2.range_x3_.stride());
1149  return difference_type(int((i1.x1_ - i2.x1_)/i1.range_x1_.stride()),
1150  int((i1.x2_ - i2.x2_))/i1.range_x2_.stride(),
1151  int((i1.x3_ - i2.x3_))/i1.range_x3_.stride());
1152  }
1153 
1154 
1163  inline
1165  {
1166  return (*cont3d_)[this->x1_+ this->range_x1_.stride() * d.dx1()]
1167  [this->x2_+ this->range_x2_.stride() * d.dx2()]
1168  [this->x3_+ this->range_x3_.stride() * d.dx3()];
1169  }
1170 
1180  inline
1182  {
1183  return (*cont3d_)[this->x1_+ this->range_x1_.stride() * d.dx1()]
1184  [this->x2_ + this->range_x2_.stride() * d.dx2()];
1185  }
1186 
1195  inline
1196  pointer* operator[](int n) const
1197  {
1198  return (*cont3d_)[this->x1_+ this->range_x1_.stride() * n];
1199  }
1200 
1206 
1215  inline
1216  typename Container3D::const_row_range_iterator row_begin(size_type slice
1217  , size_type row) const
1218  {
1219  return cont3d_->row_begin(range_x1_.start() + slice * range_x1_.stride()
1220  , range_x2_.start() + row * range_x2_.stride(), range_x3_);
1221  }
1222 
1231  inline
1232  typename Container3D::const_row_range_iterator row_end(size_type slice
1233  , size_type row) const
1234  {
1235  return this->row_begin(slice,row) + (range_x3_.iterations() + 1);
1236  }
1237 
1246  inline
1247  typename Container3D::const_col_range_iterator col_begin(size_type slice
1248  , size_type col) const
1249  {
1250  return cont3d_->col_begin(range_x1_.start() + slice * range_x1_.stride()
1251  , range_x3_.start() + col * range_x3_.stride(), range_x2_);
1252  }
1253 
1262  inline
1263  typename Container3D::const_col_range_iterator col_end(size_type slice
1264  , size_type col) const
1265  {
1266  return this->col_begin(slice,col) + (range_x2_.iterations() + 1);
1267  }
1268 
1280  inline
1281  int x1()
1282  {
1283  return this->x1_;
1284  }
1289  inline
1290  int k()
1291  {
1292  return this->x2_;
1293  }
1298  inline
1299  int x2()
1300  {
1301  return this->x2_;
1302  }
1307  inline
1308  int i()
1309  {
1310  return this->x2_;
1311  }
1316  inline
1317  int x3()
1318  {
1319  return this->x3_;
1320  }
1325  inline
1326  int j()
1327  {
1328  return this->x3_;
1329  }
1330 
1335  private:
1336  Container3D* cont3d_; // pointer to the 3d container
1337  pointer pos_; // linear position within the container
1338  int x1_; // first subscript position
1339  int x2_; // second subscript position
1340  int x3_; // third subscript position
1341  slip::Range<int> range_x1_; // range to iterate on the first axis
1342  slip::Range<int> range_x2_; //range to iterate on the second axis
1343  slip::Range<int> range_x3_; //range to iterate on the third axis
1344  };
1345 
1346 
1347 
1348 
1349 }//slip::
1350 
1351 #endif //SLIP_ITERATOR3D_RANGE_HPP
self operator--(int)
Postdecrement a iterator3d_range. Iterate to the previous location inside the Range3d.
self & operator-=(const difference_type &d)
const_iterator3d_range substraction.
std::size_t iterations() const
Rerturns the number of iterations of the range.
Definition: Range.hpp:305
int x3() const
Access to the third subscript of the current iterator3d_range.
Container3D::reference reference
Provides a class to modelize 3d points.
Provides a class to modelize the difference of slip::Point2d.
void dx3(const CoordType &dx)
Accessor of the first coordinate of DPoint3d.
Definition: DPoint3d.hpp:273
Container3D::row_range_iterator row_end(size_type slice, size_type row)
iterator3d_range element assignment operator.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint2d.
Definition: DPoint2d.hpp:241
Difference of Point3D class, specialization of DPoint<CoordType,DIM> with DIM = 3.
self & operator++()
Preincrement a const_iterator3d_range. Iterate to the next location inside the Range.
reference operator[](difference_type d)
iterator3d_range element assignment operator. Equivalent to *(k + d) = t.
reference operator*()
Dereference assignment operator. Returns the element that the current iterator3d_range i point to...
int x2() const
Access to the second subscript of the current iterator3d_range.
std::random_access_iterator3d_tag iterator_category
iterator3d_range()
Constructs a iterator3d_range.
self operator+(const difference_type &d)
iterator3d_range addition.
self & operator-=(const difference_type &d)
iterator3d_range substraction.
int k()
Access to the first subscript of the current const_iterator3d_range.
This is some iterator to iterate a 3d container into two Range defined by the indices and strides of ...
Container3D::size_type size_type
Provides a class to tag SLIP iterators.
self operator-(const difference_type &d)
iterator3d_range substraction.
int j()
Access to the third subscript of the current const_iterator3d_range.
pointer * operator[](int n)
iterator3d_range element assignment operator. Equivalent to *(k + n) = t.
self operator++(int)
Postincrement a const_iterator3d_range. Iterate to the next location inside the Range3d.
pointer operator[](diff2d d) const
const_iterator3d_range element assignment operator. Equivalent to *(k + d) = t.
pointer operator[](diff2d d)
iterator3d_range element assignment operator. Equivalent to *(k + d) = t.
Provides a class to modelize the difference of slip::Point3d.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
int x1() const
Access to the first subscript of the current iterator3d_range.
Container3D::col_range_iterator col_end(size_type slice, size_type col)
iterator3d_range element assignment operator.
self operator++(int)
Postincrement a iterator3d_range. Iterate to the next location inside the Range3d.
self operator+(const difference_type &d)
const_iterator3d_range addition.
Container3D::pointer pointer
friend bool operator<(const self &i1, const self &i2)
< operator.
Container3D::const_reference reference
int x3()
Access to the third subscript of the current const_iterator3d_range.
Container3D::const_col_range_iterator col_begin(size_type slice, size_type col) const
const_iterator3d_range element assignment operator.
friend difference_type operator-(const self &i1, const self &i2)
const_iterator3d_range difference operator.
Container3D::const_row_range_iterator row_end(size_type slice, size_type row) const
const_iterator3d_range element assignment operator.
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint2d.
Definition: DPoint2d.hpp:229
reference operator[](difference_type d) const
const_iterator3d_range element assignment operator. Equivalent to *(k + d) = t.
self & operator=(const self &o)
Assign a iterator3d_range.
friend bool operator>=(const self &i1, const self &i2)
>= operator.
self operator-(const difference_type &d)
const_iterator3d_range substraction.
self & operator--()
Predecrement a iterator3d_range. Iterate to the previous location inside the Range3d.
friend bool operator<=(const self &i1, const self &i2)
<= operator.
iterator3d_range(Container3D *c, const slip::Range< int > &r1, const slip::Range< int > &r2, const slip::Range< int > &r3)
Constructs a iterator3d_range.
const_iterator3d_range(Container3D *c, const slip::Range< int > &r1, const slip::Range< int > &r2, const slip::Range< int > &r3)
Constructs a const_iterator3d_range.
int j() const
Access to the third subscript of the current iterator3d_range.
friend difference_type operator-(const self &i1, const self &i2)
iterator3d_range difference operator.
iterator3d_range(const self &o)
Constructs a copy of the iterator3d_range o.
int k() const
Access to the first subscript of the current iterator3d_range.
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint3d.
Definition: DPoint3d.hpp:261
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
Definition: Array2d.hpp:129
SubType start() const
Accessor of the start subscript of the Range.
Definition: Range.hpp:284
Container3D::row_range_iterator row_begin(size_type slice, size_type row)
iterator3d_range element assignment operator.
Container3D::value_type value_type
const_iterator3d_range(const self &o)
Constructs a copy of the const_iterator3d_range o.
friend bool operator>(const self &i1, const self &i2)
operator.
DPoint3d< int > difference_type
self & operator+=(const difference_type &d)
iterator3d_range addition.
friend bool operator>(const self &i1, const self &i2)
operator.
Container3D::col_range_iterator col_begin(size_type slice, size_type col)
iterator3d_range element assignment operator.
int x1()
Access to the first subscript of the current const_iterator3d_range.
int i()
Access to the second subscript of the current const_iterator3d_range.
pointer * operator[](int n) const
const_iterator3d_range element assignment operator. Equivalent to *(k + n).
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
std::random_access_iterator3d_tag iterator_category
This is some iterator to iterate a 3d container into two Range defined by the indices and strides of ...
Container3D::size_type size_type
Container3D::const_row_range_iterator row_begin(size_type slice, size_type row) const
const_iterator3d_range element assignment operator.
reference operator*() const
Dereference operator. Returns the element that the current const_iterator3d_range i point to...
int stride() const
Accessor of the stride of the Range.
Definition: Range.hpp:298
friend bool operator<=(const self &i1, const self &i2)
<= operator.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
int x2()
Access to the second subscript of the current const_iterator3d_range.
self & operator+=(const difference_type &d)
const_iterator3d_range addition.
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint3d.
Definition: DPoint3d.hpp:249
friend bool operator>=(const self &i1, const self &i2)
>= operator.
self & operator--()
Predecrement a const_iterator3d_range. Iterate to the previous location inside the Range3d...
Provides a class to manipulate Ranges.
Container3D::value_type value_type
Container3D::const_col_range_iterator col_end(size_type slice, size_type col) const
const_iterator3d_range element assignment operator.
const_iterator3d_range()
Constructs a const_iterator3d_range.
self operator--(int)
Postdecrement a const_iterator3d_range. Iterate to the previous location inside the Range3d...
int i() const
Access to the second subscript of the current iterator3d_range.
friend bool operator<(const self &i1, const self &i2)
< operator.
Container3D::const_pointer pointer
self & operator++()
Preincrement a iterator3d_range. Iterate to the next location inside the Range.
self & operator=(const self &o)
Assign a const_iterator3d_range.