26 #ifndef MLN_TOPO_ALGEBRAIC_N_FACE_HH
27 # define MLN_TOPO_ALGEBRAIC_N_FACE_HH
32 #include <mln/topo/n_face.hh>
49 template <
unsigned N,
unsigned D>
76 template <
unsigned N,
unsigned D>
83 template <
unsigned N,
unsigned D>
87 template <
unsigned N,
unsigned D>
100 template <
unsigned N,
unsigned D>
109 template <
unsigned N,
unsigned D>
121 template <
unsigned N,
unsigned D>
123 operator< (const algebraic_n_face<N, D>& lhs,
130 template <
unsigned N,
unsigned D>
132 operator<<(std::ostream& ostr, const algebraic_n_face<N, D>& f);
155 template <
unsigned D>
162 # ifndef MLN_INCLUDE_ONLY
164 template <
unsigned N,
unsigned D>
167 : super_(), sign_(true)
170 metal::bool_< N <= D >::check();
171 mln_postcondition(!this->
is_valid());
174 template <
unsigned N,
unsigned D>
178 : super_(c, face_id), sign_(sign)
181 metal::bool_< N <= D >::check();
184 template <
unsigned N,
unsigned D>
187 : super_(f), sign_(sign)
190 metal::bool_< N <= D >::check();
194 template <
unsigned N,
unsigned D>
202 template <
unsigned N,
unsigned D>
211 template <
unsigned N,
unsigned D>
212 algebraic_n_face<N, D>
215 return algebraic_n_face<N, D>(f,
sign);
219 template <
unsigned N,
unsigned D>
220 algebraic_n_face<N, D>
223 return algebraic_n_face<N, D>(f,
false);
226 template <
unsigned N,
unsigned D>
227 algebraic_n_face<N, D>
228 operator-(
const algebraic_n_face<N, D>& f)
230 algebraic_n_face<N, D> f2(f);
231 f2.set_sign(!f.sign());
236 template <
unsigned N,
unsigned D>
240 const algebraic_n_face<N, D>&
rhs)
243 mln_precondition(lhs.cplx() == rhs.cplx());
244 return lhs.face_id() == rhs.face_id() && lhs.sign() == rhs.sign();
247 template <
unsigned N,
unsigned D>
251 const algebraic_n_face<N, D>& rhs)
254 mln_precondition(lhs.cplx() == rhs.cplx());
255 return !(lhs ==
rhs);
258 template <
unsigned N,
unsigned D>
261 operator< (const algebraic_n_face<N, D>& lhs,
262 const algebraic_n_face<N, D>&
rhs)
265 mln_precondition(lhs.cplx() == rhs.cplx());
266 return lhs.face_id() < rhs.face_id();
270 template <
unsigned N,
unsigned D>
273 operator<<(std::ostream& ostr, const algebraic_n_face<N, D>& f)
276 ostr <<
"(cplx = " << f.cplx().addr() <<
", dim = " << f.n()
277 <<
", id = " << f.face_id() <<
", sign = " << f.sign()<<
')';
284 template <
unsigned D>
285 algebraic_n_face<1, D>
286 edge(
const n_face<0, D>& f1,
const n_face<0, D>& f2)
288 typedef std::vector< algebraic_n_face<0, D> > n0_faces_t;
289 typedef std::vector< algebraic_n_face<1, D> > n1_faces_t;
291 n1_faces_t f1_adj_edges = f1.higher_dim_adj_faces();
292 for (
typename n1_faces_t::const_iterator e = f1_adj_edges.begin();
293 e != f1_adj_edges.end(); ++e)
295 n0_faces_t e_adj_vertices = e->lower_dim_adj_faces();
296 for (
typename n0_faces_t::const_iterator w = e_adj_vertices.begin();
297 w != e_adj_vertices.end(); ++w)
304 return algebraic_n_face<1, D>();
307 # endif // ! MLN_INCLUDE_ONLY
313 #endif // ! MLN_TOPO_ALGEBRAIC_N_FACE_HH