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;
90 const target* target_()
const;
92 void change_target(
const target& new_target);
104 topo::n_face<N, D> face()
const;
109 unsigned face_id()
const;
138 topo::n_face<N, D> face_;
152 template <
unsigned N,
unsigned D,
typename P>
155 const faces_psite<N, D, P>& rhs);
162 template <
unsigned N,
unsigned D,
typename P>
165 const faces_psite<N, D, P>& rhs);
173 template <
unsigned N,
unsigned D,
typename P>
175 operator< (const faces_psite<N, D, P>& lhs,
176 const faces_psite<N, D, P>& rhs);
180 template <
unsigned N,
unsigned D,
typename P>
183 operator<<(std::ostream& ostr, const faces_psite<N, D, P>& p);
187 # ifndef MLN_INCLUDE_ONLY
189 template <
unsigned N,
unsigned D,
typename P>
191 faces_psite<N, D, P>::faces_psite()
195 metal::bool_< N <= D >::check();
200 template <
unsigned N,
unsigned D,
typename P>
202 faces_psite<N, D, P>::faces_psite(
const p_faces<N, D, P>& pf,
203 const topo::n_face<N, D>& face)
208 metal::bool_< N <= D >::check();
215 template <
unsigned N,
unsigned D,
typename P>
217 faces_psite<N, D, P>::faces_psite(
const p_faces<N, D, P>& pf,
220 face_(pf.cplx(), face_id)
223 metal::bool_< N <= D >::check();
228 template <
unsigned N,
unsigned D,
typename P>
231 faces_psite<N, D, P>::is_valid()
const
234 return face_.is_valid();
237 template <
unsigned N,
unsigned D,
typename P>
240 faces_psite<N, D, P>::invalidate()
242 return face_.invalidate();
245 template <
unsigned N,
unsigned D,
typename P>
247 const p_faces<N, D, P>&
248 faces_psite<N, D, P>::site_set()
const
250 mln_precondition(target_());
254 template <
unsigned N,
unsigned D,
typename P>
256 const p_faces<N, D, P>*
257 faces_psite<N, D, P>::target_()
const
263 template <
unsigned N,
unsigned D,
typename P>
266 faces_psite<N, D, P>::change_target(
const target& new_target)
270 face_.set_cplx(new_target.cplx());
276 template <
unsigned N,
unsigned D,
typename P>
279 faces_psite<N, D, P>::subj_()
287 template <
unsigned N,
unsigned D,
typename P>
290 faces_psite<N, D, P>::face()
const
295 template <
unsigned N,
unsigned D,
typename P>
298 faces_psite<N, D, P>::n()
const
303 template <
unsigned N,
unsigned D,
typename P>
306 faces_psite<N, D, P>::face_id()
const
308 return face_.face_id();
311 template <
unsigned N,
unsigned D,
typename P>
314 faces_psite<N, D, P>::update_()
316 mln_precondition(is_valid());
326 template <
unsigned N,
unsigned D,
typename P>
329 const faces_psite<N, D, P>& rhs)
331 mln_precondition(&lhs.site_set() == &rhs.site_set());
332 return lhs.face() == rhs.face();
335 template <
unsigned N,
unsigned D,
typename P>
338 const faces_psite<N, D, P>& rhs)
340 mln_precondition(&lhs.site_set() == &rhs.site_set());
341 return lhs.face() != rhs.face();
344 template <
unsigned N,
unsigned D,
typename P>
346 operator< (const faces_psite<N, D, P>& lhs,
347 const faces_psite<N, D, P>& rhs)
349 mln_precondition(&lhs.site_set() == &rhs.site_set());
350 return lhs.face() < rhs.face();
358 template <
unsigned N,
unsigned D,
typename P>
361 operator<<(std::ostream& ostr, const faces_psite<N, D, P>& p)
363 return ostr <<
"(dim = " << p.n() <<
", id = " << p.face_id() <<
')';
366 # endif // ! MLN_INCLUDE_ONLY
370 #endif // ! MLN_CORE_FACES_PSITE_HH