27 #ifndef MLN_TOPO_FACE_HH
28 # define MLN_TOPO_FACE_HH
37 # include <mln/value/internal/limits.hh>
38 # include <mln/core/contract.hh>
39 # include <mln/metal/bool.hh>
49 template <
unsigned D>
class complex;
50 template <
unsigned N,
unsigned D>
class n_face;
51 template <
unsigned N,
unsigned D>
class face_data;
52 template <
unsigned N>
class algebraic_face;
113 template <
unsigned N>
144 template <
unsigned D>
151 template <
unsigned D>
161 template <
unsigned D>
162 bool operator< (const face<D>& lhs,
const face<D>&
rhs);
168 template <
unsigned D>
170 operator<<(std::ostream& ostr, const face<D>& f);
174 # ifndef MLN_INCLUDE_ONLY
176 template <
unsigned D>
185 template <
unsigned D>
188 : cplx_(c), n_(n), face_id_(face_id)
191 mln_precondition(n <= D);
194 template <
unsigned D>
195 template <
unsigned N>
198 : cplx_(f.cplx()), n_(N), face_id_(f.face_id())
201 metal::bool_< N <= D >::check();
204 template <
unsigned D>
209 return n_ <= D && face_id_ < cplx_.nfaces_of_dim(n_);
212 template <
unsigned D>
221 template <
unsigned D>
229 template <
unsigned D>
237 template <
unsigned D>
245 template <
unsigned D>
253 template <
unsigned D>
261 template <
unsigned D>
269 template <
unsigned D>
277 template <
unsigned D>
285 template <
unsigned D>
293 template <
unsigned D>
301 template <
unsigned D>
302 template <
unsigned N>
307 mln_precondition(n_ == N);
308 mln_precondition(is_valid());
309 return cplx_.template face_data_<N>(face_id_);
327 template <
unsigned N,
unsigned D>
328 struct lower_dim_adj_faces_if_dim_matches_
330 std::vector< algebraic_face<D> > operator()(
const face<D>& face);
333 template <
unsigned D>
334 struct lower_dim_adj_faces_if_dim_matches_<1, D>
336 std::vector< algebraic_face<D> > operator()(
const face<D>& face);
339 template <
unsigned N,
unsigned D>
340 struct higher_dim_adj_faces_if_dim_matches_
342 std::vector< algebraic_face<D> > operator()(
const face<D>& face);
345 template <
unsigned D>
346 struct higher_dim_adj_faces_if_dim_matches_<0, D>
348 std::vector< algebraic_face<D> > operator()(
const face<D>& face);
354 template <
unsigned D>
356 std::vector< algebraic_face<D> >
360 metal::bool_<( D != 0 )>::check();
363 internal::lower_dim_adj_faces_if_dim_matches_<D, D>()(*
this) :
364 std::vector< algebraic_face<D> >();
367 template <
unsigned D>
369 std::vector< algebraic_face<D> >
373 metal::bool_<( D != 0 )>::check();
376 internal::higher_dim_adj_faces_if_dim_matches_<D - 1, D>()(*
this) :
377 std::vector< algebraic_face<D> >();
381 template <
unsigned D>
387 mln_precondition(lhs.cplx() == rhs.cplx());
388 return lhs.n() == rhs.n() && lhs.face_id() == rhs.face_id();
391 template <
unsigned D>
394 operator!=(
const face<D>& lhs,
const face<D>& rhs)
397 mln_precondition(lhs.cplx() == rhs.cplx());
398 return !(lhs ==
rhs);
401 template <
unsigned D>
404 operator< (const face<D>& lhs,
const face<D>&
rhs)
407 mln_precondition(lhs.cplx() == rhs.cplx());
408 return lhs.n() < rhs.n() ||
409 (lhs.n() == rhs.n() && lhs.face_id() < rhs.face_id());
413 template <
unsigned D>
416 operator<<(std::ostream& ostr, const face<D>& f)
418 return ostr <<
"(cplx = " << f.cplx().addr() <<
", dim = " << f.n()
419 <<
", id = " << f.face_id() <<
')';
422 # endif // ! MLN_INCLUDE_ONLY
428 #endif // ! MLN_TOPO_FACE_HH