33 #include <mln/topo/complex.hh>
42 template <
unsigned N,
unsigned D>
46 template <
unsigned N,
unsigned D>
96 std::cout << c << std::endl;
99 <<
"Using ``static'' manipulators." << std::endl
100 <<
" number of 0-faces: c.nfaces_of_static_dim<0>() = "
102 <<
" number of 1-faces: c.nfaces_of_static_dim<1>() = "
104 <<
" number of 2-faces: c.nfaces_of_static_dim<2>() = "
106 <<
" total number of faces: c.nfaces() = " << c.
nfaces() << std::endl
110 <<
"Using ``dynamic'' manipulators." << std::endl
111 <<
" number of 0-faces: c.nfaces_of_dim(0) = "
113 <<
" number of 1-faces: c.nfaces_of_dim(1) = "
115 <<
" number of 2-faces: c.nfaces_of_dim(2) = "
133 mln_assertion(&face1 == &face2);
140 std::vector< topo::algebraic_face<D> > af_lower_dim_adj_faces =
141 af.lower_dim_adj_faces();
142 std::cout <<
"lower-dimension faces adjacent to " << af <<
":" << std::endl;
143 std::copy (af_lower_dim_adj_faces.begin(), af_lower_dim_adj_faces.end(),
144 std::ostream_iterator< topo::face<D> > (std::cout,
"\n"));
145 std::cout << std::endl;
148 std::vector< topo::algebraic_face<D> > af_higher_dim_adj_faces =
149 af.higher_dim_adj_faces();
150 std::cout <<
"higher-dimension faces adjacent to " << af <<
":" << std::endl;
151 std::copy (af_higher_dim_adj_faces.begin(), af_higher_dim_adj_faces.end(),
152 std::ostream_iterator< topo::face<D> > (std::cout,
"\n"));
153 std::cout << std::endl;
170 for_all_2(fwd_f, bkd_f)
171 std::cout << fwd_f << ' ' << bkd_f << std::endl;
172 std::cout << std::endl;
184 for (
unsigned n = 0; n <= D; ++n)
188 std::cout <<
"test (dynamic) n_face_iters (n = " << n <<
"):"
190 for_all_2(fwd_nf, bkd_nf)
191 std::cout << fwd_nf << ' ' << bkd_nf << std::endl;
192 std::cout << std::endl;
196 test_static_n_face_iter<0>(c);
197 test_static_n_face_iter<1>(c);
198 test_static_n_face_iter<2>(c);
204 test_faces_iter<0>(c);
205 test_faces_iter<1>(c);
206 test_faces_iter<2>(c);
235 std::cout <<
"Lower-dimension faces adjacent to " << fwd_f <<
": "
237 for_all_2(fwd_alf, bkd_alf)
238 std::cout << " " << fwd_alf << '\t' << bkd_alf << std::endl;
240 std::cout << std::endl;
243 topo::adj_higher_face_fwd_iter<D> fwd_ahf(fwd_f);
244 topo::adj_higher_face_bkd_iter<D> bkd_ahf(fwd_f);
247 std::cout <<
"Higher-dimension faces adjacent to " << fwd_f <<
": "
249 for_all_2(fwd_ahf, bkd_ahf)
250 std::cout << " " << fwd_ahf << '\t' << bkd_ahf << std::endl;
252 std::cout << std::endl;
256 topo::adj_lower_higher_face_fwd_iter<D> fwd_alhf(fwd_f);
257 topo::adj_lower_higher_face_bkd_iter<D> bkd_alhf(fwd_f);
260 std::cout <<
"Lower- and higher-dimension faces adjacent to " << fwd_f
261 <<
": " << std::endl;
262 for_all_2(fwd_alhf, bkd_alhf)
263 std::cout << " " << fwd_alhf << '\t' << bkd_alhf << std::endl;
265 std::cout << std::endl;
275 topo::adj_lower_dim_connected_n_face_fwd_iter<D> fwd_aldcf(fwd_f);
276 topo::adj_lower_dim_connected_n_face_bkd_iter<D> bkd_aldcf(fwd_f);
279 std::cout <<
"Lower-dim-connected faces adjacent to " << fwd_f
280 <<
": " << std::endl;
281 for_all_2(fwd_aldcf, bkd_aldcf)
282 std::cout << " " << fwd_aldcf << '\t' << bkd_aldcf << std::endl;
284 std::cout << std::endl;
288 topo::adj_higher_dim_connected_n_face_fwd_iter<D> fwd_ahdcf(fwd_f);
289 topo::adj_higher_dim_connected_n_face_bkd_iter<D> bkd_ahdcf(fwd_f);
292 std::cout <<
"Higher-dim-connected faces adjacent to " << fwd_f
293 <<
": " << std::endl;
294 for_all_2(fwd_ahdcf, bkd_ahdcf)
295 std::cout << " " << fwd_ahdcf << '\t' << bkd_ahdcf << std::endl;
297 std::cout << std::endl;
301 topo::adj_m_face_fwd_iter<D> fwd_amf(fwd_f, 0);
302 topo::adj_m_face_bkd_iter<D> bkd_amf(fwd_f, 0);
305 for (
unsigned m = 0; m <= D; ++m)
309 std::cout << m <<
"-faces (transitively) adjacent to " << fwd_f
310 <<
": " << std::endl;
311 for_all_2(fwd_amf, bkd_amf)
312 std::cout << " " << fwd_amf << '\t' << bkd_amf << std::endl;
314 std::cout << std::endl;
374 std::cout << "Center-only iterator:" << std::endl;
375 topo::center_only_iter<D> center(fwd_f);
378 std::cout << " " << center << std::endl;
379 std::cout << std::endl;
383 template <
unsigned N,
unsigned D>
385 test_static_n_face_iter(topo::complex<D>& c)
387 std::cout <<
"test_static_n_face_iter<" << N <<
", " << D <<
">:"
394 for_all_2(fwd_nf, bkd_nf)
395 std::cout << fwd_nf << ' ' << bkd_nf << std::endl;
396 std::cout << std::endl;
401 template <
unsigned N,
unsigned D>
405 std::cout <<
"test_faces_iter<" << N <<
", " << D <<
">:"
408 mln_bkd_fiter(N, topo::complex<D>) bkd_nf(c);
409 for_all_2(fwd_nf, bkd_nf)
410 std::cout << fwd_nf << ' ' << bkd_nf << std::endl;
411 std::cout << std::endl;