27 #ifndef MLN_CORE_FACES_PSITE_HH
28 # define MLN_CORE_FACES_PSITE_HH
36 # include <mln/core/internal/pseudo_site_base.hh>
38 # include <mln/topo/complex.hh>
48 template <
unsigned N,
unsigned D,
typename P>
struct p_faces;
56 template <
unsigned N,
unsigned D,
typename P>
58 :
public internal::pseudo_site_base_< const P&,
59 faces_psite<N, D, P> >
64 typedef p_faces<N, D, P> target;
70 faces_psite(
const p_faces<N, D, P>& pf,
const topo::n_face<N, D>& face);
71 faces_psite(
const p_faces<N, D, P>& pf,
unsigned face_id);
77 bool is_valid()
const;
91 const target* target_()
const;
109 topo::n_face<N, D> face()
const;
114 unsigned face_id()
const;
143 topo::n_face<N, D> face_;
157 template <
unsigned N,
unsigned D,
typename P>
160 const faces_psite<N, D, P>&
rhs);
167 template <
unsigned N,
unsigned D,
typename P>
170 const faces_psite<N, D, P>&
rhs);
178 template <
unsigned N,
unsigned D,
typename P>
180 operator< (const faces_psite<N, D, P>& lhs,
181 const faces_psite<N, D, P>&
rhs);
185 template <
unsigned N,
unsigned D,
typename P>
188 operator<<(std::ostream& ostr, const faces_psite<N, D, P>&
p);
192 # ifndef MLN_INCLUDE_ONLY
194 template <
unsigned N,
unsigned D,
typename P>
196 faces_psite<N, D, P>::faces_psite()
200 metal::bool_< N <= D >::check();
205 template <
unsigned N,
unsigned D,
typename P>
207 faces_psite<N, D, P>::faces_psite(
const p_faces<N, D, P>& pf,
208 const topo::n_face<N, D>& face)
213 metal::bool_< N <= D >::check();
220 template <
unsigned N,
unsigned D,
typename P>
222 faces_psite<N, D, P>::faces_psite(
const p_faces<N, D, P>& pf,
225 face_(pf.cplx(), face_id)
228 metal::bool_< N <= D >::check();
233 template <
unsigned N,
unsigned D,
typename P>
236 faces_psite<N, D, P>::is_valid()
const
239 return face_.is_valid();
242 template <
unsigned N,
unsigned D,
typename P>
245 faces_psite<N, D, P>::invalidate()
247 return face_.invalidate();
250 template <
unsigned N,
unsigned D,
typename P>
252 const p_faces<N, D, P>&
255 mln_precondition(target_());
259 template <
unsigned N,
unsigned D,
typename P>
261 const p_faces<N, D, P>*
262 faces_psite<N, D, P>::target_()
const
268 template <
unsigned N,
unsigned D,
typename P>
271 faces_psite<N, D, P>::change_target(
const target& new_target)
275 face_.set_cplx(new_target.cplx());
281 template <
unsigned N,
unsigned D,
typename P>
284 faces_psite<N, D, P>::subj_()
292 template <
unsigned N,
unsigned D,
typename P>
295 faces_psite<N, D, P>::face()
const
300 template <
unsigned N,
unsigned D,
typename P>
303 faces_psite<N, D, P>::n()
const
308 template <
unsigned N,
unsigned D,
typename P>
311 faces_psite<N, D, P>::face_id()
const
313 return face_.face_id();
316 template <
unsigned N,
unsigned D,
typename P>
319 faces_psite<N, D, P>::update_()
321 mln_precondition(is_valid());
331 template <
unsigned N,
unsigned D,
typename P>
334 const faces_psite<N, D, P>&
rhs)
336 mln_precondition(&lhs.site_set() == &rhs.site_set());
337 return lhs.face() == rhs.face();
340 template <
unsigned N,
unsigned D,
typename P>
343 const faces_psite<N, D, P>& rhs)
345 mln_precondition(&lhs.site_set() == &rhs.site_set());
346 return lhs.face() != rhs.face();
349 template <
unsigned N,
unsigned D,
typename P>
351 operator< (const faces_psite<N, D, P>& lhs,
352 const faces_psite<N, D, P>&
rhs)
354 mln_precondition(&lhs.site_set() == &rhs.site_set());
355 return lhs.face() < rhs.face();
363 template <
unsigned N,
unsigned D,
typename P>
366 operator<<(std::ostream& ostr, const faces_psite<N, D, P>&
p)
368 return ostr <<
"(dim = " <<
p.n() <<
", id = " <<
p.face_id() <<
')';
371 # endif // ! MLN_INCLUDE_ONLY
375 #endif // ! MLN_CORE_FACES_PSITE_HH