26 #ifndef MLN_TOPO_IS_SIMPLE_CELL_HH
27 # define MLN_TOPO_IS_SIMPLE_CELL_HH
33 # include <mln/core/concept/function.hh>
34 # include <mln/core/concept/image.hh>
36 # include <mln/core/site_set/p_set.hh>
37 # include <mln/core/site_set/complex_psite.hh>
38 # include <mln/core/site_set/p_complex_piter.hh>
39 # include <mln/core/image/complex_neighborhoods.hh>
40 # include <mln/core/image/complex_neighborhood_piter.hh>
42 # include <mln/make/attachment.hh>
61 static const unsigned D = I::dim;
88 # ifndef MLN_INCLUDE_ONLY
100 : ima_(mln::exact(&ima))
104 template <
typename I>
109 ima_ = mln::exact(&ima);
112 template <
typename I>
118 mln_precondition(ima_);
128 if (att.nsites() == 0)
137 typedef complex_lower_neighborhood<D, G> lower_adj_nbh_t;
138 typedef complex_higher_neighborhood<D, G> higher_adj_nbh_t;
139 lower_adj_nbh_t lower_adj_nbh;
140 higher_adj_nbh_t higher_adj_nbh;
141 while (att.nsites() > 1)
144 bool simple_pair_collapsed =
false;
148 mln_piter(faces_t) g(att);
152 if (static_cast<psite>(g).n() > 0)
155 bool g_is_facet =
true;
156 mln_niter(higher_adj_nbh_t) f(higher_adj_nbh, g);
167 bool gh_is_simple_pair =
false;
168 mln_niter(lower_adj_nbh_t) h(lower_adj_nbh, g);
171 bool h_strictly_in_g =
true;
174 mln_niter(higher_adj_nbh_t) i(higher_adj_nbh, h);
176 if (i != g && att.has(i))
178 h_strictly_in_g =
false;
184 gh_is_simple_pair =
true;
187 mln_invariant(att.nsites() > 0);
194 if (gh_is_simple_pair)
196 simple_pair_collapsed =
true;
201 if (!simple_pair_collapsed)
208 mln_postcondition(att.nsites() == 1);
209 mln_postcondition(att[0].n() == 0);
216 # endif // MLN_INCLUDE_ONLY
222 #endif // ! MLN_TOPO_IS_SIMPLE_CELL_HH