SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenericMultiComponent2d.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 
75 #ifndef SLIP_GENERICMULTICOMPONENT2D_HPP
76 #define SLIP_GENERICMULTICOMPONENT2D_HPP
77 
78 #include <iostream>
79 #include <iterator>
80 #include <cassert>
81 #include <numeric>
82 #include <cmath>
83 #include <string>
84 #include <vector>
85 #include <cstddef>
86 #include "Matrix.hpp"
87 #include "stride_iterator.hpp"
88 #include "kstride_iterator.hpp"
89 #include "iterator2d_box.hpp"
90 #include "iterator2d_range.hpp"
93 #include "apply.hpp"
94 #include "Range.hpp"
95 #include "Box2d.hpp"
96 #include "Point2d.hpp"
97 #include "DPoint2d.hpp"
98 #include "compare.hpp"
99 
100 #include <boost/serialization/access.hpp>
101 #include <boost/serialization/split_member.hpp>
102 #include <boost/serialization/version.hpp>
103 
104 namespace slip
105 {
106 
107 template<class Block>
108 class stride_iterator;
109 
110 template<class Block>
111 class iterator2d_box;
112 
113 template<class T>
114 class const_iterator2d_box;
115 
116 template<class T>
117 class const_iterator2d_range;
118 
119 template <class Block>
120 class DPoint2d;
121 
122 template <class Block>
123 class Point2d;
124 
125 template <class Block>
126 class Box2d;
127 
128 template <typename Block>
130 
131 template <typename Block>
132 class Matrix;
133 
134 template <typename Block>
135 std::ostream& operator<<(std::ostream & out, const slip::GenericMultiComponent2d<Block>& a);
136 
137 template<typename Block>
140 
141 template<typename Block>
144 
145 // template<typename Block>
146 // bool operator<(const slip::GenericMultiComponent2d<Block>& x,
147 // const slip::GenericMultiComponent2d<Block>& y);
148 
149 // template<typename sBlock>
150 // bool operator>(const slip::GenericMultiComponent2d<Block>& x,
151 // const slip::GenericMultiComponent2d<Block>& y);
152 
153 // template<typename Block>
154 // bool operator<=(const slip::GenericMultiComponent2d<Block>& x,
155 // const slip::GenericMultiComponent2d<Block>& y);
156 
157 // template<typename Block>
158 // bool operator>=(const slip::GenericMultiComponent2d<Block>& x,
159 // const slip::GenericMultiComponent2d<Block>& y);
160 
190 template <typename Block>
192 {
193 public :
194 
195  typedef Block value_type;
198  typedef value_type* pointer;
199  typedef value_type const * const_pointer;
201  typedef value_type const & const_reference;
202 
203  typedef ptrdiff_t difference_type;
204  typedef std::size_t size_type;
205 
206  typedef pointer iterator;
208 
209  typedef std::reverse_iterator<iterator> reverse_iterator;
210  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
211 
212 
217 
218 
227 
228  typedef typename Block::value_type block_value_type;
235 
236  typedef std::reverse_iterator<iterator> reverse_row_iterator;
237  typedef std::reverse_iterator<const_iterator> const_reverse_row_iterator;
238  typedef std::reverse_iterator<col_iterator> reverse_col_iterator;
239  typedef std::reverse_iterator<const_col_iterator> const_reverse_col_iterator;
240  typedef std::reverse_iterator<iterator2d> reverse_iterator2d;
241  typedef std::reverse_iterator<const_iterator2d> const_reverse_iterator2d;
242  typedef std::reverse_iterator<row_range_iterator> reverse_row_range_iterator;
243  typedef std::reverse_iterator<const_row_range_iterator> const_reverse_row_range_iterator;
244  typedef std::reverse_iterator<col_range_iterator> reverse_col_range_iterator;
245  typedef std::reverse_iterator<const_col_range_iterator> const_reverse_col_range_iterator;
246  typedef std::reverse_iterator<iterator2d_range> reverse_iterator2d_range;
247  typedef std::reverse_iterator<const_iterator2d_range> const_reverse_iterator2d_range;
248  typedef std::reverse_iterator<component_iterator> reverse_component_iterator;
249  typedef std::reverse_iterator<const_component_iterator> const_reverse_component_iterator;
250 
255  typedef std::reverse_iterator<component_row_iterator> reverse_component_row_iterator;
256  typedef std::reverse_iterator<const_component_row_iterator> const_reverse_component_row_iterator;
257  typedef std::reverse_iterator<component_row_range_iterator> reverse_component_row_range_iterator;
258  typedef std::reverse_iterator<const_component_row_range_iterator> const_reverse_component_row_range_iterator;
259 
264  typedef std::reverse_iterator<component_col_iterator> reverse_component_col_iterator;
265  typedef std::reverse_iterator<const_component_col_iterator> const_reverse_component_col_iterator;
266  typedef std::reverse_iterator<component_col_range_iterator> reverse_component_col_range_iterator;
267  typedef std::reverse_iterator<const_component_col_range_iterator> const_reverse_component_col_range_iterator;
268 
270  typedef std::reverse_iterator<component_iterator2d> reverse_component_iterator2d;
272  typedef std::reverse_iterator<const_component_iterator2d> const_reverse_component_iterator2d;
273 
275  typedef std::reverse_iterator<component_iterator2d_range> reverse_component_iterator2d_range;
277  typedef std::reverse_iterator<const_component_iterator2d_range> const_reverse_component_iterator2d_range;
278 
279  //default iterator of the container
282 
283  static const std::size_t DIM = 2;
284  static const std::size_t COMPONENTS = Block::SIZE;
285 public:
290 
295 
302  const size_type width);
303 
311  const size_type width,
312  const Block& val);
313 
321  const size_type width,
322  typename Block::const_pointer val);
323 
331  const size_type width,
332  const Block* val);
333 
334 
345  template<typename InputIterator>
347  const size_type width,
348  InputIterator first,
349  InputIterator last)
350  {
351  matrix_ = new slip::Matrix<Block>(height,width,first,last);
352  }
353 
367  template<typename InputIterator>
369  const size_type width,
370  std::vector<InputIterator> first_iterators_list,
371  InputIterator last)
372 
373  {
374  matrix_ = new slip::Matrix<Block>(height,width);
375  this->fill(first_iterators_list,last);
376  }
377 
378 
382  GenericMultiComponent2d(const self& rhs);
383 
387  virtual ~GenericMultiComponent2d();
388 
389 
399  void resize(const size_type height,
400  const size_type width,
401  const Block& val = Block());
402 
425  iterator begin();
426 
427 
447  iterator end();
448 
469  const_iterator begin() const;
470 
471 
491  const_iterator end() const;
492 
514 
536 
558 
559 
581 
582 
602  row_iterator row_begin(const size_type row);
603 
604 
624  row_iterator row_end(const size_type row);
625 
626 
646  const_row_iterator row_begin(const size_type row) const;
647 
648 
668  const_row_iterator row_end(const size_type row) const;
669 
689  col_iterator col_begin(const size_type col);
690 
691 
711  col_iterator col_end(const size_type col);
712 
732  const_col_iterator col_begin(const size_type col) const;
733 
734 
735 
755  const_col_iterator col_end(const size_type col) const;
756 
757 
783  const slip::Range<int>& range);
784 
785 
786 
812  const slip::Range<int>& range);
813 
814 
840  const slip::Range<int>& range) const;
841 
842 
867  const slip::Range<int>& range) const;
868 
869 
895  const slip::Range<int>& range);
896 
923  const slip::Range<int>& range);
924 
925 
926 
927 
953  const slip::Range<int>& range) const;
954 
955 
982  const slip::Range<int>& range) const;
983 
984 
985 
998 
999 
1012 
1025 
1038 
1052 
1053 
1067 
1081 
1082 
1096 
1097 
1113  const slip::Range<int>& range);
1114 
1115 
1132  const slip::Range<int>& range);
1133 
1134 
1135 
1149  const slip::Range<int>& range) const;
1150 
1151 
1167  const slip::Range<int>& range) const;
1168 
1169 
1170 
1171 
1187  const slip::Range<int>& range);
1188 
1205  const slip::Range<int>& range);
1206 
1207 
1223  col_rbegin(const size_type col,
1224  const slip::Range<int>& range) const;
1225 
1226 
1242  const slip::Range<int>& range) const;
1243 
1244 
1263 
1264 
1283 
1284 
1302  const_iterator2d upper_left() const;
1303 
1304 
1323 
1347  iterator2d upper_left(const Box2d<int>& box);
1348 
1349 
1374  iterator2d bottom_right(const Box2d<int>& box);
1375 
1376 
1401  const_iterator2d upper_left(const Box2d<int>& box) const;
1402 
1403 
1428  const_iterator2d bottom_right(const Box2d<int>& box) const;
1429 
1430 
1458  iterator2d_range upper_left(const Range<int>& row_range,
1459  const Range<int>& col_range);
1460 
1488  iterator2d_range bottom_right(const Range<int>& row_range,
1489  const Range<int>& col_range);
1490 
1491 
1519  const_iterator2d_range upper_left(const Range<int>& row_range,
1520  const Range<int>& col_range) const;
1521 
1522 
1551  const Range<int>& col_range) const;
1552 
1553 
1554 
1555 
1556 
1581  iterator2d_range upper_left(const Range<int>& range);
1582 
1583 
1610 
1611 
1612 
1613 
1638  const_iterator2d_range upper_left(const Range<int>& range) const;
1639 
1640 
1641 
1667  const_iterator2d_range bottom_right(const Range<int>& range) const;
1668 
1669 
1680 
1691 
1702 
1703 
1714 
1715 
1731 
1747 
1763 
1764 
1780 
1781 
1799  const Range<int>& col_range);
1800 
1801 
1802 
1820  const Range<int>& col_range);
1821 
1822 
1823 
1841  const Range<int>& col_range) const;
1842 
1860  const Range<int>& col_range) const;
1861 
1862 
1863 
1880 
1881 
1882 
1900 
1901 
1919 
1920 
1938 
1939  //--------------------------------------------------------------------
1940 
1948  component_iterator begin(const std::size_t component);
1949 
1957  const_component_iterator begin(const std::size_t component) const;
1958 
1966  component_iterator end(const std::size_t component);
1967 
1975  const_component_iterator end(const std::size_t component) const;
1976 
1984  reverse_component_iterator rbegin(const std::size_t component);
1985 
1993  const_reverse_component_iterator rbegin(const std::size_t component) const;
1994 
2002  reverse_component_iterator rend(const std::size_t component);
2003 
2011  const_reverse_component_iterator rend(const std::size_t component) const;
2012 
2013 
2022  component_row_iterator row_begin(const std::size_t component,
2023  const std::size_t row);
2024 
2033  const_component_row_iterator row_begin(const std::size_t component,
2034  const std::size_t row) const;
2035 
2044  component_row_iterator row_end(const std::size_t component,
2045  const std::size_t row);
2046 
2055  const_component_row_iterator row_end(const std::size_t component,
2056  const std::size_t row) const;
2057 
2058 
2067  reverse_component_row_iterator row_rbegin(const std::size_t component,
2068  const std::size_t row);
2069 
2078  const_reverse_component_row_iterator row_rbegin(const std::size_t component,
2079  const std::size_t row) const;
2080 
2089  reverse_component_row_iterator row_rend(const std::size_t component,
2090  const std::size_t row);
2091 
2100  const_reverse_component_row_iterator row_rend(const std::size_t component,
2101  const std::size_t row) const;
2102 
2103 
2112  component_col_iterator col_begin(const std::size_t component,
2113  const std::size_t col);
2114 
2123  const_component_col_iterator col_begin(const std::size_t component,
2124  const std::size_t col) const;
2125 
2134  component_col_iterator col_end(const std::size_t component,
2135  const std::size_t col);
2136 
2145  const_component_col_iterator col_end(const std::size_t component,
2146  const std::size_t col) const;
2147 
2148 
2149 
2158  reverse_component_col_iterator col_rbegin(const std::size_t component,
2159  const std::size_t col);
2160 
2169  const_reverse_component_col_iterator col_rbegin(const std::size_t component,
2170  const std::size_t col) const;
2171 
2180  reverse_component_col_iterator col_rend(const std::size_t component,
2181  const std::size_t col);
2182 
2191  const_reverse_component_col_iterator col_rend(const std::size_t component,
2192  const std::size_t col) const;
2193 
2194  //##############################################################################"
2195 
2221  component_row_range_iterator row_begin(const std::size_t component, const size_type row,
2222  const slip::Range<int>& range);
2223 
2249  component_row_range_iterator row_end(const std::size_t component, const size_type row,
2250  const slip::Range<int>& range);
2251 
2277  const_component_row_range_iterator row_begin(const std::size_t component, const size_type row,
2278  const slip::Range<int>& range) const;
2279 
2304  const_component_row_range_iterator row_end(const std::size_t component, const size_type row,
2305  const slip::Range<int>& range) const;
2306 
2307 
2333  component_col_range_iterator col_begin(const std::size_t component, const size_type col,
2334  const slip::Range<int>& range);
2335 
2362  component_col_range_iterator col_end(const std::size_t component, const size_type col,
2363  const slip::Range<int>& range);
2364 
2390  const_component_col_range_iterator col_begin(const std::size_t component, const size_type col,
2391  const slip::Range<int>& range) const;
2392 
2419  const_component_col_range_iterator col_end(const std::size_t component, const size_type col,
2420  const slip::Range<int>& range) const;
2421 
2422 
2438  reverse_component_row_range_iterator row_rbegin(const std::size_t component, const size_type row,
2439  const slip::Range<int>& range);
2440 
2441 
2458  reverse_component_row_range_iterator row_rend(const std::size_t component, const size_type row,
2459  const slip::Range<int>& range);
2460 
2461 
2462 
2476  const_reverse_component_row_range_iterator row_rbegin(const std::size_t component, const size_type row,
2477  const slip::Range<int>& range) const;
2478 
2479 
2495  const_reverse_component_row_range_iterator row_rend(const std::size_t component, const size_type row,
2496  const slip::Range<int>& range) const;
2497 
2498 
2499 
2500 
2516  reverse_component_col_range_iterator col_rbegin(const std::size_t component, const size_type col,
2517  const slip::Range<int>& range);
2518 
2535  reverse_component_col_range_iterator col_rend(const std::size_t component, const size_type col,
2536  const slip::Range<int>& range);
2537 
2538 
2554  const_reverse_component_col_range_iterator col_rbegin(const std::size_t component, const size_type col,
2555  const slip::Range<int>& range) const;
2556 
2557 
2573  const_reverse_component_col_range_iterator col_rend(const std::size_t component, const size_type col,
2574  const slip::Range<int>& range) const;
2575 
2593  component_iterator2d upper_left(const std::size_t component);
2594 
2613  component_iterator2d bottom_right(const std::size_t component);
2614 
2625  const_component_iterator2d upper_left(const std::size_t component) const;
2626 
2637  const_component_iterator2d bottom_right(const std::size_t component) const;
2638 
2649  reverse_component_iterator2d rupper_left(const std::size_t component);
2650 
2661  reverse_component_iterator2d rbottom_right(const std::size_t component);
2662 
2673  const_reverse_component_iterator2d rupper_left(const std::size_t component) const;
2674 
2675 
2686  const_reverse_component_iterator2d rbottom_right(const std::size_t component) const;
2687 
2702  component_iterator2d upper_left(const std::size_t component,
2703  const Box2d<int>& box);
2704 
2720  component_iterator2d bottom_right(const std::size_t component,
2721  const Box2d<int>& box);
2722 
2737  const_component_iterator2d upper_left(const std::size_t component,
2738  const Box2d<int>& box) const;
2739 
2754  const_component_iterator2d bottom_right(const std::size_t component,
2755  const Box2d<int>& box) const;
2756 
2757 
2774  component_iterator2d_range upper_left(const std::size_t component,
2775  const Range<int>& row_range,
2776  const Range<int>& col_range);
2777 
2794  component_iterator2d_range bottom_right(const std::size_t component,
2795  const Range<int>& row_range,
2796  const Range<int>& col_range);
2797 
2814  const_component_iterator2d_range upper_left(const std::size_t component,
2815  const Range<int>& row_range,
2816  const Range<int>& col_range) const;
2817 
2834  const_component_iterator2d_range bottom_right(const std::size_t component,
2835  const Range<int>& row_range,
2836  const Range<int>& col_range) const;
2837 
2853  reverse_component_iterator2d rupper_left(const std::size_t component,
2854  const Box2d<int>& box);
2855 
2871  reverse_component_iterator2d rbottom_right(const std::size_t component,
2872  const Box2d<int>& box);
2873 
2889  const_reverse_component_iterator2d rupper_left(const std::size_t component,
2890  const Box2d<int>& box) const;
2891 
2892 
2908  const_reverse_component_iterator2d rbottom_right(const std::size_t component,
2909  const Box2d<int>& box) const;
2910 
2911 
2929  reverse_component_iterator2d_range rupper_left(const std::size_t component,
2930  const Range<int>& row_range,
2931  const Range<int>& col_range);
2932 
2950  reverse_component_iterator2d_range rbottom_right(const std::size_t component,
2951  const Range<int>& row_range,
2952  const Range<int>& col_range);
2953 
2971  const_reverse_component_iterator2d_range rupper_left(const std::size_t component,
2972  const Range<int>& row_range,
2973  const Range<int>& col_range) const;
2974 
2992  const_reverse_component_iterator2d_range rbottom_right(const std::size_t component,
2993  const Range<int>& row_range,
2994  const Range<int>& col_range) const;
2995 
2996 
3003 
3009  friend std::ostream& operator<< <>(std::ostream & out, const self& a);
3010 
3017 
3026  self& operator=(const self & rhs);
3027 
3033  self& operator=(const Block& val);
3034 
3035 
3041  self& operator=(const typename Block::value_type& val);
3042 
3043 
3044 
3050  void fill(const Block& value)
3051  {
3052  std::fill_n(this->begin(),size(),value);
3053  }
3054 
3061  void fill(const typename Block::pointer value)
3062  {
3063  std::copy(value,value + size(), (typename Block::pointer)begin());
3064  }
3065 
3072  void fill(const Block* value)
3073  {
3074  std::copy(value,value + size(), this->begin());
3075  }
3076 
3085  template<typename InputIterator>
3086  void fill(InputIterator first,
3087  InputIterator last)
3088  {
3089  std::copy(first,last,this->begin());
3090  }
3091 
3100  template<typename InputIterator>
3101  void fill(std::vector<InputIterator> first_iterators_list,
3102  InputIterator last)
3103  {
3104  std::vector<typename slip::kstride_iterator<typename Block::pointer,Block::SIZE> > iterators_list(Block::SIZE);
3105 
3106  for(std::size_t component = 0; component < Block::SIZE; ++component)
3107  {
3108  iterators_list[component]= slip::kstride_iterator<typename Block::pointer,Block::SIZE>((typename Block::pointer)this->begin() + component);
3109  }
3110 
3111 
3112  while(first_iterators_list[0] != last)
3113  {
3114  for(std::size_t component = 0; component < Block::SIZE; ++component)
3115  {
3116  *iterators_list[component]++ = *first_iterators_list[component]++;
3117  }
3118  }
3119  iterators_list.clear();
3120  }
3121 
3122 
3132  template<typename InputIterator>
3133  void fill(std::size_t component,
3134  InputIterator first,
3135  InputIterator last)
3136  {
3137  std::copy(first,last,this->begin(component));
3138  }
3139 
3153  friend bool operator== <>(const GenericMultiComponent2d<Block>& x,
3155 
3163  friend bool operator!= <>(const GenericMultiComponent2d<Block>& x,
3165 
3166 // /*!
3167 // ** \brief Less than comparison operator (GenericMultiComponent2d ordering relation)
3168 // ** \param x A %GenericMultiComponent2d
3169 // ** \param y A %GenericMultiComponent2d of the same type of \a x
3170 // ** \return true iff \a x is lexicographically less than \a y
3171 // ** \pre x.size() == y.size()
3172 // */
3173 // friend bool operator< <>(const GenericMultiComponent2d<Block>& x,
3174 // const GenericMultiComponent2d<Block>& y);
3175 
3176 // /*!
3177 // ** \brief More than comparison operator
3178 // ** \param x A %GenericMultiComponent2d
3179 // ** \param y A %GenericMultiComponent2d of the same type of \a x
3180 // ** \return true iff y > x
3181 // ** \pre x.size() == y.size()
3182 // */
3183 // friend bool operator> <>(const GenericMultiComponent2d<Block>& x,
3184 // const GenericMultiComponent2d<Block>& y);
3185 
3186 // /*!
3187 // ** \brief Less than equal comparison operator
3188 // ** \param x A %GenericMultiComponent2d
3189 // ** \param y A %GenericMultiComponent2d of the same type of \a x
3190 // ** \return true iff !(y > x)
3191 // ** \pre x.size() == y.size()
3192 // */
3193 // friend bool operator<= <>(const GenericMultiComponent2d<Block>& x,
3194 // const GenericMultiComponent2d<Block>& y);
3195 
3196 // /*!
3197 // ** \brief More than equal comparison operator
3198 // ** \param x A %GenericMultiComponent2d
3199 // ** \param y A %GenericMultiComponent2d of the same type of \a x
3200 // ** \return true iff !(x < y)
3201 // ** \pre x.size() == y.size()
3202 // */
3203 // friend bool operator>= <>(const GenericMultiComponent2d<Block>& x,
3204 // const GenericMultiComponent2d<Block>& y);
3205 
3206 
3223  pointer operator[](const size_type i);
3224 
3235  const_pointer operator[](const size_type i) const;
3236 
3237 
3250  reference operator()(const size_type i,
3251  const size_type j);
3252 
3266  const size_type j) const;
3267 
3268 
3280  reference operator()(const Point2d<size_type>& point2d);
3281 
3293  const_reference operator()(const Point2d<size_type>& point2d) const;
3294 
3307  self operator()(const Range<int>& row_range,
3308  const Range<int>& col_range);
3309 
3310 
3317  size_type dim1() const;
3318 
3323  size_type rows() const;
3324 
3329  size_type height() const;
3330 
3335  size_type dim2() const;
3336 
3341  size_type columns() const;
3342 
3347  size_type cols() const;
3348 
3353  size_type width() const;
3354 
3358  size_type size() const;
3359 
3363  size_type max_size() const;
3364 
3368  bool empty()const;
3369 
3374  void swap(self& M);
3375 
3376 
3382  Block min() const;
3383 
3384 
3390  Block max() const;
3391 
3392  // /*!
3393 // ** \brief Returns the sums of the elements of the %GenericMultiComponent2d
3394 // ** \pre size() != 0
3395 // */
3396 // Block sum() const;
3397 
3404  GenericMultiComponent2d<Block>& apply(Block(*fun)(Block));
3405 
3412  GenericMultiComponent2d<Block>& apply(Block(*fun)(const Block&));
3413 
3414 
3415  //private:
3416 private:
3417  slip::Matrix<Block>* matrix_;
3418 
3419  private:
3420  friend class boost::serialization::access;
3421  template<class Archive>
3422  void save(Archive & ar, const unsigned int version) const
3423  {
3424  ar & this->matrix_;
3425  }
3426  template<class Archive>
3427  void load(Archive & ar, const unsigned int version)
3428  {
3429  ar & this->matrix_;
3430  }
3431  BOOST_SERIALIZATION_SPLIT_MEMBER();
3432 
3433 };
3434  // end of MultiComponent2dContainer group
3436 }//slip::
3437 
3438 
3439 namespace slip
3440 {
3441  template<typename Block>
3442  inline
3444  matrix_(new slip::Matrix<Block>())
3445  {}
3446 
3447  template<typename Block>
3448  inline
3450  const typename GenericMultiComponent2d<Block>::size_type width):
3451  matrix_(new slip::Matrix<Block>(height,width))
3452  {}
3453 
3454  template<typename Block>
3455  inline
3457  const typename GenericMultiComponent2d<Block>::size_type width,
3458  typename Block::const_pointer val):
3459  matrix_(new slip::Matrix<Block>(height,width))
3460  {
3461  typename slip::Matrix<Block>::iterator it = matrix_->begin();
3462  typename slip::Matrix<Block>::iterator ite = matrix_->end();
3463 
3464  for(;it!=ite; it++)
3465  {
3466  for(typename GenericMultiComponent2d<Block>::size_type component = 0; component < Block::SIZE; ++component)
3467  {
3468  (*it)[component] = *val++;
3469  }
3470  }
3471  }
3472 
3473  template<typename Block>
3474  inline
3476  const typename GenericMultiComponent2d<Block>::size_type width,
3477  const Block& val):
3478  matrix_(new slip::Matrix<Block>(height,width,val))
3479  {}
3480 
3481  template<typename Block>
3482  inline
3484  const typename GenericMultiComponent2d<Block>::size_type width,
3485  const Block* val):
3486  matrix_(new slip::Matrix<Block>(height,width,val))
3487  {}
3488 
3489  template<typename Block>
3490  inline
3492  matrix_(new slip::Matrix<Block>((*rhs.matrix_)))
3493  {}
3494 
3495  template<typename Block>
3496  inline
3498  {
3499  delete matrix_;
3500  }
3501 
3502  template<typename Block>
3503  inline
3505  {
3506  if(this != &rhs)
3507  {
3508  *matrix_ = *(rhs.matrix_);
3509  }
3510  return *this;
3511  }
3512 
3513  template<typename Block>
3514  inline
3516  {
3517  std::fill_n(matrix_->begin(),matrix_->size(),val);
3518  return *this;
3519  }
3520 
3521  template<typename Block>
3522  inline
3524  {
3525  std::fill_n(matrix_->begin(),matrix_->size(),val);
3526  return *this;
3527  }
3528 
3529  template<typename Block>
3530  inline
3532  const typename GenericMultiComponent2d<Block>::size_type width,
3533  const Block& val)
3534  {
3535  matrix_->resize(height,width,val);
3536  }
3537 
3538  //----------------------------------
3539  template<typename Block>
3540  inline
3542  {
3543  return matrix_->begin();
3544  }
3545 
3546  template<typename Block>
3547  inline
3549  {
3550  return matrix_->end();
3551  }
3552 
3553  template<typename Block>
3554  inline
3556  {
3557  slip::Matrix<Block> const * tp(matrix_);
3558  return tp->begin();
3559  }
3560 
3561  template<typename Block>
3562  inline
3564  {
3565  slip::Matrix<Block> const * tp(matrix_);
3566  return tp->end();
3567  }
3568 
3569 
3570  template<typename Block>
3571  inline
3573  {
3574  return typename GenericMultiComponent2d<Block>::reverse_iterator(this->end());
3575  }
3576 
3577  template<typename Block>
3578  inline
3580  {
3581  return typename GenericMultiComponent2d<Block>::reverse_iterator(this->begin());
3582  }
3583 
3584  template<typename Block>
3585  inline
3587  {
3588  return typename GenericMultiComponent2d<Block>::const_reverse_iterator(this->end());
3589  }
3590 
3591  template<typename Block>
3592  inline
3594  {
3595  return typename GenericMultiComponent2d<Block>::const_reverse_iterator(this->begin());
3596  }
3597 
3598  template<typename Block>
3599  inline
3602  {
3603  return matrix_->row_begin(row);
3604  }
3605 
3606  template<typename Block>
3607  inline
3608  typename GenericMultiComponent2d<Block>::row_iterator
3609  GenericMultiComponent2d<Block>::row_end(const typename GenericMultiComponent2d<Block>::size_type row)
3610  {
3611  return matrix_->row_end(row);
3612  }
3613 
3614  template<typename Block>
3615  inline
3616  typename GenericMultiComponent2d<Block>::col_iterator
3617  GenericMultiComponent2d<Block>::col_begin(const typename GenericMultiComponent2d<Block>::size_type col)
3618  {
3619  return matrix_->col_begin(col);
3620  }
3621 
3622 
3623  template<typename Block>
3624  inline
3625  typename GenericMultiComponent2d<Block>::col_iterator
3626  GenericMultiComponent2d<Block>::col_end(const typename GenericMultiComponent2d<Block>::size_type col)
3627  {
3628  return matrix_->col_end(col);
3629  }
3630 
3631 
3632  template<typename Block>
3633  inline
3634  typename GenericMultiComponent2d<Block>::const_row_iterator
3635  GenericMultiComponent2d<Block>::row_begin(const typename GenericMultiComponent2d<Block>::size_type row) const
3636  {
3637  slip::Matrix<Block> const * tp(matrix_);
3638  return tp->row_begin(row);
3639  }
3640 
3641  template<typename Block>
3642  inline
3643  typename GenericMultiComponent2d<Block>::const_row_iterator
3644  GenericMultiComponent2d<Block>::row_end(const typename GenericMultiComponent2d<Block>::size_type row) const
3645  {
3646  slip::Matrix<Block> const * tp(matrix_);
3647  return tp->row_end(row);
3648  }
3649 
3650  template<typename Block>
3651  inline
3652  typename GenericMultiComponent2d<Block>::const_col_iterator GenericMultiComponent2d<Block>::col_begin(const typename GenericMultiComponent2d<Block>::size_type col) const
3653  {
3654  slip::Matrix<Block> const * tp(matrix_);
3655  return tp->col_begin(col);
3656  }
3657 
3658  template<typename Block>
3659  inline
3660  typename GenericMultiComponent2d<Block>::const_col_iterator GenericMultiComponent2d<Block>::col_end(const typename GenericMultiComponent2d<Block>::size_type col) const
3661  {
3662  slip::Matrix<Block> const * tp(matrix_);
3663  return tp->col_end(col);
3664  }
3665 
3666 
3667  template<typename Block>
3668  inline
3669  typename GenericMultiComponent2d<Block>::reverse_row_iterator
3670  GenericMultiComponent2d<Block>::row_rbegin(const typename GenericMultiComponent2d<Block>::size_type row)
3671  {
3672  return matrix_->row_rbegin(row);
3673  }
3674 
3675  template<typename Block>
3676  inline
3677  typename GenericMultiComponent2d<Block>::const_reverse_row_iterator
3678  GenericMultiComponent2d<Block>::row_rbegin(const typename GenericMultiComponent2d<Block>::size_type row) const
3679  {
3680  slip::Matrix<Block> const * tp(matrix_);
3681  return tp->row_rbegin(row);
3682  }
3683 
3684  template<typename Block>
3685  inline
3686  typename GenericMultiComponent2d<Block>::reverse_row_iterator GenericMultiComponent2d<Block>::row_rend(const typename GenericMultiComponent2d<Block>::size_type row)
3687  {
3688  return matrix_->row_rend(row);
3689  }
3690 
3691  template<typename Block>
3692  inline
3693  typename GenericMultiComponent2d<Block>::const_reverse_row_iterator
3694  GenericMultiComponent2d<Block>::row_rend(const typename GenericMultiComponent2d<Block>::size_type row) const
3695  {
3696  slip::Matrix<Block> const * tp(matrix_);
3697  return tp->row_rend(row);
3698  }
3699 
3700 
3701  template<typename Block>
3702  inline
3703  typename GenericMultiComponent2d<Block>::reverse_col_iterator GenericMultiComponent2d<Block>::col_rbegin(const typename GenericMultiComponent2d<Block>::size_type col)
3704  {
3705  return matrix_->col_rbegin(col);
3706  }
3707 
3708  template<typename Block>
3709  inline
3710  typename GenericMultiComponent2d<Block>::const_reverse_col_iterator GenericMultiComponent2d<Block>::col_rbegin(const typename GenericMultiComponent2d<Block>::size_type col) const
3711  {
3712  slip::Matrix<Block> const * tp(matrix_);
3713  return tp->col_rbegin(col);
3714  }
3715 
3716  template<typename Block>
3717  inline
3718  typename GenericMultiComponent2d<Block>::reverse_col_iterator
3719  GenericMultiComponent2d<Block>::col_rend(const typename GenericMultiComponent2d<Block>::size_type col)
3720  {
3721  return matrix_->col_rend(col);
3722  }
3723 
3724  template<typename Block>
3725  inline
3726  typename GenericMultiComponent2d<Block>::const_reverse_col_iterator
3727  GenericMultiComponent2d<Block>::col_rend(const typename GenericMultiComponent2d<Block>::size_type col) const
3728  {
3729  slip::Matrix<Block> const * tp(matrix_);
3730  return tp->col_rend(col);
3731  }
3732 
3733  template<typename Block>
3734  inline
3735  typename GenericMultiComponent2d<Block>::row_range_iterator
3736  GenericMultiComponent2d<Block>::row_begin(const typename GenericMultiComponent2d<Block>::size_type row, const slip::Range<int>& range)
3737  {
3738  return matrix_->row_begin(row,range);
3739  }
3740 
3741  template<typename Block>
3742  inline
3743  typename GenericMultiComponent2d<Block>::const_row_range_iterator
3744  GenericMultiComponent2d<Block>::row_begin(const typename GenericMultiComponent2d<Block>::size_type row,
3745  const slip::Range<int>& range) const
3746  {
3747  slip::Matrix<Block> const * tp(matrix_);
3748  return tp->row_begin(row,range);
3749  }
3750 
3751  template<typename Block>
3752  inline
3753  typename GenericMultiComponent2d<Block>::col_range_iterator
3754  GenericMultiComponent2d<Block>::col_begin(const typename GenericMultiComponent2d<Block>::size_type col,
3755  const slip::Range<int>& range)
3756  {
3757  return matrix_->col_begin(col,range);
3758  }
3759 
3760  template<typename Block>
3761  inline
3762  typename GenericMultiComponent2d<Block>::const_col_range_iterator
3763  GenericMultiComponent2d<Block>::col_begin(const typename GenericMultiComponent2d<Block>::size_type col,
3764  const slip::Range<int>& range) const
3765  {
3766  slip::Matrix<Block> const * tp(matrix_);
3767  return tp->col_begin(col,range);
3768  }
3769 
3770 
3771  template<typename Block>
3772  inline
3773  typename GenericMultiComponent2d<Block>::row_range_iterator
3774  GenericMultiComponent2d<Block>::row_end(const typename GenericMultiComponent2d<Block>::size_type row,
3775  const slip::Range<int>& range)
3776  {
3777  return matrix_->row_end(row,range);
3778  }
3779 
3780  template<typename Block>
3781  inline
3782  typename GenericMultiComponent2d<Block>::const_row_range_iterator
3783  GenericMultiComponent2d<Block>::row_end(const typename GenericMultiComponent2d<Block>::size_type row,
3784  const slip::Range<int>& range) const
3785  {
3786  slip::Matrix<Block> const * tp(matrix_);
3787  return tp->row_end(row,range);
3788  }
3789 
3790  template<typename Block>
3791  inline
3792  typename GenericMultiComponent2d<Block>::col_range_iterator
3793  GenericMultiComponent2d<Block>::col_end(const typename GenericMultiComponent2d<Block>::size_type col,
3794  const slip::Range<int>& range)
3795  {
3796  return matrix_->col_end(col,range);
3797  }
3798 
3799  template<typename Block>
3800  inline
3801  typename GenericMultiComponent2d<Block>::const_col_range_iterator
3802  GenericMultiComponent2d<Block>::col_end(const typename GenericMultiComponent2d<Block>::size_type col,
3803  const slip::Range<int>& range) const
3804  {
3805  slip::Matrix<Block> const * tp(matrix_);
3806  return tp->col_end(col,range);
3807  }
3808 
3809  template<typename Block>
3810  inline
3811  typename GenericMultiComponent2d<Block>::reverse_row_range_iterator
3812  GenericMultiComponent2d<Block>::row_rbegin(const typename GenericMultiComponent2d<Block>::size_type row,
3813  const slip::Range<int>& range)
3814  {
3815  return typename GenericMultiComponent2d<Block>::reverse_row_range_iterator(this->row_end(row,range));
3816  }
3817 
3818  template<typename Block>
3819  inline
3820  typename GenericMultiComponent2d<Block>::const_reverse_row_range_iterator
3821  GenericMultiComponent2d<Block>::row_rbegin(const typename GenericMultiComponent2d<Block>::size_type row,
3822  const slip::Range<int>& range) const
3823  {
3824  return typename GenericMultiComponent2d<Block>::const_reverse_row_range_iterator(this->row_end(row,range));
3825  }
3826 
3827 
3828  template<typename Block>
3829  inline
3830  typename GenericMultiComponent2d<Block>::reverse_col_range_iterator
3831  GenericMultiComponent2d<Block>::col_rbegin(const typename GenericMultiComponent2d<Block>::size_type col,
3832  const slip::Range<int>& range)
3833  {
3834  return typename GenericMultiComponent2d<Block>::reverse_col_range_iterator(this->col_end(col,range));
3835  }
3836 
3837  template<typename Block>
3838  inline
3839  typename GenericMultiComponent2d<Block>::const_reverse_col_range_iterator
3840  GenericMultiComponent2d<Block>::col_rbegin(const typename GenericMultiComponent2d<Block>::size_type col,
3841  const slip::Range<int>& range) const
3842  {
3843  return typename GenericMultiComponent2d<Block>::const_reverse_col_range_iterator(this->col_end(col,range));
3844  }
3845 
3846  template<typename Block>
3847  inline
3848  typename GenericMultiComponent2d<Block>::reverse_row_range_iterator
3849  GenericMultiComponent2d<Block>::row_rend(const typename GenericMultiComponent2d<Block>::size_type row,
3850  const slip::Range<int>& range)
3851  {
3852  return typename GenericMultiComponent2d<Block>::reverse_row_range_iterator(this->row_begin(row,range));
3853  }
3854 
3855  template<typename Block>
3856  inline
3857  typename GenericMultiComponent2d<Block>::const_reverse_row_range_iterator
3858  GenericMultiComponent2d<Block>::row_rend(const typename GenericMultiComponent2d<Block>::size_type row,
3859  const slip::Range<int>& range) const
3860  {
3861  return typename GenericMultiComponent2d<Block>::const_reverse_row_range_iterator(this->row_begin(row,range));
3862  }
3863 
3864 
3865  template<typename Block>
3866  inline
3867  typename GenericMultiComponent2d<Block>::reverse_col_range_iterator
3868  GenericMultiComponent2d<Block>::col_rend(const typename GenericMultiComponent2d<Block>::size_type col,
3869  const slip::Range<int>& range)
3870  {
3871  return typename GenericMultiComponent2d<Block>::reverse_col_range_iterator(this->col_begin(col,range));
3872  }
3873 
3874  template<typename Block>
3875  inline
3876  typename GenericMultiComponent2d<Block>::const_reverse_col_range_iterator
3877  GenericMultiComponent2d<Block>::col_rend(const typename GenericMultiComponent2d<Block>::size_type col,
3878  const slip::Range<int>& range) const
3879  {
3880  return typename GenericMultiComponent2d<Block>::const_reverse_col_range_iterator(this->col_begin(col,range));
3881  }
3882 
3883  template<typename Block>
3884  inline
3886  {
3887  return matrix_->upper_left();
3888  }
3889 
3890  template<typename Block>
3891  inline
3893  {
3894  slip::Matrix<Block> const * tp(matrix_);
3895  return tp->upper_left();
3896  }
3897 
3898 
3899  template<typename Block>
3900  inline
3902  {
3903  return matrix_->bottom_right();
3904  }
3905 
3906  template<typename Block>
3907  inline
3909  {
3910  slip::Matrix<Block> const * tp(matrix_);
3911  return tp->bottom_right();
3912  }
3913 
3914  template<typename Block>
3915  inline
3917  {
3918  return matrix_->upper_left(box);
3919  }
3920 
3921 
3922  template<typename Block>
3923  inline
3925  {
3926  slip::Matrix<Block> const * tp(matrix_);
3927  return tp->upper_left(box);
3928  }
3929 
3930  template<typename Block>
3931  inline
3933  {
3934  return matrix_->bottom_right(box);
3935  }
3936 
3937  template<typename Block>
3938  inline
3940  {
3941  slip::Matrix<Block> const * tp(matrix_);
3942  return tp->bottom_right(box);
3943  }
3944 
3945 
3946  template<typename Block>
3947  inline
3950  const Range<int>& col_range)
3951  {
3952  return matrix_->upper_left(row_range,col_range);
3953  }
3954 
3955  template<typename Block>
3956  inline
3959  const Range<int>& col_range) const
3960  {
3961  slip::Matrix<Block> const * tp(matrix_);
3962  return tp->upper_left(row_range,col_range);
3963  }
3964 
3965  template<typename Block>
3966  inline
3969  const Range<int>& col_range)
3970  {
3971  return matrix_->bottom_right(row_range,col_range);
3972  }
3973 
3974  template<typename Block>
3975  inline
3978  const Range<int>& col_range) const
3979  {
3980  slip::Matrix<Block> const * tp(matrix_);
3981  return tp->bottom_right(row_range,col_range);
3982  }
3983 
3984  template<typename Block>
3985  inline
3988  {
3989  return matrix_->upper_left(range);
3990  }
3991 
3992  template<typename Block>
3993  inline
3996  {
3997  slip::Matrix<Block> const * tp(matrix_);
3998  return tp->upper_left(range);
3999  }
4000 
4001  template<typename Block>
4002  inline
4005  {
4006  return matrix_->bottom_right(range);
4007  }
4008 
4009  template<typename Block>
4010  inline
4013  {
4014  slip::Matrix<Block> const * tp(matrix_);
4015  return tp->bottom_right(range);
4016  }
4017 
4018 
4019  template<typename Block>
4020  inline
4023  {
4024  return matrix_->rbottom_right();
4025  }
4026 
4027  template<typename Block>
4028  inline
4031  {
4032  slip::Matrix<Block> const * tp(matrix_);
4033  return tp->rbottom_right();
4034  }
4035 
4036  template<typename Block>
4037  inline
4040  {
4041  return matrix_->rupper_left();
4042  }
4043 
4044  template<typename Block>
4045  inline
4048  {
4049  slip::Matrix<Block> const * tp(matrix_);
4050  return tp->rupper_left();
4051  }
4052 
4053  template<typename Block>
4054  inline
4057  {
4058  return matrix_->rbottom_right(box);
4059  }
4060 
4061  template<typename Block>
4062  inline
4065  {
4066  slip::Matrix<Block> const * tp(matrix_);
4067  return tp->rbottom_right(box);
4068  }
4069 
4070  template<typename Block>
4071  inline
4074  {
4075  return matrix_->rupper_left(box);
4076  }
4077 
4078  template<typename Block>
4079  inline
4082  {
4083  slip::Matrix<Block> const * tp(matrix_);
4084  return tp->rupper_left(box);
4085  }
4086 
4087  template<typename Block>
4088  inline
4091  const Range<int>& col_range)
4092  {
4093  return matrix_->rupper_left(row_range,col_range);
4094  }
4095 
4096  template<typename Block>
4097  inline
4100  const Range<int>& col_range) const
4101  {
4102  slip::Matrix<Block> const * tp(matrix_);
4103  return tp->rupper_left(row_range,col_range);
4104  }
4105 
4106  template<typename Block>
4107  inline
4110  const Range<int>& col_range)
4111  {
4112  return matrix_->rbottom_right(row_range,col_range);
4113  }
4114 
4115  template<typename Block>
4116  inline
4119  const Range<int>& col_range) const
4120  {
4121  slip::Matrix<Block> const * tp(matrix_);
4122  return tp->rbottom_right(row_range,col_range);
4123  }
4124 
4125  template<typename Block>
4126  inline
4129  {
4130  return this->rupper_left(range,range);
4131  }
4132 
4133  template<typename Block>
4134  inline
4137  {
4138  slip::Matrix<Block> const * tp(matrix_);
4139  return tp->rupper_left(range,range);
4140  }
4141 
4142  template<typename Block>
4143  inline
4146  {
4147  return this->rbottom_right(range,range);
4148  }
4149 
4150  template<typename Block>
4151  inline
4154  {
4155  slip::Matrix<Block> const * tp(matrix_);
4156  return tp->rbottom_right(range,range);
4157  }
4158 
4159 
4160 
4161 
4162  //------------------------------------------------------------------
4163  template<typename Block>
4164  inline
4167  {
4168  return typename GenericMultiComponent2d<Block>::component_iterator((typename Block::pointer)begin() + component);
4169  }
4170 
4171  template<typename Block>
4172  inline
4173  typename GenericMultiComponent2d<Block>::component_iterator
4174  GenericMultiComponent2d<Block>::end(const typename GenericMultiComponent2d<Block>::size_type component)
4175  {
4176  return typename GenericMultiComponent2d<Block>::component_iterator((typename Block::pointer)end() + component);
4177  }
4178 
4179  template<typename Block>
4180  inline
4181  typename GenericMultiComponent2d<Block>::const_component_iterator
4182  GenericMultiComponent2d<Block>::begin(const typename GenericMultiComponent2d<Block>::size_type component) const
4183  {
4184  return typename GenericMultiComponent2d<Block>::const_component_iterator((typename Block::const_pointer)begin() + component);
4185  }
4186 
4187  template<typename Block>
4188  inline
4189  typename GenericMultiComponent2d<Block>::const_component_iterator
4190  GenericMultiComponent2d<Block>::end(const typename GenericMultiComponent2d<Block>::size_type component) const
4191  {
4192  return typename GenericMultiComponent2d<Block>::const_component_iterator((typename Block::const_pointer)end() + component);
4193  }
4194 
4195 
4196  template<typename Block>
4197  inline
4198  typename GenericMultiComponent2d<Block>::reverse_component_iterator
4199  GenericMultiComponent2d<Block>::rbegin(const typename GenericMultiComponent2d<Block>::size_type component)
4200  {
4201  return typename GenericMultiComponent2d<Block>::reverse_component_iterator(this->end(component));
4202  }
4203 
4204  template<typename Block>
4205  inline
4206  typename GenericMultiComponent2d<Block>::reverse_component_iterator
4207  GenericMultiComponent2d<Block>::rend(const typename GenericMultiComponent2d<Block>::size_type component)
4208  {
4209  return typename GenericMultiComponent2d<Block>::reverse_component_iterator(this->begin(component));
4210  }
4211 
4212  template<typename Block>
4213  inline
4214  typename GenericMultiComponent2d<Block>::const_reverse_component_iterator
4215  GenericMultiComponent2d<Block>::rbegin(const typename GenericMultiComponent2d<Block>::size_type component) const
4216  {
4217  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator(this->end(component));
4218  }
4219 
4220  template<typename Block>
4221  inline
4222  typename GenericMultiComponent2d<Block>::const_reverse_component_iterator
4223  GenericMultiComponent2d<Block>::rend(const typename GenericMultiComponent2d<Block>::size_type component) const
4224  {
4225  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator(this->begin(component));
4226  }
4227 
4228 
4229  template<typename Block>
4230  inline
4231  typename GenericMultiComponent2d<Block>::component_row_iterator
4232  GenericMultiComponent2d<Block>::row_begin(const typename GenericMultiComponent2d<Block>::size_type component,
4233  const typename GenericMultiComponent2d<Block>::size_type row)
4234  {
4235  return typename GenericMultiComponent2d<Block>::component_row_iterator((typename Block::pointer)this->row_begin(row) + component);
4236  }
4237 
4238  template<typename Block>
4239  inline
4240  typename GenericMultiComponent2d<Block>::component_row_iterator
4241  GenericMultiComponent2d<Block>::row_end(const typename GenericMultiComponent2d<Block>::size_type component,
4242  const typename GenericMultiComponent2d<Block>::size_type row)
4243  {
4244  return typename GenericMultiComponent2d<Block>::component_row_iterator((typename Block::pointer)this->row_end(row) + component);
4245  }
4246 
4247  template<typename Block>
4248  inline
4249  typename GenericMultiComponent2d<Block>::const_component_row_iterator
4250  GenericMultiComponent2d<Block>::row_begin(const typename GenericMultiComponent2d<Block>::size_type component,
4251  const typename GenericMultiComponent2d<Block>::size_type row) const
4252  {
4253  return typename GenericMultiComponent2d<Block>::const_component_row_iterator((typename Block::const_pointer)this->row_begin(row) + component);
4254  }
4255 
4256  template<typename Block>
4257  inline
4258  typename GenericMultiComponent2d<Block>::const_component_row_iterator
4259  GenericMultiComponent2d<Block>::row_end(const typename GenericMultiComponent2d<Block>::size_type component,
4260  const typename GenericMultiComponent2d<Block>::size_type row) const
4261  {
4262  return typename GenericMultiComponent2d<Block>::const_component_row_iterator((typename Block::const_pointer)this->row_end(row) + component);
4263  }
4264 
4265  template<typename Block>
4266  inline
4267  typename GenericMultiComponent2d<Block>::reverse_component_row_iterator
4268  GenericMultiComponent2d<Block>::row_rbegin(const typename GenericMultiComponent2d<Block>::size_type component,
4269  const typename GenericMultiComponent2d<Block>::size_type row)
4270  {
4271  return typename GenericMultiComponent2d<Block>::reverse_component_row_iterator(this->row_end(component,row));
4272  }
4273 
4274  template<typename Block>
4275  inline
4276  typename GenericMultiComponent2d<Block>::reverse_component_row_iterator
4277  GenericMultiComponent2d<Block>::row_rend(const typename GenericMultiComponent2d<Block>::size_type component,
4278  const typename GenericMultiComponent2d<Block>::size_type row)
4279  {
4280  return typename GenericMultiComponent2d<Block>::reverse_component_row_iterator(this->row_begin(component,row));
4281  }
4282 
4283  template<typename Block>
4284  inline
4285  typename GenericMultiComponent2d<Block>::const_reverse_component_row_iterator
4286  GenericMultiComponent2d<Block>::row_rbegin(const typename GenericMultiComponent2d<Block>::size_type component,
4287  const typename GenericMultiComponent2d<Block>::size_type row) const
4288  {
4289  return typename GenericMultiComponent2d<Block>::const_reverse_component_row_iterator(this->row_end(component,row));
4290  }
4291 
4292  template<typename Block>
4293  inline
4294  typename GenericMultiComponent2d<Block>::const_reverse_component_row_iterator
4295  GenericMultiComponent2d<Block>::row_rend(const typename GenericMultiComponent2d<Block>::size_type component,
4296  const typename GenericMultiComponent2d<Block>::size_type row) const
4297  {
4298  return typename GenericMultiComponent2d<Block>::const_reverse_component_row_iterator(this->row_begin(component,row));
4299  }
4300 
4301  template<typename Block>
4302  inline
4304  GenericMultiComponent2d<Block>::col_begin(const typename GenericMultiComponent2d<Block>::size_type component,
4305  const typename GenericMultiComponent2d<Block>::size_type col)
4306  {
4307  return slip::stride_iterator<typename GenericMultiComponent2d<Block>::block_pointer>(&((*this)[0][col][component]), Block::SIZE * this->dim2());
4308  }
4309 
4310 
4311 
4312  template<typename Block>
4313  inline
4315  GenericMultiComponent2d<Block>::col_begin(const typename GenericMultiComponent2d<Block>::size_type component,
4316  const typename GenericMultiComponent2d<Block>::size_type col) const
4317  {
4318  return slip::stride_iterator<typename GenericMultiComponent2d<Block>::const_block_pointer>(&((*this)[0][col][component]), Block::SIZE * this->dim2());
4319  }
4320 
4321 
4322  template<typename Block>
4323  inline
4325  GenericMultiComponent2d<Block>::col_end(const typename GenericMultiComponent2d<Block>::size_type component,
4326  const typename GenericMultiComponent2d<Block>::size_type col)
4327  {
4328  return ++(slip::stride_iterator<typename GenericMultiComponent2d<Block>::block_pointer>(&((*this)[this->dim1()-1][col][component]), Block::SIZE * this->dim2()));
4329  }
4330 
4331 
4332  template<typename Block>
4333  inline
4335  GenericMultiComponent2d<Block>::col_end(const typename GenericMultiComponent2d<Block>::size_type component,
4336  const typename GenericMultiComponent2d<Block>::size_type col) const
4337  {
4338  return ++slip::stride_iterator<typename GenericMultiComponent2d<Block>::const_block_pointer>(&((*this)[this->dim1()-1][col][component]), Block::SIZE * this->dim2());
4339  }
4340 
4341 
4342  template<typename Block>
4343  inline
4344  typename GenericMultiComponent2d<Block>::reverse_component_col_iterator
4345  GenericMultiComponent2d<Block>::col_rbegin(const typename GenericMultiComponent2d<Block>::size_type component,
4346  const typename GenericMultiComponent2d<Block>::size_type col)
4347  {
4348  return typename GenericMultiComponent2d<Block>::reverse_component_col_iterator(this->col_end(component,col));
4349  }
4350 
4351  template<typename Block>
4352  inline
4353  typename GenericMultiComponent2d<Block>::reverse_component_col_iterator
4354  GenericMultiComponent2d<Block>::col_rend(const typename GenericMultiComponent2d<Block>::size_type component,
4355  const typename GenericMultiComponent2d<Block>::size_type col)
4356  {
4357  return typename GenericMultiComponent2d<Block>::reverse_component_col_iterator(this->col_begin(component,col));
4358  }
4359 
4360  template<typename Block>
4361  inline
4362  typename GenericMultiComponent2d<Block>::const_reverse_component_col_iterator
4363  GenericMultiComponent2d<Block>::col_rbegin(const typename GenericMultiComponent2d<Block>::size_type component,
4364  const typename GenericMultiComponent2d<Block>::size_type col) const
4365  {
4366  return typename GenericMultiComponent2d<Block>::const_reverse_component_col_iterator(this->col_end(component,col));
4367  }
4368 
4369  template<typename Block>
4370  inline
4371  typename GenericMultiComponent2d<Block>::const_reverse_component_col_iterator
4372  GenericMultiComponent2d<Block>::col_rend(const typename GenericMultiComponent2d<Block>::size_type component,
4373  const typename GenericMultiComponent2d<Block>::size_type col) const
4374  {
4375  return typename GenericMultiComponent2d<Block>::const_reverse_component_col_iterator(this->col_begin(component,col));
4376  }
4377 
4378  template<typename Block>
4379  inline
4380  typename GenericMultiComponent2d<Block>::component_row_range_iterator
4381  GenericMultiComponent2d<Block>::row_begin(const std::size_t component, const size_type row,
4382  const slip::Range<int>& range)
4383  {
4384  return slip::stride_iterator<typename GenericMultiComponent2d<Block>::block_pointer>(&((*this)[row][range.start()][component]), Block::SIZE * range.stride());
4385  }
4386 
4387  template<typename Block>
4388  inline
4390  GenericMultiComponent2d<Block>::row_end(const std::size_t component, const size_type row,
4391  const slip::Range<int>& range)
4392  {
4393  return ++(slip::stride_iterator<typename GenericMultiComponent2d<Block>::block_pointer>(&((*this)[row][range.stop()][component]), Block::SIZE * range.stride()));
4394  }
4395 
4396  template<typename Block>
4397  inline
4399  GenericMultiComponent2d<Block>::row_begin(const std::size_t component, const size_type row,
4400  const slip::Range<int>& range) const
4401  {
4402  return slip::stride_iterator<typename GenericMultiComponent2d<Block>::const_block_pointer>(&((*this)[row][range.start()][component]), Block::SIZE * range.stride());
4403  }
4404 
4405  template<typename Block>
4406  inline
4408  GenericMultiComponent2d<Block>::row_end(const std::size_t component, const size_type row,
4409  const slip::Range<int>& range) const
4410  {
4411  return ++(slip::stride_iterator<typename GenericMultiComponent2d<Block>::const_block_pointer>(&((*this)[row][range.stop()][component]), Block::SIZE * range.stride()));
4412  }
4413 
4414  template<typename Block>
4415  inline
4417  GenericMultiComponent2d<Block>::col_begin(const std::size_t component, const size_type col,
4418  const slip::Range<int>& range)
4419  {
4420  return slip::stride_iterator<typename GenericMultiComponent2d<Block>::block_pointer>(&((*this)[range.start()][col][component]), Block::SIZE * this->dim2() * range.stride());
4421  }
4422 
4423  template<typename Block>
4424  inline
4426  GenericMultiComponent2d<Block>::col_end(const std::size_t component, const size_type col,
4427  const slip::Range<int>& range)
4428  {
4429  return ++(slip::stride_iterator<typename GenericMultiComponent2d<Block>::block_pointer>(&((*this)[range.stop()][col][component]), Block::SIZE * this->dim2() * range.stride()));
4430  }
4431 
4432  template<typename Block>
4433  inline
4435  GenericMultiComponent2d<Block>::col_begin(const std::size_t component, const size_type col,
4436  const slip::Range<int>& range) const
4437  {
4438  return slip::stride_iterator<typename GenericMultiComponent2d<Block>::const_block_pointer>(&((*this)[range.start()][col][component]), Block::SIZE * this->dim2() * range.stride());
4439  }
4440 
4441  template<typename Block>
4442  inline
4444  GenericMultiComponent2d<Block>::col_end(const std::size_t component, const size_type col,
4445  const slip::Range<int>& range) const
4446  {
4447  return ++(slip::stride_iterator<typename GenericMultiComponent2d<Block>::const_block_pointer>(&((*this)[range.stop()][col][component]), Block::SIZE * this->dim2() * range.stride()));
4448  }
4449 
4450  template<typename Block>
4451  inline
4453  GenericMultiComponent2d<Block>::row_rbegin(const std::size_t component, const size_type row,
4454  const slip::Range<int>& range)
4455  {
4456  return typename GenericMultiComponent2d<Block>::reverse_component_row_range_iterator(this->row_end(component,row,range));
4457  }
4458 
4459  template<typename Block>
4460  inline
4462  GenericMultiComponent2d<Block>::row_rend(const std::size_t component, const size_type row,
4463  const slip::Range<int>& range)
4464  {
4465  return typename GenericMultiComponent2d<Block>::reverse_component_row_range_iterator(this->row_begin(component,row,range));
4466  }
4467 
4468  template<typename Block>
4469  inline
4471  GenericMultiComponent2d<Block>::row_rbegin(const std::size_t component, const size_type row,
4472  const slip::Range<int>& range) const
4473  {
4474  return typename GenericMultiComponent2d<Block>::const_reverse_component_row_range_iterator(this->row_end(component,row,range));
4475  }
4476 
4477  template<typename Block>
4478  inline
4480  GenericMultiComponent2d<Block>::row_rend(const std::size_t component, const size_type row,
4481  const slip::Range<int>& range) const
4482  {
4483  return typename GenericMultiComponent2d<Block>::const_reverse_component_row_range_iterator(this->row_begin(component,row,range));
4484  }
4485 
4486  template<typename Block>
4487  inline
4489  GenericMultiComponent2d<Block>::col_rbegin(const std::size_t component, const size_type col,
4490  const slip::Range<int>& range)
4491  {
4492  return typename GenericMultiComponent2d<Block>::reverse_component_col_range_iterator(this->col_end(component,col,range));
4493  }
4494 
4495  template<typename Block>
4496  inline
4498  GenericMultiComponent2d<Block>::col_rend(const std::size_t component, const size_type col,
4499  const slip::Range<int>& range)
4500  {
4501  return typename GenericMultiComponent2d<Block>::reverse_component_col_range_iterator(this->col_begin(component,col,range));
4502  }
4503 
4504 
4505  template<typename Block>
4506  inline
4508  GenericMultiComponent2d<Block>::col_rbegin(const std::size_t component, const size_type col,
4509  const slip::Range<int>& range) const
4510  {
4511  return typename GenericMultiComponent2d<Block>::const_reverse_component_col_range_iterator(this->col_end(component,col,range));
4512  }
4513 
4514  template<typename Block>
4515  inline
4517  GenericMultiComponent2d<Block>::col_rend(const std::size_t component, const size_type col,
4518  const slip::Range<int>& range) const
4519  {
4520  return typename GenericMultiComponent2d<Block>::const_reverse_component_col_range_iterator(this->col_begin(component,col,range));
4521  }
4522 
4523  template<typename Block>
4524  inline
4526  GenericMultiComponent2d<Block>::upper_left(const std::size_t component)
4527  {
4528  return typename GenericMultiComponent2d<Block>::component_iterator2d(this,component,Box2d<int>(0,0,this->dim1()-1,this->dim2()-1));
4529  }
4530 
4531  template<typename Block>
4532  inline
4535  {
4536  DPoint2d<int> dp(this->dim1(),this->dim2());
4537  typename GenericMultiComponent2d<Block>::component_iterator2d it = (*this).upper_left(component) + dp;
4538  return it;
4539  }
4540 
4541  template<typename Block>
4542  inline
4544  GenericMultiComponent2d<Block>::upper_left(const std::size_t component) const
4545  {
4546  return typename GenericMultiComponent2d<Block>::const_component_iterator2d(this,component,Box2d<int>(0,0,this->dim1()-1,this->dim2()-1));
4547  }
4548 
4549  template<typename Block>
4550  inline
4552  GenericMultiComponent2d<Block>::bottom_right(const std::size_t component) const
4553  {
4554  DPoint2d<int> dp(this->dim1(),this->dim2());
4555  typename GenericMultiComponent2d<Block>::const_component_iterator2d it = (*this).upper_left(component) + dp;
4556  return it;
4557  }
4558 
4559  template<typename Block>
4560  inline
4562  GenericMultiComponent2d<Block>::rupper_left(const std::size_t component)
4563  {
4564  DPoint2d<int> dp(1,0);
4565  return typename GenericMultiComponent2d<Block>::reverse_component_iterator2d(this->bottom_right(component) - dp);
4566  }
4567 
4568  template<typename Block>
4569  inline
4572  {
4573  return typename GenericMultiComponent2d<Block>::reverse_component_iterator2d(this->upper_left(component));
4574  }
4575 
4576  template<typename Block>
4577  inline
4579  GenericMultiComponent2d<Block>::rupper_left(const std::size_t component) const
4580  {
4581  DPoint2d<int> dp(1,0);
4582  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator2d(this->bottom_right(component) - dp);
4583  }
4584 
4585  template<typename Block>
4586  inline
4588  GenericMultiComponent2d<Block>::rbottom_right(const std::size_t component) const
4589  {
4590  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator2d(this->upper_left(component));
4591  }
4592 
4593 
4594  template<typename Block>
4595  inline
4597  GenericMultiComponent2d<Block>::upper_left(const std::size_t component,
4598  const slip::Box2d<int>& box)
4599  {
4600  return typename GenericMultiComponent2d<Block>::component_iterator2d(this,component,box);
4601  }
4602 
4603  template<typename Block>
4604  inline
4606  GenericMultiComponent2d<Block>::bottom_right(const std::size_t component,
4607  const slip::Box2d<int>& box)
4608  {
4609  DPoint2d<int> dp(box.height(),box.width());
4610  return (typename GenericMultiComponent2d<Block>::component_iterator2d((*this).upper_left(component,box) + dp));
4611  }
4612 
4613  template<typename Block>
4614  inline
4616  GenericMultiComponent2d<Block>::upper_left(const std::size_t component,
4617  const slip::Box2d<int>& box) const
4618  {
4619  return typename GenericMultiComponent2d<Block>::const_component_iterator2d(this,component,box);
4620  }
4621 
4622  template<typename Block>
4623  inline
4625  GenericMultiComponent2d<Block>::bottom_right(const std::size_t component,
4626  const slip::Box2d<int>& box) const
4627  {
4628  DPoint2d<int> dp(box.height(),box.width());
4629  return (typename GenericMultiComponent2d<Block>::const_component_iterator2d((*this).upper_left(component,box) + dp));
4630  }
4631 
4632  template<typename Block>
4633  inline
4635  GenericMultiComponent2d<Block>::upper_left(const std::size_t component,
4636  const slip::Range<int>& row_range,
4637  const slip::Range<int>& col_range)
4638  {
4639  return typename GenericMultiComponent2d<Block>::component_iterator2d_range(this,component,row_range,col_range);
4640  }
4641 
4642  template<typename Block>
4643  inline
4645  GenericMultiComponent2d<Block>::bottom_right(const std::size_t component,
4646  const slip::Range<int>& row_range,
4647  const slip::Range<int>& col_range)
4648  {
4649  DPoint2d<int> dp(row_range.iterations()+1,col_range.iterations()+1);
4650  return typename GenericMultiComponent2d<Block>::component_iterator2d_range((*this).upper_left(component,row_range,col_range) + dp);
4651  }
4652 
4653  template<typename Block>
4654  inline
4656  GenericMultiComponent2d<Block>::upper_left(const std::size_t component,
4657  const slip::Range<int>& row_range,
4658  const slip::Range<int>& col_range) const
4659  {
4660  return typename GenericMultiComponent2d<Block>::const_component_iterator2d_range(this,component,row_range,col_range);
4661  }
4662 
4663  template<typename Block>
4664  inline
4666  GenericMultiComponent2d<Block>::bottom_right(const std::size_t component,
4667  const slip::Range<int>& row_range,
4668  const slip::Range<int>& col_range) const
4669  {
4670  DPoint2d<int> dp(row_range.iterations()+1,col_range.iterations()+1);
4671  return typename GenericMultiComponent2d<Block>::const_component_iterator2d_range((*this).upper_left(component,row_range,col_range) + dp);
4672  }
4673 
4674  template<typename Block>
4675  inline
4678  const slip::Box2d<int>& box)
4679  {
4680  return typename GenericMultiComponent2d<Block>::reverse_component_iterator2d(this->upper_left(component,box));
4681  }
4682 
4683  template<typename Block>
4684  inline
4686  GenericMultiComponent2d<Block>::rupper_left(const std::size_t component,
4687  const slip::Box2d<int>& box)
4688  {
4689  slip::DPoint2d<int> dp(1,0);
4690  return typename GenericMultiComponent2d<Block>::reverse_component_iterator2d(this->bottom_right(component,box) - dp);
4691  }
4692 
4693  template<typename Block>
4694  inline
4697  const slip::Box2d<int>& box) const
4698  {
4699  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator2d(this->upper_left(component,box));
4700  }
4701 
4702  template<typename Block>
4703  inline
4705  GenericMultiComponent2d<Block>::rupper_left(const std::size_t component,
4706  const slip::Box2d<int>& box) const
4707  {
4708  slip::DPoint2d<int> dp(1,0);
4709  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator2d(this->bottom_right(component,box) - dp);
4710  }
4711 
4712  template<typename Block>
4713  inline
4716  const slip::Range<int>& row_range,
4717  const slip::Range<int>& col_range)
4718  {
4719  return typename GenericMultiComponent2d<Block>::reverse_component_iterator2d_range(this->upper_left(component,row_range,col_range));
4720  }
4721 
4722  template<typename Block>
4723  inline
4725  GenericMultiComponent2d<Block>::rupper_left(const std::size_t component,
4726  const slip::Range<int>& row_range,
4727  const slip::Range<int>& col_range)
4728  {
4729  slip::DPoint2d<int> dp(1,0);
4730  return typename GenericMultiComponent2d<Block>::reverse_component_iterator2d_range(this->bottom_right(component,row_range,col_range) - dp);
4731  }
4732 
4733  template<typename Block>
4734  inline
4737  const slip::Range<int>& row_range,
4738  const slip::Range<int>& col_range) const
4739  {
4740  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator2d_range(this->upper_left(component,row_range,col_range));
4741  }
4742 
4743  template<typename Block>
4744  inline
4746  GenericMultiComponent2d<Block>::rupper_left(const std::size_t component,
4747  const slip::Range<int>& row_range,
4748  const slip::Range<int>& col_range) const
4749  {
4750  slip::DPoint2d<int> dp(1,0);
4751  return typename GenericMultiComponent2d<Block>::const_reverse_component_iterator2d_range(this->bottom_right(component,row_range,col_range) - dp);
4752  }
4753 
4754 
4755 
4756 
4757 
4758  template <typename Block>
4759  inline
4760  std::ostream& operator<<(std::ostream & out,
4762  {
4763  out<<*(a.matrix_)<<std::endl;
4764  return out;
4765  }
4766 
4767  template<typename Block>
4768  inline
4769  typename GenericMultiComponent2d<Block>::pointer GenericMultiComponent2d<Block>::operator[](const typename GenericMultiComponent2d<Block>::size_type i)
4770  {
4771  return (*matrix_)[i];
4772  }
4773 
4774  template<typename Block>
4775  inline
4776  typename GenericMultiComponent2d<Block>::const_pointer GenericMultiComponent2d<Block>::operator[](const typename GenericMultiComponent2d<Block>::size_type i) const
4777  {
4778  return (*matrix_)[i];
4779  }
4780 
4781  template<typename Block>
4782  inline
4783  typename GenericMultiComponent2d<Block>::reference GenericMultiComponent2d<Block>::operator()(const typename GenericMultiComponent2d<Block>::size_type i,
4784  const typename GenericMultiComponent2d<Block>::size_type j)
4785  {
4786  return (*matrix_)[i][j];
4787  }
4788 
4789  template<typename Block>
4790  inline
4791  typename GenericMultiComponent2d<Block>::const_reference GenericMultiComponent2d<Block>::operator()(const typename GenericMultiComponent2d<Block>::size_type i,
4792  const typename GenericMultiComponent2d<Block>::size_type j) const
4793  {
4794  return (*matrix_)[i][j];
4795  }
4796 
4797  template<typename Block>
4798  inline
4799  typename GenericMultiComponent2d<Block>::reference GenericMultiComponent2d<Block>::operator()(const Point2d<typename GenericMultiComponent2d<Block>::size_type>& point2d)
4800  {
4801  return (*matrix_)(point2d);
4802  }
4803 
4804  template<typename Block>
4805  inline
4806  typename GenericMultiComponent2d<Block>::const_reference GenericMultiComponent2d<Block>::operator()(const Point2d<typename GenericMultiComponent2d<Block>::size_type>& point2d) const
4807  {
4808  return (*matrix_)(point2d);
4809  }
4810 
4811  template<typename Block>
4812  inline
4813  GenericMultiComponent2d<Block>
4815  const Range<int>& col_range)
4816  {
4817  assert((*this)[0] != 0);
4818  assert(row_range.is_valid());
4819  assert(row_range.start() < int(this->dim2()));
4820  assert(row_range.stop() < int(this->dim2()));
4821  assert(col_range.is_valid());
4822  assert(col_range.start() < int(this->dim1()));
4823  assert(col_range.stop() < int(this->dim1()));
4824  std::size_t rows = row_range.iterations();
4825  std::size_t cols = col_range.iterations();
4826  return GenericMultiComponent2d<Block>(rows+1,cols+1,matrix_->upper_left(row_range,col_range),
4827  matrix_->bottom_right(row_range,col_range));
4828  }
4829 
4830  template<typename Block>
4831  inline
4833 
4834  template<typename Block>
4835  inline
4837 
4838  template<typename Block>
4839  inline
4841 
4842  template<typename Block>
4843  inline
4845 
4846  template<typename Block>
4847  inline
4849 
4850  template<typename Block>
4851  inline
4853 
4854  template<typename Block>
4855  inline
4857 
4858  template<typename Block>
4859  inline
4861 
4862  template<typename Block>
4863  inline
4865 
4866 
4867  template<typename Block>
4868  inline
4869  bool GenericMultiComponent2d<Block>::empty()const {return matrix_->empty();}
4870 
4871  template<typename Block>
4872  inline
4874  {
4875  matrix_->swap(*(M.matrix_));
4876  }
4877 
4878 
4879 
4880  template<typename Block>
4881  inline
4883  {
4884  Block tmp;
4885  for(typename GenericMultiComponent2d<Block>::size_type component = 0; component < Block::SIZE; ++component)
4886  {
4887  typename Block::value_type min = *std::min_element(this->begin(component),this->end(component));
4888  tmp[component] = min;
4889  }
4890  return tmp;
4891  }
4892 
4893 
4894  template<typename Block>
4895  inline
4897  {
4898  Block tmp;
4899  for(typename GenericMultiComponent2d<Block>::size_type component = 0; component < Block::SIZE; ++component)
4900  {
4901  typename Block::value_type max = *std::max_element(this->begin(component),this->end(component));
4902  tmp[component] = max;
4903  }
4904  return tmp;
4905  }
4906 
4907 
4908  template<typename Block>
4909  inline
4911  {
4912  matrix_->apply(fun);
4913  return *this;
4914  }
4915 
4916  template<typename Block>
4917  inline
4919  {
4920  matrix_->apply(fun);
4921  return *this;
4922  }
4923 
4924 
4925  template<typename Block>
4926  inline
4929  {
4930  return ( x.size() == y.size()
4931  && std::equal(x.begin(),x.end(),y.begin()));
4932  }
4933 
4934  template<typename Block>
4935  inline
4938  {
4939  return !(x == y);
4940  }
4941 
4942 
4943  // template<typename Block>
4944 // inline
4945 // bool operator<(const GenericMultiComponent2d<Block>& x,
4946 // const GenericMultiComponent2d<Block>& y)
4947 // {
4948 // return std::lexicographical_compare(x.begin(), x.end(),
4949 // y.begin(), y.end());
4950 // }
4951 
4952 // template<typename Block>
4953 // inline
4954 // bool operator>(const GenericMultiComponent2d<Block>& x,
4955 // const GenericMultiComponent2d<Block>& y)
4956 // {
4957 // return (y < x);
4958 // }
4959 
4960 
4961 // template<typename Block>
4962 // inline
4963 // bool operator<=(const GenericMultiComponent2d<Block>& x,
4964 // const GenericMultiComponent2d<Block>& y)
4965 // {
4966 // return !(y < x);
4967 // }
4968 
4969 
4970 // template<typename Block>
4971 // inline
4972 // bool operator>=(const GenericMultiComponent2d<Block>& x,
4973 // const GenericMultiComponent2d<Block>& y)
4974 // {
4975 // return !(x < y);
4976 // }
4977 
4978 
4979 
4980 
4981 
4982 }//slip::
4983 
4984 #endif //SLIP_GENERICMULTICOMPONENT2D_HPP
bool operator!=(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1448
std::size_t iterations() const
Rerturns the number of iterations of the range.
Definition: Range.hpp:305
reverse_iterator rbegin()
Returns a read/write reverse iterator that points to the last element in the GenericMultiComponent2d...
Provides a class to modelize the difference of slip::Point2d.
CoordType height() const
compute the height of the Box2d.
Definition: Box2d.hpp:378
void fill(const Block *value)
Fills the container range [begin(),begin()+size()) with a copy of the value array.
iterator2d upper_left()
Returns a read/write iterator2d that points to the first element of the Matrix. It points to the uppe...
Definition: Matrix.hpp:3135
iterator begin()
Returns a read/write iterator that points to the first element in the GenericMultiComponent2d. Iteration is done in ordinary element order.
std::reverse_iterator< component_col_iterator > reverse_component_col_iterator
This is a GenericMultiComponent2d class. This container statisfies the BidirectionnalContainer concep...
Block min() const
Returns the min elements of the GenericMultiComponent2d according to the operator <...
std::reverse_iterator< const_component_col_iterator > const_reverse_component_col_iterator
reference operator()(const size_type i, const size_type j)
Subscript access to the data contained in the GenericMultiComponent2d.
size_type cols() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
slip::kstride_iterator< typename Block::const_pointer, Block::SIZE > const_component_iterator
std::reverse_iterator< const_iterator > const_reverse_row_iterator
slip::Matrix< Block >::iterator2d_range iterator2d_range
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 GenericMul...
slip::stride_iterator< const_block_pointer > const_component_col_iterator
slip::component_iterator2d_box< self, Block::SIZE > component_iterator2d
void resize(const size_type height, const size_type width, const Block &val=Block())
Resizes a GenericMultiComponent2d.
const GenericMultiComponent2d< Block > const_self
std::reverse_iterator< const_component_iterator2d > const_reverse_component_iterator2d
Provides a class to manipulate 2d box.
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 GenericMu...
std::reverse_iterator< const_component_col_range_iterator > const_reverse_component_col_range_iterator
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
Definition: Array2d.hpp:119
This is a Vector3d struct. It is a specialization of kvector. It implements some specific 3d operatio...
Definition: Vector3d.hpp:96
iterator2d bottom_right()
Returns a read/write iterator2d that points to the past the end element of the Matrix. It points to past the end element of the bottom right element of the Matrix.
Definition: Matrix.hpp:3151
T & min(const GrayscaleImage< T > &M1)
Returns the min element of a GrayscaleImage.
reverse_iterator2d rupper_left()
Returns a read/write reverse iterator2d. It points to the bottom right element of the GenericMultiCom...
iterator begin()
Returns a read/write iterator that points to the first element in the Matrix. Iteration is done in or...
Definition: Matrix.hpp:2789
Provides a class to manipulate iterator2d within a slip::Box2d. It is used to iterate throw 2d contai...
Block max() const
Returns the max elements of the GenericMultiComponent2d according to the operator <...
size_type dim2() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
std::reverse_iterator< component_col_range_iterator > reverse_component_col_range_iterator
CoordType width() const
compute the width of the Box2d.
Definition: Box2d.hpp:374
slip::stride_iterator< const_pointer > const_col_iterator
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 GenericMultiComp...
reverse_iterator rend()
Returns a read/write reverse iterator that points to one before the first element in the GenericMulti...
const block_value_type const_block_reference
std::reverse_iterator< col_iterator > reverse_col_iterator
bool empty() const
Returns true if the GenericMultiComponent2d is empty. (Thus size() == 0)
size_type size() const
Returns the number of elements in the GenericMultiComponent2d.
slip::stride_iterator< const_block_pointer > const_component_col_range_iterator
const block_value_type * const_block_pointer
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 GenericMulti...
void swap(self &M)
Swaps data with another GenericMultiComponent2d.
Provides a class to iterate a 1d range according to a constant step.
GenericMultiComponent2d< Block > & apply(Block(*fun)(Block))
Returns the sums of the elements of the GenericMultiComponent2d.
std::reverse_iterator< const_iterator > const_reverse_iterator
slip::stride_iterator< pointer > col_iterator
std::reverse_iterator< row_range_iterator > reverse_row_range_iterator
Provides some algorithms to compare ranges.
std::reverse_iterator< const_col_range_iterator > const_reverse_col_range_iterator
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
self & operator=(const self &rhs)
Assign a GenericMultiComponent2d.
This is a point2d class, a specialized version of Point<CoordType,DIM> with DIM = 2...
Definition: Array2d.hpp:132
This is some iterator to iterate a 2d MultiComponentContainer into a Box area defined by the indices ...
size_type height() const
Returns the height (first dimension size) in the GenericMultiComponent2d.
size_type dim1() const
Returns the number of rows (first dimension size) in the GenericMultiComponent2d. ...
std::reverse_iterator< const_iterator2d > const_reverse_iterator2d
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
slip::const_component_iterator2d_range< const_self, Block::SIZE > const_component_iterator2d_range
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 ...
slip::Matrix< Block >::const_iterator2d const_iterator2d
void fill(std::size_t component, InputIterator first, InputIterator last)
Fills the container range [begin(),begin()+size()) with a copy of the range [first,last)
Provides a class to iterate a 2d multicomponent container into two Ranges.
std::reverse_iterator< const_col_iterator > const_reverse_col_iterator
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 Ge...
std::reverse_iterator< const_iterator2d_range > const_reverse_iterator2d_range
void fill(InputIterator first, InputIterator last)
Fills the container range [begin(),begin()+size()) with a copy of the range [first,last)
std::reverse_iterator< component_iterator > reverse_component_iterator
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
std::reverse_iterator< const_component_row_iterator > const_reverse_component_row_iterator
SubType start() const
Accessor of the start subscript of the Range.
Definition: Range.hpp:284
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 Generi...
Provides a class to iterate a 2d MultiComponentContainer into a slip::Box2d.
slip::stride_iterator< block_pointer > component_col_range_iterator
slip::stride_iterator< const_col_iterator > const_col_range_iterator
std::reverse_iterator< component_row_range_iterator > reverse_component_row_range_iterator
std::reverse_iterator< const_row_range_iterator > const_reverse_row_range_iterator
iterator2d upper_left()
Returns a read/write iterator2d that points to the first element of the GenericMultiComponent2d. It points to the upper left element of the GenericMultiComponent2d.
This is some iterator to iterate a 2d container into a slip::Box2d area defined by the indices of the...
Definition: Array2d.hpp:116
slip::Matrix< Block >::const_iterator2d_range const_iterator2d_range
virtual ~GenericMultiComponent2d()
Destructor of the GenericMultiComponent2d.
Numerical matrix class. This container statisfies the BidirectionnalContainer concepts of the STL...
This is some iterator to iterate a 2d MultiComponentContainer into a Box area defined by the indices ...
void fill(const Block &value)
Fills the container range [begin(),begin()+size()) with copies of value.
reverse_iterator2d rupper_left()
Returns a read/write reverse iterator2d. It points to the bottom right element of the Matrix...
Definition: Matrix.hpp:3289
slip::stride_iterator< const_block_pointer > const_component_row_range_iterator
slip::stride_iterator< col_iterator > col_range_iterator
std::reverse_iterator< component_iterator2d > reverse_component_iterator2d
std::ostream & operator<<(std::ostream &out, const Array< T > &a)
Definition: Array.hpp:1282
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
GenericMultiComponent2d()
Constructs a GenericMultiComponent2d.
std::reverse_iterator< const_component_row_range_iterator > const_reverse_component_row_range_iterator
pointer operator[](const size_type i)
Subscript access to the row datas contained in the GenericMultiComponent2d.
size_type columns() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
iterator end()
Returns a read/write iterator that points one past the last element in the GenericMultiComponent2d. Iteration is done in ordinary element order.
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 Gen...
slip::stride_iterator< block_pointer > component_col_iterator
slip::stride_iterator< const_pointer > const_row_range_iterator
pointer iterator
Definition: Matrix.hpp:206
size_type max_size() const
Returns the maximal size (number of elements) in the GenericMultiComponent2d.
This is some iterator to iterate a 2d container into two Range defined by the indices and strides of ...
Definition: Array2d.hpp:125
iterator end()
Returns a read/write iterator that points one past the last element in the Matrix. Iteration is done in ordinary element order.
Definition: Matrix.hpp:2796
std::reverse_iterator< iterator > reverse_iterator
size_type width() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
int stride() const
Accessor of the stride of the Range.
Definition: Range.hpp:298
slip::const_component_iterator2d_box< const_self, Block::SIZE > const_component_iterator2d
GenericMultiComponent2d(const size_type height, const size_type width, std::vector< InputIterator > first_iterators_list, InputIterator last)
Contructs a GenericMultiComponent2d from a 3 ranges.
Provides a class to manipulate Numerical Matrix.
slip::Matrix< Block >::iterator2d iterator2d
Provides some algorithms to apply C like functions to ranges.
Provides a class to modelize 2d points.
std::reverse_iterator< component_iterator2d_range > reverse_component_iterator2d_range
GenericMultiComponent2d(const size_type height, const size_type width, InputIterator first, InputIterator last)
Contructs a GenericMultiComponent2d from a range.
Provides a class to iterate a 1d range according to a step.
void fill(std::vector< InputIterator > first_iterators_list, InputIterator last)
Fills the container range [begin(),begin()+size()) with a copy of the range [first,last)
size_type rows() const
Returns the number of rows (first dimension size) in the GenericMultiComponent2d. ...
reverse_iterator2d rbottom_right()
Returns a read/write reverse iterator2d. It points to past the upper left element of the GenericMulti...
slip::kstride_iterator< typename Block::pointer, Block::SIZE > component_iterator
void fill(const typename Block::pointer value)
Fills the container range [begin(),begin()+size()) with a copy of the value array.
bool operator==(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1439
std::reverse_iterator< component_row_iterator > reverse_component_row_iterator
std::reverse_iterator< col_range_iterator > reverse_col_range_iterator
const_component_iterator const_component_row_iterator
reverse_iterator2d rbottom_right()
Returns a read/write reverse iterator2d. It points to past the upper left element of the Matrix...
Definition: Matrix.hpp:3272
std::reverse_iterator< iterator > reverse_row_iterator
iterator2d bottom_right()
Returns a read/write iterator2d that points to the past the end element of the GenericMultiComponent2...
slip::stride_iterator< block_pointer > component_row_range_iterator
std::reverse_iterator< const_component_iterator > const_reverse_component_iterator
Provides a class to manipulate Ranges.
Provides a class to manipulate iterator2d within a slip::Range. It is used to iterate throw 2d contai...
T & max(const GrayscaleImage< T > &M1)
Returns the max element of a GrayscaleImage.
SubType stop() const
Accessor of the stop subscript of the Range.
Definition: Range.hpp:291
std::reverse_iterator< iterator2d_range > reverse_iterator2d_range
slip::stride_iterator< pointer > row_range_iterator
slip::component_iterator2d_range< self, Block::SIZE > component_iterator2d_range
std::reverse_iterator< const_component_iterator2d_range > const_reverse_component_iterator2d_range
std::reverse_iterator< iterator2d > reverse_iterator2d