SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Block2d.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 
67 
68 
76 #ifndef SLIP_BLOCK2D_HPP
77 #define SLIP_BLOCK2D_HPP
78 
79 #include <iostream>
80 #include <iterator>
81 #include <cassert>
82 #include <string>
83 #include <cstddef>
84 #include "Box2d.hpp"
85 #include "Point2d.hpp"
86 #include "DPoint2d.hpp"
87 #include "Range.hpp"
88 #include "kstride_iterator.hpp"
89 #include "stride_iterator.hpp"
90 #include "iterator2d_box.hpp"
91 #include "iterator2d_range.hpp"
92 #include <boost/serialization/access.hpp>
93 #include <boost/serialization/split_member.hpp>
94 #include <boost/serialization/string.hpp>
95 #include <boost/serialization/complex.hpp>
96 #include <boost/serialization/version.hpp>
97 
98 namespace slip
99 {
100 
101 template<class T, int NC>
103 
104 template<class T>
105 class iterator2d_box;
106 
107 template<class T>
108 class iterator2d_range;
109 
110 template<class T>
112 
113 template<class T>
115 
116 
117 template <class T>
118 class DPoint2d;
119 
120 template <class T>
121 class Point2d;
122 
123 template <typename T, std::size_t NR, std::size_t NC>
124 struct block2d;
125 
126 template <typename T, std::size_t NR, std::size_t NC>
127 std::ostream& operator<<(std::ostream & out,
128  const slip::block2d<T,NR,NC>& b);
129 
130 template <typename T, std::size_t NR, std::size_t NC>
131 bool operator==(const slip:: block2d<T,NR,NC>& x,
132  const slip::block2d<T,NR,NC>& y);
133 
134 template <typename T, std::size_t NR, std::size_t NC>
135 bool operator!=(const slip::block2d<T,NR,NC>& x,
136  const slip::block2d<T,NR,NC>& y);
137 
138 template <typename T, std::size_t NR, std::size_t NC>
139 bool operator<(const slip::block2d<T,NR,NC>& x,
140  const slip::block2d<T,NR,NC>& y);
141 
142 template <typename T, std::size_t NR, std::size_t NC>
143 bool operator>(const slip::block2d<T,NR,NC>& x,
144  const slip::block2d<T,NR,NC>& y);
145 
146 template <typename T, std::size_t NR, std::size_t NC>
147 bool operator<=(const slip::block2d<T,NR,NC>& x,
148  const slip::block2d<T,NR,NC>& y);
149 
150 template <typename T, std::size_t NR, std::size_t NC>
151 bool operator>=(const slip::block2d<T,NR,NC>& x,
152  const slip::block2d<T,NR,NC>& y);
153 
174 template <typename T, std::size_t NR, std::size_t NC>
175 struct block2d
176 {
177  typedef T value_type;
178  typedef block2d<T,NR,NC> self;
180 
181  typedef value_type* pointer;
182  typedef const value_type* const_pointer;
184  typedef const value_type& const_reference;
185 
186  typedef ptrdiff_t difference_type;
187  typedef std::size_t size_type;
188 
189  typedef pointer iterator;
191 
192  typedef std::reverse_iterator<iterator> reverse_iterator;
193  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
194 
195 
200 
201 
202 
205 
212 
213 
214  typedef std::reverse_iterator<iterator> reverse_row_iterator;
215  typedef std::reverse_iterator<const_iterator> const_reverse_row_iterator;
216  typedef std::reverse_iterator<col_iterator> reverse_col_iterator;
217  typedef std::reverse_iterator<const_col_iterator> const_reverse_col_iterator;
218  typedef std::reverse_iterator<iterator2d> reverse_iterator2d;
219  typedef std::reverse_iterator<const_iterator2d> const_reverse_iterator2d;
220  typedef std::reverse_iterator<row_range_iterator> reverse_row_range_iterator;
221  typedef std::reverse_iterator<const_row_range_iterator> const_reverse_row_range_iterator;
222  typedef std::reverse_iterator<col_range_iterator> reverse_col_range_iterator;
223  typedef std::reverse_iterator<const_col_range_iterator> const_reverse_col_range_iterator;
224  typedef std::reverse_iterator<iterator2d_range> reverse_iterator2d_range;
225  typedef std::reverse_iterator<const_iterator2d_range> const_reverse_iterator2d_range;
226 
227 
228  //default iterator of the container
231 
233  static const std::size_t SIZE = NR * NC;
234 
235  static const std::size_t DIM = 2;
240 
241 
242 
262  iterator begin() {return data;}
263 
264 
265 
286  const_iterator begin() const {return data;}
287 
288 
308  iterator end() {return data + SIZE;}
309 
310 
330  const_iterator end() const {return data + SIZE;}
331 
332 
354 
376 
398 
399 
421 
422 
423 
444  {
445  return this->data + NC * row;
446  }
447 
448 
469  {
470  return this->data + NC * row;
471  }
472 
473 
494  {
495  return col_iterator(this->data + col);
496  }
497 
498 
519  {
520  return const_col_iterator(this->data + col);
521  }
522 
543  {
544  return this->row_begin(row) + NR - 1;
545  }
546 
547 
568  {
569  return this->row_begin(row) + NR - 1;
570  }
571 
592  {
593  return col_iterator(this->data + NR * (NR - 1) + col);
594  }
595 
596 
617  {
618  return const_col_iterator(this->data + NR *(NR - 1) + col);
619  }
620 
621 
622 
648  const slip::Range<int>& range)
649  {
650  assert(row < NR);
651  assert(range.is_valid());
652  assert(range.start() >= 0);
653  assert(range.stop() >= 0);
654  assert(range.start() < int(NC));
655  assert(range.stop() < int(NC));
657  }
658 
684  const slip::Range<int>& range)
685  {
686  assert(row < NR);
687  assert(range.start() < int(NC));
688  assert(range.stop() < int(NC));
689  return ++(slip::stride_iterator<typename block2d<T,NR,NC>::row_iterator>(this->row_begin(row) + range.start() + range.iterations() * range.stride(),range.stride()));
690  }
691 
717  const slip::Range<int>& range) const
718  {
719  assert(row < NR);
720  assert(range.is_valid());
721  assert(range.start() >= 0);
722  assert(range.stop() >= 0);
723  assert(range.start() < int(NC));
724  assert(range.stop() < int(NC));
726  }
727 
728 
729 
754  const slip::Range<int>& range) const
755  {
756  assert(row < NR);
757  assert(range.start() < int(NC));
758  assert(range.stop() < int(NC));
759  return ++(slip::stride_iterator<typename block2d<T,NR,NC>::const_row_iterator>(this->row_begin(row) + range.start() + range.stride() * range.iterations(),range.stride()));
760  }
761 
762 
788  const slip::Range<int>& range)
789  {
790  assert(col < NC);
791  assert(range.is_valid());
792  assert(range.start() >= 0);
793  assert(range.stop() >= 0);
794  assert(range.start() < int(NR));
795  assert(range.stop() < int(NR));
797  }
798 
825  const slip::Range<int>& range)
826  {
827  assert(col < NC);
828  assert(range.start() < int(NR));
829  assert(range.stop() < int(NR));
830  return ++(slip::stride_iterator<typename block2d<T,NR,NC>::col_iterator>(this->col_begin(col) + range.start() + range.stride() * range.iterations(),range.stride()));
831  }
832 
833 
834 
835 
861  const slip::Range<int>& range) const
862  {
863  assert(col < NC);
864  assert(range.is_valid());
865  assert(range.start() >= 0);
866  assert(range.stop() >= 0);
867  assert(range.start() < int(NR));
868  assert(range.stop() < int(NR));
870  }
871 
872 
899  const slip::Range<int>& range) const
900  {
901  assert(col < NC);
902  assert(range.start() < int(NR));
903  assert(range.stop() < int(NR));
904  return ++(slip::stride_iterator<typename block2d<T,NR,NC>::const_col_iterator>(this->col_begin(col) + range.start() + range.stride() * range.iterations(),range.stride()));
905  }
906 
907 
908 
921  {
922  return reverse_row_iterator(this->row_end(row));
923  }
924 
925 
938  {
939  return const_reverse_iterator(this->row_end(row));
940  }
941 
955  {
956  return reverse_col_iterator(this->col_end(col));
957  }
958 
972  {
973  return const_reverse_col_iterator(this->col_end(col));
974  }
975 
988  {
989  return reverse_row_iterator(this->row_begin(row));
990  }
991 
1004  {
1005  return const_reverse_row_iterator(this->row_begin(row));
1006  }
1007 
1021  {
1022  return reverse_col_iterator(this->col_begin(col));
1023  }
1024 
1038  {
1039  return const_reverse_col_iterator(this->col_begin(col));
1040  }
1041 
1057  const slip::Range<int>& range)
1058  {
1059  return typename block2d<T,NR,NC>::reverse_row_range_iterator(this->row_end(row,range));
1060  }
1061 
1062 
1079  const slip::Range<int>& range)
1080  {
1081  return typename block2d<T,NR,NC>::reverse_row_range_iterator(this->row_begin(row,range));
1082  }
1083 
1084 
1085 
1099  const slip::Range<int>& range) const
1100  {
1101  return typename block2d<T,NR,NC>::const_reverse_row_range_iterator(this->row_end(row,range));
1102  }
1103 
1104 
1120  const slip::Range<int>& range) const
1121  {
1122  return typename block2d<T,NR,NC>::const_reverse_row_range_iterator(this->row_begin(row,range));
1123  }
1124 
1125 
1126 
1127 
1143  const slip::Range<int>& range)
1144  {
1145  return typename block2d<T,NR,NC>::reverse_col_range_iterator(this->col_end(col,range));
1146  }
1147 
1164  const slip::Range<int>& range)
1165  {
1166  return typename block2d<T,NR,NC>::reverse_col_range_iterator(this->col_begin(col,range));
1167  }
1168 
1169 
1186  const slip::Range<int>& range) const
1187  {
1188  return typename block2d<T,NR,NC>::const_reverse_col_range_iterator(this->col_end(col,range));
1189  }
1190 
1191 
1207  const slip::Range<int>& range) const
1208  {
1209  return typename block2d<T,NR,NC>::const_reverse_col_range_iterator(this->col_begin(col,range));
1210  }
1211 
1212 
1213 
1232  {
1233  return iterator2d(this,Box2d<int>(0,0,NR-1,NC-1));
1234  }
1235 
1254  {
1255  return const_iterator2d(this,Box2d<int>(0,0,NR-1,NC-1));
1256  }
1257 
1276  {
1277  DPoint2d<int> dp(NR,NC);
1278  iterator2d it = (*this).upper_left() + dp;
1279  return it;
1280  }
1281 
1300  {
1301  DPoint2d<int> dp(NR,NC);
1302  const_iterator2d it = (*this).upper_left() + dp;
1303  return it;
1304  }
1305 
1306 
1331  {
1332  return iterator2d(this,box);
1333  }
1334 
1360  {
1361  return const_iterator2d(this,box);
1362  }
1363 
1389  {
1390  DPoint2d<int> dp(box.height(),box.width());
1391  iterator2d it = (*this).upper_left(box) + dp;
1392  return it;
1393  }
1394 
1420  {
1421  DPoint2d<int> dp(box.height(),box.width());
1422  const_iterator2d it = (*this).upper_left(box) + dp;
1423  return it;
1424  }
1425 
1426 
1455  const Range<int>& col_range)
1456  {
1457  return typename block2d<T,NR,NC>::iterator2d_range(this,row_range,col_range);
1458  }
1459 
1488  const Range<int>& col_range)
1489  {
1490  DPoint2d<int> dp(row_range.iterations()+1,col_range.iterations()+1);
1491  return typename block2d<T,NR,NC>::iterator2d_range((*this).upper_left(row_range,col_range) + dp);
1492  }
1493 
1494 
1523  const Range<int>& col_range) const
1524  {
1525  return typename block2d<T,NR,NC>::const_iterator2d_range(this,row_range,col_range);
1526  }
1527 
1528 
1557  const Range<int>& col_range) const
1558  {
1559  DPoint2d<int> dp(row_range.iterations()+1,col_range.iterations()+1);
1560  return typename block2d<T,NR,NC>::const_iterator2d_range((*this).upper_left(row_range,col_range) + dp);
1561  }
1562 
1563 
1564 
1565 
1566 
1567 
1593  {
1594  return this->upper_left(range,range);
1595  }
1596 
1597 
1624  {
1625  return this->bottom_right(range,range);
1626  }
1627 
1628 
1629 
1630 
1656  {
1657  return this->upper_left(range,range);
1658  }
1659 
1660 
1661 
1688  {
1689  return this->bottom_right(range,range);
1690  }
1691 
1692 
1703  {
1704  slip::DPoint2d<int> dp(1,0);
1705  return typename block2d<T,NR,NC>::reverse_iterator2d(this->bottom_right() - dp);
1706  }
1707 
1718  {
1719  return typename block2d<T,NR,NC>::reverse_iterator2d(this->upper_left());
1720  }
1721 
1732  {
1733  slip::DPoint2d<int> dp(1,0);
1734  return typename block2d<T,NR,NC>::const_reverse_iterator2d(this->bottom_right() - dp);
1735  }
1736 
1737 
1748  {
1749  return typename block2d<T,NR,NC>::const_reverse_iterator2d(this->upper_left());
1750  }
1751 
1752 
1768  {
1769  slip::DPoint2d<int> dp(1,0);
1770  return typename block2d<T,NR,NC>::reverse_iterator2d(this->bottom_right(box) - dp);
1771  }
1772 
1788  {
1789  return typename block2d<T,NR,NC>::reverse_iterator2d(this->upper_left(box));
1790  }
1791 
1807  {
1808  slip::DPoint2d<int> dp(1,0);
1809  return typename block2d<T,NR,NC>::const_reverse_iterator2d(this->bottom_right(box) - dp);
1810  }
1811 
1812 
1828  {
1829  return typename block2d<T,NR,NC>::const_reverse_iterator2d(this->upper_left(box));
1830  }
1831 
1832 
1850  const Range<int>& col_range)
1851  {
1852  slip::DPoint2d<int> dp(1,0);
1853  return typename block2d<T,NR,NC>::reverse_iterator2d_range(this->bottom_right(row_range,col_range) - dp);
1854  }
1855 
1856 
1857 
1875  const Range<int>& col_range)
1876  {
1877  return typename block2d<T,NR,NC>::reverse_iterator2d_range(this->upper_left(row_range,col_range));
1878  }
1879 
1880 
1881 
1899  const Range<int>& col_range) const
1900  {
1901  slip::DPoint2d<int> dp(1,0);
1902  return typename block2d<T,NR,NC>::const_reverse_iterator2d_range(this->bottom_right(row_range,col_range) - dp);
1903  }
1904 
1922  const Range<int>& col_range) const
1923  {
1924  return typename block2d<T,NR,NC>::const_reverse_iterator2d_range(this->upper_left(row_range,col_range));
1925  }
1926 
1927 
1928 
1945  {
1946  return this->rupper_left(range,range);
1947  }
1948 
1949 
1950 
1968  {
1969  return this->rbottom_right(range,range);
1970  }
1971 
1972 
1973 
1991  {
1992  return this->rupper_left(range,range);
1993  }
1994 
1995 
2013  {
2014  return this->rbottom_right(range,range);
2015  }
2016 
2017 
2018 
2026 
2032  friend std::ostream& operator<< <>(std::ostream & out,
2033  const block2d<T,NR,NC>& b);
2040 
2045  void fill(const T& value)
2046  {
2047  std::fill_n(this->begin(),SIZE,value);
2048  }
2049 
2055  void fill(const T* value)
2056  {
2057  std::copy(value,value + SIZE, this->begin());
2058  }
2059 
2068  template<typename InputIterator>
2069  void fill(InputIterator first,
2070  InputIterator last)
2071  {
2072  std::copy(first,last, this->begin());
2073  }
2074 
2082  self& operator=(const T& value)
2083  {
2084  this->fill(value);
2085  return *this;
2086  }
2100  friend bool operator== <>(const block2d<T,NR,NC>& x,
2101  const block2d<T,NR,NC>& y);
2102 
2103 
2110  friend bool operator!= <>(const block2d<T,NR,NC>& x,
2111  const block2d<T,NR,NC>& y);
2118  friend bool operator< <>(const block2d<T,NR,NC>& x,
2119  const block2d<T,NR,NC>& y);
2120 
2127  friend bool operator> <>(const block2d<T,NR,NC>& x,
2128  const block2d<T,NR,NC>&y);
2129 
2136  friend bool operator<= <>(const block2d<T,NR,NC>& x,
2137  const block2d<T,NR,NC>& y);
2138 
2145  friend bool operator>= <>(const block2d<T,NR,NC>& x,
2146  const block2d<T,NR,NC>&y);
2147 
2155 
2167  {
2168  assert(i < NR);
2169  return this->data + NC * i;
2170  }
2171 
2183  {
2184  assert(i < NR);
2185  return this->data + NC * i;
2186  }
2187 
2188 
2202  const size_type j)
2203  {
2204  assert(i < NR);
2205  assert(j < NC);
2206  return this->data[i * NC + j];
2207  }
2208 
2222  const size_type j) const
2223  {
2224  assert(i < NR);
2225  assert(j < NC);
2226  return this->data[i * NC + j];
2227  }
2228 
2241  {
2242  assert(this->data != 0);
2243  assert(point2d[0] < NR);
2244  assert(point2d[1] < NC);
2245  return this->data[point2d[0] * NC + point2d[1]];
2246  }
2247 
2260  {
2261  assert(this->data != 0);
2262  assert(point2d[0] < NR);
2263  assert(point2d[1] < NC);
2264  return this->data[point2d[0] * NC + point2d[1]];
2265  }
2266 
2267 
2268 
2269 
2276  std::string name() const {return "block2d";}
2277 
2282  static size_type dim1() {return NR;}
2287  static size_type rows() {return NR;}
2292  static size_type dim2() {return NC;}
2297  static size_type columns() {return NC;}
2298 
2303  static size_type cols() {return NC;}
2304 
2308  static size_type size() {return SIZE;}
2309 
2313  static size_type max_size() {return SIZE;}
2314 
2318  static bool empty(){return SIZE == 0;}
2319 
2325  {
2326  std::swap_ranges(begin(),end(),x.begin());
2327  }
2328 
2331 private:
2333  template<class Archive>
2334  void save(Archive & ar, const unsigned int version) const
2335  {
2336  ar & data;
2337  }
2338  template<class Archive>
2339  void load(Archive & ar, const unsigned int version)
2340  {
2341  ar & data;
2342  }
2343 
2344  BOOST_SERIALIZATION_SPLIT_MEMBER()
2345 };
2346 
2347 
2348 }//slip::
2349 
2350 namespace slip
2351 {
2353  /* @{ */
2354  template<typename T,std::size_t NR, std::size_t NC>
2355  inline
2356  std::ostream& operator<<(std::ostream & out,
2357  const block2d<T,NR,NC>& b)
2358  {
2359  for(std::size_t i = 0; i < NR; ++i)
2360  {
2361  for(std::size_t j = 0; j < NC; ++j)
2362  {
2363  assert( (i * NC + j) < NR*NC);
2364  out<<b.data[i * NC + j]<<" ";
2365  }
2366  out<<std::endl;
2367  }
2368  return out;
2369  }
2370 /* @} */
2372  /* @{ */
2373  template <typename T, std::size_t NR, std::size_t NC>
2374  inline
2376  const block2d<T,NR,NC>& y)
2377  {
2378  return ( x.size() == y.size()
2379  && std::equal(x.begin(),x.end(),y.begin()));
2380  }
2381 
2382  template <typename T, std::size_t NR, std::size_t NC>
2383  inline
2385  const block2d<T,NR,NC>& y)
2386  {
2387  return !(x == y);
2388  }
2389 
2390 /* @} */
2391 
2393  /* @{ */
2394  template <typename T, std::size_t NR, std::size_t NC>
2395  inline
2396  bool operator<(const block2d<T,NR,NC>& x,
2397  const block2d<T,NR,NC>& y)
2398  {
2399  return std::lexicographical_compare(x.begin(), x.end(),
2400  y.begin(), y.end());
2401  }
2402 
2403  template <typename T, std::size_t NR, std::size_t NC>
2404  inline
2405  bool operator>(const block2d<T,NR,NC>& x,
2406  const block2d<T,NR,NC>& y)
2407  {
2408  return (y < x);
2409  }
2410 
2411  template <typename T, std::size_t NR, std::size_t NC>
2412  inline
2413  bool operator<=(const block2d<T,NR,NC>& x,
2414  const block2d<T,NR,NC>& y)
2415  {
2416  return !(y < x);
2417  }
2418 
2419  template <typename T, std::size_t NR, std::size_t NC>
2420  inline
2422  const block2d<T,NR,NC>& y)
2423  {
2424  return !(x < y);
2425  }
2426  /* @} */
2427 
2428 }//slip::
2429 
2430 #endif //SLIP_BLOCK2D_HPP
reverse_row_range_iterator row_rend(const size_type row, const slip::Range< int > &range)
Returns a read-write iterator that points one before the first element of the Range range of the row ...
Definition: Block2d.hpp:1078
static bool empty()
Returns true if the block is empty. (Thus size == 0)
Definition: Block2d.hpp:2318
const_iterator end() const
Returns a read-only (constant) iterator that points one past the last element in the block2d...
Definition: Block2d.hpp:330
std::reverse_iterator< const_iterator2d > const_reverse_iterator2d
Definition: Block2d.hpp:219
bool operator!=(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1448
const_reverse_iterator2d_range rupper_left(const Range< int > &row_range, const Range< int > &col_range) const
Returns a read-only reverse_iterator2d_range that points to the past the bottom right element of the ...
Definition: Block2d.hpp:1898
reverse_iterator2d rbottom_right()
Returns a read/write reverse iterator2d. It points to past the upper left element of the block2d...
Definition: Block2d.hpp:1717
std::reverse_iterator< const_iterator > const_reverse_row_iterator
Definition: Block2d.hpp:215
std::size_t iterations() const
Rerturns the number of iterations of the range.
Definition: Range.hpp:305
const_reverse_iterator rbegin() const
Returns a read-only (constant) reverse iterator that points to the last element in the block2d...
Definition: Block2d.hpp:375
static size_type columns()
Returns the number of columns (second dimension size) in the block2d.
Definition: Block2d.hpp:2297
Provides a class to modelize the difference of slip::Point2d.
CoordType height() const
compute the height of the Box2d.
Definition: Box2d.hpp:378
const_reverse_iterator2d rbottom_right(const Box2d< int > &box) const
Returns a read-only reverse iterator2d. It points to one before the element of the bottom right eleme...
Definition: Block2d.hpp:1827
const_reverse_row_iterator row_rend(const size_type row) const
Returns a read-only reverse iterator that points one past the first element of the row row in the blo...
Definition: Block2d.hpp:1003
row_range_iterator row_end(const size_type row, const slip::Range< int > &range)
Returns a read/write iterator that points one past the end element of the Range range of the row row ...
Definition: Block2d.hpp:683
const_iterator2d_range bottom_right(const Range< int > &row_range, const Range< int > &col_range) const
Returns a read-only iterator2d_range that points to the past the end bottom right element of the rang...
Definition: Block2d.hpp:1556
col_range_iterator col_end(const size_type col, const slip::Range< int > &range)
Returns a read-write iterator that points to the past the end element of the Range range of the col c...
Definition: Block2d.hpp:824
value_type * pointer
Definition: Block2d.hpp:181
const_col_range_iterator col_begin(const size_type col, const slip::Range< int > &range) const
Returns a read-only iterator that points to the first element of the Range range of the col col in th...
Definition: Block2d.hpp:860
const_iterator2d bottom_right() const
Returns a read-only iterator2d that points to the past the end element of the block2d. It points to past the end element of the bottom right element of the block2d.
Definition: Block2d.hpp:1299
const_iterator2d bottom_right(const Box2d< int > &box) const
Returns a read only iterator2d that points to the past the end element of the block2d. It points to past the end element of the bottom right element of the Box2d associated to the block2d.
Definition: Block2d.hpp:1419
pointer iterator
Definition: Block2d.hpp:189
reverse_iterator2d rupper_left(const Box2d< int > &box)
Returns a read/write reverse iterator2d. It points to the bottom right element of the Box2d associate...
Definition: Block2d.hpp:1767
pointer operator[](const size_type i)
Subscript access to the row datas contained in the block2d.
Definition: Block2d.hpp:2166
Provides a class to manipulate 2d box.
friend class boost::serialization::access
Definition: Block2d.hpp:2332
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
Definition: Array2d.hpp:119
ptrdiff_t difference_type
Definition: Block2d.hpp:186
static size_type dim2()
Returns the number of columns (second dimension size) in the block2d.
Definition: Block2d.hpp:2292
row_iterator row_end(const size_type row)
Returns a read/write iterator that points one past the end element of the row row in the block2d...
Definition: Block2d.hpp:542
iterator2d default_iterator
Definition: Block2d.hpp:229
reverse_row_iterator row_rend(const size_type row)
Returns a read/write reverse iterator that points one past the first element of the row row in the bl...
Definition: Block2d.hpp:987
col_iterator col_begin(const size_type col)
Returns a read/write iterator that points to the first element of the column column in the block2d...
Definition: Block2d.hpp:493
reverse_col_range_iterator col_rend(const size_type col, const slip::Range< int > &range)
Returns a read-write iterator that points to one before the first element of the Range range of the c...
Definition: Block2d.hpp:1163
Provides a class to manipulate iterator2d within a slip::Box2d. It is used to iterate throw 2d contai...
const_reference operator()(const Point2d< size_type > &point2d) const
Subscript access to the data contained in the block2d.
Definition: Block2d.hpp:2259
iterator end()
Returns a read/write iterator that points one past the last element in the block2d. Iteration is done in ordinary element order.
Definition: Block2d.hpp:308
slip::stride_iterator< const_pointer > const_row_range_iterator
Definition: Block2d.hpp:207
slip::kstride_iterator< const_pointer, NC > const_col_iterator
Definition: Block2d.hpp:199
const_reference operator()(const size_type i, const size_type j) const
Subscript access to the data contained in the block2d.
Definition: Block2d.hpp:2221
This is a two-dimensional static and generic container. This container statisfies the BidirectionnalC...
Definition: Block2d.hpp:124
reverse_col_range_iterator col_rbegin(const size_type col, const slip::Range< int > &range)
Returns a read-write iterator that points to the last element of the Range range of the col col in th...
Definition: Block2d.hpp:1142
CoordType width() const
compute the width of the Box2d.
Definition: Box2d.hpp:374
const_reverse_col_iterator col_rend(const size_type col) const
Returns a read-only reverse iterator that points one past the first element of the column column in t...
Definition: Block2d.hpp:1037
const_iterator2d_range upper_left(const Range< int > &row_range, const Range< int > &col_range) const
Returns a read-only iterator2d_range that points to the to the upper left element of the ranges row_r...
Definition: Block2d.hpp:1522
reverse_row_iterator row_rbegin(const size_type row)
Returns a read/write reverse iterator that points to the last element of the row row in the block2d...
Definition: Block2d.hpp:920
reverse_col_iterator col_rend(const size_type col)
Returns a read/write reverse iterator that points one past the first element of the column column in ...
Definition: Block2d.hpp:1020
static size_type max_size()
Returns the maximal size (number of elements) in the block2d.
Definition: Block2d.hpp:2313
const_reverse_row_iterator row_rbegin(const size_type row) const
Returns a read-only reverse iterator that points to the last element of the row row in the block2d...
Definition: Block2d.hpp:937
slip::iterator2d_range< self > iterator2d_range
Definition: Block2d.hpp:210
Provides a class to iterate a 1d range according to a constant step.
std::reverse_iterator< const_col_range_iterator > const_reverse_col_range_iterator
Definition: Block2d.hpp:223
reverse_row_range_iterator row_rbegin(const size_type row, const slip::Range< int > &range)
Returns a read-write iterator that points to the last element of the Range range of the row row in th...
Definition: Block2d.hpp:1056
iterator2d_range upper_left(const Range< int > &range)
Returns a read/write iterator2d_range that points to the upper left element of the Range range associ...
Definition: Block2d.hpp:1592
iterator begin()
Returns a read/write iterator that points to the first element in the block2d. Iteration is done in o...
Definition: Block2d.hpp:262
const_col_iterator col_end(const size_type col) const
Returns a read-only iterator that points one past the end element of the column column in the block2d...
Definition: Block2d.hpp:616
slip::kstride_iterator< pointer, NC > col_iterator
Definition: Block2d.hpp:198
const_reverse_iterator2d rupper_left(const Box2d< int > &box) const
Returns a read only reverse iterator2d. It points to the bottom right element of the Box2d box associ...
Definition: Block2d.hpp:1806
void fill(InputIterator first, InputIterator last)
Fills the container range [begin(),begin()+SIZE) with a copy of the range [first,last) ...
Definition: Block2d.hpp:2069
bool operator>(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1469
slip::stride_iterator< const_col_iterator > const_col_range_iterator
Definition: Block2d.hpp:209
reverse_iterator2d_range rupper_left(const Range< int > &row_range, const Range< int > &col_range)
Returns a read/write reverse_iterator2d_range that points to the past the bottom right element of the...
Definition: Block2d.hpp:1849
void fill(const T *value)
Fills the container range [begin(),begin()+SIZE) with a copy of the value array.
Definition: Block2d.hpp:2055
This is a point2d class, a specialized version of Point<CoordType,DIM> with DIM = 2...
Definition: Array2d.hpp:132
self & operator=(const T &value)
Assign all the elments of the block2d by value.
Definition: Block2d.hpp:2082
const value_type * const_pointer
Definition: Block2d.hpp:182
std::string name() const
Returns the name of the class.
Definition: Block2d.hpp:2276
static size_type rows()
Returns the number of rows (first dimension size) in the block2d.
Definition: Block2d.hpp:2287
slip::const_iterator2d_range< const_self > const_iterator2d_range
Definition: Block2d.hpp:211
const value_type & const_reference
Definition: Block2d.hpp:184
iterator2d_range bottom_right(const Range< int > &row_range, const Range< int > &col_range)
Returns a read/write iterator2d_range that points to the past the end bottom right element of the ran...
Definition: Block2d.hpp:1487
const_reverse_col_iterator col_rbegin(const size_type col) const
Returns a read-only reverse iterator that points to the last element of the column column in the bloc...
Definition: Block2d.hpp:971
This is some iterator to iterate a 2d container into a Box area defined by the indices of the 2d cont...
Definition: Array2d.hpp:122
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: Block2d.hpp:193
void swap(block2d< T, NR, NC > &x)
Swaps data with another block.
Definition: Block2d.hpp:2324
std::reverse_iterator< row_range_iterator > reverse_row_range_iterator
Definition: Block2d.hpp:220
const_reverse_iterator rend() const
Returns a read-only (constant) reverse iterator that points to one before the first element in the bl...
Definition: Block2d.hpp:420
reverse_iterator2d_range rbottom_right(const Range< int > &range)
Returns a read/write reverse_iterator2d_range that points to one before the upper left element of the...
Definition: Block2d.hpp:1967
const_pointer operator[](const size_type i) const
Subscript access to the row datas contained in the block2d.
Definition: Block2d.hpp:2182
iterator2d_range bottom_right(const Range< int > &range)
Returns a read/write iterator2d_range that points to the past the end bottom right element of the Ran...
Definition: Block2d.hpp:1623
pointer row_iterator
Definition: Block2d.hpp:196
const_pointer const_row_iterator
Definition: Block2d.hpp:197
row_iterator row_begin(const size_type row)
Returns a read/write iterator that points to the first element of the row row in the block2d...
Definition: Block2d.hpp:443
const block2d< T, NR, NC > const_self
Definition: Block2d.hpp:179
std::reverse_iterator< const_row_range_iterator > const_reverse_row_range_iterator
Definition: Block2d.hpp:221
iterator2d bottom_right()
Returns a read/write iterator2d that points to the past the end element of the block2d. It points to past the end element of the bottom right element of the block2d.
Definition: Block2d.hpp:1275
const_reverse_row_range_iterator row_rbegin(const size_type row, const slip::Range< int > &range) const
Returns a read-only iterator that points to the last element of the Range range of the row row in the...
Definition: Block2d.hpp:1098
void copy(_II first, _II last, _OI output_first)
Copy algorithm optimized for slip iterators.
Definition: copy_ext.hpp:177
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
Definition: Array2d.hpp:129
bool is_valid() const
Returns true if the range is valid :
Definition: Range.hpp:322
SubType start() const
Accessor of the start subscript of the Range.
Definition: Range.hpp:284
slip::stride_iterator< pointer > row_range_iterator
Definition: Block2d.hpp:206
const_reverse_col_range_iterator col_rbegin(const size_type col, const slip::Range< int > &range) const
Returns a read_only iterator that points to the last element of the Range & range of the col col in t...
Definition: Block2d.hpp:1185
const_row_range_iterator row_begin(const size_type row, const slip::Range< int > &range) const
Returns a read-only iterator that points to the first element of the Range range of the row row in th...
Definition: Block2d.hpp:716
reverse_col_iterator col_rbegin(const size_type col)
Returns a read/write reverse iterator that points to the last element of the column column in the blo...
Definition: Block2d.hpp:954
std::reverse_iterator< const_iterator2d_range > const_reverse_iterator2d_range
Definition: Block2d.hpp:225
reverse_iterator2d rupper_left()
Returns a read/write reverse iterator2d. It points to the bottom right element of the block2d...
Definition: Block2d.hpp:1702
value_type & reference
Definition: Block2d.hpp:183
const_reverse_iterator2d_range rbottom_right(const Range< int > &range) const
Returns a read_only reverse_iterator2d_range that points to one before the upper left element of the ...
Definition: Block2d.hpp:2012
col_iterator col_end(const size_type col)
Returns a read/write iterator that points one past the end element of the column column in the block2...
Definition: Block2d.hpp:591
iterator2d upper_left()
Returns a read/write iterator2d that points to the first element of the block2d. It points to the upp...
Definition: Block2d.hpp:1231
reverse_iterator2d_range rbottom_right(const Range< int > &row_range, const Range< int > &col_range)
Returns a read/write reverse_iterator2d_range that points to one before the upper left element of the...
Definition: Block2d.hpp:1874
iterator2d_range upper_left(const Range< int > &row_range, const Range< int > &col_range)
Returns a read/write iterator2d_range that points to the upper left element of the ranges row_range a...
Definition: Block2d.hpp:1454
const_row_iterator row_end(const size_type row) const
Returns a read-only iterator that points one past the end element of the row row in the block2d...
Definition: Block2d.hpp:567
This is some iterator to iterate a 2d container into a slip::Box2d area defined by the indices of the...
Definition: Array2d.hpp:116
static size_type cols()
Returns the number of columns (second dimension size) in the block2d.
Definition: Block2d.hpp:2303
const_reverse_col_range_iterator col_rend(const size_type col, const slip::Range< int > &range) const
Returns a read-only iterator that points to the first element of the Range range of the col col in th...
Definition: Block2d.hpp:1206
std::reverse_iterator< const_col_iterator > const_reverse_col_iterator
Definition: Block2d.hpp:217
const_reverse_iterator2d rupper_left() const
Returns a read only reverse iterator2d that points. It points to the bottom right element of the bloc...
Definition: Block2d.hpp:1731
slip::stride_iterator< col_iterator > col_range_iterator
Definition: Block2d.hpp:208
static size_type size()
Returns the number of elements in the block2d.
Definition: Block2d.hpp:2308
slip::iterator2d_box< self > iterator2d
Definition: Block2d.hpp:203
const_col_range_iterator col_end(const size_type col, const slip::Range< int > &range) const
Returns a read-only iterator that points to the past the end element of the Range range of the col co...
Definition: Block2d.hpp:898
reference operator()(const size_type i, const size_type j)
Subscript access to the data contained in the block2d.
Definition: Block2d.hpp:2201
reverse_iterator2d_range rupper_left(const Range< int > &range)
Returns a read/write reverse_iterator2d_range that points to the bottom right element of the Range ra...
Definition: Block2d.hpp:1944
std::ostream & operator<<(std::ostream &out, const Array< T > &a)
Definition: Array.hpp:1282
std::reverse_iterator< iterator2d_range > reverse_iterator2d_range
Definition: Block2d.hpp:224
const_reverse_iterator2d_range rbottom_right(const Range< int > &row_range, const Range< int > &col_range) const
Returns a read-only reverse_iterator2d_range that points to one before the upper left element of the ...
Definition: Block2d.hpp:1921
iterator2d upper_left(const Box2d< int > &box)
Returns a read/write iterator2d that points to the first element of the block2d. It points to the upp...
Definition: Block2d.hpp:1330
const_iterator2d const_default_iterator
Definition: Block2d.hpp:230
void fill(const T &value)
Fills the container range [begin(),begin()+SIZE) with copies of value.
Definition: Block2d.hpp:2045
static const std::size_t DIM
Definition: Block2d.hpp:235
const_iterator2d_range bottom_right(const Range< int > &range) const
Returns a read-only const_iterator2d_range that points to the past the end bottom right element of th...
Definition: Block2d.hpp:1687
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
Definition: Array2d.hpp:125
col_range_iterator col_begin(const size_type col, const slip::Range< int > &range)
Returns a read-write iterator that points to the first element of the Range range of the col col in t...
Definition: Block2d.hpp:787
std::reverse_iterator< iterator > reverse_iterator
Definition: Block2d.hpp:192
reverse_iterator rbegin()
Returns a read/write reverse iterator that points to the last element in the block2d. Iteration is done in reverse element order.
Definition: Block2d.hpp:353
iterator2d bottom_right(const Box2d< int > &box)
Returns a read/write iterator2d that points to the past the end element of the block2d. It points to past the end element of the bottom right element of the Box2d associated to the block2d.
Definition: Block2d.hpp:1388
const_iterator2d upper_left(const Box2d< int > &box) const
Returns a read only iterator2d that points to the first element of the block2d. It points to the uppe...
Definition: Block2d.hpp:1359
std::reverse_iterator< iterator > reverse_row_iterator
Definition: Block2d.hpp:214
int stride() const
Accessor of the stride of the Range.
Definition: Range.hpp:298
const_iterator2d_range upper_left(const Range< int > &range) const
Returns a read-only iterator2d_range that points to the to the upper left element of the Range range ...
Definition: Block2d.hpp:1655
static const std::size_t SIZE
Size of the block2d.
Definition: Block2d.hpp:233
slip::const_iterator2d_box< const_self > const_iterator2d
Definition: Block2d.hpp:204
const_reverse_iterator2d_range rupper_left(const Range< int > &range) const
Returns a read-only reverse_iterator2d_range that points to the to the bottom right element of the Ra...
Definition: Block2d.hpp:1990
Provides a class to modelize 2d points.
std::reverse_iterator< col_range_iterator > reverse_col_range_iterator
Definition: Block2d.hpp:222
std::size_t size_type
Definition: Block2d.hpp:187
Provides a class to iterate a 1d range according to a step.
std::reverse_iterator< iterator2d > reverse_iterator2d
Definition: Block2d.hpp:218
T data[SIZE]
Data array storage of the block2d.
Definition: Block2d.hpp:2330
const_iterator begin() const
Returns a read-only (constant) iterator that points to the first element in the block2d. Iteration is done in ordinary element order.
Definition: Block2d.hpp:286
std::reverse_iterator< col_iterator > reverse_col_iterator
Definition: Block2d.hpp:216
const_col_iterator col_begin(const size_type col) const
Returns a read-only iterator that points to the first element of the column column in the block2d...
Definition: Block2d.hpp:518
bool operator==(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1439
const_iterator2d upper_left() const
Returns a read-only iterator2d that points to the first element of the block2d. It points to the uppe...
Definition: Block2d.hpp:1253
const_row_range_iterator row_end(const size_type row, const slip::Range< int > &range) const
Returns a read_only iterator that points one past the last element of the Range range of the row row ...
Definition: Block2d.hpp:753
const_reverse_row_range_iterator row_rend(const size_type row, const slip::Range< int > &range) const
Returns a read-only iterator that points one before the first element of the Range range of the row r...
Definition: Block2d.hpp:1119
reverse_iterator rend()
Returns a read/write reverse iterator that points to one before the first element in the block2d...
Definition: Block2d.hpp:397
reference operator()(const Point2d< size_type > &point2d)
Subscript access to the data contained in the block2d.
Definition: Block2d.hpp:2240
row_range_iterator row_begin(const size_type row, const slip::Range< int > &range)
Returns a read/write iterator that points to the first element of the Range range of the row row in t...
Definition: Block2d.hpp:647
const_pointer const_iterator
Definition: Block2d.hpp:190
Provides a class to manipulate Ranges.
Provides a class to manipulate iterator2d within a slip::Range. It is used to iterate throw 2d contai...
SubType stop() const
Accessor of the stop subscript of the Range.
Definition: Range.hpp:291
bool operator>=(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1485
const_row_iterator row_begin(const size_type row) const
Returns a read-only iterator that points to the first element of the row row in the block2d...
Definition: Block2d.hpp:468
const_reverse_iterator2d rbottom_right() const
Returns a read only reverse iterator2d. It points to past the upper left element of the block2d...
Definition: Block2d.hpp:1747
static size_type dim1()
Returns the number of rows (first dimension size) in the block2d.
Definition: Block2d.hpp:2282
reverse_iterator2d rbottom_right(const Box2d< int > &box)
Returns a read/write reverse iterator2d. It points to one before the upper left element of the Box2d ...
Definition: Block2d.hpp:1787