Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
September 2008
- 12 participants
- 359 discussions
2419: Rename topo::complex_{fwd, bkd}_iter_ as topo::face_{fwd, bkd}_iter.
by Roland Levillain 26 Sep '08
by Roland Levillain 26 Sep '08
26 Sep '08
* mln/topo/complex_iter.hh: Rename as...
* mln/topo/face_iter.hh: ...this.
(mln::topo::complex_fwd_iter_<D>)
(mln::topo::complex_bkd_iter_<D>):
Rename as...
(mln::topo::face_fwd_iter<D>)
(mln::topo::face_bkd_iter<D>):
...these.
* milena/mln/topo/complex.hh: Adjust.
* milena/tests/topo/complex.cc: Update documentation.
---
milena/ChangeLog | 15 ++++
milena/mln/topo/complex.hh | 10 ++--
milena/mln/topo/{complex_iter.hh => face_iter.hh} | 75 +++++++++++----------
milena/tests/topo/complex.cc | 26 ++++----
4 files changed, 71 insertions(+), 55 deletions(-)
rename milena/mln/topo/{complex_iter.hh => face_iter.hh} (76%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index e129023..e2d0609 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,20 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Rename topo::complex_{fwd,bkd}_iter_ as topo::face_{fwd,bkd}_iter.
+
+ * mln/topo/complex_iter.hh: Rename as...
+ * mln/topo/face_iter.hh: ...this.
+ (mln::topo::complex_fwd_iter_<D>)
+ (mln::topo::complex_bkd_iter_<D>):
+ Rename as...
+ (mln::topo::face_fwd_iter<D>)
+ (mln::topo::face_bkd_iter<D>):
+ ...these.
+ * milena/mln/topo/complex.hh: Adjust.
+ * milena/tests/topo/complex.cc: Update documentation.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
Rename internal::complex_iter_base_ as internal::complex_iter_base.
* mln/topo/internal/complex_iter_base.hh
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index 2ce88fd..e49f513 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -48,7 +48,7 @@
# include <mln/topo/n_face.hh>
# include <mln/topo/n_faces_set.hh>
-# include <mln/topo/complex_iter.hh>
+# include <mln/topo/face_iter.hh>
// FIXME: Disabled (moved to the attic).
# if 0
# include <mln/topo/faces_iter.hh>
@@ -63,8 +63,8 @@ namespace mln
// Forward declarations (external).
template <unsigned N, unsigned D> class n_faces_set;
- template <unsigned D> class complex_fwd_iter_;
- template <unsigned D> class complex_bkd_iter_;
+ template <unsigned D> class face_fwd_iter;
+ template <unsigned D> class face_bkd_iter;
// FIXME: Disabled (moved to the attic).
# if 0
template <unsigned N, unsigned D> class faces_fwd_iter_;
@@ -92,9 +92,9 @@ namespace mln
{
public:
/// Forward mln::Iterator type iterating on all faces.
- typedef complex_fwd_iter_<D> fwd_citer;
+ typedef face_fwd_iter<D> fwd_citer;
/// Backward mln::Iterator type iterating on all faces.
- typedef complex_bkd_iter_<D> bkd_citer;
+ typedef face_bkd_iter<D> bkd_citer;
// FIXME: Disabled (moved to the attic).
# if 0
diff --git a/milena/mln/topo/complex_iter.hh b/milena/mln/topo/face_iter.hh
similarity index 76%
rename from milena/mln/topo/complex_iter.hh
rename to milena/mln/topo/face_iter.hh
index c589093..e366441 100644
--- a/milena/mln/topo/complex_iter.hh
+++ b/milena/mln/topo/face_iter.hh
@@ -25,11 +25,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_TOPO_COMPLEX_ITER_HH
-# define MLN_TOPO_COMPLEX_ITER_HH
+#ifndef MLN_TOPO_FACE_ITER_HH
+# define MLN_TOPO_FACE_ITER_HH
-/// \file mln/topo/complex_iter.hh
-/// \brief Definition of forward and backward iterators on complexes.
+/// \file mln/topo/face_iter.hh
+/// \brief Definition of forward and backward iterators on all the
+/// faces of a complex.
# include <mln/topo/internal/complex_iter_base.hh>
# include <mln/topo/face.hh>
@@ -47,23 +48,23 @@ namespace mln
template <unsigned D> class complex;
- /*-----------------------------.
- | topo::complex_fwd_iter_<D>. |
- `-----------------------------*/
+ /*-------------------------.
+ | topo::face_fwd_iter<D>. |
+ `-------------------------*/
- /// \brief Forward iterator on all the faces of a mln::complex<D>.
+ /// \brief Forward iterator on all the faces of an mln::complex<D>.
///
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned D>
- class complex_fwd_iter_
- : public internal::complex_iter_base< face<D>, complex_fwd_iter_<D> >
+ class face_fwd_iter
+ : public internal::complex_iter_base< face<D>, face_fwd_iter<D> >
{
public:
/// Type of associated face.
typedef face<D> face;
private:
- typedef complex_fwd_iter_<D> self_;
+ typedef face_fwd_iter<D> self_;
typedef internal::complex_iter_base< face, self_ > super_;
public:
@@ -73,9 +74,9 @@ namespace mln
public:
/// Construction and assignment.
/// \{
- complex_fwd_iter_();
+ face_fwd_iter();
// FIXME: See comment in internal::complex_iter_base's default ctor
- complex_fwd_iter_(complex<D>& c);
+ face_fwd_iter(complex<D>& c);
/// \}
/// Manipulation.
@@ -91,23 +92,23 @@ namespace mln
};
- /*-----------------------------.
- | topo::complex_bkd_iter_<D>. |
- `-----------------------------*/
+ /*-------------------------.
+ | topo::face_bkd_iter<D>. |
+ `-------------------------*/
- /// \brief Backward iterator on all the faces of a mln::complex<D>.
+ /// \brief Backward iterator on all the faces of an mln::complex<D>.
///
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned D>
- class complex_bkd_iter_
- : public internal::complex_iter_base< face<D>, complex_bkd_iter_<D> >
+ class face_bkd_iter
+ : public internal::complex_iter_base< face<D>, face_bkd_iter<D> >
{
public:
/// Type of associated face.
typedef face<D> face;
private:
- typedef complex_bkd_iter_<D> self_;
+ typedef face_bkd_iter<D> self_;
typedef internal::complex_iter_base< face, self_ > super_;
public:
@@ -117,9 +118,9 @@ namespace mln
public:
/// Construction and assignment.
/// \{
- complex_bkd_iter_();
+ face_bkd_iter();
// FIXME: See comment in internal::complex_iter_base's default ctor
- complex_bkd_iter_(complex<D>& c);
+ face_bkd_iter(complex<D>& c);
/// \}
/// Manipulation.
@@ -138,20 +139,20 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- /*-----------------------------.
- | topo::complex_fwd_iter_<D>. |
- `-----------------------------*/
+ /*-------------------------.
+ | topo::face_fwd_iter<D>. |
+ `-------------------------*/
template <unsigned D>
inline
- complex_fwd_iter_<D>::complex_fwd_iter_()
+ face_fwd_iter<D>::face_fwd_iter()
: super_()
{
}
template <unsigned D>
inline
- complex_fwd_iter_<D>::complex_fwd_iter_(complex<D>& c)
+ face_fwd_iter<D>::face_fwd_iter(complex<D>& c)
: super_(c)
{
set_cplx(c);
@@ -161,7 +162,7 @@ namespace mln
template <unsigned D>
inline
void
- complex_fwd_iter_<D>::start()
+ face_fwd_iter<D>::start()
{
face_.set_n(0u);
face_.set_face_id(0u);
@@ -170,7 +171,7 @@ namespace mln
template <unsigned D>
inline
void
- complex_fwd_iter_<D>::next_()
+ face_fwd_iter<D>::next_()
{
if (is_valid())
{
@@ -202,20 +203,20 @@ namespace mln
}
- /*-----------------------------.
- | topo::complex_bkd_iter_<D>. |
- `-----------------------------*/
+ /*-------------------------.
+ | topo::face_bkd_iter<D>. |
+ `-------------------------*/
template <unsigned D>
inline
- complex_bkd_iter_<D>::complex_bkd_iter_()
+ face_bkd_iter<D>::face_bkd_iter()
: super_()
{
}
template <unsigned D>
inline
- complex_bkd_iter_<D>::complex_bkd_iter_(complex<D>& c)
+ face_bkd_iter<D>::face_bkd_iter(complex<D>& c)
: super_(c)
{
set_cplx(c);
@@ -225,7 +226,7 @@ namespace mln
template <unsigned D>
inline
void
- complex_bkd_iter_<D>::start()
+ face_bkd_iter<D>::start()
{
face_.set_n(D);
face_.set_face_id(face_.cplx().template nfaces<D>() - 1);
@@ -234,7 +235,7 @@ namespace mln
template <unsigned D>
inline
void
- complex_bkd_iter_<D>::next_()
+ face_bkd_iter<D>::next_()
{
if (is_valid())
{
@@ -271,4 +272,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_TOPO_COMPLEX_ITER_HH
+#endif // ! MLN_TOPO_FACE_ITER_HH
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index eeaeb14..3319813 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -189,24 +189,24 @@ int main()
complex_faces_piter) use a static `n'. We should also have
n-faces iterators where n could be dynamic.
- But first, we need to clarify (existing) names.
+
+ But first, we need to clarify (existing) names. These ones are
+ OK:
-----------------------------------------------------------------
- Current name New name Definition
+ Name Definition
-----------------------------------------------------------------
- complex<D> (n/a) General complex
+ complex<D> General complex
- face_data<N, D> (n/a) Face data
- n_face<N, D> (n/a) (Static) n-face handle
- n_faces_set<N, D> (n/a) Set of face handles
- face<D> (n/a) Dynamic face handle
+ face_data<N, D> Face data
+ n_face<N, D> (Static) n-face handle
+ n_faces_set<N, D> Set of face handles
+ face<D> Dynamic face handle
- complex_fwd_iter_<D>(c) face_fwd_iter<D>(c) | Iterators on all
- complex_bkd_iter_<D>(c) face_bkd_iter<D>(c) | faces of c
+ face_fwd_iter<D>(c) | Iterators on all the faces
+ face_bkd_iter<D>(c) | of c
- complex_iter_base_<F, E> complex_iter_base<F, E>
- | Factoring base
- | class.
+ internal::complex_iter_base<F, E> Factoring base class.
-----------------------------------------------------------------
(Note: get rid of trailing underscores, even for entities in
@@ -286,7 +286,7 @@ int main()
n_face<N, D>'s.
faces_fwd_iter_<N, D> Iterators on N-faces, N being
- faces_fwd_iter_<N, D> static, acting as proxies of
+ faces_fwd_iter_<N, D> static, acting as proxies of
face<D>'s.
-----------------------------------------------------------------
*/
--
1.6.0.1
1
0
2418: Rename internal::complex_iter_base_ as internal::complex_iter_base.
by Roland Levillain 26 Sep '08
by Roland Levillain 26 Sep '08
26 Sep '08
* mln/topo/internal/complex_iter_base.hh
(mln::topo::internal::complex_iter_base_<F, E>): Rename as...
(mln::topo::internal::complex_iter_base<F, E>): ...this.
* milena/mln/topo/attic/complex_faces_iter.hh,
* milena/mln/topo/attic/faces_iter.hh,
* milena/mln/topo/complex_iter.hh:
Adjust clients.
---
milena/ChangeLog | 12 +++++++++++
milena/mln/topo/attic/complex_faces_iter.hh | 16 +++++++-------
milena/mln/topo/attic/faces_iter.hh | 16 +++++++-------
milena/mln/topo/complex_iter.hh | 16 ++++++--------
milena/mln/topo/internal/complex_iter_base.hh | 26 ++++++++++++------------
5 files changed, 48 insertions(+), 38 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d105628..e129023 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,17 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Rename internal::complex_iter_base_ as internal::complex_iter_base.
+
+ * mln/topo/internal/complex_iter_base.hh
+ (mln::topo::internal::complex_iter_base_<F, E>): Rename as...
+ (mln::topo::internal::complex_iter_base<F, E>): ...this.
+ * milena/mln/topo/attic/complex_faces_iter.hh,
+ * milena/mln/topo/attic/faces_iter.hh,
+ * milena/mln/topo/complex_iter.hh:
+ Adjust clients.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
Disable old iterators on n-faces (with n statically known).
* milena/mln/core/site_set/p_complex_faces_piter.hh,
diff --git a/milena/mln/topo/attic/complex_faces_iter.hh b/milena/mln/topo/attic/complex_faces_iter.hh
index 95d7901..c0d278c 100644
--- a/milena/mln/topo/attic/complex_faces_iter.hh
+++ b/milena/mln/topo/attic/complex_faces_iter.hh
@@ -56,8 +56,8 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class complex_faces_fwd_iter_
- : public internal::complex_iter_base_< face<D>,
- complex_faces_fwd_iter_<N, D> >
+ : public internal::complex_iter_base< face<D>,
+ complex_faces_fwd_iter_<N, D> >
{
public:
/// Type of associated face.
@@ -65,7 +65,7 @@ namespace mln
private:
typedef complex_faces_fwd_iter_<N, D> self_;
- typedef internal::complex_iter_base_< face, self_ > super_;
+ typedef internal::complex_iter_base< face, self_ > super_;
public:
using super_::is_valid;
@@ -75,7 +75,7 @@ namespace mln
/// Construction and assignment.
/// \{
complex_faces_fwd_iter_();
- // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ // FIXME: See comment in internal::complex_iter_base's default ctor
complex_faces_fwd_iter_(complex<D>& c);
/// \}
@@ -102,8 +102,8 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class complex_faces_bkd_iter_
- : public internal::complex_iter_base_< face<D>,
- complex_faces_bkd_iter_<N, D> >
+ : public internal::complex_iter_base< face<D>,
+ complex_faces_bkd_iter_<N, D> >
{
public:
/// Type of associated face.
@@ -111,7 +111,7 @@ namespace mln
private:
typedef complex_faces_bkd_iter_<N, D> self_;
- typedef internal::complex_iter_base_< face, self_ > super_;
+ typedef internal::complex_iter_base< face, self_ > super_;
public:
using super_::is_valid;
@@ -121,7 +121,7 @@ namespace mln
/// Construction and assignment.
/// \{
complex_faces_bkd_iter_();
- // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ // FIXME: See comment in internal::complex_iter_base's default ctor
complex_faces_bkd_iter_(complex<D>& c);
/// \}
diff --git a/milena/mln/topo/attic/faces_iter.hh b/milena/mln/topo/attic/faces_iter.hh
index 509ed9c..9497a14 100644
--- a/milena/mln/topo/attic/faces_iter.hh
+++ b/milena/mln/topo/attic/faces_iter.hh
@@ -51,8 +51,8 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class faces_fwd_iter_
- : public internal::complex_iter_base_< n_face<N, D>,
- faces_fwd_iter_<N, D> >
+ : public internal::complex_iter_base< n_face<N, D>,
+ faces_fwd_iter_<N, D> >
{
public:
/// Type of associated face.
@@ -60,7 +60,7 @@ namespace mln
private:
typedef faces_fwd_iter_<N, D> self_;
- typedef internal::complex_iter_base_< face, self_ > super_;
+ typedef internal::complex_iter_base< face, self_ > super_;
public:
using super_::is_valid;
@@ -70,7 +70,7 @@ namespace mln
/// Construction and assignment.
/// \{
faces_fwd_iter_();
- // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ // FIXME: See comment in internal::complex_iter_base's default ctor
faces_fwd_iter_(complex<D>& c);
/// \}
@@ -97,8 +97,8 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class faces_bkd_iter_
- : public internal::complex_iter_base_< n_face<N, D>,
- faces_bkd_iter_<N, D> >
+ : public internal::complex_iter_base< n_face<N, D>,
+ faces_bkd_iter_<N, D> >
{
public:
/// Type of associated face.
@@ -106,7 +106,7 @@ namespace mln
private:
typedef faces_bkd_iter_<N, D> self_;
- typedef internal::complex_iter_base_< face, self_ > super_;
+ typedef internal::complex_iter_base< face, self_ > super_;
public:
using super_::is_valid;
@@ -116,7 +116,7 @@ namespace mln
/// Construction and assignment.
/// \{
faces_bkd_iter_();
- // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ // FIXME: See comment in internal::complex_iter_base's default ctor
faces_bkd_iter_(complex<D>& c);
/// \}
diff --git a/milena/mln/topo/complex_iter.hh b/milena/mln/topo/complex_iter.hh
index 32bbb1f..c589093 100644
--- a/milena/mln/topo/complex_iter.hh
+++ b/milena/mln/topo/complex_iter.hh
@@ -34,7 +34,7 @@
# include <mln/topo/internal/complex_iter_base.hh>
# include <mln/topo/face.hh>
-// FIXME: Factor a bit more? (Using complex_iter_base_.)
+// FIXME: Factor a bit more? (Using complex_iter_base.)
namespace mln
@@ -56,8 +56,7 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned D>
class complex_fwd_iter_
- : public internal::complex_iter_base_< face<D>,
- complex_fwd_iter_<D> >
+ : public internal::complex_iter_base< face<D>, complex_fwd_iter_<D> >
{
public:
/// Type of associated face.
@@ -65,7 +64,7 @@ namespace mln
private:
typedef complex_fwd_iter_<D> self_;
- typedef internal::complex_iter_base_< face, self_ > super_;
+ typedef internal::complex_iter_base< face, self_ > super_;
public:
using super_::is_valid;
@@ -75,7 +74,7 @@ namespace mln
/// Construction and assignment.
/// \{
complex_fwd_iter_();
- // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ // FIXME: See comment in internal::complex_iter_base's default ctor
complex_fwd_iter_(complex<D>& c);
/// \}
@@ -101,8 +100,7 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned D>
class complex_bkd_iter_
- : public internal::complex_iter_base_< face<D>,
- complex_bkd_iter_<D> >
+ : public internal::complex_iter_base< face<D>, complex_bkd_iter_<D> >
{
public:
/// Type of associated face.
@@ -110,7 +108,7 @@ namespace mln
private:
typedef complex_bkd_iter_<D> self_;
- typedef internal::complex_iter_base_< face, self_ > super_;
+ typedef internal::complex_iter_base< face, self_ > super_;
public:
using super_::is_valid;
@@ -120,7 +118,7 @@ namespace mln
/// Construction and assignment.
/// \{
complex_bkd_iter_();
- // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ // FIXME: See comment in internal::complex_iter_base's default ctor
complex_bkd_iter_(complex<D>& c);
/// \}
diff --git a/milena/mln/topo/internal/complex_iter_base.hh b/milena/mln/topo/internal/complex_iter_base.hh
index d371372..8e20801 100644
--- a/milena/mln/topo/internal/complex_iter_base.hh
+++ b/milena/mln/topo/internal/complex_iter_base.hh
@@ -53,9 +53,9 @@ namespace mln
/// \arg \p F The type of the face handle.
/// \arg \p E The type exact type of the iterator.
template <typename F, typename E>
- class complex_iter_base_ : public Iterator<E>
+ class complex_iter_base : public Iterator<E>
{
- typedef complex_iter_base_<F, E> self_;
+ typedef complex_iter_base<F, E> self_;
public:
typedef F face;
@@ -67,8 +67,8 @@ namespace mln
/// \{
/* FIXME: Keep this non-const? See a (big) comment about this in
milena/tests/complex_image.cc. */
- complex_iter_base_();
- complex_iter_base_(complex_type& c);
+ complex_iter_base();
+ complex_iter_base(complex_type& c);
/// \}
/// Manipulation.
@@ -104,7 +104,7 @@ namespace mln
template <typename F, typename E>
inline
std::ostream&
- operator<<(std::ostream& ostr, const complex_iter_base_<F, E>& p);
+ operator<<(std::ostream& ostr, const complex_iter_base<F, E>& p);
@@ -112,7 +112,7 @@ namespace mln
template <typename F, typename E>
inline
- complex_iter_base_<F, E>::complex_iter_base_()
+ complex_iter_base<F, E>::complex_iter_base()
{
// Ensure F and E are compatible.
mlc_equal(F, typename E::face)::check();
@@ -122,7 +122,7 @@ namespace mln
template <typename F, typename E>
inline
- complex_iter_base_<F, E>::complex_iter_base_(complex_type& c)
+ complex_iter_base<F, E>::complex_iter_base(complex_type& c)
{
// Ensure F and E are compatible.
mlc_equal(F, typename E::face)::check();
@@ -135,7 +135,7 @@ namespace mln
template <typename F, typename E>
inline
void
- complex_iter_base_<F, E>::set_cplx(complex_type& c)
+ complex_iter_base<F, E>::set_cplx(complex_type& c)
{
face_.set_cplx(c);
// Invalidate face_.
@@ -145,7 +145,7 @@ namespace mln
template <typename F, typename E>
inline
bool
- complex_iter_base_<F, E>::is_valid() const
+ complex_iter_base<F, E>::is_valid() const
{
return face_.is_valid();
}
@@ -153,7 +153,7 @@ namespace mln
template <typename F, typename E>
inline
void
- complex_iter_base_<F, E>::invalidate()
+ complex_iter_base<F, E>::invalidate()
{
face_.invalidate();
}
@@ -161,14 +161,14 @@ namespace mln
template <typename F, typename E>
inline
const F&
- complex_iter_base_<F, E>::to_face() const
+ complex_iter_base<F, E>::to_face() const
{
return face_;
}
template <typename F, typename E>
inline
- complex_iter_base_<F, E>::operator F() const
+ complex_iter_base<F, E>::operator F() const
{
mln_precondition(is_valid());
return face_;
@@ -178,7 +178,7 @@ namespace mln
template <typename F, typename E>
inline
std::ostream&
- operator<<(std::ostream& ostr, const complex_iter_base_<F, E>& p)
+ operator<<(std::ostream& ostr, const complex_iter_base<F, E>& p)
{
/* FIXME: We should use p.to_face() here, but as it lacks the
precondition the conversion operator has, so we use the latter.
--
1.6.0.1
1
0
26 Sep '08
* milena/mln/core/site_set/p_complex_faces_piter.hh,
* milena/mln/core/site_set/p_faces_piter.hh,
* milena/mln/topo/complex_faces_iter.hh,
* milena/mln/topo/faces_iter.hh:
Move...
* milena/mln/core/site_set/attic/p_complex_faces_piter.hh,
* milena/mln/core/site_set/attic/p_faces_piter.hh,
* milena/mln/topo/attic/complex_faces_iter.hh,
* milena/mln/topo/attic/faces_iter.hh:
...here.
Disable these iterators...
* milena/mln/core/site_set/p_complex.hh,
* milena/mln/core/site_set/p_faces.hh,
* milena/mln/topo/complex.hh,
* milena/tests/core/image/complex_image.cc,
* milena/tests/topo/complex.cc:
...in those files.
---
milena/ChangeLog | 22 ++++++++++++++++++++
.../site_set/{ => attic}/p_complex_faces_piter.hh | 0
.../mln/core/site_set/{ => attic}/p_faces_piter.hh | 0
milena/mln/core/site_set/p_complex.hh | 9 ++++++-
milena/mln/core/site_set/p_faces.hh | 6 ++++-
milena/mln/topo/{ => attic}/complex_faces_iter.hh | 0
milena/mln/topo/{ => attic}/faces_iter.hh | 0
milena/mln/topo/complex.hh | 14 ++++++++++--
milena/tests/core/image/complex_image.cc | 8 ++----
milena/tests/topo/complex.cc | 13 ++++++++++-
10 files changed, 59 insertions(+), 13 deletions(-)
rename milena/mln/core/site_set/{ => attic}/p_complex_faces_piter.hh (100%)
rename milena/mln/core/site_set/{ => attic}/p_faces_piter.hh (100%)
rename milena/mln/topo/{ => attic}/complex_faces_iter.hh (100%)
rename milena/mln/topo/{ => attic}/faces_iter.hh (100%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 9bd58d5..d105628 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,27 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Disable old iterators on n-faces (with n statically known).
+
+ * milena/mln/core/site_set/p_complex_faces_piter.hh,
+ * milena/mln/core/site_set/p_faces_piter.hh,
+ * milena/mln/topo/complex_faces_iter.hh,
+ * milena/mln/topo/faces_iter.hh:
+ Move...
+ * milena/mln/core/site_set/attic/p_complex_faces_piter.hh,
+ * milena/mln/core/site_set/attic/p_faces_piter.hh,
+ * milena/mln/topo/attic/complex_faces_iter.hh,
+ * milena/mln/topo/attic/faces_iter.hh:
+ ...here.
+ Disable these iterators...
+ * milena/mln/core/site_set/p_complex.hh,
+ * milena/mln/core/site_set/p_faces.hh,
+ * milena/mln/topo/complex.hh,
+ * milena/tests/core/image/complex_image.cc,
+ * milena/tests/topo/complex.cc:
+ ...in those files.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
Split mln/topo/face.hh.
* milena/mln/topo/face.hh
diff --git a/milena/mln/core/site_set/p_complex_faces_piter.hh b/milena/mln/core/site_set/attic/p_complex_faces_piter.hh
similarity index 100%
rename from milena/mln/core/site_set/p_complex_faces_piter.hh
rename to milena/mln/core/site_set/attic/p_complex_faces_piter.hh
diff --git a/milena/mln/core/site_set/p_faces_piter.hh b/milena/mln/core/site_set/attic/p_faces_piter.hh
similarity index 100%
rename from milena/mln/core/site_set/p_faces_piter.hh
rename to milena/mln/core/site_set/attic/p_faces_piter.hh
diff --git a/milena/mln/core/site_set/p_complex.hh b/milena/mln/core/site_set/p_complex.hh
index a747b69..06fc8b2 100644
--- a/milena/mln/core/site_set/p_complex.hh
+++ b/milena/mln/core/site_set/p_complex.hh
@@ -37,7 +37,10 @@
# include <mln/core/site_set/complex_psite.hh>
# include <mln/core/site_set/p_complex_piter.hh>
-# include <mln/core/site_set/p_complex_faces_piter.hh>
+// FIXME: Disabled (moved to the attic).
+# if 0
+# include <mln/core/site_set/p_complex_faces_piter.hh>
+# endif
namespace mln
@@ -49,11 +52,13 @@ namespace mln
template <unsigned D, typename P> class p_complex_fwd_piter_;
template <unsigned D, typename P> class p_complex_bkd_piter_;
+// FIXME: Disabled (moved to the attic).
+# if 0
template <unsigned N, unsigned D, typename P>
class p_complex_faces_fwd_piter_;
template <unsigned N, unsigned D, typename P>
class p_complex_faces_bkd_piter_;
-
+# endif
namespace trait
{
diff --git a/milena/mln/core/site_set/p_faces.hh b/milena/mln/core/site_set/p_faces.hh
index b17f85a..6df4ded 100644
--- a/milena/mln/core/site_set/p_faces.hh
+++ b/milena/mln/core/site_set/p_faces.hh
@@ -37,7 +37,11 @@
# include <mln/topo/complex.hh>
# include <mln/core/faces_psite.hh>
-# include <mln/core/site_set/p_faces_piter.hh>
+
+// FIXME: Disabled (moved to the attic).
+# if 0
+# include <mln/core/site_set/p_faces_piter.hh>
+# endif
# include <mln/core/site_set/p_complex.hh>
diff --git a/milena/mln/topo/complex_faces_iter.hh b/milena/mln/topo/attic/complex_faces_iter.hh
similarity index 100%
rename from milena/mln/topo/complex_faces_iter.hh
rename to milena/mln/topo/attic/complex_faces_iter.hh
diff --git a/milena/mln/topo/faces_iter.hh b/milena/mln/topo/attic/faces_iter.hh
similarity index 100%
rename from milena/mln/topo/faces_iter.hh
rename to milena/mln/topo/attic/faces_iter.hh
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index bef3ca9..2ce88fd 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -49,9 +49,11 @@
# include <mln/topo/n_faces_set.hh>
# include <mln/topo/complex_iter.hh>
-# include <mln/topo/faces_iter.hh>
-# include <mln/topo/complex_faces_iter.hh>
-
+// FIXME: Disabled (moved to the attic).
+# if 0
+# include <mln/topo/faces_iter.hh>
+# include <mln/topo/complex_faces_iter.hh>
+# endif
namespace mln
{
@@ -63,8 +65,11 @@ namespace mln
template <unsigned N, unsigned D> class n_faces_set;
template <unsigned D> class complex_fwd_iter_;
template <unsigned D> class complex_bkd_iter_;
+// FIXME: Disabled (moved to the attic).
+# if 0
template <unsigned N, unsigned D> class faces_fwd_iter_;
template <unsigned N, unsigned D> class faces_bkd_iter_;
+#endif
// Forward declarations (internal).
namespace internal
@@ -91,12 +96,15 @@ namespace mln
/// Backward mln::Iterator type iterating on all faces.
typedef complex_bkd_iter_<D> bkd_citer;
+// FIXME: Disabled (moved to the attic).
+# if 0
/// Forward mln::Iterator type iterating on \p N-faces.
template <unsigned N>
struct fwd_fiter { typedef faces_fwd_iter_<N, D> ret; };
/// Backward mln::Iterator type iterating on \p N-faces.
template <unsigned N>
struct bkd_fiter { typedef faces_bkd_iter_<N, D> ret; };
+#endif
/// Complex construction.
/// \{
diff --git a/milena/tests/core/image/complex_image.cc b/milena/tests/core/image/complex_image.cc
index 148041d..47233cb 100644
--- a/milena/tests/core/image/complex_image.cc
+++ b/milena/tests/core/image/complex_image.cc
@@ -164,15 +164,13 @@ int main()
// Iterators on n-faces (with n fixed in [0, D]). //
// ----------------------------------------------- //
- // We need to instantiate a (non temporary) object on the stack, so
- // that it can be referenced later by face_psites held by iterators
- // (as for windows and neighborhoods).
-
+// FIXME: Disabled (moved to the attic).
+# if 0
// FIXME: Sugar the name of the iterator.
p_complex_faces_fwd_piter_<0, D, point2d> f0p(ima.domain());
for_all(f0p)
std::cout << "ima(" << f0p << ") = " << ima(f0p) << std::endl;
-
+#endif
/* FIXME: Implement other psite iterators, for instance:
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index 6b8c17e..eeaeb14 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -143,6 +143,8 @@ int main()
actual complex processing since they are not really flexible ---
but I'm not sure. */
+// FIXME: Disabled (moved to the attic).
+# if 0
/* Using faces_{fwd,bkd}_iter_<N, D>, which are proxies to
n_faces<N, D>. */
test_faces_iter<0>(c);
@@ -154,6 +156,7 @@ int main()
test_complex_faces_iter<0>(c);
test_complex_faces_iter<1>(c);
test_complex_faces_iter<2>(c);
+#endif
/*------------------------------.
| Iterators on adjacent faces. |
@@ -269,8 +272,11 @@ int main()
| define the iterated subset.
-----------------------------------------------------------------
- I'm unsure about the following existing iterators; should we keep
- them? What are they good for, except testing our code?
+
+ I'm unsure about the old iterators on n-faces (with a static n)
+ moved to the attic; should we keep them? What are they good for,
+ except testing our code? At least, we should find better names
+ for them, as we might confuse them with new iterators.
-----------------------------------------------------------------
Current name Definition
@@ -287,6 +293,8 @@ int main()
}
+// FIXME: Disabled (moved to the attic).
+# if 0
template <unsigned N, unsigned D>
void
test_faces_iter(topo::complex<D>& c)
@@ -315,3 +323,4 @@ test_complex_faces_iter(topo::complex<D>& c)
std::cout << fwd_ncf << ' ' << bkd_ncf << std::endl;
std::cout << std::endl;
}
+#endif
--
1.6.0.1
1
0
* milena/mln/topo/face.hh
(mln::topo::face_data<N, D>)
(mln::topo::n_face<N, D>)
(mln::topo::n_faces_set<N, D>):
Move...
* milena/mln/topo/face_data.hh,
* milena/mln/topo/n_face.hh,
* milena/mln/topo/n_faces_set.hh:
...here (new files).
* milena/mln/topo/complex.hh,
* milena/mln/topo/complex_faces_iter.hh,
* milena/mln/topo/complex_iter.hh,
* milena/mln/topo/faces_iter.hh:
Adjust.
* milena/tests/topo/complex.cc: Update documentation.
---
milena/ChangeLog | 20 ++
milena/mln/topo/complex.hh | 16 +-
milena/mln/topo/complex_faces_iter.hh | 1 +
milena/mln/topo/complex_iter.hh | 1 +
milena/mln/topo/face.hh | 442 +--------------------------------
milena/mln/topo/face_data.hh | 158 ++++++++++++
milena/mln/topo/faces_iter.hh | 1 +
milena/mln/topo/n_face.hh | 285 +++++++++++++++++++++
milena/mln/topo/n_faces_set.hh | 138 ++++++++++
milena/tests/topo/complex.cc | 17 +-
10 files changed, 629 insertions(+), 450 deletions(-)
create mode 100644 milena/mln/topo/face_data.hh
create mode 100644 milena/mln/topo/n_face.hh
create mode 100644 milena/mln/topo/n_faces_set.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 5a41910..9bd58d5 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,25 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Split mln/topo/face.hh.
+
+ * milena/mln/topo/face.hh
+ (mln::topo::face_data<N, D>)
+ (mln::topo::n_face<N, D>)
+ (mln::topo::n_faces_set<N, D>):
+ Move...
+ * milena/mln/topo/face_data.hh,
+ * milena/mln/topo/n_face.hh,
+ * milena/mln/topo/n_faces_set.hh:
+ ...here (new files).
+ * milena/mln/topo/complex.hh,
+ * milena/mln/topo/complex_faces_iter.hh,
+ * milena/mln/topo/complex_iter.hh,
+ * milena/mln/topo/faces_iter.hh:
+ Adjust.
+ * milena/tests/topo/complex.cc: Update documentation.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
Rename mln::topo::faces_set as mln::topo::n_faces_set.
* mln/topo/face.hh (mln::topo::faces_set<N, D>): Rename as...
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index 3ed8923..bef3ca9 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -43,7 +43,10 @@
# include <mln/util/tracked_ptr.hh>
+# include <mln/topo/face_data.hh>
# include <mln/topo/face.hh>
+# include <mln/topo/n_face.hh>
+# include <mln/topo/n_faces_set.hh>
# include <mln/topo/complex_iter.hh>
# include <mln/topo/faces_iter.hh>
@@ -56,7 +59,14 @@ namespace mln
namespace topo
{
- // Forward declarations.
+ // Forward declarations (external).
+ template <unsigned N, unsigned D> class n_faces_set;
+ template <unsigned D> class complex_fwd_iter_;
+ template <unsigned D> class complex_bkd_iter_;
+ template <unsigned N, unsigned D> class faces_fwd_iter_;
+ template <unsigned N, unsigned D> class faces_bkd_iter_;
+
+ // Forward declarations (internal).
namespace internal
{
template <unsigned D>
@@ -65,10 +75,6 @@ namespace mln
template <unsigned N, unsigned D>
struct faces_set_mixin;
}
- template <unsigned D> class complex_fwd_iter_;
- template <unsigned D> class complex_bkd_iter_;
- template <unsigned N, unsigned D> class faces_fwd_iter_;
- template <unsigned N, unsigned D> class faces_bkd_iter_;
/*----------.
diff --git a/milena/mln/topo/complex_faces_iter.hh b/milena/mln/topo/complex_faces_iter.hh
index 990d8d4..95d7901 100644
--- a/milena/mln/topo/complex_faces_iter.hh
+++ b/milena/mln/topo/complex_faces_iter.hh
@@ -33,6 +33,7 @@
/// of a complex.
# include <mln/topo/internal/complex_iter_base.hh>
+# include <mln/topo/face.hh>
/* FIXME: Should we drop N from the signature of these iterators?
I.e., have N be dynamic? Or better: provide other iterators where
diff --git a/milena/mln/topo/complex_iter.hh b/milena/mln/topo/complex_iter.hh
index a752892..32bbb1f 100644
--- a/milena/mln/topo/complex_iter.hh
+++ b/milena/mln/topo/complex_iter.hh
@@ -32,6 +32,7 @@
/// \brief Definition of forward and backward iterators on complexes.
# include <mln/topo/internal/complex_iter_base.hh>
+# include <mln/topo/face.hh>
// FIXME: Factor a bit more? (Using complex_iter_base_.)
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index e15c66a..136271c 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -33,236 +33,19 @@
#include <limits>
-#include <vector>
-
#include <mln/core/contract.hh>
-/* FIXME: Suggestions:
-
- Split `face', `face_handle' and `any_face_handle' code into several
- files.
-
- `face_data' is somehow an implementation detail: it should be
- hidden, either by moving it to mln/topo/complex.cc or into its own
- file in mln/topo/internal.
-
- And what about `n_faces_set'? Should we move it to its own file as
- well? */
-
namespace mln
{
namespace topo
{
- // Forward declarations (external).
+ // Forward declarations.
template <unsigned D> class complex;
- namespace internal
- {
- template <unsigned N, unsigned D> struct lower_dim_faces_set_mixin;
- template <unsigned N, unsigned D> struct higher_dim_faces_set_mixin;
- }
-
- // Forward declarations (internal).
template <unsigned N, unsigned D> class n_face;
- namespace internal
- {
- template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
- template <unsigned N, unsigned D> class higher_dim_faces_data_mixin;
- }
-
-
- /*------------.
- | Face data. |
- `------------*/
-
- /// Data (adjacent faces) associated to a \p N-face of a \p D-complex.
template <unsigned N, unsigned D> class face_data;
-
-
- // Specialization for the faces of highest dimension (\p D).
- template <unsigned D>
- class face_data<D, D> : public internal::lower_dim_faces_data_mixin<D, D>
- {
- };
-
- // Specialization for the faces of intermediate dimension (greater
- // than 0, lower than \p D).
- template <unsigned N, unsigned D>
- class face_data : public internal::lower_dim_faces_data_mixin<N, D>,
- public internal::higher_dim_faces_data_mixin<N, D>
- {
- };
-
- // Specialization for the faces of lowest dimension (0).
- template <unsigned D>
- class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u, D>
- {
- };
-
- // Specialization for the case of a 0-complex.
- template <>
- class face_data<0u, 0u>
- {
- };
-
-
- namespace internal
- {
-
- /// Factored implementation of faces.
- /// \{
- template <unsigned N, unsigned D>
- class lower_dim_faces_data_mixin
- {
- public:
- void connect_lower_dim_face (const n_face<N - 1, D>& f);
- private:
- friend class mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
- std::vector< n_face<N - 1, D> > lower_dim_faces_;
- };
-
- template <unsigned N, unsigned D>
- class higher_dim_faces_data_mixin
- {
- public:
- void connect_higher_dim_face(const n_face<N + 1, D>& f);
- private:
- friend class mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
- std::vector< n_face<N + 1, D> > higher_dim_faces_;
- };
- /// \}
-
- } // end of namespace mln::topo::internal
-
-
-
- /*---------.
- | n-Face. |
- `---------*/
-
- /// \brief \p N-face handle in a complex.
- ///
- /// Contrary to an mln::topo::face, the dimension of an
- /// mln::topo::n_face is fixed.
- template <unsigned N, unsigned D>
- struct n_face
- {
- // The type of the complex this handle points to.
- typedef complex<D> complex_type;
-
- /// Build a non-initialized face handle.
- n_face();
- /// Build a face handle from \a complex and \a face_id.
- n_face(complex<D>& complex, unsigned face_id);
-
- /// Copy and assignment.
- /// \{
- n_face(const n_face<N, D>& rhs);
- n_face<N, D>& operator=(const n_face<N, D>& rhs);
- /// \}
-
- /// Is this handle valid?
- bool is_valid() const;
- /// Invalidate this handle.
- void invalidate();
-
- /// Accessors.
- /// \{
- /// Return the complex the face belongs to.
- complex<D>& cplx() const;
- /// Return the id of the face.
- // FIXME: Rename as `id'?
- unsigned face_id() const;
-
- /// Set the complex the face belongs to.
- void set_cplx(complex<D>& cplx);
- /// Return the dimension of the face.
- // FIXME: Rename as `dim'?
- unsigned n() const;
- /// Set the id of the face.
- void set_face_id(unsigned face_id);
-
- /// Return the mln::topo::face_data pointed by this handle.
- face_data<N, D>& face_data() const;
- /// \}
-
- private:
- /// \brief The complex the face belongs to.
- ///
- /// A const mln::topo::n_face can be used to modify a complex.
- mutable complex<D>* cplx_;
- /// \brief The id of the face.
- // FIXME: Rename as `id_'?
- unsigned face_id_;
- };
-
-
- /// Create a handle for \p N-face of a \p D-complex.
- template <unsigned N, unsigned D>
- n_face<N, D>
- make_n_face(const complex<D>& c, unsigned face_id);
-
-
- /// Comparison of two instances of mln::topo::n_face.
- /// \{
- /// \brief Is \a lhs equal to \a rhs?
- ///
- /// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::topo::complex.
- template <unsigned N, unsigned D>
- bool
- operator==(const n_face<N, D>& lhs, const n_face<N, D>& rhs);
-
- /// \brief Is \a lhs ``less'' than \a rhs?
- ///
- /// This comparison is required by algorithms sorting face handles.
- ///
- /// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::topo::complex.
- template <unsigned N, unsigned D>
- bool
- operator< (const n_face<N, D>& lhs, const n_face<N, D>& rhs);
- /// \}
-
-
- /*----------------------.
- | Set of face handles. |
- `----------------------*/
-
- /// \brief Set of face handles of dimension \p N.
- template <unsigned N, unsigned D>
- class n_faces_set
- {
- public:
- void add(const n_face<N, D>& f);
-
- /// \brief Accessors.
- ///
- /// Return the set of handles.
- /// \{
- const std::vector< n_face<N, D> >& faces() const;
- /// \}
-
- private:
- friend class complex<D>;
-
- // FIXME: Rename this as `handles_'?
- std::vector< n_face<N, D> > faces_;
- };
-
-
- /// Construction helpers for mln::topo::n_faces_set.
- /// \{
- template <unsigned N, unsigned D>
- n_faces_set<N, D>
- operator+(const n_face<N, D>& f1, const n_face<N, D>& f2);
-
- template <unsigned N, unsigned D>
- n_faces_set<N, D>
- operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f);
- /// \}
-
+
/*-------.
| Face. |
@@ -287,6 +70,7 @@ namespace mln
template <unsigned N>
face(const n_face<N, D>& f);
+ // FIXME: Probably useless.
/// Copy and assignment.
/// \{
face(const face<D>& rhs);
@@ -361,222 +145,6 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- /*--------.
- | Faces. |
- `--------*/
-
- namespace internal
- {
- template <unsigned N, unsigned D>
- inline
- void
- lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const n_face<N - 1, D>& f)
- {
- lower_dim_faces_.push_back(f);
- }
-
- template <unsigned N, unsigned D>
- inline
- void
- higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const n_face<N + 1, D>& f)
- {
- higher_dim_faces_.push_back(f);
- }
-
- } // end of namespace mln::topo::internal
-
-
- /*--------------.
- | Face handle. |
- `--------------*/
-
- template <unsigned N, unsigned D>
- inline
- n_face<N, D>::n_face()
- : cplx_(0), face_id_(std::numeric_limits<unsigned>::max())
- {
- // Ensure N is compatible with D.
- metal::bool_< N <= D >::check();
- }
-
- template <unsigned N, unsigned D>
- inline
- n_face<N, D>::n_face(complex<D>& c, unsigned face_id)
- : cplx_(&c), face_id_(face_id)
- {
- // Ensure N is compatible with D.
- metal::bool_< N <= D >::check();
- }
-
- template <unsigned N, unsigned D>
- inline
- n_face<N, D>::n_face(const n_face<N, D>& rhs)
- : cplx_(rhs.cplx_), face_id_(rhs.face_id_)
- {
- // Ensure N is compatible with D.
- metal::bool_< N <= D >::check();
- }
-
- template <unsigned N, unsigned D>
- inline
- n_face<N, D>&
- n_face<N, D>::operator=(const n_face<N, D>& rhs)
- {
- if (&rhs != this)
- {
- cplx_ = rhs.cplx_;
- face_id_ = rhs.face_id_;
- }
- return *this;
- }
-
- template <unsigned N, unsigned D>
- inline
- bool
- n_face<N, D>::is_valid() const
- {
- return cplx_ != 0 && face_id_ < cplx_->template nfaces<N>();
- }
-
- template <unsigned N, unsigned D>
- inline
- void
- n_face<N, D>::invalidate()
- {
- set_face_id(std::numeric_limits<unsigned>::max());
- }
-
- template <unsigned N, unsigned D>
- inline
- complex<D>&
- n_face<N, D>::cplx() const
- {
- mln_precondition(cplx_);
- return *cplx_;
- }
-
- template <unsigned N, unsigned D>
- inline
- unsigned
- n_face<N, D>::n() const
- {
- return N;
- }
-
- template <unsigned N, unsigned D>
- inline
- unsigned
- n_face<N, D>::face_id() const
- {
- return face_id_;
- }
-
- template <unsigned N, unsigned D>
- inline
- void
- n_face<N, D>::set_cplx(complex<D>& cplx)
- {
- cplx_ = &cplx;
- }
-
- template <unsigned N, unsigned D>
- inline
- void
- n_face<N, D>::set_face_id(unsigned face_id)
- {
- face_id_ = face_id;
- }
-
- template <unsigned N, unsigned D>
- inline
- face_data<N, D>&
- n_face<N, D>::face_data() const
- {
- mln_precondition(is_valid());
- return cplx_->template face_data_<N>(face_id_);
- }
-
-
- template <unsigned N, unsigned D>
- inline
- n_face<N, D>
- make_n_face(const complex<D>& c, unsigned face_id)
- {
- return n_face<N, D>(&c, face_id);
- }
-
-
- template <unsigned N, unsigned D>
- inline
- bool
- operator==(const n_face<N, D>& lhs, const n_face<N, D>& rhs)
- {
- // Ensure LHS and RHS belong to the same complex.
- mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
- return lhs.face().id() == rhs.face().id();
- }
-
- template <unsigned N, unsigned D>
- inline
- bool
- operator< (const n_face<N, D>& lhs, const n_face<N, D>& rhs)
- {
- // Ensure LHS and RHS belong to the same complex.
- mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
- return lhs.face().id() < rhs.face().id();
- }
-
-
- /*---------------.
- | Set of faces. |
- `---------------*/
-
- template <unsigned N, unsigned D>
- inline
- void
- n_faces_set<N, D>::add(const n_face<N, D>& f)
- {
- // Check consistency.
- if (!faces_.empty())
- mln_precondition(&faces_.front().cplx() == &f.cplx());
- faces_.push_back(f);
- }
-
- template <unsigned N, unsigned D>
- inline
- const std::vector< n_face<N, D> >&
- n_faces_set<N, D>::faces() const
- {
- return faces_;
- }
-
-
- template <unsigned N, unsigned D>
- inline
- n_faces_set<N, D>
- operator+(const n_face<N, D>& f1, const n_face<N, D>& f2)
- {
- n_faces_set<N, D> fs;
- fs.add(f1);
- fs.add(f2);
- return fs;
- }
-
- template <unsigned N, unsigned D>
- inline
- n_faces_set<N, D>
- operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f)
- {
- n_faces_set<N, D> fs2(fs);
- fs2.add(f);
- return fs2;
- }
-
-
- /*----------------------.
- | ``Any-face'' handle. |
- `----------------------*/
-
template <unsigned D>
inline
face<D>::face()
@@ -588,8 +156,7 @@ namespace mln
template <unsigned D>
inline
- face<D>::face(complex<D>& c, unsigned n,
- unsigned face_id)
+ face<D>::face(complex<D>& c, unsigned n, unsigned face_id)
: cplx_(&c), n_(n), face_id_(face_id)
{
// Ensure N is compatible with D.
@@ -718,7 +285,6 @@ namespace mln
lhs.face().id() == rhs.face().id();
}
-
template <unsigned D>
inline
bool
diff --git a/milena/mln/topo/face_data.hh b/milena/mln/topo/face_data.hh
new file mode 100644
index 0000000..7c94ddd
--- /dev/null
+++ b/milena/mln/topo/face_data.hh
@@ -0,0 +1,158 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_TOPO_FACE_DATA_HH
+# define MLN_TOPO_FACE_DATA_HH
+
+/// \file mln/topo/face_data.hh
+/// \brief Data associated to the faces of a complex.
+///
+/// These data are actually lists of adjacent faces (of lower and
+/// higher dimensions).
+
+# include <vector>
+
+# include <mln/topo/n_face.hh>
+
+
+namespace mln
+{
+
+ namespace topo
+ {
+
+ // Forward declarations (external).
+ template <unsigned D> class complex;
+ namespace internal
+ {
+ template <unsigned N, unsigned D> struct lower_dim_faces_set_mixin;
+ template <unsigned N, unsigned D> struct higher_dim_faces_set_mixin;
+ }
+
+ // Forward declarations (internal).
+ template <unsigned N, unsigned D> class n_face;
+ namespace internal
+ {
+ template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
+ template <unsigned N, unsigned D> class higher_dim_faces_data_mixin;
+ }
+
+
+ /*------------.
+ | Face data. |
+ `------------*/
+
+ /// Data (adjacent faces) associated to a \p N-face of a \p D-complex.
+ template <unsigned N, unsigned D> class face_data;
+
+
+ // Specialization for the faces of highest dimension (\p D).
+ template <unsigned D>
+ class face_data<D, D> : public internal::lower_dim_faces_data_mixin<D, D>
+ {
+ };
+
+ // Specialization for the faces of intermediate dimension (greater
+ // than 0, lower than \p D).
+ template <unsigned N, unsigned D>
+ class face_data : public internal::lower_dim_faces_data_mixin<N, D>,
+ public internal::higher_dim_faces_data_mixin<N, D>
+ {
+ };
+
+ // Specialization for the faces of lowest dimension (0).
+ template <unsigned D>
+ class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u, D>
+ {
+ };
+
+ // Specialization for the case of a 0-complex.
+ template <>
+ class face_data<0u, 0u>
+ {
+ };
+
+
+ namespace internal
+ {
+
+ /// Factored implementation of faces.
+ /// \{
+ template <unsigned N, unsigned D>
+ class lower_dim_faces_data_mixin
+ {
+ public:
+ void connect_lower_dim_face (const n_face<N - 1, D>& f);
+ private:
+ friend class mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
+ std::vector< n_face<N - 1, D> > lower_dim_faces_;
+ };
+
+ template <unsigned N, unsigned D>
+ class higher_dim_faces_data_mixin
+ {
+ public:
+ void connect_higher_dim_face(const n_face<N + 1, D>& f);
+ private:
+ friend class mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
+ std::vector< n_face<N + 1, D> > higher_dim_faces_;
+ };
+ /// \}
+
+ } // end of namespace mln::topo::internal
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+ template <unsigned N, unsigned D>
+ inline
+ void
+ lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const n_face<N - 1, D>& f)
+ {
+ lower_dim_faces_.push_back(f);
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const n_face<N + 1, D>& f)
+ {
+ higher_dim_faces_.push_back(f);
+ }
+
+ } // end of namespace mln::topo::internal
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::topo
+
+} // end of namespace mln
+
+#endif // ! MLN_TOPO_FACE_DATA_HH
diff --git a/milena/mln/topo/faces_iter.hh b/milena/mln/topo/faces_iter.hh
index 1ad756b..509ed9c 100644
--- a/milena/mln/topo/faces_iter.hh
+++ b/milena/mln/topo/faces_iter.hh
@@ -33,6 +33,7 @@
/// of a complex.
# include <mln/topo/internal/complex_iter_base.hh>
+# include <mln/topo/n_face.hh>
namespace mln
{
diff --git a/milena/mln/topo/n_face.hh b/milena/mln/topo/n_face.hh
new file mode 100644
index 0000000..afeb4ab
--- /dev/null
+++ b/milena/mln/topo/n_face.hh
@@ -0,0 +1,285 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_TOPO_N_FACE_HH
+# define MLN_TOPO_N_FACE_HH
+
+/// \file mln/topo/n_face.hh
+/// \brief n-face of a complex.
+
+#include <limits>
+
+#include <mln/core/contract.hh>
+
+
+namespace mln
+{
+
+ namespace topo
+ {
+
+ // Forward declaration.
+ template <unsigned D> class complex;
+ template <unsigned N, unsigned D> class face_data;
+
+
+ /*---------.
+ | n-Face. |
+ `---------*/
+
+ /// \brief \p N-face handle in a complex.
+ ///
+ /// Contrary to an mln::topo::face, the dimension of an
+ /// mln::topo::n_face is fixed.
+ template <unsigned N, unsigned D>
+ struct n_face
+ {
+ // The type of the complex this handle points to.
+ typedef complex<D> complex_type;
+
+ /// Build a non-initialized face handle.
+ n_face();
+ /// Build a face handle from \a complex and \a face_id.
+ n_face(complex<D>& complex, unsigned face_id);
+
+ // FIXME: Probably useless.
+ /// Copy and assignment.
+ /// \{
+ n_face(const n_face<N, D>& rhs);
+ n_face<N, D>& operator=(const n_face<N, D>& rhs);
+ /// \}
+
+ /// Is this handle valid?
+ bool is_valid() const;
+ /// Invalidate this handle.
+ void invalidate();
+
+ /// Accessors.
+ /// \{
+ /// Return the complex the face belongs to.
+ complex<D>& cplx() const;
+ /// Return the id of the face.
+ // FIXME: Rename as `id'?
+ unsigned face_id() const;
+
+ /// Set the complex the face belongs to.
+ void set_cplx(complex<D>& cplx);
+ /// Return the dimension of the face.
+ // FIXME: Rename as `dim'?
+ unsigned n() const;
+ /// Set the id of the face.
+ void set_face_id(unsigned face_id);
+
+ /// Return the mln::topo::face_data pointed by this handle.
+ face_data<N, D>& face_data() const;
+ /// \}
+
+ private:
+ /// \brief The complex the face belongs to.
+ ///
+ /// A const mln::topo::n_face can be used to modify a complex.
+ mutable complex<D>* cplx_;
+ /// \brief The id of the face.
+ // FIXME: Rename as `id_'?
+ unsigned face_id_;
+ };
+
+
+ /// Create a handle for \p N-face of a \p D-complex.
+ template <unsigned N, unsigned D>
+ n_face<N, D>
+ make_n_face(const complex<D>& c, unsigned face_id);
+
+
+ /// Comparison of two instances of mln::topo::n_face.
+ /// \{
+ /// \brief Is \a lhs equal to \a rhs?
+ ///
+ /// \pre Arguments \a lhs and \a rhs must belong to the same
+ /// mln::topo::complex.
+ template <unsigned N, unsigned D>
+ bool
+ operator==(const n_face<N, D>& lhs, const n_face<N, D>& rhs);
+
+ /// \brief Is \a lhs ``less'' than \a rhs?
+ ///
+ /// This comparison is required by algorithms sorting face handles.
+ ///
+ /// \pre Arguments \a lhs and \a rhs must belong to the same
+ /// mln::topo::complex.
+ template <unsigned N, unsigned D>
+ bool
+ operator< (const n_face<N, D>& lhs, const n_face<N, D>& rhs);
+ /// \}
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned N, unsigned D>
+ inline
+ n_face<N, D>::n_face()
+ : cplx_(0), face_id_(std::numeric_limits<unsigned>::max())
+ {
+ // Ensure N is compatible with D.
+ metal::bool_< N <= D >::check();
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ n_face<N, D>::n_face(complex<D>& c, unsigned face_id)
+ : cplx_(&c), face_id_(face_id)
+ {
+ // Ensure N is compatible with D.
+ metal::bool_< N <= D >::check();
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ n_face<N, D>::n_face(const n_face<N, D>& rhs)
+ : cplx_(rhs.cplx_), face_id_(rhs.face_id_)
+ {
+ // Ensure N is compatible with D.
+ metal::bool_< N <= D >::check();
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ n_face<N, D>&
+ n_face<N, D>::operator=(const n_face<N, D>& rhs)
+ {
+ if (&rhs != this)
+ {
+ cplx_ = rhs.cplx_;
+ face_id_ = rhs.face_id_;
+ }
+ return *this;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ bool
+ n_face<N, D>::is_valid() const
+ {
+ return cplx_ != 0 && face_id_ < cplx_->template nfaces<N>();
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ n_face<N, D>::invalidate()
+ {
+ set_face_id(std::numeric_limits<unsigned>::max());
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ complex<D>&
+ n_face<N, D>::cplx() const
+ {
+ mln_precondition(cplx_);
+ return *cplx_;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ unsigned
+ n_face<N, D>::n() const
+ {
+ return N;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ unsigned
+ n_face<N, D>::face_id() const
+ {
+ return face_id_;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ n_face<N, D>::set_cplx(complex<D>& cplx)
+ {
+ cplx_ = &cplx;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ n_face<N, D>::set_face_id(unsigned face_id)
+ {
+ face_id_ = face_id;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ face_data<N, D>&
+ n_face<N, D>::face_data() const
+ {
+ mln_precondition(is_valid());
+ return cplx_->template face_data_<N>(face_id_);
+ }
+
+
+ template <unsigned N, unsigned D>
+ inline
+ n_face<N, D>
+ make_n_face(const complex<D>& c, unsigned face_id)
+ {
+ return n_face<N, D>(&c, face_id);
+ }
+
+
+ template <unsigned N, unsigned D>
+ inline
+ bool
+ operator==(const n_face<N, D>& lhs, const n_face<N, D>& rhs)
+ {
+ // Ensure LHS and RHS belong to the same complex.
+ mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
+ return lhs.face().id() == rhs.face().id();
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ bool
+ operator< (const n_face<N, D>& lhs, const n_face<N, D>& rhs)
+ {
+ // Ensure LHS and RHS belong to the same complex.
+ mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
+ return lhs.face().id() < rhs.face().id();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::topo
+
+} // end of namespace mln
+
+#endif // ! MLN_TOPO_N_FACE_HH
diff --git a/milena/mln/topo/n_faces_set.hh b/milena/mln/topo/n_faces_set.hh
new file mode 100644
index 0000000..65f56d9
--- /dev/null
+++ b/milena/mln/topo/n_faces_set.hh
@@ -0,0 +1,138 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_TOPO_N_FACES_SET_HH
+# define MLN_TOPO_N_FACES_SET_HH
+
+/// \file mln/topo/n_face_set.hh
+/// \brief Set of n-face of a complex.
+
+#include <vector>
+
+#include <mln/core/contract.hh>
+#include <mln/topo/n_face.hh>
+
+
+namespace mln
+{
+
+ namespace topo
+ {
+
+ // Forward declaration.
+ template <unsigned D> class complex;
+
+
+ /*------------------------.
+ | Set of n-face handles. |
+ `------------------------*/
+
+ /// \brief Set of face handles of dimension \p N.
+ template <unsigned N, unsigned D>
+ class n_faces_set
+ {
+ public:
+ void add(const n_face<N, D>& f);
+
+ /// \brief Accessors.
+ ///
+ /// Return the set of handles.
+ /// \{
+ const std::vector< n_face<N, D> >& faces() const;
+ /// \}
+
+ private:
+ friend class complex<D>;
+
+ // FIXME: Rename this as `handles_'?
+ std::vector< n_face<N, D> > faces_;
+ };
+
+
+ /// Construction helpers for mln::topo::n_faces_set.
+ /// \{
+ template <unsigned N, unsigned D>
+ n_faces_set<N, D>
+ operator+(const n_face<N, D>& f1, const n_face<N, D>& f2);
+
+ template <unsigned N, unsigned D>
+ n_faces_set<N, D>
+ operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f);
+ /// \}
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ n_faces_set<N, D>::add(const n_face<N, D>& f)
+ {
+ // Check consistency.
+ if (!faces_.empty())
+ mln_precondition(&faces_.front().cplx() == &f.cplx());
+ faces_.push_back(f);
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ const std::vector< n_face<N, D> >&
+ n_faces_set<N, D>::faces() const
+ {
+ return faces_;
+ }
+
+
+ template <unsigned N, unsigned D>
+ inline
+ n_faces_set<N, D>
+ operator+(const n_face<N, D>& f1, const n_face<N, D>& f2)
+ {
+ n_faces_set<N, D> fs;
+ fs.add(f1);
+ fs.add(f2);
+ return fs;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ n_faces_set<N, D>
+ operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f)
+ {
+ n_faces_set<N, D> fs2(fs);
+ fs2.add(f);
+ return fs2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::topo
+
+} // end of namespace mln
+
+#endif // ! MLN_TOPO_N_FACES_SET_HH
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index ebe734a..6b8c17e 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -189,15 +189,15 @@ int main()
But first, we need to clarify (existing) names.
-----------------------------------------------------------------
- Current/old name New name Definition
+ Current name New name Definition
-----------------------------------------------------------------
complex<D> (n/a) General complex
-
- face<N, D> face_data<N, D> Face data
- face_handle<N, D> n_face<N, D> (Static) n-face handle
- faces_set<N, D> n_faces_set<N, D> Set of face handles
- any_face_handle<D> face<D> Dynamic face handle
-
+
+ face_data<N, D> (n/a) Face data
+ n_face<N, D> (n/a) (Static) n-face handle
+ n_faces_set<N, D> (n/a) Set of face handles
+ face<D> (n/a) Dynamic face handle
+
complex_fwd_iter_<D>(c) face_fwd_iter<D>(c) | Iterators on all
complex_bkd_iter_<D>(c) face_bkd_iter<D>(c) | faces of c
@@ -209,6 +209,9 @@ int main()
(Note: get rid of trailing underscores, even for entities in
mln::internal::.)
+ And likewise for image-related entities!
+
+
Next, write these:
-----------------------------------------------------------------
--
1.6.0.1
1
0
26 Sep '08
* mln/topo/face.hh (mln::topo::faces_set<N, D>): Rename as...
(mln::topo::n_faces_set<N, D>): ...this.
Adjust.
* mln/topo/complex.hh: Adjust.
---
milena/ChangeLog | 9 +++++++++
milena/mln/topo/complex.hh | 10 +++++-----
milena/mln/topo/face.hh | 30 ++++++++++++++----------------
3 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index ded9680..5a41910 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Rename mln::topo::faces_set as mln::topo::n_faces_set.
+
+ * mln/topo/face.hh (mln::topo::faces_set<N, D>): Rename as...
+ (mln::topo::n_faces_set<N, D>): ...this.
+ Adjust.
+ * mln/topo/complex.hh: Adjust.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
Rename mln::topo::any_face_handle as mln::topo::face.
* mln/topo/face.hh (mln::topo::any_face_handle<D>): Rename as...
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index de6fb90..3ed8923 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -105,7 +105,7 @@ namespace mln
/// \param adjacent_faces The (\p N-1)-faces adjacent to the new
/// \p N-face.
template <unsigned N>
- n_face<N + 1, D> add_face(const faces_set<N, D>& adjacent_faces);
+ n_face<N + 1, D> add_face(const n_faces_set<N, D>& adjacent_faces);
/// \}
/// \brief Static manipulators.
@@ -128,8 +128,8 @@ namespace mln
/// \brief Return the number of \a n-faces.
///
/// Warning, this function has a complexity linear in term of N,
- /// since each faces_set is checked (the present implementation
- /// does not provide a direct access to faces_set through a
+ /// 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).
std::size_t nfaces(unsigned n) const;
/// \}
@@ -171,7 +171,7 @@ namespace mln
/* FIXME: Replace F and ACCU by a Milena accumulator? */
/** \brief Apply a kind of static fold left operator to the
- implicit list of faces_set using a functor \a f and a value \a
+ implicit list of n_faces_set using a functor \a f and a value \a
accu.
Argument \a is called an "accumulator", but with a slightly
@@ -420,7 +420,7 @@ namespace mln
template <unsigned D>
template <unsigned N>
n_face<N + 1, D>
- complex<D>::add_face(const faces_set<N, D>& adjacent_faces)
+ complex<D>::add_face(const n_faces_set<N, D>& adjacent_faces)
{
typedef typename std::vector< n_face<N, D> >::const_iterator iter_t;
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 85c2fef..e15c66a 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -39,8 +39,6 @@
/* FIXME: Suggestions:
- Rename faces_set as n_faces_set.
-
Split `face', `face_handle' and `any_face_handle' code into several
files.
@@ -48,8 +46,8 @@
hidden, either by moving it to mln/topo/complex.cc or into its own
file in mln/topo/internal.
- (And what about `faces_set'? Should we move it to its own file as
- well?) */
+ And what about `n_faces_set'? Should we move it to its own file as
+ well? */
namespace mln
{
@@ -234,7 +232,7 @@ namespace mln
/// \brief Set of face handles of dimension \p N.
template <unsigned N, unsigned D>
- class faces_set
+ class n_faces_set
{
public:
void add(const n_face<N, D>& f);
@@ -254,15 +252,15 @@ namespace mln
};
- /// Construction helpers for mln::topo::faces_set.
+ /// Construction helpers for mln::topo::n_faces_set.
/// \{
template <unsigned N, unsigned D>
- faces_set<N, D>
+ n_faces_set<N, D>
operator+(const n_face<N, D>& f1, const n_face<N, D>& f2);
template <unsigned N, unsigned D>
- faces_set<N, D>
- operator+(const faces_set<N, D>& fs, const n_face<N, D>& f);
+ n_faces_set<N, D>
+ operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f);
/// \}
@@ -536,7 +534,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- faces_set<N, D>::add(const n_face<N, D>& f)
+ n_faces_set<N, D>::add(const n_face<N, D>& f)
{
// Check consistency.
if (!faces_.empty())
@@ -547,7 +545,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
const std::vector< n_face<N, D> >&
- faces_set<N, D>::faces() const
+ n_faces_set<N, D>::faces() const
{
return faces_;
}
@@ -555,10 +553,10 @@ namespace mln
template <unsigned N, unsigned D>
inline
- faces_set<N, D>
+ n_faces_set<N, D>
operator+(const n_face<N, D>& f1, const n_face<N, D>& f2)
{
- faces_set<N, D> fs;
+ n_faces_set<N, D> fs;
fs.add(f1);
fs.add(f2);
return fs;
@@ -566,10 +564,10 @@ namespace mln
template <unsigned N, unsigned D>
inline
- faces_set<N, D>
- operator+(const faces_set<N, D>& fs, const n_face<N, D>& f)
+ n_faces_set<N, D>
+ operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f)
{
- faces_set<N, D> fs2(fs);
+ n_faces_set<N, D> fs2(fs);
fs2.add(f);
return fs2;
}
--
1.6.0.1
1
0
26 Sep '08
* mln/topo/face.hh (mln::topo::any_face_handle<D>): Rename as...
(mln::topo::face<D>): ...this.
Adjust.
* mln/topo/complex.hh,
* mln/topo/complex_iter.hh,
* mln/topo/complex_faces_iter.hh,
* tests/topo/complex.cc:
Adjust.
* mln/core/site_set/p_complex.hh: Update documentation.
* mln/core/site_set/complex_psite.hh,
* tests/core/image/complex_image.cc:
Adjust.
---
milena/ChangeLog | 18 ++++++
milena/mln/core/site_set/complex_psite.hh | 10 ++--
milena/mln/core/site_set/p_complex.hh | 15 +++---
milena/mln/topo/complex.hh | 2 +-
milena/mln/topo/complex_faces_iter.hh | 12 ++--
milena/mln/topo/complex_iter.hh | 12 ++--
milena/mln/topo/face.hh | 81 +++++++++++++++--------------
milena/tests/core/image/complex_image.cc | 2 +-
milena/tests/topo/complex.cc | 6 +-
9 files changed, 89 insertions(+), 69 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index dfdd15b..ded9680 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,23 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Rename mln::topo::any_face_handle as mln::topo::face.
+
+ * mln/topo/face.hh (mln::topo::any_face_handle<D>): Rename as...
+ (mln::topo::face<D>): ...this.
+ Adjust.
+ * mln/topo/complex.hh,
+ * mln/topo/complex_iter.hh,
+ * mln/topo/complex_faces_iter.hh,
+ * tests/topo/complex.cc:
+ Adjust.
+
+ * mln/core/site_set/p_complex.hh: Update documentation.
+ * mln/core/site_set/complex_psite.hh,
+ * tests/core/image/complex_image.cc:
+ Adjust.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
Rename mln::topo::face_handle as mln::topo::n_face.
* mln/topo/face.hh (mln::topo::face_handle<N, D>): Rename as...
diff --git a/milena/mln/core/site_set/complex_psite.hh b/milena/mln/core/site_set/complex_psite.hh
index 71dd84e..02ab19e 100644
--- a/milena/mln/core/site_set/complex_psite.hh
+++ b/milena/mln/core/site_set/complex_psite.hh
@@ -73,7 +73,7 @@ namespace mln
complex_psite();
/// \pre pc.cplx() == face.cplx().
complex_psite(const p_complex<D, P>& pc,
- const topo::any_face_handle<D>& face);
+ const topo::face<D>& face);
complex_psite(const p_complex<D, P>& pc, unsigned n, unsigned face_id);
/// \}
@@ -107,7 +107,7 @@ namespace mln
/// Face handle manipulators.
/// \{
/// Return the face handle of this point site.
- topo::any_face_handle<D> face() const;
+ topo::face<D> face() const;
/// Return the dimension of the face of this psite.
unsigned n() const;
@@ -142,7 +142,7 @@ namespace mln
/// The mln::p_faces this point site belongs to.
const target* pc_;
/// The handle of the face this psite is pointing towards.
- topo::any_face_handle<D> face_;
+ topo::face<D> face_;
/// \}
};
@@ -209,7 +209,7 @@ namespace mln
template <unsigned D, typename P>
inline
complex_psite<D, P>::complex_psite(const p_complex<D, P>& pc,
- const topo::any_face_handle<D>& face)
+ const topo::face<D>& face)
: pc_(&pc),
face_(face)
{
@@ -289,7 +289,7 @@ namespace mln
template <unsigned D, typename P>
inline
- topo::any_face_handle<D>
+ topo::face<D>
complex_psite<D, P>::face() const
{
return face_;
diff --git a/milena/mln/core/site_set/p_complex.hh b/milena/mln/core/site_set/p_complex.hh
index 206cd34..a747b69 100644
--- a/milena/mln/core/site_set/p_complex.hh
+++ b/milena/mln/core/site_set/p_complex.hh
@@ -167,18 +167,17 @@ namespace mln
private:
/// The complex on which this pset is built.
/* FIXME: Get rid of this `mutable' qualifier. This is needed for
- compatiblity reasons with any_face_handle (see
- p_complex_piter).
+ compatiblity reasons with topo::face (see p_complex_piter).
We should either
- - have an additional version of any_face_handle holding a
- const (not mutable) complex;
+ - have an additional version of topo::face holding a const (not
+ mutable) complex;
- - have face_handle and any_face_handle do not hold a reference
- on a complex, leading to a design of complexes similar to
- graphs, where vertex and edge handles (named `id's) are not
- tied to a specific graph. */
+ - have face_handle and topo::face do not hold a reference on a
+ complex, leading to a design of complexes similar to graphs,
+ where vertex and edge handles (named `id's) are not tied to a
+ specific graph. */
mutable topo::complex<D> cplx_;
};
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index 021e788..de6fb90 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -153,7 +153,7 @@ namespace mln
/// Accessors.
/// \{
template <unsigned N, unsigned D_> friend class n_face;
- template <unsigned D_> friend class any_face_handle;
+ template <unsigned D_> friend class face;
template <unsigned N>
face_data<N, D>& face_data_(unsigned face_id);
diff --git a/milena/mln/topo/complex_faces_iter.hh b/milena/mln/topo/complex_faces_iter.hh
index 05713da..990d8d4 100644
--- a/milena/mln/topo/complex_faces_iter.hh
+++ b/milena/mln/topo/complex_faces_iter.hh
@@ -55,12 +55,12 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class complex_faces_fwd_iter_
- : public internal::complex_iter_base_< any_face_handle<D>,
+ : public internal::complex_iter_base_< face<D>,
complex_faces_fwd_iter_<N, D> >
{
public:
/// Type of associated face.
- typedef any_face_handle<D> face;
+ typedef face<D> face;
private:
typedef complex_faces_fwd_iter_<N, D> self_;
@@ -101,12 +101,12 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class complex_faces_bkd_iter_
- : public internal::complex_iter_base_< any_face_handle<D>,
+ : public internal::complex_iter_base_< face<D>,
complex_faces_bkd_iter_<N, D> >
{
public:
/// Type of associated face.
- typedef any_face_handle<D> face;
+ typedef face<D> face;
private:
typedef complex_faces_bkd_iter_<N, D> self_;
@@ -183,7 +183,7 @@ namespace mln
{
unsigned face_id = face_.face_id();
if (face_id + 1 < face_.cplx().template nfaces<N>())
- /* FIXME: Provide accessor any_face_handle::face_id()
+ /* FIXME: Provide accessor face::face_id()
returning a mutable reference? This way, we could just
write
@@ -242,7 +242,7 @@ namespace mln
{
unsigned face_id = face_.face_id();
if (face_id > 0)
- /* FIXME: Provide accessor any_face_handle::face_id()
+ /* FIXME: Provide accessor face::face_id()
returning a mutable reference? This way, we could just
write
diff --git a/milena/mln/topo/complex_iter.hh b/milena/mln/topo/complex_iter.hh
index b30ca00..a752892 100644
--- a/milena/mln/topo/complex_iter.hh
+++ b/milena/mln/topo/complex_iter.hh
@@ -55,12 +55,12 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned D>
class complex_fwd_iter_
- : public internal::complex_iter_base_< any_face_handle<D>,
+ : public internal::complex_iter_base_< face<D>,
complex_fwd_iter_<D> >
{
public:
/// Type of associated face.
- typedef any_face_handle<D> face;
+ typedef face<D> face;
private:
typedef complex_fwd_iter_<D> self_;
@@ -100,12 +100,12 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned D>
class complex_bkd_iter_
- : public internal::complex_iter_base_< any_face_handle<D>,
+ : public internal::complex_iter_base_< face<D>,
complex_bkd_iter_<D> >
{
public:
/// Type of associated face.
- typedef any_face_handle<D> face;
+ typedef face<D> face;
private:
typedef complex_bkd_iter_<D> self_;
@@ -179,7 +179,7 @@ namespace mln
unsigned face_id = face_.face_id();
if (face_id + 1 < face_.cplx().nfaces(n))
- /* FIXME: Provide accessor any_face_handle::face_id() returning
+ /* FIXME: Provide accessor face::face_id() returning
a mutable reference? This way, we could just write
++face_.face_id();
@@ -243,7 +243,7 @@ namespace mln
unsigned face_id = face_.face_id();
if (face_id > 0)
- /* FIXME: Provide accessor any_face_handle::face_id() returning
+ /* FIXME: Provide accessor face::face_id() returning
a mutable reference? This way, we could just write
++face_.face_id();
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 4aab366..85c2fef 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -39,13 +39,10 @@
/* FIXME: Suggestions:
- - rename `face' as `face_data', and move it into complex.hh or its
- own file;
- - rename `face_handle' as `face', and move it to its own file;
- - rename `any_face_handle' as `any_face', and move it to its own file.
+ Rename faces_set as n_faces_set.
- Anyway, whatever the decision, splitting `face', `face_handle' and
- `any_face_handle' seems to be sound.
+ Split `face', `face_handle' and `any_face_handle' code into several
+ files.
`face_data' is somehow an implementation detail: it should be
hidden, either by moving it to mln/topo/complex.cc or into its own
@@ -146,7 +143,10 @@ namespace mln
| n-Face. |
`---------*/
- // \p N-face handle in a complex.
+ /// \brief \p N-face handle in a complex.
+ ///
+ /// Contrary to an mln::topo::face, the dimension of an
+ /// mln::topo::n_face is fixed.
template <unsigned N, unsigned D>
struct n_face
{
@@ -266,30 +266,33 @@ namespace mln
/// \}
- /*----------------------.
- | ``Any-face'' handle. |
- `----------------------*/
+ /*-------.
+ | Face. |
+ `-------*/
- // Face handle in a complex, where the dimension is dynamic.
+ /// \brief Face handle in a complex; the face dimension is dynamic.
+ ///
+ /// Contrary to an mln::topo::n_face, the dimension of an
+ /// mln::topo::face is not fixed.
template <unsigned D>
- struct any_face_handle
+ struct face
{
// The type of the complex this handle points to.
typedef complex<D> complex_type;
/// Build a non-initialized face handle.
- any_face_handle();
+ face();
/// Build a face handle from \a complex and \a face_id.
- any_face_handle(complex<D>& complex, unsigned n, unsigned face_id);
+ face(complex<D>& complex, unsigned n, unsigned face_id);
- /// Build a face handle from a face_handle.
+ /// Build a face handle from an mln::topo::n_face.
template <unsigned N>
- any_face_handle(const n_face<N, D>& f);
+ face(const n_face<N, D>& f);
/// Copy and assignment.
/// \{
- any_face_handle(const any_face_handle<D>& rhs);
- any_face_handle<D>& operator=(const any_face_handle<D>& rhs);
+ face(const face<D>& rhs);
+ face<D>& operator=(const face<D>& rhs);
/// \}
/// Is this handle valid?
@@ -323,7 +326,7 @@ namespace mln
private:
/// \brief The complex the face belongs to.
///
- /// A const any_face_handle can be used to modify a complex.
+ /// A const face can be used to modify a complex.
mutable complex<D>* cplx_;
/// The dimension of the face.
// FIXME: Rename as `dim_'?
@@ -334,7 +337,7 @@ namespace mln
};
- /// Comparison of two instances of mln::topo::any_face_handle.
+ /// Comparison of two instances of mln::topo::face.
/// \{
/// \brief Is \a lhs equal to \a rhs?
///
@@ -342,7 +345,7 @@ namespace mln
/// mln::topo::complex.
template <unsigned D>
bool
- operator==(const any_face_handle<D>& lhs, const any_face_handle<D>& rhs);
+ operator==(const face<D>& lhs, const face<D>& rhs);
/// \brief Is \a lhs ``less'' than \a rhs?
///
@@ -353,7 +356,7 @@ namespace mln
/// \pre Arguments \a lhs and \a rhs must have the same dimension.
template <unsigned D>
bool
- operator< (const any_face_handle<D>& lhs, const any_face_handle<D>& rhs);
+ operator< (const face<D>& lhs, const face<D>& rhs);
/// \}
@@ -578,7 +581,7 @@ namespace mln
template <unsigned D>
inline
- any_face_handle<D>::any_face_handle()
+ face<D>::face()
: cplx_(0),
n_(std::numeric_limits<unsigned>::max()),
face_id_(std::numeric_limits<unsigned>::max())
@@ -587,7 +590,7 @@ namespace mln
template <unsigned D>
inline
- any_face_handle<D>::any_face_handle(complex<D>& c, unsigned n,
+ face<D>::face(complex<D>& c, unsigned n,
unsigned face_id)
: cplx_(&c), n_(n), face_id_(face_id)
{
@@ -598,7 +601,7 @@ namespace mln
template <unsigned D>
template <unsigned N>
inline
- any_face_handle<D>::any_face_handle(const n_face<N, D>& f)
+ face<D>::face(const n_face<N, D>& f)
: cplx_(&f.cplx()), n_(N), face_id_(f.face_id())
{
// Ensure N is compatible with D.
@@ -608,15 +611,15 @@ namespace mln
template <unsigned D>
inline
- any_face_handle<D>::any_face_handle(const any_face_handle<D>& rhs)
+ face<D>::face(const face<D>& rhs)
: cplx_(rhs.cplx_), n_(rhs.n_), face_id_(rhs.face_id_)
{
}
template <unsigned D>
inline
- any_face_handle<D>&
- any_face_handle<D>::operator=(const any_face_handle<D>& rhs)
+ face<D>&
+ face<D>::operator=(const face<D>& rhs)
{
if (&rhs != this)
{
@@ -630,7 +633,7 @@ namespace mln
template <unsigned D>
inline
bool
- any_face_handle<D>::is_valid() const
+ face<D>::is_valid() const
{
return cplx_ != 0 && n_ <= D && face_id_ < cplx_->nfaces(n_);
}
@@ -638,7 +641,7 @@ namespace mln
template <unsigned D>
inline
void
- any_face_handle<D>::invalidate()
+ face<D>::invalidate()
{
set_n(std::numeric_limits<unsigned>::max());
set_face_id(std::numeric_limits<unsigned>::max());
@@ -647,7 +650,7 @@ namespace mln
template <unsigned D>
inline
complex<D>&
- any_face_handle<D>::cplx() const
+ face<D>::cplx() const
{
mln_precondition(cplx_);
return *cplx_;
@@ -656,7 +659,7 @@ namespace mln
template <unsigned D>
inline
unsigned
- any_face_handle<D>::n() const
+ face<D>::n() const
{
return n_;
}
@@ -664,7 +667,7 @@ namespace mln
template <unsigned D>
inline
unsigned
- any_face_handle<D>::face_id() const
+ face<D>::face_id() const
{
return face_id_;
}
@@ -672,7 +675,7 @@ namespace mln
template <unsigned D>
inline
void
- any_face_handle<D>::set_cplx(complex<D>& cplx)
+ face<D>::set_cplx(complex<D>& cplx)
{
cplx_ = &cplx;
}
@@ -680,7 +683,7 @@ namespace mln
template <unsigned D>
inline
void
- any_face_handle<D>::set_n(unsigned n)
+ face<D>::set_n(unsigned n)
{
n_ = n;
}
@@ -688,7 +691,7 @@ namespace mln
template <unsigned D>
inline
void
- any_face_handle<D>::set_face_id(unsigned face_id)
+ face<D>::set_face_id(unsigned face_id)
{
face_id_ = face_id;
}
@@ -697,7 +700,7 @@ namespace mln
template <unsigned N>
inline
face_data<N, D>&
- any_face_handle<D>::face_data() const
+ face<D>::face_data() const
{
mln_precondition(n_ == N);
mln_precondition(is_valid());
@@ -708,7 +711,7 @@ namespace mln
template <unsigned D>
inline
bool
- operator==(const any_face_handle<D>& lhs, const any_face_handle<D>& rhs)
+ operator==(const face<D>& lhs, const face<D>& rhs)
{
// Ensure LHS and RHS belong to the same complex.
mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
@@ -721,7 +724,7 @@ namespace mln
template <unsigned D>
inline
bool
- operator< (const any_face_handle<D>& lhs, const any_face_handle<D>& rhs)
+ operator< (const face<D>& lhs, const face<D>& rhs)
{
// Ensure LHS and RHS belong to the same complex.
mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
diff --git a/milena/tests/core/image/complex_image.cc b/milena/tests/core/image/complex_image.cc
index b8e4c8a..148041d 100644
--- a/milena/tests/core/image/complex_image.cc
+++ b/milena/tests/core/image/complex_image.cc
@@ -91,7 +91,7 @@ int main()
// A pset.
p_complex<D, point2d> pc(c);
- topo::any_face_handle<D> af(e0);
+ topo::face<D> af(e0);
// An associated psite.
complex_psite<D, point2d> cs(pc, af);
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index e10721f..ebe734a 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -110,7 +110,7 @@ int main()
const topo::face_data<1, D>& face1 = e0.face_data();
// Any-face handle.
- topo::any_face_handle<D> af(e0);
+ topo::face<D> af(e0);
// Get the face data from (``dynamic'') face handle AF.
const topo::face_data<1, D>& face2 = af.face_data<1>();
@@ -150,7 +150,7 @@ int main()
test_faces_iter<2>(c);
/* Using complex_faces_{fwd,bkd}_iter_<N, D>, which are proxies to
- any_face_handles<N>. */
+ faces<N>. */
test_complex_faces_iter<0>(c);
test_complex_faces_iter<1>(c);
test_complex_faces_iter<2>(c);
@@ -278,7 +278,7 @@ int main()
faces_fwd_iter_<N, D> Iterators on N-faces, N being
faces_fwd_iter_<N, D> static, acting as proxies of
- any_face_handle<N, D>'s.
+ face<D>'s.
-----------------------------------------------------------------
*/
}
--
1.6.0.1
1
0
* mln/topo/face.hh (mln::topo::face_handle<N, D>): Rename as...
(mln::topo::n_face<N, D>): ...this.
Adjust.
* mln/topo/complex.hh,
* mln/topo/faces_iter.hh,
* tests/topo/complex.cc:
Adjust.
* mln/core/faces_psite.hh,
* tests/core/image/complex_image.cc:
Likewise.
---
milena/ChangeLog | 16 +++++
milena/mln/core/faces_psite.hh | 10 ++--
milena/mln/topo/complex.hh | 28 ++++----
milena/mln/topo/face.hh | 102 +++++++++++++++---------------
milena/mln/topo/faces_iter.hh | 12 ++--
milena/tests/core/image/complex_image.cc | 22 +++---
milena/tests/topo/complex.cc | 28 ++++----
7 files changed, 117 insertions(+), 101 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index fb69e22..dfdd15b 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,21 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Rename mln::topo::face_handle as mln::topo::n_face.
+
+ * mln/topo/face.hh (mln::topo::face_handle<N, D>): Rename as...
+ (mln::topo::n_face<N, D>): ...this.
+ Adjust.
+ * mln/topo/complex.hh,
+ * mln/topo/faces_iter.hh,
+ * tests/topo/complex.cc:
+ Adjust.
+
+ * mln/core/faces_psite.hh,
+ * tests/core/image/complex_image.cc:
+ Likewise.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
Rename mln::topo::face as mln::topo::face_data.
* mln/topo/face.hh (mln::topo::face<N, D>): Rename as...
diff --git a/milena/mln/core/faces_psite.hh b/milena/mln/core/faces_psite.hh
index dd213b6..0e4d635 100644
--- a/milena/mln/core/faces_psite.hh
+++ b/milena/mln/core/faces_psite.hh
@@ -66,7 +66,7 @@ namespace mln
/// \{
faces_psite();
/// \pre pf.cplx() == face.cplx().
- faces_psite(const p_faces<N, D, P>& pf, const topo::face_handle<N, D>& face);
+ faces_psite(const p_faces<N, D, P>& pf, const topo::n_face<N, D>& face);
faces_psite(const p_faces<N, D, P>& pf, unsigned face_id);
/// \}
@@ -100,7 +100,7 @@ namespace mln
/// Face handle manipulators.
/// \{
/// Return the face handle of this point site.
- topo::face_handle<N, D> face() const;
+ topo::n_face<N, D> face() const;
/// Return the dimension of the face of this psite.
unsigned n() const;
@@ -134,7 +134,7 @@ namespace mln
/// The mln::p_faces this point site belongs to.
const target* pf_;
/// The handle of the face this psite is pointing towards.
- topo::face_handle<N, D> face_;
+ topo::n_face<N, D> face_;
/// \}
};
@@ -199,7 +199,7 @@ namespace mln
template <unsigned N, unsigned D, typename P>
inline
faces_psite<N, D, P>::faces_psite(const p_faces<N, D, P>& pf,
- const topo::face_handle<N, D>& face)
+ const topo::n_face<N, D>& face)
: pf_(&pf),
face_(face)
{
@@ -285,7 +285,7 @@ namespace mln
template <unsigned N, unsigned D, typename P>
inline
- topo::face_handle<N, D>
+ topo::n_face<N, D>
faces_psite<N, D, P>::face() const
{
return face_;
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index 52c43a9..021e788 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -98,14 +98,14 @@ namespace mln
complex();
/// \brief Add a 0-face to the complex.
- face_handle<0u, D> add_face();
+ n_face<0u, D> add_face();
/// \brief Add a \p (N+1)-face to the complex (with \p N >= 0).
///
/// \param adjacent_faces The (\p N-1)-faces adjacent to the new
/// \p N-face.
template <unsigned N>
- face_handle<N + 1, D> add_face(const faces_set<N, D>& adjacent_faces);
+ n_face<N + 1, D> add_face(const faces_set<N, D>& adjacent_faces);
/// \}
/// \brief Static manipulators.
@@ -152,7 +152,7 @@ namespace mln
/// Accessors.
/// \{
- template <unsigned N, unsigned D_> friend class face_handle;
+ template <unsigned N, unsigned D_> friend class n_face;
template <unsigned D_> friend class any_face_handle;
template <unsigned N>
@@ -195,8 +195,8 @@ namespace mln
///
/// \pre \p N must be lower or equal to \p D.
template <unsigned N>
- void connect_(const face_handle<N, D>& f1,
- const face_handle<N + 1, D>& f2);
+ void connect_(const n_face<N, D>& f1,
+ const n_face<N + 1, D>& f2);
};
@@ -406,7 +406,7 @@ namespace mln
}
template <unsigned D>
- face_handle<0u, D>
+ n_face<0u, D>
complex<D>::add_face()
{
/* FIXME: This is not thread-proof (these two lines should
@@ -414,15 +414,15 @@ namespace mln
data_->internal::faces_set_mixin<0u, D>::faces_.push_back(face_data<0u, D>());
unsigned id = nfaces<0u>() - 1;
- return face_handle<0u, D>(*this, id);
+ return n_face<0u, D>(*this, id);
}
template <unsigned D>
template <unsigned N>
- face_handle<N + 1, D>
+ n_face<N + 1, D>
complex<D>::add_face(const faces_set<N, D>& adjacent_faces)
{
- typedef typename std::vector< face_handle<N, D> >::const_iterator iter_t;
+ typedef typename std::vector< n_face<N, D> >::const_iterator iter_t;
// Ensure ADJACENT_FACES are already part of the complex.
if (!HAS_NDEBUG)
@@ -439,7 +439,7 @@ namespace mln
data_->internal::faces_set_mixin<N + 1, D>::faces_.push_back(f);
unsigned id = nfaces<N + 1>() - 1;
- face_handle<N + 1, D> fh(*this, id);
+ n_face<N + 1, D> fh(*this, id);
// Connect F and its ADJACENT_FACES.
for (iter_t a = adjacent_faces.faces().begin();
a != adjacent_faces.faces().end(); ++a)
@@ -551,8 +551,8 @@ namespace mln
template <unsigned D>
template <unsigned N>
void
- complex<D>::connect_(const face_handle<N, D>& f1,
- const face_handle<N + 1, D>& f2)
+ complex<D>::connect_(const n_face<N, D>& f1,
+ const n_face<N + 1, D>& f2)
{
// Ensure N is compatible with D.
metal::bool_< N <= D >::check();
@@ -703,7 +703,7 @@ namespace mln
lower_dim_faces_set_mixin<N, D>::print(std::ostream& ostr,
const face_data<N, D>& f) const
{
- for (typename std::vector< face_handle<N - 1, D> >::const_iterator l =
+ for (typename std::vector< n_face<N - 1, D> >::const_iterator l =
f.lower_dim_faces_.begin(); l != f.lower_dim_faces_.end(); ++l)
ostr << l->face_id() << " ";
}
@@ -713,7 +713,7 @@ namespace mln
higher_dim_faces_set_mixin<N, D>::print(std::ostream& ostr,
const face_data<N, D>& f) const
{
- for (typename std::vector< face_handle<N + 1, D> >::const_iterator h =
+ for (typename std::vector< n_face<N + 1, D> >::const_iterator h =
f.higher_dim_faces_.begin(); h != f.higher_dim_faces_.end(); ++h)
ostr << h->face_id() << " ";
}
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 689f7e6..4aab366 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -69,7 +69,7 @@ namespace mln
}
// Forward declarations (internal).
- template <unsigned N, unsigned D> class face_handle;
+ template <unsigned N, unsigned D> class n_face;
namespace internal
{
template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
@@ -121,20 +121,20 @@ namespace mln
class lower_dim_faces_data_mixin
{
public:
- void connect_lower_dim_face (const face_handle<N - 1, D>& f);
+ void connect_lower_dim_face (const n_face<N - 1, D>& f);
private:
friend class mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
- std::vector< face_handle<N - 1, D> > lower_dim_faces_;
+ std::vector< n_face<N - 1, D> > lower_dim_faces_;
};
template <unsigned N, unsigned D>
class higher_dim_faces_data_mixin
{
public:
- void connect_higher_dim_face(const face_handle<N + 1, D>& f);
+ void connect_higher_dim_face(const n_face<N + 1, D>& f);
private:
friend class mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
- std::vector< face_handle<N + 1, D> > higher_dim_faces_;
+ std::vector< n_face<N + 1, D> > higher_dim_faces_;
};
/// \}
@@ -142,26 +142,26 @@ namespace mln
- /*--------------.
- | Face handle. |
- `--------------*/
+ /*---------.
+ | n-Face. |
+ `---------*/
- // Face handle in a complex.
+ // \p N-face handle in a complex.
template <unsigned N, unsigned D>
- struct face_handle
+ struct n_face
{
// The type of the complex this handle points to.
typedef complex<D> complex_type;
/// Build a non-initialized face handle.
- face_handle();
+ n_face();
/// Build a face handle from \a complex and \a face_id.
- face_handle(complex<D>& complex, unsigned face_id);
+ n_face(complex<D>& complex, unsigned face_id);
/// Copy and assignment.
/// \{
- face_handle(const face_handle<N, D>& rhs);
- face_handle<N, D>& operator=(const face_handle<N, D>& rhs);
+ n_face(const n_face<N, D>& rhs);
+ n_face<N, D>& operator=(const n_face<N, D>& rhs);
/// \}
/// Is this handle valid?
@@ -192,7 +192,7 @@ namespace mln
private:
/// \brief The complex the face belongs to.
///
- /// A const face_handle can be used to modify a complex.
+ /// A const mln::topo::n_face can be used to modify a complex.
mutable complex<D>* cplx_;
/// \brief The id of the face.
// FIXME: Rename as `id_'?
@@ -202,11 +202,11 @@ namespace mln
/// Create a handle for \p N-face of a \p D-complex.
template <unsigned N, unsigned D>
- face_handle<N, D>
- make_face_handle(const complex<D>& c, unsigned face_id);
+ n_face<N, D>
+ make_n_face(const complex<D>& c, unsigned face_id);
- /// Comparison of two instances of mln::topo::face_handle.
+ /// Comparison of two instances of mln::topo::n_face.
/// \{
/// \brief Is \a lhs equal to \a rhs?
///
@@ -214,7 +214,7 @@ namespace mln
/// mln::topo::complex.
template <unsigned N, unsigned D>
bool
- operator==(const face_handle<N, D>& lhs, const face_handle<N, D>& rhs);
+ operator==(const n_face<N, D>& lhs, const n_face<N, D>& rhs);
/// \brief Is \a lhs ``less'' than \a rhs?
///
@@ -224,7 +224,7 @@ namespace mln
/// mln::topo::complex.
template <unsigned N, unsigned D>
bool
- operator< (const face_handle<N, D>& lhs, const face_handle<N, D>& rhs);
+ operator< (const n_face<N, D>& lhs, const n_face<N, D>& rhs);
/// \}
@@ -237,20 +237,20 @@ namespace mln
class faces_set
{
public:
- void add(const face_handle<N, D>& f);
+ void add(const n_face<N, D>& f);
/// \brief Accessors.
///
/// Return the set of handles.
/// \{
- const std::vector< face_handle<N, D> >& faces() const;
+ const std::vector< n_face<N, D> >& faces() const;
/// \}
private:
friend class complex<D>;
// FIXME: Rename this as `handles_'?
- std::vector< face_handle<N, D> > faces_;
+ std::vector< n_face<N, D> > faces_;
};
@@ -258,11 +258,11 @@ namespace mln
/// \{
template <unsigned N, unsigned D>
faces_set<N, D>
- operator+(const face_handle<N, D>& f1, const face_handle<N, D>& f2);
+ operator+(const n_face<N, D>& f1, const n_face<N, D>& f2);
template <unsigned N, unsigned D>
faces_set<N, D>
- operator+(const faces_set<N, D>& fs, const face_handle<N, D>& f);
+ operator+(const faces_set<N, D>& fs, const n_face<N, D>& f);
/// \}
@@ -284,7 +284,7 @@ namespace mln
/// Build a face handle from a face_handle.
template <unsigned N>
- any_face_handle(const face_handle<N, D>& f);
+ any_face_handle(const n_face<N, D>& f);
/// Copy and assignment.
/// \{
@@ -369,7 +369,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const face_handle<N - 1, D>& f)
+ lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const n_face<N - 1, D>& f)
{
lower_dim_faces_.push_back(f);
}
@@ -377,7 +377,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const face_handle<N + 1, D>& f)
+ higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const n_face<N + 1, D>& f)
{
higher_dim_faces_.push_back(f);
}
@@ -391,7 +391,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
- face_handle<N, D>::face_handle()
+ n_face<N, D>::n_face()
: cplx_(0), face_id_(std::numeric_limits<unsigned>::max())
{
// Ensure N is compatible with D.
@@ -400,7 +400,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
- face_handle<N, D>::face_handle(complex<D>& c, unsigned face_id)
+ n_face<N, D>::n_face(complex<D>& c, unsigned face_id)
: cplx_(&c), face_id_(face_id)
{
// Ensure N is compatible with D.
@@ -409,7 +409,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
- face_handle<N, D>::face_handle(const face_handle<N, D>& rhs)
+ n_face<N, D>::n_face(const n_face<N, D>& rhs)
: cplx_(rhs.cplx_), face_id_(rhs.face_id_)
{
// Ensure N is compatible with D.
@@ -418,8 +418,8 @@ namespace mln
template <unsigned N, unsigned D>
inline
- face_handle<N, D>&
- face_handle<N, D>::operator=(const face_handle<N, D>& rhs)
+ n_face<N, D>&
+ n_face<N, D>::operator=(const n_face<N, D>& rhs)
{
if (&rhs != this)
{
@@ -432,7 +432,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
bool
- face_handle<N, D>::is_valid() const
+ n_face<N, D>::is_valid() const
{
return cplx_ != 0 && face_id_ < cplx_->template nfaces<N>();
}
@@ -440,7 +440,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- face_handle<N, D>::invalidate()
+ n_face<N, D>::invalidate()
{
set_face_id(std::numeric_limits<unsigned>::max());
}
@@ -448,7 +448,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
complex<D>&
- face_handle<N, D>::cplx() const
+ n_face<N, D>::cplx() const
{
mln_precondition(cplx_);
return *cplx_;
@@ -457,7 +457,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
unsigned
- face_handle<N, D>::n() const
+ n_face<N, D>::n() const
{
return N;
}
@@ -465,7 +465,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
unsigned
- face_handle<N, D>::face_id() const
+ n_face<N, D>::face_id() const
{
return face_id_;
}
@@ -473,7 +473,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- face_handle<N, D>::set_cplx(complex<D>& cplx)
+ n_face<N, D>::set_cplx(complex<D>& cplx)
{
cplx_ = &cplx;
}
@@ -481,7 +481,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- face_handle<N, D>::set_face_id(unsigned face_id)
+ n_face<N, D>::set_face_id(unsigned face_id)
{
face_id_ = face_id;
}
@@ -489,7 +489,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
face_data<N, D>&
- face_handle<N, D>::face_data() const
+ n_face<N, D>::face_data() const
{
mln_precondition(is_valid());
return cplx_->template face_data_<N>(face_id_);
@@ -498,17 +498,17 @@ namespace mln
template <unsigned N, unsigned D>
inline
- face_handle<N, D>
- make_face_handle(const complex<D>& c, unsigned face_id)
+ n_face<N, D>
+ make_n_face(const complex<D>& c, unsigned face_id)
{
- return face_handle<N, D>(&c, face_id);
+ return n_face<N, D>(&c, face_id);
}
template <unsigned N, unsigned D>
inline
bool
- operator==(const face_handle<N, D>& lhs, const face_handle<N, D>& rhs)
+ operator==(const n_face<N, D>& lhs, const n_face<N, D>& rhs)
{
// Ensure LHS and RHS belong to the same complex.
mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
@@ -518,7 +518,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
bool
- operator< (const face_handle<N, D>& lhs, const face_handle<N, D>& rhs)
+ operator< (const n_face<N, D>& lhs, const n_face<N, D>& rhs)
{
// Ensure LHS and RHS belong to the same complex.
mln_precondition(&lhs.face.cplx() == &rhs.face.cplx());
@@ -533,7 +533,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- faces_set<N, D>::add(const face_handle<N, D>& f)
+ faces_set<N, D>::add(const n_face<N, D>& f)
{
// Check consistency.
if (!faces_.empty())
@@ -543,7 +543,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
- const std::vector< face_handle<N, D> >&
+ const std::vector< n_face<N, D> >&
faces_set<N, D>::faces() const
{
return faces_;
@@ -553,7 +553,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
faces_set<N, D>
- operator+(const face_handle<N, D>& f1, const face_handle<N, D>& f2)
+ operator+(const n_face<N, D>& f1, const n_face<N, D>& f2)
{
faces_set<N, D> fs;
fs.add(f1);
@@ -564,7 +564,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
faces_set<N, D>
- operator+(const faces_set<N, D>& fs, const face_handle<N, D>& f)
+ operator+(const faces_set<N, D>& fs, const n_face<N, D>& f)
{
faces_set<N, D> fs2(fs);
fs2.add(f);
@@ -598,7 +598,7 @@ namespace mln
template <unsigned D>
template <unsigned N>
inline
- any_face_handle<D>::any_face_handle(const face_handle<N, D>& f)
+ any_face_handle<D>::any_face_handle(const n_face<N, D>& f)
: cplx_(&f.cplx()), n_(N), face_id_(f.face_id())
{
// Ensure N is compatible with D.
diff --git a/milena/mln/topo/faces_iter.hh b/milena/mln/topo/faces_iter.hh
index 8f444c7..1ad756b 100644
--- a/milena/mln/topo/faces_iter.hh
+++ b/milena/mln/topo/faces_iter.hh
@@ -50,12 +50,12 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class faces_fwd_iter_
- : public internal::complex_iter_base_< face_handle<N, D>,
+ : public internal::complex_iter_base_< n_face<N, D>,
faces_fwd_iter_<N, D> >
{
public:
/// Type of associated face.
- typedef face_handle<N, D> face;
+ typedef n_face<N, D> face;
private:
typedef faces_fwd_iter_<N, D> self_;
@@ -96,12 +96,12 @@ namespace mln
/// \arg \p D The dimension of the complex this iterator belongs to.
template <unsigned N, unsigned D>
class faces_bkd_iter_
- : public internal::complex_iter_base_< face_handle<N, D>,
+ : public internal::complex_iter_base_< n_face<N, D>,
faces_bkd_iter_<N, D> >
{
public:
/// Type of associated face.
- typedef face_handle<N, D> face;
+ typedef n_face<N, D> face;
private:
typedef faces_bkd_iter_<N, D> self_;
@@ -176,7 +176,7 @@ namespace mln
{
unsigned face_id = face_.face_id();
if (face_id + 1 < face_.cplx().template nfaces<N>())
- /* FIXME: Provide accessor face_handle::n() returning
+ /* FIXME: Provide accessor n_face::n() returning
a mutable reference? This way, we could just write
++face_.face_id();
@@ -230,7 +230,7 @@ namespace mln
{
unsigned face_id = face_.face_id();
if (face_id > 0)
- /* FIXME: Provide accessor face_handle::n() returning
+ /* FIXME: Provide accessor n_face::n() returning
a mutable reference? This way, we could just write
++face_.face_id();
diff --git a/milena/tests/core/image/complex_image.cc b/milena/tests/core/image/complex_image.cc
index 3b40fba..b8e4c8a 100644
--- a/milena/tests/core/image/complex_image.cc
+++ b/milena/tests/core/image/complex_image.cc
@@ -68,21 +68,21 @@ int main()
topo::complex<D> c;
// 0-faces (points).
- topo::face_handle<0, D> v0 = c.add_face();
- topo::face_handle<0, D> v1 = c.add_face();
- topo::face_handle<0, D> v2 = c.add_face();
- topo::face_handle<0, D> v3 = c.add_face();
+ topo::n_face<0, D> v0 = c.add_face();
+ topo::n_face<0, D> v1 = c.add_face();
+ topo::n_face<0, D> v2 = c.add_face();
+ topo::n_face<0, D> v3 = c.add_face();
// 1-faces (segments).
- topo::face_handle<1, D> e0 = c.add_face(v0 + v1);
- topo::face_handle<1, D> e1 = c.add_face(v0 + v2);
- topo::face_handle<1, D> e2 = c.add_face(v1 + v2);
- topo::face_handle<1, D> e3 = c.add_face(v0 + v3);
- topo::face_handle<1, D> e4 = c.add_face(v2 + v3);
+ topo::n_face<1, D> e0 = c.add_face(v0 + v1);
+ topo::n_face<1, D> e1 = c.add_face(v0 + v2);
+ topo::n_face<1, D> e2 = c.add_face(v1 + v2);
+ topo::n_face<1, D> e3 = c.add_face(v0 + v3);
+ topo::n_face<1, D> e4 = c.add_face(v2 + v3);
// 2-faces (triangles).
- topo::face_handle<2, D> t0 = c.add_face(e0 + e1 + e2);
- topo::face_handle<2, D> t1 = c.add_face(e1 + e3 + e4);
+ topo::n_face<2, D> t0 = c.add_face(e0 + e1 + e2);
+ topo::n_face<2, D> t1 = c.add_face(e1 + e3 + e4);
/*---------------------.
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index 43143c5..e10721f 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -69,21 +69,21 @@ int main()
topo::complex<D> c;
// 0-faces (points).
- topo::face_handle<0, D> v0 = c.add_face();
- topo::face_handle<0, D> v1 = c.add_face();
- topo::face_handle<0, D> v2 = c.add_face();
- topo::face_handle<0, D> v3 = c.add_face();
+ topo::n_face<0, D> v0 = c.add_face();
+ topo::n_face<0, D> v1 = c.add_face();
+ topo::n_face<0, D> v2 = c.add_face();
+ topo::n_face<0, D> v3 = c.add_face();
// 1-faces (segments).
- topo::face_handle<1, D> e0 = c.add_face(v0 + v1);
- topo::face_handle<1, D> e1 = c.add_face(v0 + v2);
- topo::face_handle<1, D> e2 = c.add_face(v1 + v2);
- topo::face_handle<1, D> e3 = c.add_face(v0 + v3);
- topo::face_handle<1, D> e4 = c.add_face(v2 + v3);
+ topo::n_face<1, D> e0 = c.add_face(v0 + v1);
+ topo::n_face<1, D> e1 = c.add_face(v0 + v2);
+ topo::n_face<1, D> e2 = c.add_face(v1 + v2);
+ topo::n_face<1, D> e3 = c.add_face(v0 + v3);
+ topo::n_face<1, D> e4 = c.add_face(v2 + v3);
// 2-faces (triangles).
- topo::face_handle<2, D> t0 = c.add_face(e0 + e1 + e2);
- topo::face_handle<2, D> t1 = c.add_face(e1 + e3 + e4);
+ topo::n_face<2, D> t0 = c.add_face(e0 + e1 + e2);
+ topo::n_face<2, D> t1 = c.add_face(e1 + e3 + e4);
std::cout << c << std::endl;
@@ -144,7 +144,7 @@ int main()
but I'm not sure. */
/* Using faces_{fwd,bkd}_iter_<N, D>, which are proxies to
- face_handles<N, D>. */
+ n_faces<N, D>. */
test_faces_iter<0>(c);
test_faces_iter<1>(c);
test_faces_iter<2>(c);
@@ -189,7 +189,7 @@ int main()
But first, we need to clarify (existing) names.
-----------------------------------------------------------------
- Current name New name Definition
+ Current/old name New name Definition
-----------------------------------------------------------------
complex<D> (n/a) General complex
@@ -274,7 +274,7 @@ int main()
-----------------------------------------------------------------
complex_faces_fwd_iter_<N, D> Iterators on N-faces, N being
complex_faces_fwd_iter_<N, D> static, acting as proxies of
- face_handle<N, D>'s.
+ n_face<N, D>'s.
faces_fwd_iter_<N, D> Iterators on N-faces, N being
faces_fwd_iter_<N, D> static, acting as proxies of
--
1.6.0.1
1
0
* mln/topo/face.hh (mln::topo::face<N, D>): Rename as...
(mln::topo::face_data<N, D>): ...this.
(mln::topo::internal::lower_dim_faces_mixin<N, D>)
(mln::topo::internal::higher_dim_faces_mixin<N, D>):
Rename as...
(mln::topo::internal::lower_dim_faces_data_mixin<N, D>)
(mln::topo::internal::higher_dim_faces_data_mixin<N, D>):
...these.
(mln::topo::face_handle<N, D>::to_face)
(mln::topo::any_face_handle<D>::to_face):
Rename accessors as...
(mln::topo::face_handle<N, D>::face_data)
(mln::topo::any_face_handle<D>::face_data):
...these.
Adjust.
* mln/topo/complex.hh: Adjust.
* tests/topo/complex.cc: Likewise.
---
milena/ChangeLog | 22 +++++++++++++
milena/mln/topo/complex.hh | 36 ++++++++++----------
milena/mln/topo/face.hh | 72 ++++++++++++++++++++++-------------------
milena/tests/topo/complex.cc | 4 +-
4 files changed, 81 insertions(+), 53 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index ce8c7c6..fb69e22 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,27 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Rename mln::topo::face as mln::topo::face_data.
+
+ * mln/topo/face.hh (mln::topo::face<N, D>): Rename as...
+ (mln::topo::face_data<N, D>): ...this.
+ (mln::topo::internal::lower_dim_faces_mixin<N, D>)
+ (mln::topo::internal::higher_dim_faces_mixin<N, D>):
+ Rename as...
+ (mln::topo::internal::lower_dim_faces_data_mixin<N, D>)
+ (mln::topo::internal::higher_dim_faces_data_mixin<N, D>):
+ ...these.
+ (mln::topo::face_handle<N, D>::to_face)
+ (mln::topo::any_face_handle<D>::to_face):
+ Rename accessors as...
+ (mln::topo::face_handle<N, D>::face_data)
+ (mln::topo::any_face_handle<D>::face_data):
+ ...these.
+ Adjust.
+ * mln/topo/complex.hh: Adjust.
+ * tests/topo/complex.cc: Likewise.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
* tests/topo/complex.cc: Add more to-do and proto-documentation.
2008-09-26 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index ae69dee..52c43a9 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -156,10 +156,10 @@ namespace mln
template <unsigned D_> friend class any_face_handle;
template <unsigned N>
- face<N, D>& face_(unsigned face_id);
+ face_data<N, D>& face_data_(unsigned face_id);
template <unsigned N>
- const face<N, D>& face_(unsigned face_id) const;
+ const face_data<N, D>& face_data_(unsigned face_id) const;
/// \}
/// Functional meta-manipulators.
@@ -258,7 +258,7 @@ namespace mln
struct faces_set_mixin<D, D> : public faces_set_mixin<D - 1, D>,
public lower_dim_faces_set_mixin<D, D>
{
- std::vector< face<D, D> > faces_;
+ std::vector< face_data<D, D> > faces_;
/// Pretty-printing.
/// \{
@@ -287,7 +287,7 @@ namespace mln
public lower_dim_faces_set_mixin<N, D>,
public higher_dim_faces_set_mixin<N, D>
{
- std::vector< face<N, D> > faces_;
+ std::vector< face_data<N, D> > faces_;
/// Pretty-printing.
/// \{
@@ -316,7 +316,7 @@ namespace mln
template <unsigned D>
struct faces_set_mixin<0u, D> : public higher_dim_faces_set_mixin<0u, D>
{
- std::vector< face<0u, D> > faces_;
+ std::vector< face_data<0u, D> > faces_;
/// Pretty-printing.
/// \{
@@ -343,7 +343,7 @@ namespace mln
template <>
struct faces_set_mixin<0u, 0u>
{
- std::vector< face<0u, 0u> > faces_;
+ std::vector< face_data<0u, 0u> > faces_;
/// Pretty-printing.
/// \{
@@ -378,13 +378,13 @@ namespace mln
template <unsigned N, unsigned D>
struct lower_dim_faces_set_mixin
{
- void print(std::ostream& ostr, const face<N, D>& f) const;
+ void print(std::ostream& ostr, const face_data<N, D>& f) const;
};
template <unsigned N, unsigned D>
struct higher_dim_faces_set_mixin
{
- void print(std::ostream& ostr, const face<N, D>& f) const;
+ void print(std::ostream& ostr, const face_data<N, D>& f) const;
};
/// \}
@@ -411,7 +411,7 @@ namespace mln
{
/* FIXME: This is not thread-proof (these two lines should
form an atomic section). */
- data_->internal::faces_set_mixin<0u, D>::faces_.push_back(face<0u, D>());
+ data_->internal::faces_set_mixin<0u, D>::faces_.push_back(face_data<0u, D>());
unsigned id = nfaces<0u>() - 1;
return face_handle<0u, D>(*this, id);
@@ -433,7 +433,7 @@ namespace mln
mln_precondition(a->is_valid());
}
- face<N + 1, D> f;
+ face_data<N + 1, D> f;
/* FIXME: This is not thread-proof (these two lines should
form an atomic section). */
data_->internal::faces_set_mixin<N + 1, D>::faces_.push_back(f);
@@ -534,16 +534,16 @@ namespace mln
template <unsigned D>
template <unsigned N>
- face<N, D>&
- complex<D>::face_(unsigned face_id)
+ face_data<N, D>&
+ complex<D>::face_data_(unsigned face_id)
{
return data_->internal::faces_set_mixin<N, D>::faces_[face_id];
}
template <unsigned D>
template <unsigned N>
- const face<N, D>&
- complex<D>::face_(unsigned face_id) const
+ const face_data<N, D>&
+ complex<D>::face_data_(unsigned face_id) const
{
return data_->internal::faces_set_mixin<N, D>::faces_[face_id];
}
@@ -557,8 +557,8 @@ namespace mln
// Ensure N is compatible with D.
metal::bool_< N <= D >::check();
- f1.to_face().connect_higher_dim_face(f2);
- f2.to_face().connect_lower_dim_face(f1);
+ f1.face_data().connect_higher_dim_face(f2);
+ f2.face_data().connect_lower_dim_face(f1);
}
@@ -701,7 +701,7 @@ namespace mln
template <unsigned N, unsigned D>
void
lower_dim_faces_set_mixin<N, D>::print(std::ostream& ostr,
- const face<N, D>& f) const
+ const face_data<N, D>& f) const
{
for (typename std::vector< face_handle<N - 1, D> >::const_iterator l =
f.lower_dim_faces_.begin(); l != f.lower_dim_faces_.end(); ++l)
@@ -711,7 +711,7 @@ namespace mln
template <unsigned N, unsigned D>
void
higher_dim_faces_set_mixin<N, D>::print(std::ostream& ostr,
- const face<N, D>& f) const
+ const face_data<N, D>& f) const
{
for (typename std::vector< face_handle<N + 1, D> >::const_iterator h =
f.higher_dim_faces_.begin(); h != f.higher_dim_faces_.end(); ++h)
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 11f22b2..689f7e6 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -47,6 +47,10 @@
Anyway, whatever the decision, splitting `face', `face_handle' and
`any_face_handle' seems to be sound.
+ `face_data' is somehow an implementation detail: it should be
+ hidden, either by moving it to mln/topo/complex.cc or into its own
+ file in mln/topo/internal.
+
(And what about `faces_set'? Should we move it to its own file as
well?) */
@@ -68,42 +72,42 @@ namespace mln
template <unsigned N, unsigned D> class face_handle;
namespace internal
{
- template <unsigned N, unsigned D> class lower_dim_faces_mixin;
- template <unsigned N, unsigned D> class higher_dim_faces_mixin;
+ template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
+ template <unsigned N, unsigned D> class higher_dim_faces_data_mixin;
}
- /*-------.
- | Face. |
- `-------*/
+ /*------------.
+ | Face data. |
+ `------------*/
- /// \p N-face of a \p D-complex.
- template <unsigned N, unsigned D> class face;
+ /// Data (adjacent faces) associated to a \p N-face of a \p D-complex.
+ template <unsigned N, unsigned D> class face_data;
// Specialization for the faces of highest dimension (\p D).
template <unsigned D>
- class face<D, D> : public internal::lower_dim_faces_mixin<D, D>
+ class face_data<D, D> : public internal::lower_dim_faces_data_mixin<D, D>
{
};
// Specialization for the faces of intermediate dimension (greater
// than 0, lower than \p D).
template <unsigned N, unsigned D>
- class face : public internal::lower_dim_faces_mixin<N, D>,
- public internal::higher_dim_faces_mixin<N, D>
+ class face_data : public internal::lower_dim_faces_data_mixin<N, D>,
+ public internal::higher_dim_faces_data_mixin<N, D>
{
};
// Specialization for the faces of lowest dimension (0).
template <unsigned D>
- class face<0u, D> : public internal::higher_dim_faces_mixin<0u, D>
+ class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u, D>
{
};
// Specialization for the case of a 0-complex.
template <>
- class face<0u, 0u>
+ class face_data<0u, 0u>
{
};
@@ -114,7 +118,7 @@ namespace mln
/// Factored implementation of faces.
/// \{
template <unsigned N, unsigned D>
- class lower_dim_faces_mixin
+ class lower_dim_faces_data_mixin
{
public:
void connect_lower_dim_face (const face_handle<N - 1, D>& f);
@@ -124,7 +128,7 @@ namespace mln
};
template <unsigned N, unsigned D>
- class higher_dim_faces_mixin
+ class higher_dim_faces_data_mixin
{
public:
void connect_higher_dim_face(const face_handle<N + 1, D>& f);
@@ -181,8 +185,8 @@ namespace mln
/// Set the id of the face.
void set_face_id(unsigned face_id);
- /// Return the mln::face pointed by this handle.
- face<N, D>& to_face() const;
+ /// Return the mln::topo::face_data pointed by this handle.
+ face_data<N, D>& face_data() const;
/// \}
private:
@@ -202,12 +206,12 @@ namespace mln
make_face_handle(const complex<D>& c, unsigned face_id);
- /// Comparison of two instances of mln::face_handle.
+ /// Comparison of two instances of mln::topo::face_handle.
/// \{
/// \brief Is \a lhs equal to \a rhs?
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
template <unsigned N, unsigned D>
bool
operator==(const face_handle<N, D>& lhs, const face_handle<N, D>& rhs);
@@ -217,7 +221,7 @@ namespace mln
/// This comparison is required by algorithms sorting face handles.
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
template <unsigned N, unsigned D>
bool
operator< (const face_handle<N, D>& lhs, const face_handle<N, D>& rhs);
@@ -250,7 +254,7 @@ namespace mln
};
- /// Construction helpers for mln::faces_set.
+ /// Construction helpers for mln::topo::faces_set.
/// \{
template <unsigned N, unsigned D>
faces_set<N, D>
@@ -311,9 +315,9 @@ namespace mln
/// Set the id of the face.
void set_face_id(unsigned face_id);
- /// Return the mln::face pointed by this handle.
+ /// Return the mln::topo::face_data pointed by this handle.
template <unsigned N>
- face<N, D>& to_face() const;
+ face_data<N, D>& face_data() const;
/// \}
private:
@@ -330,12 +334,12 @@ namespace mln
};
- /// Comparison of two instances of mln::any_face_handle.
+ /// Comparison of two instances of mln::topo::any_face_handle.
/// \{
/// \brief Is \a lhs equal to \a rhs?
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
template <unsigned D>
bool
operator==(const any_face_handle<D>& lhs, const any_face_handle<D>& rhs);
@@ -345,7 +349,7 @@ namespace mln
/// This comparison is required by algorithms sorting face handles.
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
/// \pre Arguments \a lhs and \a rhs must have the same dimension.
template <unsigned D>
bool
@@ -365,7 +369,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- lower_dim_faces_mixin<N, D>::connect_lower_dim_face(const face_handle<N - 1, D>& f)
+ lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const face_handle<N - 1, D>& f)
{
lower_dim_faces_.push_back(f);
}
@@ -373,7 +377,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- higher_dim_faces_mixin<N, D>::connect_higher_dim_face(const face_handle<N + 1, D>& f)
+ higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const face_handle<N + 1, D>& f)
{
higher_dim_faces_.push_back(f);
}
@@ -484,11 +488,11 @@ namespace mln
template <unsigned N, unsigned D>
inline
- face<N, D>&
- face_handle<N, D>::to_face() const
+ face_data<N, D>&
+ face_handle<N, D>::face_data() const
{
mln_precondition(is_valid());
- return cplx_->template face_<N>(face_id_);
+ return cplx_->template face_data_<N>(face_id_);
}
@@ -500,6 +504,7 @@ namespace mln
return face_handle<N, D>(&c, face_id);
}
+
template <unsigned N, unsigned D>
inline
bool
@@ -691,12 +696,12 @@ namespace mln
template <unsigned D>
template <unsigned N>
inline
- face<N, D>&
- any_face_handle<D>::to_face() const
+ face_data<N, D>&
+ any_face_handle<D>::face_data() const
{
mln_precondition(n_ == N);
mln_precondition(is_valid());
- return cplx_->template face_<N>(face_id_);
+ return cplx_->template face_data_<N>(face_id_);
}
@@ -712,6 +717,7 @@ namespace mln
lhs.face().id() == rhs.face().id();
}
+
template <unsigned D>
inline
bool
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index b9051dc..43143c5 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -107,12 +107,12 @@ int main()
`-------------------*/
// Get the face data from (``static'') face handle E0.
- const topo::face<1, D>& face1 = e0.to_face();
+ const topo::face_data<1, D>& face1 = e0.face_data();
// Any-face handle.
topo::any_face_handle<D> af(e0);
// Get the face data from (``dynamic'') face handle AF.
- const topo::face<1, D>& face2 = af.to_face<1>();
+ const topo::face_data<1, D>& face2 = af.face_data<1>();
mln_assertion(&face1 == &face2);
--
1.6.0.1
1
0
2411: * tests/topo/complex.cc: Add more to-do and proto-documentation.
by Roland Levillain 26 Sep '08
by Roland Levillain 26 Sep '08
26 Sep '08
---
milena/ChangeLog | 4 +
milena/tests/topo/complex.cc | 125 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 127 insertions(+), 2 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 6af1c1c..ce8c7c6 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * tests/topo/complex.cc: Add more to-do and proto-documentation.
+
2008-09-26 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Clean erosion and dilation a bit.
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index 08be130..b9051dc 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -155,11 +155,132 @@ int main()
test_complex_faces_iter<1>(c);
test_complex_faces_iter<2>(c);
+ /*------------------------------.
+ | Iterators on adjacent faces. |
+ `------------------------------*/
- /* FIXME: Exercice more iterators (see
+ /* FIXME: Write and exercise more iterators (see
milena/tests/core/complex_image.cc) and ticket #162
(https://trac.lrde.org/olena/ticket/162) */
- // ...
+
+ /* Iterate on the the set of (n-1)-faces adjacent to AF.
+
+ Note: this can be solved with iterators where the dimension can
+ be either static or dynamic.
+
+ Let's start with a dynamic one, as it would allow us to
+ write something like this:
+
+ mln_fwd_citer_(topo::complex<D>) f(c);
+ mln_fwd_lower_nciter(topo::complex<D>) n(c);
+ for_all(c)
+ for_all(n)
+ // ...
+
+ (Note: we might want to get rid of the name `citer', and use
+ `fiter' everywhere.).
+
+ A static version might be useful (and more efficient) too.
+
+ Likewise, our iterators on n-faces (both faces_piter and
+ complex_faces_piter) use a static `n'. We should also have
+ n-faces iterators where n could be dynamic.
+
+ But first, we need to clarify (existing) names.
+
+ -----------------------------------------------------------------
+ Current name New name Definition
+ -----------------------------------------------------------------
+ complex<D> (n/a) General complex
+
+ face<N, D> face_data<N, D> Face data
+ face_handle<N, D> n_face<N, D> (Static) n-face handle
+ faces_set<N, D> n_faces_set<N, D> Set of face handles
+ any_face_handle<D> face<D> Dynamic face handle
+
+ complex_fwd_iter_<D>(c) face_fwd_iter<D>(c) | Iterators on all
+ complex_bkd_iter_<D>(c) face_bkd_iter<D>(c) | faces of c
+
+ complex_iter_base_<F, E> complex_iter_base<F, E>
+ | Factoring base
+ | class.
+ -----------------------------------------------------------------
+
+ (Note: get rid of trailing underscores, even for entities in
+ mln::internal::.)
+
+ Next, write these:
+
+ -----------------------------------------------------------------
+ Name Definition
+ -----------------------------------------------------------------
+ n_faces_fwd_iter<D>(c) | Iterators on n-faces,
+ n_faces_bkd_iter<D>(c) | n being dynamic
+
+ adj_lower_faces_fwd_iter<D>(c, f) | Iterators on the adjacent
+ adj_lower_faces_bkd_iter<D>(c, f) | (lower) (n-1)-faces of the
+ | n-face f of the complex c,
+ | n being dynamic
+
+ adj_higher_faces_fwd_iter<D>(c, f) | Iterators on the adjacent
+ adj_higher_faces_bkd_iter<D>(c, f) | (higher) (n+1)-faces of the
+ | n-face f of the complex c,
+ | n being dynamic
+
+ adj_lower_dim_connected_n_faces_fwd_iter<D>(c, f)
+ adj_lower_dim_connected_n_faces_bkd_iter<D>(c, f)
+ (FIXME: These names are admittedly too long.)
+ | Iterators on the the set of
+ | n-faces sharing an adjacent
+ | (n-1)-face with f, n being
+ | dynamic
+
+ adj_higher_dim_connected_n_faces_fwd_iter<D>(c, f)
+ adj_higher_dim_connected_n_faces_bkd_iter<D>(c, f)
+ (FIXME: These names are admittedly too long.)
+ | Iterators on the the set of
+ | n-faces sharing an adjacent
+ | (n+1)-face with f, n being
+ | dynamic
+
+ cell_fwd_iter<D>(c, f) | Iterators on the set of the
+ cell_bkd_iter<D>(c, f) | faces in the « cell »
+ | including p, i.e. the set of
+ | all m-faces adjacent to p,
+ | where m is in [0, n-1];
+ | this set is name « f-hat »
+
+ cell_boundary_fwd_iter<D>(c, f) | Likewise, but excluding p;
+ cell_boundary_bkd_iter<D>(c, f) | this set is named « p-hat* »
+ -----------------------------------------------------------------
+
+ We could also have generic iterators based on predicated, and
+ even use them to provide first (non efficient) implementations of
+ the iterators from the previous list.
+
+ -----------------------------------------------------------------
+ Name Definition
+ -----------------------------------------------------------------
+ generic_face_fwd_iter<D>(c, pred) | Generic face iterators on c
+ generic_face_bkd_iter<D>(c, pred) | using predicate pred to
+ | define the iterated subset.
+ -----------------------------------------------------------------
+
+ I'm unsure about the following existing iterators; should we keep
+ them? What are they good for, except testing our code?
+
+ -----------------------------------------------------------------
+ Current name Definition
+ -----------------------------------------------------------------
+ complex_faces_fwd_iter_<N, D> Iterators on N-faces, N being
+ complex_faces_fwd_iter_<N, D> static, acting as proxies of
+ face_handle<N, D>'s.
+
+ faces_fwd_iter_<N, D> Iterators on N-faces, N being
+ faces_fwd_iter_<N, D> static, acting as proxies of
+ any_face_handle<N, D>'s.
+ -----------------------------------------------------------------
+ */
}
--
1.6.0.1
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Clean erosion and dilation a bit.
* doc/examples/tuto_one.cc: Cleanup.
(argv): New argument for chosing neighborhood.
* mln/border/resize.hh (todo): New.
* mln/morpho/erosion.spe.hh,
* mln/morpho/erosion.hh,
* mln/morpho/dilation.hh,
* mln/morpho/dilation_fast.hh: Use extension fill.
Anticipate border adjust.
* mln/extension/all.hh: New.
* mln/morpho/includes.hh: Update.
doc/examples/tuto_one.cc | 107 +++++++++++++++++++++++++-------------------
mln/border/resize.hh | 3 +
mln/extension/all.hh | 51 ++++++++++++++++++++
mln/morpho/dilation.hh | 12 ++++
mln/morpho/dilation_fast.hh | 6 +-
mln/morpho/erosion.hh | 13 ++++-
mln/morpho/erosion.spe.hh | 23 +++++++--
mln/morpho/includes.hh | 3 -
8 files changed, 160 insertions(+), 58 deletions(-)
Index: doc/examples/tuto_one.cc
--- doc/examples/tuto_one.cc (revision 2409)
+++ doc/examples/tuto_one.cc (working copy)
@@ -3,41 +3,35 @@
# include <mln/value/int_u8.hh>
# include <mln/value/rgb8.hh>
+# include <mln/io/pgm/load.hh>
+# include <mln/io/ppm/save.hh>
+
# include <mln/core/var.hh>
# include <mln/core/image/image2d.hh>
# include <mln/core/alias/neighb2d.hh>
-# include <mln/core/alias/window2d.hh>
-
-# include <mln/convert/to_p_set.hh>
-# include <mln/convert/to_image.hh>
-# include <mln/debug/println.hh>
-
# include <mln/make/double_neighb2d.hh>
-# include <mln/io/pgm/load.hh>
-# include <mln/io/pgm/save.hh>
-# include <mln/io/pbm/save.hh>
-# include <mln/io/ppm/save.hh>
-
# include <mln/level/transform.hh>
# include <mln/literal/black.hh>
-# include <mln/pw/all.hh>
+# include <mln/debug/println.hh>
# include <mln/morpho/closing_area.hh>
# include <mln/morpho/gradient.hh>
# include <mln/morpho/meyer_wst.hh>
+using namespace mln;
+using value::int_u8;
-struct colorize : mln::Function_v2v< colorize >
+struct colorize : Function_v2v< colorize >
{
- typedef mln::value::rgb8 result;
+ typedef value::rgb8 result;
colorize(unsigned max)
: lut(max + 1)
{
- lut[0] = mln::literal::black;
+ lut[0] = literal::black;
for (unsigned i = 1; i <= max; ++i)
lut[i] = result(100 + std::rand() % 150,
100 + std::rand() % 150,
@@ -51,7 +45,7 @@
};
- bool is_chess(const mln::point2d& p)
+bool is_chess(const point2d& p)
{
return p.col() % 2 == p.row() % 2;
}
@@ -59,23 +53,67 @@
void usage(char* argv[])
{
- std::cerr << "usage: " << argv[0] << " input.pgm lambda output.ppm" << std::endl;
+ std::cerr << "usage: " << argv[0] << " input.pgm nbh lambda output.ppm" << std::endl;
+ std::cerr << " nbh in {4, 6, 8}; lambda >= 0" << std::endl;
abort();
}
+template <typename I, typename N>
+void do_it(const I& ima,
+ const N& nbh,
+ int lambda,
+ const std::string& filename)
+{
+ I grad = morpho::gradient(ima, nbh.win());
+
+ I clo;
+ if (lambda > 1)
+ clo = morpho::closing_area(grad, nbh, lambda);
+ else
+ clo = grad;
+
+ unsigned l;
+ mln_ch_value(I, unsigned) wst = morpho::meyer_wst(clo, nbh, l);
+
+ debug::println(labeling::regional_minima(clo, nbh, l));
+ debug::println(wst);
+
+ io::ppm::save(level::transform(wst, colorize(l)), filename);
+}
+
+
int main(int argc, char* argv[])
{
- using namespace mln;
- using value::int_u8;
+ if (argc != 5)
+ usage(argv);
+ image2d<int_u8> ima;
+
+ io::pgm::load(ima, argv[1]);
+
+ int nbh_ = atoi(argv[2]);
+ if (! (nbh_ == 4 || nbh_ == 6 || nbh_ == 8))
+ usage(argv);
- if (argc != 4)
+ int lambda = atoi(argv[3]);
+ if (lambda < 0)
usage(argv);
- image2d<int_u8> lena;
- io::pgm::load(lena, argv[1]);
+ std::string filename(argv[4]);
+ if (nbh_ == 4)
+ {
+ mln_VAR(nbh, c4());
+ do_it(ima, nbh, lambda, filename);
+ }
+ else if (nbh_ == 8)
+ {
+ mln_VAR(nbh, c8());
+ do_it(ima, nbh, lambda, filename);
+ }
+ else if (nbh_ == 6)
+ {
bool vert[] = { 1, 1, 0,
1, 0, 1,
0, 1, 1 };
@@ -85,29 +123,6 @@
1, 1, 0 };
mln_VAR( nbh, make::double_neighb2d(is_chess, vert, hori) );
-// mln_VAR(nbh, c4());
-// mln_VAR(nbh, c8());
-
- image2d<int_u8> clo, grad = morpho::gradient(lena, nbh.win());
- // io::pgm::save(grad, "tmp_grad.pgm");
-
- int lambda = atoi(argv[2]);
- if (lambda > 1)
- {
- clo = morpho::closing_area(grad, nbh, lambda);
- io::pgm::save(clo, "tmp_clo.pgm");
+ do_it(ima, nbh, lambda, filename);
}
- else
- clo = grad;
-
- unsigned l;
- image2d<unsigned> wst = morpho::meyer_wst(clo, nbh, l);
-
- std::cout << "l = " << l << std::endl;
- debug::println(wst);
-
- io::ppm::save(level::transform(wst, colorize(l)), argv[3]);
-
-// io::pbm::save((pw::value(wst) == pw::cst(0)) | lena.domain(),
-// argv[3]);
}
Index: mln/border/resize.hh
--- mln/border/resize.hh (revision 2409)
+++ mln/border/resize.hh (working copy)
@@ -34,6 +34,9 @@
* image.
*
* \todo Use level::fill!!!
+ *
+ * \todo Test with a primary image with no notion of border; I guess
+ * it does not work.
*/
# include <mln/core/concept/image.hh>
Index: mln/morpho/erosion.spe.hh
--- mln/morpho/erosion.spe.hh (revision 2409)
+++ mln/morpho/erosion.spe.hh (working copy)
@@ -45,7 +45,10 @@
*
* \brief Specialization for mln::morpho::erosion.
*
+ * \todo Warning: we should also have the "arbitrary" versions working
+ * on sets (not only on functions!)
*
+ * \todo Activate the FIXMEs (border::adjust).
*/
# ifndef MLN_INCLUDE_ONLY
@@ -91,9 +94,11 @@
const I& input = exact(input_);
const W& win = exact(win_);
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, mln_max(mln_value(I)));
+
O output;
initialize(output, input);
- extension::fill(input, mln_max(mln_value(I)));
mln_pixter(const I) p(input);
mln_pixter(O) o(output);
@@ -122,9 +127,11 @@
const I& input = exact(input_);
const W& win = exact(win_);
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, true);
+
O output;
initialize(output, input);
- extension::fill(input, true);
mln_pixter(const I) p(input);
mln_pixter(O) p_out(output);
@@ -152,11 +159,13 @@
typedef mln_concrete(I) O;
const I& input = exact(input_);
const W& win = exact(win_);
- O output;
+ // FIXME: border::adjust(input, win.delta());
extension::fill(input, true);
+ O output;
output = clone(input);
+
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
@@ -181,11 +190,13 @@
typedef mln_concrete(I) O;
const I& input = exact(input_);
const W& win = exact(win_);
- O output;
+ // FIXME: border::adjust(input, win.delta());
extension::fill(input, true);
+ O output;
output = clone(input);
+
mln_pixter(const I) p(input);
mln_qixter(const I, W) q(p, win);
mln_pixter(O) p_out(output);
@@ -280,6 +291,8 @@
void init()
{
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, mln_max(mln_value(I)));
initialize(output, input);
min.init();
p = input.domain().pmin() + up;
@@ -375,6 +388,8 @@
void init()
{
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, mln_max(mln_value(I)));
initialize(output, input);
min.init();
p = input.domain().pmin() + up;
Index: mln/morpho/erosion.hh
--- mln/morpho/erosion.hh (revision 2409)
+++ mln/morpho/erosion.hh (working copy)
@@ -30,6 +30,8 @@
/// \file mln/morpho/erosion.hh
/// \brief Morphological erosion.
+///
+/// \todo Activate the FIXMEs (border::adjust).
# include <mln/morpho/includes.hh>
@@ -70,16 +72,20 @@
const I& input = exact(input_);
const W& win = exact(win_);
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, mln_max(mln_value(I)));
+
mln_concrete(I) output;
initialize(output, input);
accu::min_<mln_value(I)> min;
+
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
{
min.init();
- for_all(q) if (input.domain().has(q))
+ for_all(q) if (input.has(q))
min.take(input(q));
output(p) = min;
}
@@ -100,6 +106,9 @@
const I& input = exact(input_);
const W& win = exact(win_);
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, true);
+
mln_concrete(I) output;
initialize(output, input);
@@ -107,7 +116,7 @@
mln_qiter(W) q(win, p);
for_all(p)
{
- for_all(q) if (input.domain().has(q))
+ for_all(q) if (input.has(q))
if (input(q) == false)
break;
output(p) = ! q.is_valid();
Index: mln/morpho/dilation.hh
--- mln/morpho/dilation.hh (revision 2409)
+++ mln/morpho/dilation.hh (working copy)
@@ -30,6 +30,8 @@
/// \file mln/morpho/dilation.hh
/// \brief Morphological dilation.
+///
+/// \todo Activate the FIXMEs (border::adjust).
# include <mln/morpho/includes.hh>
@@ -92,6 +94,9 @@
const W& win = exact(win_);
O& output = exact(output_);
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, mln_min(mln_value(I)));
+
accu::max_<mln_value(I)> max;
mln_piter(I) p(input.domain());
@@ -99,7 +104,7 @@
for_all(p)
{
max.init();
- for_all(q) if (input.domain().has(q))
+ for_all(q) if (input.has(q))
max.take(input(q));
output(p) = max.to_result();
}
@@ -116,13 +121,16 @@
const W& win = exact(win_);
O& output = exact(output_);
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, false);
+
level::fill(output, input);
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
if (!input(p))
- for_all(q) if (input.domain().has(q))
+ for_all(q) if (input.has(q))
if (input(q))
{
output(p) = true;
Index: mln/morpho/includes.hh
--- mln/morpho/includes.hh (revision 2409)
+++ mln/morpho/includes.hh (working copy)
@@ -55,8 +55,7 @@
# include <mln/test/positive.hh>
-// # include <mln/border/all.hh>
-# include <mln/extension/fill.hh>
+# include <mln/extension/all.hh>
# include <mln/geom/sym.hh>
# include <mln/set/inter.hh>
Index: mln/morpho/dilation_fast.hh
--- mln/morpho/dilation_fast.hh (revision 2409)
+++ mln/morpho/dilation_fast.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -30,7 +30,7 @@
/*! \file mln/morpho/dilation_fast.hh
*
- * \brief Ero filtering of an image.
+ * \brief Dilation filtering of an image with arbitrary s.e.
*
* \todo Add fastest versions.
*/
@@ -124,6 +124,8 @@
inline
void init()
{
+ // FIXME: border::adjust(input, win.delta());
+ extension::fill(input, mln_min(mln_value(I)));
max.init();
mln_qiter(W) q(win, p);
for_all(q) if (input.has(q))
Index: mln/extension/all.hh
--- mln/extension/all.hh (revision 0)
+++ mln/extension/all.hh (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_EXTENSION_ALL_HH
+# define MLN_EXTENSION_ALL_HH
+
+/*! \file mln/pw/all.hh
+ *
+ * \brief File that includes all extension materials.
+ *
+ * \todo Also include "extension images" + "extended"?
+ */
+
+
+namespace mln
+{
+
+ /// Namespace of extension tools.
+ namespace extension {}
+
+} // end of namespace mln
+
+
+# include <mln/extension/fill.hh>
+
+
+#endif // ! MLN_EXTENSION_ALL_HH
1
0