30 #include <mln/topo/complex.hh>
39 template <
unsigned N,
unsigned D>
43 template <
unsigned N,
unsigned D>
93 std::cout << c << std::endl;
96 <<
"Using ``static'' manipulators." << std::endl
97 <<
" number of 0-faces: c.nfaces_of_static_dim<0>() = "
99 <<
" number of 1-faces: c.nfaces_of_static_dim<1>() = "
101 <<
" number of 2-faces: c.nfaces_of_static_dim<2>() = "
103 <<
" total number of faces: c.nfaces() = " << c.
nfaces() << std::endl
107 <<
"Using ``dynamic'' manipulators." << std::endl
108 <<
" number of 0-faces: c.nfaces_of_dim(0) = "
110 <<
" number of 1-faces: c.nfaces_of_dim(1) = "
112 <<
" number of 2-faces: c.nfaces_of_dim(2) = "
121 const topo::face_data<1, D>& face1 = e0.
data();
128 const topo::face_data<1, D>& face2 = af.data<1>();
130 mln_assertion(&face1 == &face2);
137 std::vector< topo::algebraic_face<D> > af_lower_dim_adj_faces =
138 af.lower_dim_adj_faces();
139 std::cout <<
"lower-dimension faces adjacent to " << af <<
":" << std::endl;
140 std::copy (af_lower_dim_adj_faces.begin(), af_lower_dim_adj_faces.end(),
141 std::ostream_iterator< topo::face<D> > (std::cout,
"\n"));
142 std::cout << std::endl;
145 std::vector< topo::algebraic_face<D> > af_higher_dim_adj_faces =
146 af.higher_dim_adj_faces();
147 std::cout <<
"higher-dimension faces adjacent to " << af <<
":" << std::endl;
148 std::copy (af_higher_dim_adj_faces.begin(), af_higher_dim_adj_faces.end(),
149 std::ostream_iterator< topo::face<D> > (std::cout,
"\n"));
150 std::cout << std::endl;
167 for_all_2(fwd_f, bkd_f)
168 std::cout << fwd_f << ' ' << bkd_f << std::endl;
169 std::cout << std::endl;
181 for (
unsigned n = 0; n <= D; ++n)
185 std::cout <<
"test (dynamic) n_face_iters (n = " << n <<
"):"
187 for_all_2(fwd_nf, bkd_nf)
188 std::cout << fwd_nf << ' ' << bkd_nf << std::endl;
189 std::cout << std::endl;
193 test_static_n_face_iter<0>(c);
194 test_static_n_face_iter<1>(c);
195 test_static_n_face_iter<2>(c);
201 test_faces_iter<0>(c);
202 test_faces_iter<1>(c);
203 test_faces_iter<2>(c);
232 std::cout <<
"Lower-dimension faces adjacent to " << fwd_f <<
": "
234 for_all_2(fwd_alf, bkd_alf)
235 std::cout << " " << fwd_alf << '\t' << bkd_alf << std::endl;
237 std::cout << std::endl;
240 topo::adj_higher_face_fwd_iter<D> fwd_ahf(fwd_f);
241 topo::adj_higher_face_bkd_iter<D> bkd_ahf(fwd_f);
244 std::cout <<
"Higher-dimension faces adjacent to " << fwd_f <<
": "
246 for_all_2(fwd_ahf, bkd_ahf)
247 std::cout << " " << fwd_ahf << '\t' << bkd_ahf << std::endl;
249 std::cout << std::endl;
253 topo::adj_lower_higher_face_fwd_iter<D> fwd_alhf(fwd_f);
254 topo::adj_lower_higher_face_bkd_iter<D> bkd_alhf(fwd_f);
257 std::cout <<
"Lower- and higher-dimension faces adjacent to " << fwd_f
258 <<
": " << std::endl;
259 for_all_2(fwd_alhf, bkd_alhf)
260 std::cout << " " << fwd_alhf << '\t' << bkd_alhf << std::endl;
262 std::cout << std::endl;
272 topo::adj_lower_dim_connected_n_face_fwd_iter<D> fwd_aldcf(fwd_f);
273 topo::adj_lower_dim_connected_n_face_bkd_iter<D> bkd_aldcf(fwd_f);
276 std::cout <<
"Lower-dim-connected faces adjacent to " << fwd_f
277 <<
": " << std::endl;
278 for_all_2(fwd_aldcf, bkd_aldcf)
279 std::cout << " " << fwd_aldcf << '\t' << bkd_aldcf << std::endl;
281 std::cout << std::endl;
285 topo::adj_higher_dim_connected_n_face_fwd_iter<D> fwd_ahdcf(fwd_f);
286 topo::adj_higher_dim_connected_n_face_bkd_iter<D> bkd_ahdcf(fwd_f);
289 std::cout <<
"Higher-dim-connected faces adjacent to " << fwd_f
290 <<
": " << std::endl;
291 for_all_2(fwd_ahdcf, bkd_ahdcf)
292 std::cout << " " << fwd_ahdcf << '\t' << bkd_ahdcf << std::endl;
294 std::cout << std::endl;
298 topo::adj_m_face_fwd_iter<D> fwd_amf(fwd_f, 0);
299 topo::adj_m_face_bkd_iter<D> bkd_amf(fwd_f, 0);
302 for (
unsigned m = 0; m <= D; ++m)
306 std::cout << m <<
"-faces (transitively) adjacent to " << fwd_f
307 <<
": " << std::endl;
308 for_all_2(fwd_amf, bkd_amf)
309 std::cout << " " << fwd_amf << '\t' << bkd_amf << std::endl;
311 std::cout << std::endl;
371 std::cout << "Center-only iterator:" << std::endl;
372 topo::center_only_iter<D> center(fwd_f);
375 std::cout << " " << center << std::endl;
376 std::cout << std::endl;
380 template <
unsigned N,
unsigned D>
382 test_static_n_face_iter(topo::complex<D>& c)
384 std::cout <<
"test_static_n_face_iter<" << N <<
", " << D <<
">:"
391 for_all_2(fwd_nf, bkd_nf)
392 std::cout << fwd_nf << ' ' << bkd_nf << std::endl;
393 std::cout << std::endl;
398 template <
unsigned N,
unsigned D>
402 std::cout <<
"test_faces_iter<" << N <<
", " << D <<
">:"
405 mln_bkd_fiter(N, topo::complex<D>) bkd_nf(c);
406 for_all_2(fwd_nf, bkd_nf)
407 std::cout << fwd_nf << ' ' << bkd_nf << std::endl;
408 std::cout << std::endl;