SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
neighborhood.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 
75 #ifndef SLIP_NEIGHBORHOOD_HPP
76 #define SLIP_NEIGHBORHOOD_HPP
77 
78 #include <vector>
79 #include "neighbors.hpp"
80 #include "iterator_types.hpp"
81 
82 
83 namespace slip
84 {
85 
92 
102 template<typename Container>
103 struct SafeN2C
104 {
105  SafeN2C(const Container& cont):
106  cont_(&cont),
107  size_(static_cast<int>(cont.size())),
108  size_max_( slip::n_2c.size())
109  {}
110 
111  template<typename _II>
112  void operator() (_II it,
113  std::vector<_II>& neigh) const
114  {
115  neigh.resize(0);
116  int it_i = static_cast<int>(it - cont_->begin());
117  for(int n = 0; n < size_max_; ++n)
118  {
119  int i = it_i + slip::n_2c[n];
120  if(i >= 0)
121  {
122  if(i < size_)
123  {
124  neigh.push_back(it + slip::n_2c[n]);
125  }
126  }
127  }
128  }
129 
130  template<typename _II>
131  void operator() (_II it,
132  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
133  {
134  neigh.resize(0);
135  int it_i = static_cast<int>(it - cont_->begin());
136  for(int n = 0; n < size_max_; ++n)
137  {
138  int i = it_i + slip::n_2c[n];
139  if(i >= 0)
140  {
141  if(i < size_)
142  {
143  neigh.push_back(it[slip::n_2c[n]]);
144  }
145  }
146  }
147  }
148  const Container* cont_;
149  int size_;
151  };
152 
153 struct N2C
154 {
155 
157  {}
158 
159  template<typename _II>
160  void operator() (_II it,
161  std::vector<_II>& neigh) const
162  {
163  neigh.resize(size_max_);
164  for(int n = 0; n < size_max_; ++n)
165  {
166  neigh[n] = it + slip::n_2c[n];
167  }
168  }
169 
170  template<typename _II>
171  void operator() (_II it,
172  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
173  {
174  neigh.resize(size_max_);
175  for(int n = 0; n < size_max_; ++n)
176  {
177  neigh[n] = it[slip::n_2c[n]];
178  }
179  }
180 
181  int size_max_ ;
182 };
183 
184  template<typename Container>
186 {
187  SafePrev2C(const Container& cont):
188  cont_(&cont),
189  size_(static_cast<int>(cont.size())),
190  size_max_( slip::prev_2c.size())
191  {}
192 
193  template<typename _II>
194  void operator() (_II it,
195  std::vector<_II>& neigh) const
196  {
197  neigh.resize(0);
198  int it_i = static_cast<int>(it - cont_->begin());
199  for(int n = 0; n < size_max_; ++n)
200  {
201  int i = it_i + slip::prev_2c[n];
202  if(i >= 0)
203  {
204  if(i < size_)
205  {
206  neigh.push_back(it + slip::prev_2c[n]);
207  }
208  }
209  }
210  }
211 
212  template<typename _II>
213  void operator() (_II it,
214  std::vector<typename std::iterator_traits<_II>::value_type> & neigh) const
215  {
216  neigh.resize(0);
217  int it_i = static_cast<int>(it - cont_->begin());
218  for(int n = 0; n < size_max_; ++n)
219  {
220  int i = it_i + slip::prev_2c[n];
221  if(i >= 0)
222  {
223  if(i < size_)
224  {
225  neigh.push_back(it[slip::prev_2c[n]]);
226  }
227  }
228  }
229  }
230 
231  const Container* cont_;
232  int size_;
234  };
235 
236 
237 struct Prev2C
238 {
239 
241  {}
242 
243  template<typename _II>
244  void operator() (_II it,
245  std::vector<_II>& neigh) const
246  {
247  neigh.resize(size_max_);
248  for(int n = 0; n < size_max_; ++n)
249  {
250  neigh[n] = it + slip::prev_2c[n];
251  }
252  }
253 
254  template<typename _II>
255  void operator() (_II it,
256  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
257  {
258  neigh.resize(size_max_);
259  for(int n = 0; n < size_max_; ++n)
260  {
261  neigh[n] = it[slip::prev_2c[n]];
262  }
263  }
264 
265  int size_max_ ;
266 };
267 
268 
269 template<typename Container>
271 {
272  SafeNext2C(const Container& cont):
273  cont_(&cont),
274  size_(static_cast<int>(cont.size())),
275  size_max_( slip::next_2c.size())
276  {}
277 
278  template<typename _II>
279  void operator() (_II it,
280  std::vector<_II>& neigh) const
281  {
282  neigh.resize(0);
283  int it_i = static_cast<int>(it - cont_->begin());
284  for(int n = 0; n < size_max_; ++n)
285  {
286  int i = it_i + slip::next_2c[n];
287  if(i >= 0)
288  {
289  if(i < size_)
290  {
291  neigh.push_back(it + slip::next_2c[n]);
292  }
293  }
294  }
295  }
296 
297  template<typename _II>
298  void operator() (_II it,
299  std::vector<typename std::iterator_traits<_II>::value_type> & neigh) const
300  {
301  neigh.resize(0);
302  int it_i = static_cast<int>(it - cont_->begin());
303  for(int n = 0; n < size_max_; ++n)
304  {
305  int i = it_i + slip::next_2c[n];
306  if(i >= 0)
307  {
308  if(i < size_)
309  {
310  neigh.push_back(it[slip::next_2c[n]]);
311  }
312  }
313  }
314  }
315 
316  const Container* cont_;
317  int size_;
319  };
320 
321 
322 struct Next2C
323 {
324 
326  {}
327 
328  template<typename _II>
329  void operator() (_II it,
330  std::vector<_II>& neigh) const
331  {
332  neigh.resize(size_max_);
333  for(int n = 0; n < size_max_; ++n)
334  {
335  neigh[n] = it + slip::next_2c[n];
336  }
337  }
338 
339  template<typename _II>
340  void operator() (_II it,
341  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
342  {
343  neigh.resize(size_max_);
344  for(int n = 0; n < size_max_; ++n)
345  {
346  neigh[n] = it[slip::next_2c[n]];
347  }
348  }
349 
350  int size_max_ ;
351 };
363 template<typename Container>
364 struct SafeN8C
365 {
366  SafeN8C(const Container& cont):
367  cont_(&cont),
368  rows_(static_cast<int>(cont.rows())),
369  cols_(static_cast<int>(cont.cols())),
370  size_max_( slip::n_8c.size())
371  {}
372 
373  template<typename _II>
374  void operator() (_II it,
375  std::vector<_II>& neigh) const
376  {
377  neigh.resize(0);
378  int it_i = it.i();
379  int it_j = it.j();
380  for(int n = 0; n < size_max_; ++n)
381  {
382  int i = it_i + slip::n_8c[n][0];
383  if(i >= 0)
384  {
385  if(i < rows_)
386  {
387  int j = it_j + slip::n_8c[n][1];
388  if(j >= 0)
389  {
390  if(j < cols_)
391  {
392  neigh.push_back(it + slip::n_8c[n]);
393  }
394  }
395  }
396  }
397  }
398  }
399 
400  template<typename _II>
401  void operator() (_II it,
402  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
403  {
404  neigh.resize(0);
405  int it_i = it.i();
406  int it_j = it.j();
407  for(int n = 0; n < size_max_; ++n)
408  {
409  int i = it_i + slip::n_8c[n][0];
410  if(i >= 0)
411  {
412  if(i < rows_)
413  {
414  int j = it_j + slip::n_8c[n][1];
415  if(j >= 0)
416  {
417  if(j < cols_)
418  {
419  neigh.push_back(it[slip::n_8c[n]]);
420  }
421  }
422  }
423  }
424  }
425  }
426 
427  const Container* cont_;
428  int rows_;
429  int cols_;
431  };
432 
433 
434 
435 struct N8C
436 {
437 
439  {}
440 
441  template<typename _II>
442  void operator() (_II it,
443  std::vector<_II>& neigh) const
444  {
445  neigh.resize(size_max_);
446  for(int n = 0; n < size_max_; ++n)
447  {
448  neigh[n] = it + slip::n_8c[n];
449  }
450  }
451 
452  template<typename _II>
453  void operator() (_II it,
454  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
455  {
456  neigh.resize(size_max_);
457  for(int n = 0; n < size_max_; ++n)
458  {
459  neigh[n] = it[slip::n_8c[n]];
460  }
461  }
462 
463  int size_max_ ;
464  };
465 
466 
467 
468 template<typename Container>
470 {
471  SafePrev8C(const Container& cont):
472  cont_(&cont),
473  rows_(static_cast<int>(cont.rows())),
474  cols_(static_cast<int>(cont.cols())),
475  size_max_( slip::prev_8c.size())
476  {}
477 
478  template<typename _II>
479  void operator() (_II it,
480  std::vector<_II>& neigh) const
481  {
482 
483  neigh.resize(0);
484  int it_i = it.i();
485  int it_j = it.j();
486  for(int n = 0; n < size_max_; ++n)
487  {
488  int i = it_i + slip::prev_8c[n][0];
489  if(i >= 0)
490  {
491  if(i < rows_)
492  {
493  int j = it_j + slip::prev_8c[n][1];
494  if(j >= 0)
495  {
496  if(j < cols_)
497  {
498  neigh.push_back(it + slip::prev_8c[n]);
499  }
500  }
501  }
502  }
503  }
504  }
505 
506  template<typename _II>
507  void operator() (_II it,
508  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
509  {
510 
511  neigh.resize(0);
512  int it_i = it.i();
513  int it_j = it.j();
514  for(int n = 0; n < size_max_; ++n)
515  {
516  int i = it_i + slip::prev_8c[n][0];
517  if(i >= 0)
518  {
519  if(i < rows_)
520  {
521  int j = it_j + slip::prev_8c[n][1];
522  if(j >= 0)
523  {
524  if(j < cols_)
525  {
526  neigh.push_back(it[slip::prev_8c[n]]);
527  }
528  }
529  }
530  }
531  }
532  }
533 
534  const Container* cont_;
535  int rows_;
536  int cols_;
538  };
539 
540 struct Prev8C
541 {
542 
544  {}
545 
546  template<typename _II>
547  void operator() (_II it,
548  std::vector<_II>& neigh) const
549  {
550  neigh.resize(size_max_);
551  for(int n = 0; n < size_max_; ++n)
552  {
553  neigh[n] = it + slip::prev_8c[n];
554  }
555  }
556 
557  template<typename _II>
558  void operator() (_II it,
559  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
560  {
561  neigh.resize(size_max_);
562  for(int n = 0; n < size_max_; ++n)
563  {
564  neigh[n] = it[slip::prev_8c[n]];
565  }
566  }
567 
568  int size_max_ ;
569  };
570 
571 
572 
573 template<typename Container>
575 {
576  SafeNext8C(const Container& cont):
577  cont_(&cont),
578  rows_(static_cast<int>(cont.rows())),
579  cols_(static_cast<int>(cont.cols())),
580  size_max_( slip::next_8c.size())
581  {}
582 
583  template<typename _II>
584  void operator() (_II it,
585  std::vector<_II>& neigh) const
586  {
587  neigh.resize(0);
588  int it_i = it.i();
589  int it_j = it.j();
590  for(int n = 0; n < size_max_; ++n)
591  {
592  int i = it_i + slip::next_8c[n][0];
593  if(i >= 0)
594  {
595  if(i < rows_)
596  {
597  int j = it_j + slip::next_8c[n][1];
598  if(j >= 0)
599  {
600  if(j < cols_)
601  {
602  neigh.push_back(it + slip::next_8c[n]);
603  }
604  }
605  }
606  }
607  }
608  }
609 
610  template<typename _II>
611  void operator() (_II it,
612  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
613  {
614  neigh.resize(0);
615  int it_i = it.i();
616  int it_j = it.j();
617  for(int n = 0; n < size_max_; ++n)
618  {
619  int i = it_i + slip::next_8c[n][0];
620  if(i >= 0)
621  {
622  if(i < rows_)
623  {
624  int j = it_j + slip::next_8c[n][1];
625  if(j >= 0)
626  {
627  if(j < cols_)
628  {
629  neigh.push_back(it[slip::next_8c[n]]);
630  }
631  }
632  }
633  }
634  }
635  }
636 
637  const Container* cont_;
638  int rows_;
639  int cols_;
641  };
642 
643 struct Next8C
644 {
645 
647  {}
648 
649  template<typename _II>
650  void operator() (_II it,
651  std::vector<_II>& neigh) const
652  {
653  neigh.resize(size_max_);
654  for(int n = 0; n < size_max_; ++n)
655  {
656  neigh[n] = it + slip::next_8c[n];
657  }
658  }
659 
660  template<typename _II>
661  void operator() (_II it,
662  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
663  {
664  neigh.resize(size_max_);
665  for(int n = 0; n < size_max_; ++n)
666  {
667  neigh[n] = it[slip::next_8c[n]];
668  }
669  }
670 
671  int size_max_ ;
672  };
673 
674 
675 template<typename Container>
676 struct SafeN4C
677 {
678  SafeN4C(const Container& cont):
679  cont_(&cont),
680  rows_(static_cast<int>(cont.rows())),
681  cols_(static_cast<int>(cont.cols())),
682  size_max_( slip::n_4c.size())
683  {}
684 
685  template<typename _II>
686  void operator() (_II it,
687  std::vector<_II>& neigh) const
688  {
689  neigh.resize(0);
690  int it_i = it.i();
691  int it_j = it.j();
692  for(int n = 0; n < size_max_; ++n)
693  {
694  int i = it_i + slip::n_4c[n][0];
695  if(i >= 0)
696  {
697  if(i < rows_)
698  {
699  int j = it_j + slip::n_4c[n][1];
700  if(j >= 0)
701  {
702  if(j < cols_)
703  {
704  neigh.push_back(it + slip::n_4c[n]);
705  }
706  }
707  }
708  }
709  }
710  }
711 
712  template<typename _II>
713  void operator() (_II it,
714  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
715  {
716  neigh.resize(0);
717  int it_i = it.i();
718  int it_j = it.j();
719  for(int n = 0; n < size_max_; ++n)
720  {
721  int i = it_i + slip::n_4c[n][0];
722  if(i >= 0)
723  {
724  if(i < rows_)
725  {
726  int j = it_j + slip::n_4c[n][1];
727  if(j >= 0)
728  {
729  if(j < cols_)
730  {
731  neigh.push_back(it[slip::n_4c[n]]);
732  }
733  }
734  }
735  }
736  }
737  }
738 
739  const Container* cont_;
740  int rows_;
741  int cols_;
743  };
744 
745 
746 struct N4C
747 {
748 
750  {}
751 
752  template<typename _II>
753  void operator() (_II it,
754  std::vector<_II>& neigh) const
755  {
756  neigh.resize(size_max_);
757  for(int n = 0; n < size_max_; ++n)
758  {
759  neigh[n] = it + slip::n_4c[n];
760  }
761  }
762 
763  template<typename _II>
764  void operator() (_II it,
765  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
766  {
767  neigh.resize(size_max_);
768  for(int n = 0; n < size_max_; ++n)
769  {
770  neigh[n] = it[slip::n_4c[n]];
771  }
772  }
773 
774  int size_max_ ;
775  };
776 
777 
778 template<typename Container>
780 {
781  SafeNext4C(const Container& cont):
782  cont_(&cont),
783  rows_(static_cast<int>(cont.rows())),
784  cols_(static_cast<int>(cont.cols())),
785  size_max_( slip::next_4c.size())
786  {}
787 
788  template<typename _II>
789  void operator() (_II it,
790  std::vector<_II>& neigh) const
791  {
792  neigh.resize(0);
793  int it_i = it.i();
794  int it_j = it.j();
795  for(int n = 0; n < size_max_; ++n)
796  {
797  int i = it_i + slip::next_4c[n][0];
798  if(i >= 0)
799  {
800  if(i < rows_)
801  {
802  int j = it_j + slip::next_4c[n][1];
803  if(j >= 0)
804  {
805  if(j < cols_)
806  {
807  neigh.push_back(it + slip::next_4c[n]);
808  }
809  }
810  }
811  }
812  }
813  }
814 
815  template<typename _II>
816  void operator() (_II it,
817  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
818  {
819  neigh.resize(0);
820  int it_i = it.i();
821  int it_j = it.j();
822  for(int n = 0; n < size_max_; ++n)
823  {
824  int i = it_i + slip::next_4c[n][0];
825  if(i >= 0)
826  {
827  if(i < rows_)
828  {
829  int j = it_j + slip::next_4c[n][1];
830  if(j >= 0)
831  {
832  if(j < cols_)
833  {
834  neigh.push_back(it[slip::next_4c[n]]);
835  }
836  }
837  }
838  }
839  }
840  }
841 
842  const Container* cont_;
843  int rows_;
844  int cols_;
846  };
847 
848 template<typename Container>
850 {
851  SafePrev4C(const Container& cont):
852  cont_(&cont),
853  rows_(static_cast<int>(cont.rows())),
854  cols_(static_cast<int>(cont.cols())),
855  size_max_( slip::prev_4c.size())
856  {}
857 
858  template<typename _II>
859  void operator() (_II it,
860  std::vector<_II>& neigh) const
861  {
862 
863  neigh.resize(0);
864  int it_i = it.i();
865  int it_j = it.j();
866  for(int n = 0; n < size_max_; ++n)
867  {
868  int i = it_i + slip::prev_4c[n][0];
869  if(i >= 0)
870  {
871  if(i < rows_)
872  {
873  int j = it_j + slip::prev_4c[n][1];
874  if(j >= 0)
875  {
876  if(j < cols_)
877  {
878  neigh.push_back(it + slip::prev_4c[n]);
879  }
880  }
881  }
882  }
883  }
884  }
885 
886  template<typename _II>
887  void operator() (_II it,
888  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
889  {
890 
891  neigh.resize(0);
892  int it_i = it.i();
893  int it_j = it.j();
894  for(int n = 0; n < size_max_; ++n)
895  {
896  int i = it_i + slip::prev_4c[n][0];
897  if(i >= 0)
898  {
899  if(i < rows_)
900  {
901  int j = it_j + slip::prev_4c[n][1];
902  if(j >= 0)
903  {
904  if(j < cols_)
905  {
906  neigh.push_back(it[slip::prev_4c[n]]);
907  }
908  }
909  }
910  }
911  }
912  }
913 
914  const Container* cont_;
915  int rows_;
916  int cols_;
918  };
919 
920 struct Prev4C
921 {
922 
924  {}
925 
926  template<typename _II>
927  void operator() (_II it,
928  std::vector<_II>& neigh) const
929  {
930  neigh.resize(size_max_);
931  for(int n = 0; n < size_max_; ++n)
932  {
933  neigh[n] = it + slip::prev_4c[n];
934  }
935  }
936 
937  template<typename _II>
938  void operator() (_II it,
939  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
940  {
941  neigh.resize(size_max_);
942  for(int n = 0; n < size_max_; ++n)
943  {
944  neigh[n] = it[slip::prev_4c[n]];
945  }
946  }
947 
948  int size_max_ ;
949  };
950 
951 struct Next4C
952 {
953 
955  {}
956 
957  template<typename _II>
958  void operator() (_II it,
959  std::vector<_II>& neigh) const
960  {
961  neigh.resize(size_max_);
962  for(int n = 0; n < size_max_; ++n)
963  {
964  neigh[n] = it + slip::next_4c[n];
965  }
966  }
967 
968  template<typename _II>
969  void operator() (_II it,
970  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
971  {
972  neigh.resize(size_max_);
973  for(int n = 0; n < size_max_; ++n)
974  {
975  neigh[n] = it[slip::next_4c[n]];
976  }
977  }
978 
979  int size_max_ ;
980  };
981 
982 
983 template<typename Container>
985 {
986  SafePseudoHexagonal(const Container& cont):
987  cont_(&cont),
988  rows_(static_cast<int>(cont.rows())),
989  cols_(static_cast<int>(cont.cols())),
990  size_max_( slip::n_6co.size())
991  {}
992 
993  template<typename _II>
994  void operator() (_II it,
995  std::vector<_II>& neigh) const
996  {
997 
998  neigh.resize(0);
999  int it_i = it.i();
1000  int it_j = it.j();
1001  if(it.i()%2 == 0)
1002  {
1003  for(int n = 0; n < size_max_; ++n)
1004  {
1005  int i = it_i + slip::n_6co[n][0];
1006  if(i >= 0)
1007  {
1008  if(i < rows_)
1009  {
1010  int j = it_j + slip::n_6co[n][1];
1011  if(j >= 0)
1012  {
1013  if(j < cols_)
1014  {
1015  neigh.push_back(it + slip::n_6co[n]);
1016  }
1017  }
1018  }
1019  }
1020  }
1021  }
1022  else
1023  {
1024  for(int n = 0; n < size_max_; ++n)
1025  {
1026  int i = it_i + slip::n_6ce[n][0];
1027  if(i >= 0)
1028  {
1029  if(i < rows_)
1030  {
1031  int j = it_j + slip::n_6ce[n][1];
1032  if(j >= 0)
1033  {
1034  if(j < cols_)
1035  {
1036  neigh.push_back(it + slip::n_6ce[n]);
1037  }
1038  }
1039  }
1040  }
1041  }
1042  }
1043  }
1044 
1045 
1046  template<typename _II>
1047  void operator() (_II it,
1048  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1049  {
1050 
1051  neigh.resize(0);
1052  int it_i = it.i();
1053  int it_j = it.j();
1054  if(it.i()%2 == 0)
1055  {
1056  for(int n = 0; n < size_max_; ++n)
1057  {
1058  int i = it_i + slip::n_6co[n][0];
1059  if(i >= 0)
1060  {
1061  if(i < rows_)
1062  {
1063  int j = it_j + slip::n_6co[n][1];
1064  if(j >= 0)
1065  {
1066  if(j < cols_)
1067  {
1068  neigh.push_back(it[slip::n_6co[n]]);
1069  }
1070  }
1071  }
1072  }
1073  }
1074  }
1075  else
1076  {
1077  for(int n = 0; n < size_max_; ++n)
1078  {
1079  int i = it_i + slip::n_6ce[n][0];
1080  if(i >= 0)
1081  {
1082  if(i < rows_)
1083  {
1084  int j = it_j + slip::n_6ce[n][1];
1085  if(j >= 0)
1086  {
1087  if(j < cols_)
1088  {
1089  neigh.push_back(it[slip::n_6ce[n]]);
1090  }
1091  }
1092  }
1093  }
1094  }
1095  }
1096  }
1097 
1098 
1099  const Container* cont_;
1100  int rows_;
1101  int cols_;
1103  };
1104 
1106 {
1107 
1109  {}
1110 
1111  template<typename _II>
1112  void operator() (_II it,
1113  std::vector<_II>& neigh) const
1114  {
1115  neigh.resize(size_max_);
1116  if(it.i() %2 == 0)
1117  {
1118  for(int n = 0; n < size_max_; ++n)
1119  {
1120  neigh[n] = it + slip::n_6co[n];
1121  }
1122  }
1123  else
1124  {
1125  for(int n = 0; n < size_max_; ++n)
1126  {
1127  neigh[n] = it + slip::n_6ce[n];
1128  }
1129  }
1130  }
1131 
1132  template<typename _II>
1133  void operator() (_II it,
1134  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1135  {
1136  neigh.resize(size_max_);
1137  if(it.i() %2 == 0)
1138  {
1139  for(int n = 0; n < size_max_; ++n)
1140  {
1141  neigh[n] = it[slip::n_6co[n]];
1142  }
1143  }
1144  else
1145  {
1146  for(int n = 0; n < size_max_; ++n)
1147  {
1148  neigh[n] = it[slip::n_6ce[n]];
1149  }
1150  }
1151  }
1152 
1153 
1155  };
1156 
1157 template<typename Container>
1159 {
1160  SafePrevPseudoHexagonal(const Container& cont):
1161  cont_(&cont),
1162  rows_(static_cast<int>(cont.rows())),
1163  cols_(static_cast<int>(cont.cols())),
1164  size_max_( slip::prev_6co.size())
1165  {}
1166 
1167  template<typename _II>
1168  void operator() (_II it,
1169  std::vector<_II>& neigh) const
1170  {
1171 
1172  neigh.resize(0);
1173  int it_i = it.i();
1174  int it_j = it.j();
1175  if(it.i()%2 == 0)
1176  {
1177  for(int n = 0; n < size_max_; ++n)
1178  {
1179  int i = it_i + slip::prev_6co[n][0];
1180  if(i >= 0)
1181  {
1182  if(i < rows_)
1183  {
1184  int j = it_j + slip::prev_6co[n][1];
1185  if(j >= 0)
1186  {
1187  if(j < cols_)
1188  {
1189  neigh.push_back(it + slip::prev_6co[n]);
1190  }
1191  }
1192  }
1193  }
1194  }
1195  }
1196  else
1197  {
1198  for(int n = 0; n < size_max_; ++n)
1199  {
1200  int i = it_i + slip::prev_6ce[n][0];
1201  if(i >= 0)
1202  {
1203  if(i < rows_)
1204  {
1205  int j = it_j + slip::prev_6ce[n][1];
1206  if(j >= 0)
1207  {
1208  if(j < cols_)
1209  {
1210  neigh.push_back(it + slip::prev_6ce[n]);
1211  }
1212  }
1213  }
1214  }
1215  }
1216  }
1217  }
1218 
1219  template<typename _II>
1220  void operator() (_II it,
1221  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1222  {
1223 
1224  neigh.resize(0);
1225  int it_i = it.i();
1226  int it_j = it.j();
1227  if(it.i()%2 == 0)
1228  {
1229  for(int n = 0; n < size_max_; ++n)
1230  {
1231  int i = it_i + slip::prev_6co[n][0];
1232  if(i >= 0)
1233  {
1234  if(i < rows_)
1235  {
1236  int j = it_j + slip::prev_6co[n][1];
1237  if(j >= 0)
1238  {
1239  if(j < cols_)
1240  {
1241  neigh.push_back(it[slip::prev_6co[n]]);
1242  }
1243  }
1244  }
1245  }
1246  }
1247  }
1248  else
1249  {
1250  for(int n = 0; n < size_max_; ++n)
1251  {
1252  int i = it_i + slip::prev_6ce[n][0];
1253  if(i >= 0)
1254  {
1255  if(i < rows_)
1256  {
1257  int j = it_j + slip::prev_6ce[n][1];
1258  if(j >= 0)
1259  {
1260  if(j < cols_)
1261  {
1262  neigh.push_back(it[slip::prev_6ce[n]]);
1263  }
1264  }
1265  }
1266  }
1267  }
1268  }
1269  }
1270 
1271 
1272  const Container* cont_;
1273  int rows_;
1274  int cols_;
1276  };
1277 
1278 template<typename Container>
1280 {
1281  SafeNextPseudoHexagonal(const Container& cont):
1282  cont_(&cont),
1283  rows_(static_cast<int>(cont.rows())),
1284  cols_(static_cast<int>(cont.cols())),
1285  size_max_( slip::next_6co.size())
1286  {}
1287 
1288  template<typename _II>
1289  void operator() (_II it,
1290  std::vector<_II>& neigh) const
1291  {
1292 
1293  neigh.resize(0);
1294  int it_i = it.i();
1295  int it_j = it.j();
1296  if(it.i()%2 == 0)
1297  {
1298  for(int n = 0; n < size_max_; ++n)
1299  {
1300  int i = it_i + slip::next_6co[n][0];
1301  if(i >= 0)
1302  {
1303  if(i < rows_)
1304  {
1305  int j = it_j + slip::next_6co[n][1];
1306  if(j >= 0)
1307  {
1308  if(j < cols_)
1309  {
1310  neigh.push_back(it + slip::next_6co[n]);
1311  }
1312  }
1313  }
1314  }
1315  }
1316  }
1317  else
1318  {
1319  for(int n = 0; n < size_max_; ++n)
1320  {
1321  int i = it_i + slip::next_6ce[n][0];
1322  if(i >= 0)
1323  {
1324  if(i < rows_)
1325  {
1326  int j = it_j + slip::next_6ce[n][1];
1327  if(j >= 0)
1328  {
1329  if(j < cols_)
1330  {
1331  neigh.push_back(it + slip::next_6ce[n]);
1332  }
1333  }
1334  }
1335  }
1336  }
1337  }
1338  }
1339 
1340 
1341  template<typename _II>
1342  void operator() (_II it,
1343  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1344  {
1345 
1346  neigh.resize(0);
1347  int it_i = it.i();
1348  int it_j = it.j();
1349  if(it.i()%2 == 0)
1350  {
1351  for(int n = 0; n < size_max_; ++n)
1352  {
1353  int i = it_i + slip::next_6co[n][0];
1354  if(i >= 0)
1355  {
1356  if(i < rows_)
1357  {
1358  int j = it_j + slip::next_6co[n][1];
1359  if(j >= 0)
1360  {
1361  if(j < cols_)
1362  {
1363  neigh.push_back(it[slip::next_6co[n]]);
1364  }
1365  }
1366  }
1367  }
1368  }
1369  }
1370  else
1371  {
1372  for(int n = 0; n < size_max_; ++n)
1373  {
1374  int i = it_i + slip::next_6ce[n][0];
1375  if(i >= 0)
1376  {
1377  if(i < rows_)
1378  {
1379  int j = it_j + slip::next_6ce[n][1];
1380  if(j >= 0)
1381  {
1382  if(j < cols_)
1383  {
1384  neigh.push_back(it[slip::next_6ce[n]]);
1385  }
1386  }
1387  }
1388  }
1389  }
1390  }
1391  }
1392 
1393  const Container* cont_;
1394  int rows_;
1395  int cols_;
1397  };
1398 
1399 
1400 
1402 {
1403 
1405  {}
1406 
1407  template<typename _II>
1408  void operator() (_II it,
1409  std::vector<_II>& neigh) const
1410  {
1411  neigh.resize(size_max_);
1412  if(it.i() %2 == 0)
1413  {
1414  for(int n = 0; n < size_max_; ++n)
1415  {
1416  neigh[n] = it + slip::prev_6co[n];
1417  }
1418  }
1419  else
1420  {
1421  for(int n = 0; n < size_max_; ++n)
1422  {
1423  neigh[n] = it + slip::prev_6ce[n];
1424  }
1425  }
1426  }
1427 
1428  template<typename _II>
1429  void operator() (_II it,
1430  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1431  {
1432  neigh.resize(size_max_);
1433  if(it.i() %2 == 0)
1434  {
1435  for(int n = 0; n < size_max_; ++n)
1436  {
1437  neigh[n] = it[slip::prev_6co[n]];
1438  }
1439  }
1440  else
1441  {
1442  for(int n = 0; n < size_max_; ++n)
1443  {
1444  neigh[n] = it[slip::prev_6ce[n]];
1445  }
1446  }
1447  }
1448 
1450  };
1451 
1453 {
1454 
1456  {}
1457 
1458  template<typename _II>
1459  void operator() (_II it,
1460  std::vector<_II>& neigh) const
1461  {
1462  neigh.resize(size_max_);
1463  if(it.i() %2 == 0)
1464  {
1465  for(int n = 0; n < size_max_; ++n)
1466  {
1467  neigh[n] = it + slip::next_6co[n];
1468  }
1469  }
1470  else
1471  {
1472  for(int n = 0; n < size_max_; ++n)
1473  {
1474  neigh[n] = it + slip::next_6ce[n];
1475  }
1476  }
1477  }
1478 
1479  template<typename _II>
1480  void operator() (_II it,
1481  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1482  {
1483  neigh.resize(size_max_);
1484  if(it.i() %2 == 0)
1485  {
1486  for(int n = 0; n < size_max_; ++n)
1487  {
1488  neigh[n] = it[slip::next_6co[n]];
1489  }
1490  }
1491  else
1492  {
1493  for(int n = 0; n < size_max_; ++n)
1494  {
1495  neigh[n] = it[slip::next_6ce[n]];
1496  }
1497  }
1498  }
1499 
1501  };
1511 template<typename Container>
1512 struct SafeN6C
1513 {
1514  SafeN6C(const Container& cont):
1515  cont_(&cont),
1516  slices_(static_cast<int>(cont.slices())),
1517  rows_(static_cast<int>(cont.rows())),
1518  cols_(static_cast<int>(cont.cols())),
1519  size_max_( slip::n_6c.size())
1520  {}
1521 
1522  template<typename _II>
1523  void operator() (_II it,
1524  std::vector<_II>& neigh) const
1525  {
1526  neigh.resize(0);
1527  int it_i = it.i();
1528  int it_j = it.j();
1529  int it_k = it.k();
1530  for(int n = 0; n < size_max_; ++n)
1531  {
1532  int k = it_k + slip::n_6c[n][0];
1533  if(k >= 0)
1534  {
1535  if(k < slices_)
1536  {
1537  int i = it_i + slip::n_6c[n][1];
1538  if(i >= 0)
1539  {
1540  if(i < rows_)
1541  {
1542  int j = it_j + slip::n_6c[n][2];
1543  if(j>=0)
1544  {
1545  if(j<cols_)
1546  {
1547  neigh.push_back(it+slip::n_6c[n]);
1548  }
1549  }
1550  }
1551  }
1552  }
1553  }
1554  }
1555  }
1556 
1557 
1558  template<typename _II>
1559  void operator() (_II it,
1560  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1561  {
1562  neigh.resize(0);
1563  int it_i = it.i();
1564  int it_j = it.j();
1565  int it_k = it.k();
1566  for(int n = 0; n < size_max_; ++n)
1567  {
1568  int k = it_k + slip::n_6c[n][0];
1569  if(k >= 0)
1570  {
1571  if(k < slices_)
1572  {
1573  int i = it_i + slip::n_6c[n][1];
1574  if(i >= 0)
1575  {
1576  if(i < rows_)
1577  {
1578  int j = it_j + slip::n_6c[n][2];
1579  if(j>=0)
1580  {
1581  if(j<cols_)
1582  {
1583  neigh.push_back(it[slip::n_6c[n]]);
1584  }
1585  }
1586  }
1587  }
1588  }
1589  }
1590  }
1591  }
1592 
1593  const Container* cont_;
1594  int slices_;
1595  int rows_;
1596  int cols_;
1598  };
1599 
1600 struct N6C
1601 {
1602 
1604  {}
1605 
1606  template<typename _II>
1607  void operator() (_II it,
1608  std::vector<_II>& neigh) const
1609  {
1610  neigh.resize(size_max_);
1611  for(int n = 0; n < size_max_; ++n)
1612  {
1613  neigh[n] = it + slip::n_6c[n];
1614  }
1615  }
1616 
1617  template<typename _II>
1618  void operator() (_II it,
1619  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1620  {
1621  neigh.resize(size_max_);
1622  for(int n = 0; n < size_max_; ++n)
1623  {
1624  neigh[n] = it[slip::n_6c[n]];
1625  }
1626  }
1627 
1629  };
1630 
1631 
1632 template<typename Container>
1634 {
1635  SafePrev6C(const Container& cont):
1636  cont_(&cont),
1637  slices_(static_cast<int>(cont.slices())),
1638  rows_(static_cast<int>(cont.rows())),
1639  cols_(static_cast<int>(cont.cols())),
1640  size_max_( slip::prev_6c.size())
1641  {}
1642 
1643  template<typename _II>
1644  void operator() (_II it,
1645  std::vector<_II>& neigh) const
1646  {
1647 
1648  neigh.resize(0);
1649  int it_i = it.i();
1650  int it_j = it.j();
1651  int it_k = it.k();
1652 
1653  for(int n = 0; n < size_max_; ++n)
1654  {
1655  int k = it_k + slip::prev_6c[n][0];
1656  if(k >= 0)
1657  {
1658  if(k < slices_)
1659  {
1660  int i = it_i + slip::prev_6c[n][1];
1661  if(i >= 0)
1662  {
1663  if(i < rows_)
1664  {
1665  int j = it_j + slip::prev_6c[n][2];
1666  if(j>=0)
1667  {
1668  if(j<cols_)
1669  {
1670  neigh.push_back(it+slip::prev_6c[n]);
1671  }
1672  }
1673  }
1674  }
1675  }
1676  }
1677  }
1678  }
1679 
1680  template<typename _II>
1681  void operator() (_II it,
1682  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1683  {
1684 
1685  neigh.resize(0);
1686  int it_i = it.i();
1687  int it_j = it.j();
1688  int it_k = it.k();
1689 
1690  for(int n = 0; n < size_max_; ++n)
1691  {
1692  int k = it_k + slip::prev_6c[n][0];
1693  if(k >= 0)
1694  {
1695  if(k < slices_)
1696  {
1697  int i = it_i + slip::prev_6c[n][1];
1698  if(i >= 0)
1699  {
1700  if(i < rows_)
1701  {
1702  int j = it_j + slip::prev_6c[n][2];
1703  if(j>=0)
1704  {
1705  if(j<cols_)
1706  {
1707  neigh.push_back(it[slip::prev_6c[n]]);
1708  }
1709  }
1710  }
1711  }
1712  }
1713  }
1714  }
1715  }
1716 
1717  const Container* cont_;
1718  int slices_;
1719  int rows_;
1720  int cols_;
1722  };
1723 
1724 
1725 struct Prev6C
1726 {
1727 
1729  {}
1730 
1731  template<typename _II>
1732  void operator() (_II it,
1733  std::vector<_II>& neigh) const
1734  {
1735  neigh.resize(size_max_);
1736 
1737  for(int n = 0; n < size_max_; ++n)
1738  {
1739  neigh[n] = it + slip::prev_6c[n];
1740  }
1741  }
1742 
1743  template<typename _II>
1744  void operator() (_II it,
1745  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1746  {
1747  neigh.resize(size_max_);
1748 
1749  for(int n = 0; n < size_max_; ++n)
1750  {
1751  neigh[n] = it[slip::prev_6c[n]];
1752  }
1753  }
1754 
1756  };
1757 
1758 template<typename Container>
1760 {
1761  SafeNext6C(const Container& cont):
1762  cont_(&cont),
1763  slices_(static_cast<int>(cont.slices())),
1764  rows_(static_cast<int>(cont.rows())),
1765  cols_(static_cast<int>(cont.cols())),
1766  size_max_( slip::next_6c.size())
1767  {}
1768 
1769  template<typename _II>
1770  void operator() (_II it,
1771  std::vector<_II>& neigh) const
1772  {
1773  neigh.resize(0);
1774  int it_i = it.i();
1775  int it_j = it.j();
1776  int it_k = it.k();
1777  for(int n = 0; n < size_max_; ++n)
1778  {
1779  int k = it_k + slip::next_6c[n][0];
1780  if(k >= 0)
1781  {
1782  if(k < slices_)
1783  {
1784  int i = it_i + slip::next_6c[n][1];
1785  if(i >= 0)
1786  {
1787  if(i < rows_)
1788  {
1789  int j = it_j + slip::next_6c[n][2];
1790  if(j>=0)
1791  {
1792  if(j<cols_)
1793  {
1794  neigh.push_back(it+slip::next_6c[n]);
1795  }
1796  }
1797  }
1798  }
1799  }
1800  }
1801  }
1802 
1803  }
1804 
1805  template<typename _II>
1806  void operator() (_II it,
1807  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1808  {
1809  neigh.resize(0);
1810  int it_i = it.i();
1811  int it_j = it.j();
1812  int it_k = it.k();
1813  for(int n = 0; n < size_max_; ++n)
1814  {
1815  int k = it_k + slip::next_6c[n][0];
1816  if(k >= 0)
1817  {
1818  if(k < slices_)
1819  {
1820  int i = it_i + slip::next_6c[n][1];
1821  if(i >= 0)
1822  {
1823  if(i < rows_)
1824  {
1825  int j = it_j + slip::next_6c[n][2];
1826  if(j>=0)
1827  {
1828  if(j<cols_)
1829  {
1830  neigh.push_back(it[slip::next_6c[n]]);
1831  }
1832  }
1833  }
1834  }
1835  }
1836  }
1837  }
1838 
1839  }
1840 
1841  const Container* cont_;
1842  int slices_;
1843  int rows_;
1844  int cols_;
1846  };
1847 
1848 struct Next6C
1849 {
1850 
1852  {}
1853 
1854  template<typename _II>
1855  void operator() (_II it,
1856  std::vector<_II>& neigh) const
1857  {
1858  neigh.resize(size_max_);
1859 
1860  for(int n = 0; n < size_max_; ++n)
1861  {
1862  neigh[n] = it + slip::next_6c[n];
1863  }
1864  }
1865 
1866  template<typename _II>
1867  void operator() (_II it,
1868  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1869  {
1870  neigh.resize(size_max_);
1871 
1872  for(int n = 0; n < size_max_; ++n)
1873  {
1874  neigh[n] = it[slip::next_6c[n]];
1875  }
1876  }
1877 
1879  };
1880 
1881 
1882 template<typename Container>
1883 struct SafeN26C
1884 {
1885  SafeN26C(const Container& cont):
1886  cont_(&cont),
1887  slices_(static_cast<int>(cont.slices())),
1888  rows_(static_cast<int>(cont.rows())),
1889  cols_(static_cast<int>(cont.cols())),
1890  size_max_( slip::n_26c.size())
1891  {}
1892 
1893  template<typename _II>
1894  void operator() (_II it,
1895  std::vector<_II>& neigh) const
1896  {
1897 
1898  neigh.resize(0);
1899  int it_i = it.i();
1900  int it_j = it.j();
1901  int it_k = it.k();
1902  for(int n = 0; n < size_max_; ++n)
1903  {
1904  int k = it_k + slip::n_26c[n][0];
1905  if(k >= 0)
1906  {
1907  if(k < slices_)
1908  {
1909  int i = it_i + slip::n_26c[n][1];
1910  if(i >= 0)
1911  {
1912  if(i < rows_)
1913  {
1914  int j = it_j + slip::n_26c[n][2];
1915  if(j>=0)
1916  {
1917  if(j<cols_)
1918  {
1919  neigh.push_back(it+slip::n_26c[n]);
1920  }
1921  }
1922  }
1923  }
1924  }
1925  }
1926  }
1927  }
1928 
1929  template<typename _II>
1930  void operator() (_II it,
1931  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1932  {
1933 
1934  neigh.resize(0);
1935  int it_i = it.i();
1936  int it_j = it.j();
1937  int it_k = it.k();
1938  for(int n = 0; n < size_max_; ++n)
1939  {
1940  int k = it_k + slip::n_26c[n][0];
1941  if(k >= 0)
1942  {
1943  if(k < slices_)
1944  {
1945  int i = it_i + slip::n_26c[n][1];
1946  if(i >= 0)
1947  {
1948  if(i < rows_)
1949  {
1950  int j = it_j + slip::n_26c[n][2];
1951  if(j>=0)
1952  {
1953  if(j<cols_)
1954  {
1955  neigh.push_back(it[slip::n_26c[n]]);
1956  }
1957  }
1958  }
1959  }
1960  }
1961  }
1962  }
1963  }
1964 
1965  const Container* cont_;
1966  int slices_;
1967  int rows_;
1968  int cols_;
1970  };
1971 
1972 struct N26C
1973 {
1974 
1976  {}
1977 
1978  template<typename _II>
1979  void operator() (_II it,
1980  std::vector<_II>& neigh) const
1981  {
1982  neigh.resize(size_max_);
1983  for(int n = 0; n < size_max_; ++n)
1984  {
1985  neigh[n] = it + slip::n_26c[n];
1986  }
1987  }
1988 
1989  template<typename _II>
1990  void operator() (_II it,
1991  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
1992  {
1993  neigh.resize(size_max_);
1994  for(int n = 0; n < size_max_; ++n)
1995  {
1996  neigh[n] = it[slip::n_26c[n]];
1997  }
1998  }
1999 
2001  };
2002 
2003 
2004 
2005 template<typename Container>
2007 {
2008  SafePrev26C(const Container& cont):
2009  cont_(&cont),
2010  slices_(static_cast<int>(cont.slices())),
2011  rows_(static_cast<int>(cont.rows())),
2012  cols_(static_cast<int>(cont.cols())),
2013  size_max_( slip::prev_26c.size())
2014  {}
2015 
2016  template<typename _II>
2017  void operator() (_II it,
2018  std::vector<_II>& neigh) const
2019  {
2020 
2021  neigh.resize(0);
2022  int it_i = it.i();
2023  int it_j = it.j();
2024  int it_k = it.k();
2025 
2026  for(int n = 0; n < size_max_; ++n)
2027  {
2028  int k = it_k + slip::prev_26c[n][0];
2029  if(k >= 0)
2030  {
2031  if(k < slices_)
2032  {
2033  int i = it_i + slip::prev_26c[n][1];
2034  if(i >= 0)
2035  {
2036  if(i < rows_)
2037  {
2038  int j = it_j + slip::prev_26c[n][2];
2039  if(j>=0)
2040  {
2041  if(j<cols_)
2042  {
2043  neigh.push_back(it+slip::prev_26c[n]);
2044  }
2045  }
2046  }
2047  }
2048  }
2049  }
2050  }
2051  }
2052 
2053  template<typename _II>
2054  void operator() (_II it,
2055  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2056  {
2057 
2058  neigh.resize(0);
2059  int it_i = it.i();
2060  int it_j = it.j();
2061  int it_k = it.k();
2062 
2063  for(int n = 0; n < size_max_; ++n)
2064  {
2065  int k = it_k + slip::prev_26c[n][0];
2066  if(k >= 0)
2067  {
2068  if(k < slices_)
2069  {
2070  int i = it_i + slip::prev_26c[n][1];
2071  if(i >= 0)
2072  {
2073  if(i < rows_)
2074  {
2075  int j = it_j + slip::prev_26c[n][2];
2076  if(j>=0)
2077  {
2078  if(j<cols_)
2079  {
2080  neigh.push_back(it[slip::prev_26c[n]]);
2081  }
2082  }
2083  }
2084  }
2085  }
2086  }
2087  }
2088  }
2089 
2090  const Container* cont_;
2091  int slices_;
2092  int rows_;
2093  int cols_;
2095  };
2096 
2097 
2098 struct Prev26C
2099 {
2100 
2102  {}
2103 
2104  template<typename _II>
2105  void operator() (_II it,
2106  std::vector<_II>& neigh) const
2107  {
2108  neigh.resize(size_max_);
2109 
2110  for(int n = 0; n < size_max_; ++n)
2111  {
2112  neigh[n] = it + slip::prev_26c[n];
2113  }
2114  }
2115 
2116  template<typename _II>
2117  void operator() (_II it,
2118  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2119  {
2120  neigh.resize(size_max_);
2121 
2122  for(int n = 0; n < size_max_; ++n)
2123  {
2124  neigh[n] = it[slip::prev_26c[n]];
2125  }
2126  }
2127 
2129  };
2130 
2131 
2132 template<typename Container>
2134 {
2135  SafeNext26C(const Container& cont):
2136  cont_(&cont),
2137  slices_(static_cast<int>(cont.slices())),
2138  rows_(static_cast<int>(cont.rows())),
2139  cols_(static_cast<int>(cont.cols())),
2140  size_max_( slip::next_26c.size())
2141  {}
2142 
2143  template<typename _II>
2144  void operator() (_II it,
2145  std::vector<_II>& neigh) const
2146  {
2147 
2148  neigh.resize(0);
2149  int it_i = it.i();
2150  int it_j = it.j();
2151  int it_k = it.k();
2152 
2153  for(int n = 0; n < size_max_; ++n)
2154  {
2155  int k = it_k + slip::next_26c[n][0];
2156  if(k >= 0)
2157  {
2158  if(k < slices_)
2159  {
2160  int i = it_i + slip::next_26c[n][1];
2161  if(i >= 0)
2162  {
2163  if(i < rows_)
2164  {
2165  int j = it_j + slip::next_26c[n][2];
2166  if(j>=0)
2167  {
2168  if(j<cols_)
2169  {
2170  neigh.push_back(it+slip::next_26c[n]);
2171  }
2172  }
2173  }
2174  }
2175  }
2176  }
2177  }
2178 
2179  }
2180 
2181  template<typename _II>
2182  void operator() (_II it,
2183  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2184  {
2185 
2186  neigh.resize(0);
2187  int it_i = it.i();
2188  int it_j = it.j();
2189  int it_k = it.k();
2190 
2191  for(int n = 0; n < size_max_; ++n)
2192  {
2193  int k = it_k + slip::next_26c[n][0];
2194  if(k >= 0)
2195  {
2196  if(k < slices_)
2197  {
2198  int i = it_i + slip::next_26c[n][1];
2199  if(i >= 0)
2200  {
2201  if(i < rows_)
2202  {
2203  int j = it_j + slip::next_26c[n][2];
2204  if(j>=0)
2205  {
2206  if(j<cols_)
2207  {
2208  neigh.push_back(it[slip::next_26c[n]]);
2209  }
2210  }
2211  }
2212  }
2213  }
2214  }
2215  }
2216 
2217  }
2218 
2219  const Container* cont_;
2220  int slices_;
2221  int rows_;
2222  int cols_;
2224  };
2225 
2226 
2227 struct Next26C
2228 {
2229 
2231  {}
2232 
2233  template<typename _II>
2234  void operator() (_II it,
2235  std::vector<_II>& neigh) const
2236  {
2237  neigh.resize(size_max_);
2238 
2239  for(int n = 0; n < size_max_; ++n)
2240  {
2241  neigh[n] = it + slip::next_26c[n];
2242  }
2243  }
2244 
2245  template<typename _II>
2246  void operator() (_II it,
2247  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2248  {
2249  neigh.resize(size_max_);
2250 
2251  for(int n = 0; n < size_max_; ++n)
2252  {
2253  neigh[n] = it[slip::next_26c[n]];
2254  }
2255  }
2256 
2258  };
2259 
2260 
2261 template<typename Container>
2262 struct SafeN18C
2263 {
2264  SafeN18C(const Container& cont):
2265  cont_(&cont),
2266  slices_(static_cast<int>(cont.slices())),
2267  rows_(static_cast<int>(cont.rows())),
2268  cols_(static_cast<int>(cont.cols())),
2269  size_max_( slip::n_18c.size())
2270  {}
2271 
2272  template<typename _II>
2273  void operator() (_II it,
2274  std::vector<_II>& neigh) const
2275  {
2276  neigh.resize(0);
2277  int it_i = it.i();
2278  int it_j = it.j();
2279  int it_k = it.k();
2280  for(int n = 0; n < size_max_; ++n)
2281  {
2282  int k = it_k + slip::n_18c[n][0];
2283  if(k >= 0)
2284  {
2285  if(k < slices_)
2286  {
2287  int i = it_i + slip::n_18c[n][1];
2288  if(i >= 0)
2289  {
2290  if(i < rows_)
2291  {
2292  int j = it_j + slip::n_18c[n][2];
2293  if(j>=0)
2294  {
2295  if(j<cols_)
2296  {
2297  neigh.push_back(it+slip::n_18c[n]);
2298  }
2299  }
2300  }
2301  }
2302  }
2303  }
2304  }
2305  }
2306 
2307 
2308  template<typename _II>
2309  void operator() (_II it,
2310  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2311  {
2312  neigh.resize(0);
2313  int it_i = it.i();
2314  int it_j = it.j();
2315  int it_k = it.k();
2316  for(int n = 0; n < size_max_; ++n)
2317  {
2318  int k = it_k + slip::n_18c[n][0];
2319  if(k >= 0)
2320  {
2321  if(k < slices_)
2322  {
2323  int i = it_i + slip::n_18c[n][1];
2324  if(i >= 0)
2325  {
2326  if(i < rows_)
2327  {
2328  int j = it_j + slip::n_18c[n][2];
2329  if(j>=0)
2330  {
2331  if(j<cols_)
2332  {
2333  neigh.push_back(it[slip::n_18c[n]]);
2334  }
2335  }
2336  }
2337  }
2338  }
2339  }
2340  }
2341  }
2342 
2343  const Container* cont_;
2344  int slices_;
2345  int rows_;
2346  int cols_;
2348  };
2349 
2350 struct N18C
2351 {
2352 
2354  {}
2355 
2356  template<typename _II>
2357  void operator() (_II it,
2358  std::vector<_II>& neigh) const
2359  {
2360  neigh.resize(size_max_);
2361  for(int n = 0; n < size_max_; ++n)
2362  {
2363  neigh[n] = it + slip::n_18c[n];
2364  }
2365  }
2366 
2367  template<typename _II>
2368  void operator() (_II it,
2369  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2370  {
2371  neigh.resize(size_max_);
2372  for(int n = 0; n < size_max_; ++n)
2373  {
2374  neigh[n] = it[slip::n_18c[n]];
2375  }
2376  }
2377 
2379  };
2380 
2381 template<typename Container>
2383 {
2384  SafePrev18C(const Container& cont):
2385  cont_(&cont),
2386  slices_(static_cast<int>(cont.slices())),
2387  rows_(static_cast<int>(cont.rows())),
2388  cols_(static_cast<int>(cont.cols())),
2389  size_max_( slip::prev_18c.size())
2390  {}
2391 
2392  template<typename _II>
2393  void operator() (_II it,
2394  std::vector<_II>& neigh) const
2395  {
2396 
2397  neigh.resize(0);
2398  int it_i = it.i();
2399  int it_j = it.j();
2400  int it_k = it.k();
2401 
2402  for(int n = 0; n < size_max_; ++n)
2403  {
2404  int k = it_k + slip::prev_18c[n][0];
2405  if(k >= 0)
2406  {
2407  if(k < slices_)
2408  {
2409  int i = it_i + slip::prev_18c[n][1];
2410  if(i >= 0)
2411  {
2412  if(i < rows_)
2413  {
2414  int j = it_j + slip::prev_18c[n][2];
2415  if(j>=0)
2416  {
2417  if(j<cols_)
2418  {
2419  neigh.push_back(it+slip::prev_18c[n]);
2420  }
2421  }
2422  }
2423  }
2424  }
2425  }
2426  }
2427 
2428  }
2429 
2430  template<typename _II>
2431  void operator() (_II it,
2432  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2433  {
2434 
2435  neigh.resize(0);
2436  int it_i = it.i();
2437  int it_j = it.j();
2438  int it_k = it.k();
2439 
2440  for(int n = 0; n < size_max_; ++n)
2441  {
2442  int k = it_k + slip::prev_18c[n][0];
2443  if(k >= 0)
2444  {
2445  if(k < slices_)
2446  {
2447  int i = it_i + slip::prev_18c[n][1];
2448  if(i >= 0)
2449  {
2450  if(i < rows_)
2451  {
2452  int j = it_j + slip::prev_18c[n][2];
2453  if(j>=0)
2454  {
2455  if(j<cols_)
2456  {
2457  neigh.push_back(it[slip::prev_18c[n]]);
2458  }
2459  }
2460  }
2461  }
2462  }
2463  }
2464  }
2465 
2466  }
2467 
2468  const Container* cont_;
2469  int slices_;
2470  int rows_;
2471  int cols_;
2473  };
2474 
2475 struct Prev18C
2476 {
2477 
2479  {}
2480 
2481  template<typename _II>
2482  void operator() (_II it,
2483  std::vector<_II>& neigh) const
2484  {
2485  neigh.resize(size_max_);
2486 
2487  for(int n = 0; n < size_max_; ++n)
2488  {
2489  neigh[n] = it + slip::prev_18c[n];
2490  }
2491 
2492  }
2493 
2494  template<typename _II>
2495  void operator() (_II it,
2496  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2497  {
2498  neigh.resize(size_max_);
2499 
2500  for(int n = 0; n < size_max_; ++n)
2501  {
2502  neigh[n] = it[slip::prev_18c[n]];
2503  }
2504 
2505  }
2506 
2508  };
2509 
2510 
2511 
2512 template<typename Container>
2514 {
2515  SafeNext18C(const Container& cont):
2516  cont_(&cont),
2517  slices_(static_cast<int>(cont.slices())),
2518  rows_(static_cast<int>(cont.rows())),
2519  cols_(static_cast<int>(cont.cols())),
2520  size_max_( slip::next_18c.size())
2521  {}
2522 
2523  template<typename _II>
2524  void operator() (_II it,
2525  std::vector<_II>& neigh) const
2526  {
2527 
2528  neigh.resize(0);
2529  int it_i = it.i();
2530  int it_j = it.j();
2531  int it_k = it.k();
2532 
2533  for(int n = 0; n < size_max_; ++n)
2534  {
2535  int k = it_k + slip::next_18c[n][0];
2536  if(k >= 0)
2537  {
2538  if(k < slices_)
2539  {
2540  int i = it_i + slip::next_18c[n][1];
2541  if(i >= 0)
2542  {
2543  if(i < rows_)
2544  {
2545  int j = it_j + slip::next_18c[n][2];
2546  if(j>=0)
2547  {
2548  if(j<cols_)
2549  {
2550  neigh.push_back(it+slip::next_18c[n]);
2551  }
2552  }
2553  }
2554  }
2555  }
2556  }
2557  }
2558  }
2559 
2560 
2561  template<typename _II>
2562  void operator() (_II it,
2563  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2564  {
2565 
2566  neigh.resize(0);
2567  int it_i = it.i();
2568  int it_j = it.j();
2569  int it_k = it.k();
2570 
2571  for(int n = 0; n < size_max_; ++n)
2572  {
2573  int k = it_k + slip::next_18c[n][0];
2574  if(k >= 0)
2575  {
2576  if(k < slices_)
2577  {
2578  int i = it_i + slip::next_18c[n][1];
2579  if(i >= 0)
2580  {
2581  if(i < rows_)
2582  {
2583  int j = it_j + slip::next_18c[n][2];
2584  if(j>=0)
2585  {
2586  if(j<cols_)
2587  {
2588  neigh.push_back(it[slip::next_18c[n]]);
2589  }
2590  }
2591  }
2592  }
2593  }
2594  }
2595  }
2596  }
2597 
2598  const Container* cont_;
2599  int slices_;
2600  int rows_;
2601  int cols_;
2603  };
2604 
2605 
2606 struct Next18C
2607 {
2608 
2610  {}
2611 
2612  template<typename _II>
2613  void operator() (_II it,
2614  std::vector<_II>& neigh) const
2615  {
2616  neigh.resize(size_max_);
2617 
2618  for(int n = 0; n < size_max_; ++n)
2619  {
2620  neigh[n] = it + slip::next_18c[n];
2621  }
2622 
2623  }
2624 
2625  template<typename _II>
2626  void operator() (_II it,
2627  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2628  {
2629  neigh.resize(size_max_);
2630 
2631  for(int n = 0; n < size_max_; ++n)
2632  {
2633  neigh[n] = it[slip::next_18c[n]];
2634  }
2635 
2636  }
2637 
2639  };
2642 
2644 
2657 
2665  template<typename Container>
2666  struct SafeN4D8C
2667  {
2668  SafeN4D8C(const Container& cont):
2669  cont_(&cont),
2670  slabs_(static_cast<int>(cont.slabs())),
2671  slices_(static_cast<int>(cont.slices())),
2672  rows_(static_cast<int>(cont.rows())),
2673  cols_(static_cast<int>(cont.cols())),
2674  size_max_( slip::n_4d_8c.size())
2675  {}
2676 
2677  template<typename _II>
2678  void operator() (_II it,
2679  std::vector<_II>& neigh) const
2680  {
2681  neigh.resize(0);
2682  int it_i = it.i();
2683  int it_j = it.j();
2684  int it_k = it.k();
2685  int it_t = it.t();
2686  for(int n = 0; n < size_max_; ++n)
2687  {
2688  int t = it_t + slip::n_4d_8c[n][0];
2689  if(t >= 0)
2690  {
2691  if(t < slabs_)
2692  {
2693  int k = it_k + slip::n_4d_8c[n][1];
2694  if(k >= 0)
2695  {
2696  if(k < slices_)
2697  {
2698  int i = it_i + slip::n_4d_8c[n][2];
2699  if(i >= 0)
2700  {
2701  if(i < rows_)
2702  {
2703  int j = it_j + slip::n_4d_8c[n][3];
2704  if(j>=0)
2705  {
2706  if(j<cols_)
2707  {
2708  neigh.push_back(it+slip::n_4d_8c[n]);
2709  }
2710  }
2711  }
2712  }
2713  }
2714  }
2715  }
2716  }
2717  }
2718  }
2719 
2720 
2721  template<typename _II>
2722  void operator() (_II it,
2723  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2724  {
2725  neigh.resize(0);
2726  int it_i = it.i();
2727  int it_j = it.j();
2728  int it_k = it.k();
2729  int it_t = it.t();
2730  for(int n = 0; n < size_max_; ++n)
2731  {
2732  int t = it_t + slip::n_4d_8c[n][0];
2733  if(t >= 0)
2734  {
2735  if(t < slabs_)
2736  {
2737  int k = it_k + slip::n_4d_8c[n][1];
2738  if(k >= 0)
2739  {
2740  if(k < slices_)
2741  {
2742  int i = it_i + slip::n_4d_8c[n][2];
2743  if(i >= 0)
2744  {
2745  if(i < rows_)
2746  {
2747  int j = it_j + slip::n_4d_8c[n][3];
2748  if(j>=0)
2749  {
2750  if(j<cols_)
2751  {
2752  neigh.push_back(it[slip::n_4d_8c[n]]);
2753  }
2754  }
2755  }
2756  }
2757  }
2758  }
2759  }
2760  }
2761  }
2762  }
2763 
2764  const Container* cont_;
2765  int slabs_;
2766  int slices_;
2767  int rows_;
2768  int cols_;
2770  };
2771 
2779  struct N4D8C
2780  {
2781 
2783  {}
2784 
2785  template<typename _II>
2786  void operator() (_II it,
2787  std::vector<_II>& neigh) const
2788  {
2789  neigh.resize(size_max_);
2790  for(int n = 0; n < size_max_; ++n)
2791  {
2792  neigh[n] = it + slip::n_4d_8c[n];
2793  }
2794  }
2795 
2796  template<typename _II>
2797  void operator() (_II it,
2798  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2799  {
2800  neigh.resize(size_max_);
2801  for(int n = 0; n < size_max_; ++n)
2802  {
2803  neigh[n] = it[slip::n_4d_8c[n]];
2804  }
2805  }
2806 
2808  };
2809 
2817  template<typename Container>
2819  {
2820  SafePrev4D8C(const Container& cont):
2821  cont_(&cont),
2822  slabs_(static_cast<int>(cont.slabs())),
2823  slices_(static_cast<int>(cont.slices())),
2824  rows_(static_cast<int>(cont.rows())),
2825  cols_(static_cast<int>(cont.cols())),
2826  size_max_( slip::prev_4d_8c.size())
2827  {}
2828 
2829  template<typename _II>
2830  void operator() (_II it,
2831  std::vector<_II>& neigh) const
2832  {
2833 
2834  neigh.resize(0);
2835  int it_i = it.i();
2836  int it_j = it.j();
2837  int it_k = it.k();
2838  int it_t = it.t();
2839 
2840  for(int n = 0; n < size_max_; ++n)
2841  {
2842  int t = it_t + slip::n_4d_8c[n][0];
2843  if(t >= 0)
2844  {
2845  if(t < slabs_)
2846  {
2847  int k = it_k + slip::n_4d_8c[n][1];
2848  if(k >= 0)
2849  {
2850  if(k < slices_)
2851  {
2852  int i = it_i + slip::n_4d_8c[n][2];
2853  if(i >= 0)
2854  {
2855  if(i < rows_)
2856  {
2857  int j = it_j + slip::n_4d_8c[n][3];
2858  if(j>=0)
2859  {
2860  if(j<cols_)
2861  {
2862  neigh.push_back(it+slip::n_4d_8c[n]);
2863  }
2864  }
2865  }
2866  }
2867  }
2868  }
2869  }
2870  }
2871  }
2872  }
2873 
2874  template<typename _II>
2875  void operator() (_II it,
2876  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2877  {
2878 
2879  neigh.resize(0);
2880  int it_i = it.i();
2881  int it_j = it.j();
2882  int it_k = it.k();
2883  int it_t = it.t();
2884 
2885  for(int n = 0; n < size_max_; ++n)
2886  {
2887  int t = it_t + slip::n_4d_8c[n][0];
2888  if(t >= 0)
2889  {
2890  if(t < slabs_)
2891  {
2892  int k = it_k + slip::n_4d_8c[n][1];
2893  if(k >= 0)
2894  {
2895  if(k < slices_)
2896  {
2897  int i = it_i + slip::n_4d_8c[n][2];
2898  if(i >= 0)
2899  {
2900  if(i < rows_)
2901  {
2902  int j = it_j + slip::n_4d_8c[n][3];
2903  if(j>=0)
2904  {
2905  if(j<cols_)
2906  {
2907  neigh.push_back(it[slip::n_4d_8c[n]]);
2908  }
2909  }
2910  }
2911  }
2912  }
2913  }
2914  }
2915  }
2916  }
2917  }
2918 
2919  const Container* cont_;
2920  int slabs_;
2921  int slices_;
2922  int rows_;
2923  int cols_;
2925  };
2926 
2934  struct Prev4D8C
2935  {
2936 
2938  {}
2939 
2940  template<typename _II>
2941  void operator() (_II it,
2942  std::vector<_II>& neigh) const
2943  {
2944  neigh.resize(size_max_);
2945 
2946  for(int n = 0; n < size_max_; ++n)
2947  {
2948  neigh[n] = it + slip::n_4d_8c[n];
2949  }
2950  }
2951 
2952  template<typename _II>
2953  void operator() (_II it,
2954  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
2955  {
2956  neigh.resize(size_max_);
2957 
2958  for(int n = 0; n < size_max_; ++n)
2959  {
2960  neigh[n] = it[slip::n_4d_8c[n]];
2961  }
2962  }
2963 
2965  };
2966 
2974  template<typename Container>
2976  {
2977  SafeNext4D8C(const Container& cont):
2978  cont_(&cont),
2979  slabs_(static_cast<int>(cont.slabs())),
2980  slices_(static_cast<int>(cont.slices())),
2981  rows_(static_cast<int>(cont.rows())),
2982  cols_(static_cast<int>(cont.cols())),
2983  size_max_( slip::next_4d_8c.size())
2984  {}
2985 
2986  template<typename _II>
2987  void operator() (_II it,
2988  std::vector<_II>& neigh) const
2989  {
2990  neigh.resize(0);
2991  int it_i = it.i();
2992  int it_j = it.j();
2993  int it_k = it.k();
2994  int it_t = it.t();
2995  for(int n = 0; n < size_max_; ++n)
2996  {
2997  int t = it_t + slip::n_4d_8c[n][0];
2998  if(t >= 0)
2999  {
3000  if(t < slabs_)
3001  {
3002  int k = it_k + slip::n_4d_8c[n][1];
3003  if(k >= 0)
3004  {
3005  if(k < slices_)
3006  {
3007  int i = it_i + slip::n_4d_8c[n][2];
3008  if(i >= 0)
3009  {
3010  if(i < rows_)
3011  {
3012  int j = it_j + slip::n_4d_8c[n][3];
3013  if(j>=0)
3014  {
3015  if(j<cols_)
3016  {
3017  neigh.push_back(it+slip::n_4d_8c[n]);
3018  }
3019  }
3020  }
3021  }
3022  }
3023  }
3024  }
3025  }
3026  }
3027 
3028  }
3029 
3030  template<typename _II>
3031  void operator() (_II it,
3032  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
3033  {
3034  neigh.resize(0);
3035  int it_i = it.i();
3036  int it_j = it.j();
3037  int it_k = it.k();
3038  int it_t = it.t();
3039  for(int n = 0; n < size_max_; ++n)
3040  {
3041  int t = it_t + slip::n_4d_8c[n][0];
3042  if(t >= 0)
3043  {
3044  if(t < slabs_)
3045  {
3046  int k = it_k + slip::n_4d_8c[n][1];
3047  if(k >= 0)
3048  {
3049  if(k < slices_)
3050  {
3051  int i = it_i + slip::n_4d_8c[n][2];
3052  if(i >= 0)
3053  {
3054  if(i < rows_)
3055  {
3056  int j = it_j + slip::n_4d_8c[n][3];
3057  if(j>=0)
3058  {
3059  if(j<cols_)
3060  {
3061  neigh.push_back(it[slip::n_4d_8c[n]]);
3062  }
3063  }
3064  }
3065  }
3066  }
3067  }
3068  }
3069  }
3070  }
3071 
3072  }
3073 
3074  const Container* cont_;
3075  int slabs_;
3076  int slices_;
3077  int rows_;
3078  int cols_;
3080  };
3081 
3089  struct Next4D8C
3090  {
3091 
3093  {}
3094 
3095  template<typename _II>
3096  void operator() (_II it,
3097  std::vector<_II>& neigh) const
3098  {
3099  neigh.resize(size_max_);
3100 
3101  for(int n = 0; n < size_max_; ++n)
3102  {
3103  neigh[n] = it + slip::n_4d_8c[n];
3104  }
3105  }
3106 
3107  template<typename _II>
3108  void operator() (_II it,
3109  std::vector<typename std::iterator_traits<_II>::value_type>& neigh) const
3110  {
3111  neigh.resize(size_max_);
3112 
3113  for(int n = 0; n < size_max_; ++n)
3114  {
3115  neigh[n] = it[slip::n_4d_8c[n]];
3116  }
3117  }
3118 
3120  };
3121 
3122 
3123 
3127 }//::slip
3128 
3129 #endif //SLIP_NEIGHBORHOOD_HPP
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
SafePrev6C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafeNext6C(const Container &cont)
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafePrev8C(const Container &cont)
const Container * cont_
Provides a class to tag SLIP iterators.
safe version of next N4D8C neighborhood (only next and existing neighbors are returned) ...
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafeNextPseudoHexagonal(const Container &cont)
SafeN26C(const Container &cont)
SafeNext18C(const Container &cont)
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafePseudoHexagonal(const Container &cont)
safe version of previous N4D8C neighborhood (only previous and existing neighbors are returned) ...
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
SafeN4C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
SafePrev18C(const Container &cont)
SafeN4D8C(const Container &cont)
N4D8C neighborhood.
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
next N4D8C neighborhood (only next neighbors are returned)
void operator()(_II it, std::vector< _II > &neigh) const
Provides a class to manipulate neighbourhood configurations.
SafeNext8C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafePrev4C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
SafeN8C(const Container &cont)
previous N4D8C neighborhood (only previous neighbors are returned)
void operator()(_II it, std::vector< _II > &neigh) const
SafeNext4D8C(const Container &cont)
const Container * cont_
SafeN2C(const Container &cont)
const Container * cont_
SafeNext4C(const Container &cont)
SafePrev2C(const Container &cont)
SafeN18C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafePrev4D8C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
SafeN6C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafeNext2C(const Container &cont)
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
SafeNext26C(const Container &cont)
SafePrev26C(const Container &cont)
void operator()(_II it, std::vector< _II > &neigh) const
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
void operator()(_II it, std::vector< _II > &neigh) const
safe version of N4D8C neighborhood (only existing neighbors are returned)
const Container * cont_
void operator()(_II it, std::vector< _II > &neigh) const
SafePrevPseudoHexagonal(const Container &cont)