[PATCH 3/4] Rename nfaces(unsigned) as nfaces_of_dim(unsigned).

* mln/core/image/complex_image.hh, * mln/core/site_set/p_complex.hh, * mln/io/off/load.hh, * mln/topo/complex.hh, * mln/topo/face.hh, * mln/topo/face_iter.hh: * mln/topo/n_face_iter.hh, * tests/core/image/complex_image.cc, * tests/topo/complex.cc: Here. --- milena/ChangeLog | 15 +++++++++++++++ milena/mln/core/image/complex_image.hh | 4 ++-- milena/mln/core/site_set/p_complex.hh | 10 +++------- milena/mln/io/off/load.hh | 7 ++++--- milena/mln/topo/complex.hh | 6 +++--- milena/mln/topo/face.hh | 2 +- milena/mln/topo/face_iter.hh | 4 ++-- milena/mln/topo/n_face_iter.hh | 8 ++++---- milena/tests/core/image/complex_image.cc | 4 ++-- milena/tests/topo/complex.cc | 9 ++++++--- 10 files changed, 42 insertions(+), 27 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 8e2cd90..dbae327 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,20 @@ 2009-06-05 Roland Levillain <roland@lrde.epita.fr> + Rename nfaces(unsigned) as nfaces_of_dim(unsigned). + + * mln/core/image/complex_image.hh, + * mln/core/site_set/p_complex.hh, + * mln/io/off/load.hh, + * mln/topo/complex.hh, + * mln/topo/face.hh, + * mln/topo/face_iter.hh: + * mln/topo/n_face_iter.hh, + * tests/core/image/complex_image.cc, + * tests/topo/complex.cc: + Here. + +2009-06-05 Roland Levillain <roland@lrde.epita.fr> + Rename nfaces_with_dim<N>() as nfaces_of_static_dim<N>(). * apps/statues/save_bin_alt.hh, diff --git a/milena/mln/core/image/complex_image.hh b/milena/mln/core/image/complex_image.hh index b1c2c7d..fa7d26c 100644 --- a/milena/mln/core/image/complex_image.hh +++ b/milena/mln/core/image/complex_image.hh @@ -223,7 +223,7 @@ namespace mln big blocks of preconditions like this one. */ # ifndef NDEBUG for (unsigned i = 0; i < D; ++i) - mln_precondition(pc.cplx().nfaces(i) == values[i].size()); + mln_precondition(pc.cplx().nfaces_of_dim(i) == values[i].size()); # endif // !NDEBUG } @@ -245,7 +245,7 @@ namespace mln { metal::vec<D + 1, std::vector<V> > values; for (unsigned i = 0; i <= D; ++i) - values[i].resize(pc.cplx().nfaces(i)); + values[i].resize(pc.cplx().nfaces_of_dim(i)); init_(pc, values); } diff --git a/milena/mln/core/site_set/p_complex.hh b/milena/mln/core/site_set/p_complex.hh index c0e432f..235cc5b 100644 --- a/milena/mln/core/site_set/p_complex.hh +++ b/milena/mln/core/site_set/p_complex.hh @@ -158,11 +158,7 @@ namespace mln /// Return the number of faces in the complex. unsigned nfaces() const; /// Return the number of \a n-faces in the complex. - unsigned nfaces(unsigned n) const; - - // FIXME: Add nfaces(unsigned) routines? Yes, if this can - // simplify (and lighten) the implementation of piters, psites, - // etc. + unsigned nfaces_of_dim(unsigned n) const; // FIXME: This method is probably useless now. /// Is this site set valid? @@ -259,9 +255,9 @@ namespace mln template <unsigned D, typename G> inline unsigned - p_complex<D, G>::nfaces(unsigned n) const + p_complex<D, G>::nfaces_of_dim(unsigned n) const { - return cplx_.nfaces(n); + return cplx_.nfaces_of_dim(n); } template <unsigned D, typename G> diff --git a/milena/mln/io/off/load.hh b/milena/mln/io/off/load.hh index 0e8001f..792c907 100644 --- a/milena/mln/io/off/load.hh +++ b/milena/mln/io/off/load.hh @@ -583,7 +583,7 @@ namespace mln { // Default values. for (unsigned i = 0; i <= D; ++i) - vs[i].insert(vs[i].begin(), s.cplx().nfaces(i), true); + vs[i].insert(vs[i].begin(), s.cplx().nfaces_of_dim(i), true); } void @@ -591,7 +591,7 @@ namespace mln { // Default values for n-face with n in [0, D[. for (unsigned i = 0; i < D; ++i) - vs[i].insert(vs[i].begin(), s.cplx().nfaces(i), 0.0f); + vs[i].insert(vs[i].begin(), s.cplx().nfaces_of_dim(i), 0.0f); // Values for D-faces. vs[D] = face_value; } @@ -601,7 +601,8 @@ namespace mln { // Default values for n-face with n in [0, D[. for (unsigned i = 0; i < D; ++i) - vs[i].insert(vs[i].begin(), s.cplx().nfaces(i), literal::black); + vs[i].insert(vs[i].begin(), s.cplx().nfaces_of_dim(i), + literal::black); // Values for D-faces. vs[D] = face_value; } diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh index aa3af72..3a13c25 100644 --- a/milena/mln/topo/complex.hh +++ b/milena/mln/topo/complex.hh @@ -143,7 +143,7 @@ namespace mln /// since each n_faces_set is checked (the present implementation /// does not provide a direct access to n_faces_set through a /// dynamic value of the dimension). - unsigned nfaces(unsigned n) const; + unsigned nfaces_of_dim(unsigned n) const; /// \} /// Pretty-printing. @@ -555,7 +555,7 @@ namespace mln /// add_size : c -> c.size() /// \endcode /// - /// \see mln::complex<D>::nfaces (dynamic version). + /// \see mln::complex<D>::nfaces_of_dim (dynamic version). /// \see mln::complex<D>::apply_if_dim_matches_. struct get_size { @@ -600,7 +600,7 @@ namespace mln template <unsigned D> inline unsigned - complex<D>::nfaces(unsigned n) const + complex<D>::nfaces_of_dim(unsigned n) const { // Ensure N is compatible with D. mln_precondition(n <= D); diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh index 80eff90..e6f5cd2 100644 --- a/milena/mln/topo/face.hh +++ b/milena/mln/topo/face.hh @@ -208,7 +208,7 @@ namespace mln bool face<D>::is_valid() const { - return n_ <= D && face_id_ < cplx_.nfaces(n_); + return n_ <= D && face_id_ < cplx_.nfaces_of_dim(n_); } template <unsigned D> diff --git a/milena/mln/topo/face_iter.hh b/milena/mln/topo/face_iter.hh index a1c5514..ee3a189 100644 --- a/milena/mln/topo/face_iter.hh +++ b/milena/mln/topo/face_iter.hh @@ -185,7 +185,7 @@ namespace mln { if (is_valid()) { - if (f_.face_id() + 1 < f_.cplx().nfaces(f_.n())) + if (f_.face_id() + 1 < f_.cplx().nfaces_of_dim(f_.n())) f_.inc_face_id(); else // Start to iterate on the faces of the next dimension if @@ -245,7 +245,7 @@ namespace mln if (f_.n() > 0) { f_.dec_n(); - f_.set_face_id(f_.cplx().nfaces(f_.n()) - 1); + f_.set_face_id(f_.cplx().nfaces_of_dim(f_.n()) - 1); } else invalidate(); diff --git a/milena/mln/topo/n_face_iter.hh b/milena/mln/topo/n_face_iter.hh index 93981a6..a1ead8d 100644 --- a/milena/mln/topo/n_face_iter.hh +++ b/milena/mln/topo/n_face_iter.hh @@ -214,7 +214,7 @@ namespace mln { if (is_valid()) { - if (f_.face_id() + 1 < f_.cplx().nfaces(n())) + if (f_.face_id() + 1 < f_.cplx().nfaces_of_dim(n())) f_.inc_face_id(); else /* Don't invalidate the whole face if we have reached the @@ -229,7 +229,7 @@ namespace mln void n_face_fwd_iter<D>::invalidate_face_id_() { - f_.set_face_id(f_.cplx().nfaces(n())); + f_.set_face_id(f_.cplx().nfaces_of_dim(n())); } template <unsigned D> @@ -277,7 +277,7 @@ namespace mln void n_face_bkd_iter<D>::start() { - f_.set_face_id(f_.cplx().nfaces(n()) - 1); + f_.set_face_id(f_.cplx().nfaces_of_dim(n()) - 1); } template <unsigned D> @@ -302,7 +302,7 @@ namespace mln void n_face_bkd_iter<D>::invalidate_face_id_() { - f_.set_face_id(f_.cplx().nfaces(n())); + f_.set_face_id(f_.cplx().nfaces_of_dim(n())); } template <unsigned D> diff --git a/milena/tests/core/image/complex_image.cc b/milena/tests/core/image/complex_image.cc index 56346d3..08aee4e 100644 --- a/milena/tests/core/image/complex_image.cc +++ b/milena/tests/core/image/complex_image.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -160,7 +160,7 @@ int main() metal::vec<D + 1, std::vector< int_u8 > > values; // Assign 0 to 0-faces, 1 to 1-faces and 2 to 2-faces. for (unsigned d = 0; d <= D; ++d) - for (unsigned n = 0; n < pc.cplx().nfaces(d); ++n) + for (unsigned n = 0; n < pc.cplx().nfaces_of_dim(d); ++n) values[d].push_back(d); // Create and init an image based on PC. diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc index fa6832d..ba7a471 100644 --- a/milena/tests/topo/complex.cc +++ b/milena/tests/topo/complex.cc @@ -112,9 +112,12 @@ int main() std::cout << "Using ``dynamic'' manipulators." << std::endl - << " number of 0-faces: c.nfaces(0) = " << c.nfaces(0) << std::endl - << " number of 1-faces: c.nfaces(1) = " << c.nfaces(1) << std::endl - << " number of 2-faces: c.nfaces(2) = " << c.nfaces(2) << std::endl + << " number of 0-faces: c.nfaces_of_dim(0) = " + << c.nfaces_of_dim(0) << std::endl + << " number of 1-faces: c.nfaces_of_dim(1) = " + << c.nfaces_of_dim(1) << std::endl + << " number of 2-faces: c.nfaces_of_dim(2) = " + << c.nfaces_of_dim(2) << std::endl << std::endl; /*-------------------. -- 1.6.1.2
participants (1)
-
Roland Levillain