* mln/core/site_set/p_complex_piter.hh,
* mln/core/site_set/p_faces_piter.hh:
Here.
---
milena/ChangeLog | 8 ++++++++
milena/mln/core/site_set/p_complex_piter.hh | 7 +++++--
milena/mln/core/site_set/p_faces_piter.hh | 9 +++++++--
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 6cd837a..aa7dc82 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -41,6 +41,14 @@
2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+ Misc. documentation fixes in complex-related entities.
+
+ * mln/core/site_set/p_complex_piter.hh,
+ * mln/core/site_set/p_faces_piter.hh:
+ Here.
+
+2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+
Get back to the previous, simpler interface of mln::complex_image.
* mln/core/image/complex_image.hh
diff --git a/milena/mln/core/site_set/p_complex_piter.hh b/milena/mln/core/site_set/p_complex_piter.hh
index 41671ce..114eed6 100644
--- a/milena/mln/core/site_set/p_complex_piter.hh
+++ b/milena/mln/core/site_set/p_complex_piter.hh
@@ -30,6 +30,9 @@
/// \file mln/core/site_set/p_complex_piter.hh
/// \brief Definition of point iterator on complex-based pset.
+///
+/// Types defined here are akin to parametrized typedefs: the code is
+/// factored in mln::internal::p_complex_piter_base_.
# include <mln/core/site_set/p_complex.hh>
# include <mln/core/internal/p_complex_piter_base.hh>
@@ -49,7 +52,7 @@ namespace mln
| p_complex_fwd_piter_<D, P>. |
`-----------------------------*/
- /// \brief Forward iterator on point sites of a mln::p_complex<D, P>.
+ /// \brief Forward iterator on (all) the faces of an mln::p_complex<D, P>.
template <unsigned D, typename P>
class p_complex_fwd_piter_
: public internal::p_complex_piter_base_< complex_fwd_iter_<D>,
@@ -76,7 +79,7 @@ namespace mln
| p_complex_bkd_piter_<D, P>. |
`-----------------------------*/
- /// \brief Backward iterator on point sites of a mln::p_complex<D, P>.
+ /// \brief Backward iterator on (all) the faces of an mln::p_complex<D, P>.
template <unsigned D, typename P>
class p_complex_bkd_piter_
: public internal::p_complex_piter_base_< complex_bkd_iter_<D>,
diff --git a/milena/mln/core/site_set/p_faces_piter.hh b/milena/mln/core/site_set/p_faces_piter.hh
index b26ca9b..65f07fd 100644
--- a/milena/mln/core/site_set/p_faces_piter.hh
+++ b/milena/mln/core/site_set/p_faces_piter.hh
@@ -30,6 +30,9 @@
/// \file mln/core/site_set/p_faces_piter.hh
/// \brief Definition of point iterator on complex-based pset.
+///
+/// Types defined here are akin to parametrized typedefs: the code is
+/// factored in mln::internal::p_complex_piter_base_.
# include <mln/core/site_set/p_faces.hh>
# include <mln/core/internal/p_complex_piter_base.hh>
@@ -50,7 +53,8 @@ namespace mln
| p_faces_fwd_piter_<N, D, P>. |
`------------------------------*/
- /// \brief Forward iterator on point sites of a mln::p_faces<N, D, P>.
+ /// \brief Forward iterator on the \p N-faces sites of an
+ /// mln::p_faces<N, D, P>.
template <unsigned N, unsigned D, typename P>
class p_faces_fwd_piter_
: public internal::p_complex_piter_base_< faces_fwd_iter_<N, D>,
@@ -77,7 +81,8 @@ namespace mln
| p_faces_bkd_piter_<N, D, P>. |
`------------------------------*/
- /// \brief Backward iterator on point sites of a mln::p_faces<N, D, P>.
+ /// \brief Backward iterator on the \p N-faces sites of an
+ /// mln::p_faces<N, D, P>.
template <unsigned N, unsigned D, typename P>
class p_faces_bkd_piter_
/* FIXME: Rename internal::p_complex_piter_base_ to something else,
--
1.6.0.1
* mln/core/image/complex_image.hh
(complex_image<D, P, V>::operator()(const faces_psite<N, D, P>) const)
(complex_image<D, P, V>::operator()(const faces_psite<N, D, P>)):
Remove operators.
* tests/core/image/complex_image.cc: Update, and make use of
p_complex_faces_iter's.
---
milena/ChangeLog | 11 +++++++++++
milena/mln/core/image/complex_image.hh | 29 -----------------------------
milena/tests/core/image/complex_image.cc | 14 +++++++-------
3 files changed, 18 insertions(+), 36 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 62fb495..6cd837a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -41,6 +41,17 @@
2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+ Get back to the previous, simpler interface of mln::complex_image.
+
+ * mln/core/image/complex_image.hh
+ (complex_image<D, P, V>::operator()(const faces_psite<N, D, P>) const)
+ (complex_image<D, P, V>::operator()(const faces_psite<N, D, P>)):
+ Remove operators.
+ * tests/core/image/complex_image.cc: Update, and make use of
+ p_complex_faces_iter's.
+
+2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+
Have mln::p_complex known p_complex_faces_iter's.
* mln/core/site_set/p_complex.hh: Add forward declarations for
diff --git a/milena/mln/core/image/complex_image.hh b/milena/mln/core/image/complex_image.hh
index 0512d0f..09d6e13 100644
--- a/milena/mln/core/image/complex_image.hh
+++ b/milena/mln/core/image/complex_image.hh
@@ -148,13 +148,6 @@ namespace mln
/// Read-write access of face value at point site \p p.
lvalue operator()(const complex_psite<D, P>& p);
- /// Read-only access of face value at point site \p p.
- template <unsigned N>
- rvalue operator()(const faces_psite<N, D, P>& p) const;
- /// Read-write access of face value at point site \p p.
- template <unsigned N>
- lvalue operator()(const faces_psite<N, D, P>& p);
-
/// Accessors.
/// \{
/// Return the domain of psites od the image.
@@ -277,28 +270,6 @@ namespace mln
}
template <unsigned D, typename P, typename V>
- template <unsigned N>
- inline
- typename complex_image<D, P, V>::rvalue
- complex_image<D, P, V>::operator()(const faces_psite<N, D, P>& p) const
- {
- /* FIXME: We should ensure data_->pc_ has P, but it is not
- trivial: a daces_psite has no idea what a p_complex is. */
- return this->data_->values_[p.n()][p.face_id()];
- }
-
- template <unsigned D, typename P, typename V>
- template <unsigned N>
- inline
- typename complex_image<D, P, V>::lvalue
- complex_image<D, P, V>::operator()(const faces_psite<N, D, P>& p)
- {
- /* FIXME: We should ensure data_->pc_ has P, but it is not
- trivial: a daces_psite has no idea what a p_complex is. */
- return this->data_->values_[p.n()][p.face_id()];
- }
-
- template <unsigned D, typename P, typename V>
inline
const metal::vec< D + 1, std::vector<V> >&
complex_image<D, P, V>::face_values() const
diff --git a/milena/tests/core/image/complex_image.cc b/milena/tests/core/image/complex_image.cc
index 1b06036..24f0a2c 100644
--- a/milena/tests/core/image/complex_image.cc
+++ b/milena/tests/core/image/complex_image.cc
@@ -100,6 +100,10 @@ int main()
| Faces-based psets. |
`--------------------*/
+ /* FIXME: Not that p_faces have become less interesting since the
+ introduction of p_complex_faces_{fwd,bkd}_piter_. Keep this part
+ of the test? */
+
// Pset of 0-faces.
p_faces<0, D, point2d> pf0(c);
// Pset of 1-faces.
@@ -164,14 +168,10 @@ int main()
// that it can be referenced later by face_psites held by iterators
// (as for windows and neighborhoods).
- typedef p_faces<0, D, point2d> p0f_t;
- p0f_t pf(ima.domain());
- mln_piter_(p0f_t) f0p(pf);
+ // FIXME: Sugar the name of the iterator.
+ p_complex_faces_fwd_piter_<0, D, point2d> f0p(ima.domain());
for_all(f0p)
- /* FIXME: This explicit call to unproxy_() is not elegant... But
- is required for ima() to work, since the target operator() is
- templated. */
- std::cout << "ima(" << f0p << ") = " << ima(f0p.unproxy_()) << std::endl;
+ std::cout << "ima(" << f0p << ") = " << ima(f0p) << std::endl;
/* FIXME: Implement other psite iterators, for instance:
--
1.6.0.1
* mln/core/site_set/p_complex.hh: Add forward declarations for
mln::p_complex_faces_fwd_piter_ and
mln::p_complex_faces_bkd_piter_
---
milena/ChangeLog | 8 ++++++++
milena/mln/core/site_set/p_complex.hh | 9 ++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index e54d8c8..62fb495 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -41,6 +41,14 @@
2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+ Have mln::p_complex known p_complex_faces_iter's.
+
+ * mln/core/site_set/p_complex.hh: Add forward declarations for
+ mln::p_complex_faces_fwd_piter_ and
+ mln::p_complex_faces_bkd_piter_
+
+2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+
Add piters on n-faces able to convert to mln::complex_psite.
* mln/core/site_set/p_complex_faces_piter.hh: New.
diff --git a/milena/mln/core/site_set/p_complex.hh b/milena/mln/core/site_set/p_complex.hh
index 6c30c25..de6e0ad 100644
--- a/milena/mln/core/site_set/p_complex.hh
+++ b/milena/mln/core/site_set/p_complex.hh
@@ -37,6 +37,7 @@
# include <mln/core/complex_psite.hh>
# include <mln/core/site_set/p_complex_piter.hh>
+# include <mln/core/site_set/p_complex_faces_piter.hh>
namespace mln
@@ -48,6 +49,11 @@ namespace mln
template <unsigned D, typename P> class p_complex_fwd_piter_;
template <unsigned D, typename P> class p_complex_bkd_piter_;
+ 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_;
+
namespace trait
{
@@ -136,6 +142,7 @@ namespace mln
// simplify (and lighten) the implementation of piters, psites,
// etc.
+ // FIXME: This method is probably useless now.
/// Is this site set valid?
bool is_valid() const;
@@ -240,7 +247,7 @@ namespace mln
return
// Check whether P's complex is compatible with this pset's complex.
(p.site_set() == *this) &&
- // Check whether the complex has the face associated to P.
+ // Check whether P is valid.
(p.is_valid());
}
--
1.6.0.1
* mln/core/site_set/p_complex_faces_piter.hh: New.
---
milena/ChangeLog | 6 +
milena/mln/core/site_set/p_complex_faces_piter.hh | 157 +++++++++++++++++++++
2 files changed, 163 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/core/site_set/p_complex_faces_piter.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 8da4e88..e54d8c8 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -41,6 +41,12 @@
2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+ Add piters on n-faces able to convert to mln::complex_psite.
+
+ * mln/core/site_set/p_complex_faces_piter.hh: New.
+
+2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+
Exercise complex_faces_iter's.
* tests/core/other/complex.cc (test_complex_faces_iter):
diff --git a/milena/mln/core/site_set/p_complex_faces_piter.hh b/milena/mln/core/site_set/p_complex_faces_piter.hh
new file mode 100644
index 0000000..ef77272
--- /dev/null
+++ b/milena/mln/core/site_set/p_complex_faces_piter.hh
@@ -0,0 +1,157 @@
+// 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_CORE_SITE_SET_P_COMPLEX_FACES_PITER_HH
+# define MLN_CORE_SITE_SET_P_COMPLEX_FACES_PITER_HH
+
+/// \file mln/core/site_set/p_complex_faces_piter.hh
+/// \brief Definition of point iterator on the n-faces of a
+/// complex-based pset.
+///
+/// Types defined here are akin to parametrized typedefs: the code is
+/// factored in mln::internal::p_complex_piter_base_.
+
+# include <mln/core/site_set/p_complex.hh>
+# include <mln/core/internal/p_complex_piter_base.hh>
+# include <mln/core/complex_faces_iter.hh>
+
+/* FIXME: p_complex_faces_fwd_piter_ and p_complex_faces_bkd_piter_
+ are really long names: find something shorter. */
+
+
+namespace mln
+{
+
+ // Forward declarations.
+ template <unsigned N, unsigned D, typename P> class p_faces;
+
+ template <unsigned N, unsigned D> class faces_fwd_iter_;
+ template <unsigned N, unsigned D> class faces_bkd_iter_;
+
+
+ /*--------------------------------------.
+ | p_complex_faces_fwd_piter_<N, D, P>. |
+ `--------------------------------------*/
+
+ /// \brief Forward iterator on the \p N-faces sites of an
+ /// mln::p_complex<D, P>.
+ template <unsigned N, unsigned D, typename P>
+ class p_complex_faces_fwd_piter_
+ : public internal::p_complex_piter_base_< complex_faces_fwd_iter_<N, D>,
+ p_complex<D, P>,
+ P,
+ p_complex_faces_fwd_piter_<N, D, P> >
+ {
+ typedef p_complex_faces_fwd_piter_<N, D, P> self_;
+ typedef internal::p_complex_piter_base_< complex_faces_fwd_iter_<N, D>,
+ p_complex<D, P>,
+ P,
+ self_ > super_;
+
+ public:
+ /// Construction and assignment.
+ /// \{
+ p_complex_faces_fwd_piter_();
+ p_complex_faces_fwd_piter_(const p_complex<D, P>& pc);
+ /// \}
+ };
+
+
+ /*--------------------------------------.
+ | p_complex_faces_bkd_piter_<N, D, P>. |
+ `--------------------------------------*/
+
+ /// \brief Backward iterator on the \p N-faces sites of an
+ /// mln::p_complex<D, P>.
+ template <unsigned N, unsigned D, typename P>
+ class p_complex_faces_bkd_piter_
+ /* FIXME: Rename internal::p_complex_piter_base_ to something else,
+ as it is also used for p_faces piters! */
+ : public internal::p_complex_piter_base_< complex_faces_bkd_iter_<N, D>,
+ p_complex<D, P>,
+ P,
+ p_complex_faces_bkd_piter_<N, D, P> >
+ {
+ typedef p_complex_faces_bkd_piter_<N, D, P> self_;
+ typedef internal::p_complex_piter_base_< complex_faces_bkd_iter_<N, D>,
+ p_complex<D, P>,
+ P,
+ self_ > super_;
+
+ public:
+ /// Construction and assignment.
+ /// \{
+ p_complex_faces_bkd_piter_();
+ p_complex_faces_bkd_piter_(const p_complex<D, P>& pc);
+ /// \}
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ /*--------------------------------------.
+ | p_complex_faces_fwd_piter_<N, D, P>. |
+ `--------------------------------------*/
+
+ template <unsigned N, unsigned D, typename P>
+ inline
+ p_complex_faces_fwd_piter_<N, D, P>::p_complex_faces_fwd_piter_()
+ {
+ }
+
+ template <unsigned N, unsigned D, typename P>
+ inline
+ p_complex_faces_fwd_piter_<N, D, P>::p_complex_faces_fwd_piter_(const p_complex<D, P>& pc)
+ : super_(pc)
+ {
+ }
+
+
+ /*--------------------------------------.
+ | p_complex_faces_bkd_piter_<N, D, P>. |
+ `--------------------------------------*/
+
+ template <unsigned N, unsigned D, typename P>
+ inline
+ p_complex_faces_bkd_piter_<N, D, P>::p_complex_faces_bkd_piter_()
+ {
+ }
+
+ template <unsigned N, unsigned D, typename P>
+ inline
+ p_complex_faces_bkd_piter_<N, D, P>::p_complex_faces_bkd_piter_(const p_complex<D, P>& pc)
+ : super_(pc)
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of mln
+
+
+#endif // ! MLN_CORE_SITE_SET_P_COMPLEX_FACES_PITER_HH
--
1.6.0.1
* mln/core/complex_faces_iter.hh: New.
---
milena/ChangeLog | 6 +
milena/mln/core/complex_faces_iter.hh | 262 +++++++++++++++++++++++++++++++++
2 files changed, 268 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/core/complex_faces_iter.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 72e25d3..e82e082 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -41,6 +41,12 @@
2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+ Add iterators on n-faces able to convert to mln::any_face_handle's.
+
+ * mln/core/complex_faces_iter.hh: New.
+
+2008-09-24 Roland Levillain <roland(a)lrde.epita.fr>
+
Simplify iterators on complexes.
* mln/core/complex_iter.hh, mln/core/faces_iter.hh:
diff --git a/milena/mln/core/complex_faces_iter.hh b/milena/mln/core/complex_faces_iter.hh
new file mode 100644
index 0000000..ea86f6f
--- /dev/null
+++ b/milena/mln/core/complex_faces_iter.hh
@@ -0,0 +1,262 @@
+// 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_CORE_COMPLEX_FACES_ITER_HH
+# define MLN_CORE_COMPLEX_FACES_ITER_HH
+
+/// \file mln/core/complex_faces_iter.hh
+/// \brief Definition of forward and backward iterators on the n-faces
+/// of a complex.
+
+# include <mln/core/internal/complex_iter_base.hh>
+
+/* FIXME: Should we drop N from the signature of these iterators?
+ I.e., have N be dynamic? Or better: provide other iterators where
+ N is dynamic? */
+
+
+namespace mln
+{
+
+ /*--------------------------------.
+ | complex_faces_fwd_iter_<N, D>. |
+ `--------------------------------*/
+
+ /// \brief Forward iterator on all the faces of a mln::complex<D>.
+ ///
+ /// \arg \p N The dimension of the face associated to this iterator.
+ /// \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>,
+ complex_faces_fwd_iter_<N, D> >
+ {
+ public:
+ /// Type of associated face.
+ typedef any_face_handle<D> face;
+
+ private:
+ typedef complex_faces_fwd_iter_<N, D> self_;
+ typedef internal::complex_iter_base_< face, self_ > super_;
+
+ public:
+ using super_::is_valid;
+ using super_::invalidate;
+
+ public:
+ /// Construction and assignment.
+ /// \{
+ complex_faces_fwd_iter_();
+ // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ complex_faces_fwd_iter_(complex<D>& c);
+ /// \}
+
+ /// Manipulation.
+ /// \{
+ /// Test if the iterator is valid.
+ void start();
+ /// Go to the next point.
+ void next_();
+ /// \}
+
+ private:
+ using super_::face_;
+ };
+
+
+ /*--------------------------------.
+ | complex_faces_bkd_iter_<N, D>. |
+ `--------------------------------*/
+
+ /// \brief Backward iterator on all the faces of a mln::complex<D>.
+ ///
+ /// \arg \p N The dimension of the face associated to this iterator.
+ /// \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>,
+ complex_faces_bkd_iter_<N, D> >
+ {
+ public:
+ /// Type of associated face.
+ typedef any_face_handle<D> face;
+
+ private:
+ typedef complex_faces_bkd_iter_<N, D> self_;
+ typedef internal::complex_iter_base_< face, self_ > super_;
+
+ public:
+ using super_::is_valid;
+ using super_::invalidate;
+
+ public:
+ /// Construction and assignment.
+ /// \{
+ complex_faces_bkd_iter_();
+ // FIXME: See comment in internal::complex_iter_base_'s default ctor
+ complex_faces_bkd_iter_(complex<D>& c);
+ /// \}
+
+ /// Manipulation.
+ /// \{
+ /// Start an iteration.
+ void start();
+ /// Go to the next point.
+ void next_();
+ /// \}
+
+ private:
+ using super_::face_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ /*--------------------------------.
+ | complex_faces_fwd_iter_<N, D>. |
+ `--------------------------------*/
+
+ template <unsigned N, unsigned D>
+ inline
+ complex_faces_fwd_iter_<N, D>::complex_faces_fwd_iter_()
+ : super_()
+ {
+ // Ensure N is compatible with D.
+ metal::bool_< N <= D >::check();
+ face_.set_n(N);
+ mln_postcondition(!is_valid());
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ complex_faces_fwd_iter_<N, D>::complex_faces_fwd_iter_(complex<D>& c)
+ : super_(c)
+ {
+ // Ensure N is compatible with D.
+ metal::bool_< N <= D >::check();
+ face_.set_n(N);
+ mln_postcondition(!is_valid());
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ complex_faces_fwd_iter_<N, D>::start()
+ {
+ face_.set_face_id(0u);
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ complex_faces_fwd_iter_<N, D>::next_()
+ {
+ if (is_valid())
+ {
+ unsigned face_id = face_.face_id();
+ if (face_id + 1 < face_.cplx().template nfaces<N>())
+ /* FIXME: Provide accessor any_face_handle::face_id()
+ returning a mutable reference? This way, we could just
+ write
+
+ ++face_.face_id();
+
+ instead of the following.
+
+ Or add {inc,add}_face_id() services. */
+ face_.set_face_id(face_id + 1);
+ else
+ invalidate();
+ }
+ }
+
+
+ /*--------------------------------.
+ | complex_faces_bkd_iter_<N, D>. |
+ `--------------------------------*/
+
+ template <unsigned N, unsigned D>
+ inline
+ complex_faces_bkd_iter_<N, D>::complex_faces_bkd_iter_()
+ : super_()
+ {
+ // Ensure N is compatible with D.
+ metal::bool_< N <= D >::check();
+ face_.set_n(N);
+ mln_postcondition(!is_valid());
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ complex_faces_bkd_iter_<N, D>::complex_faces_bkd_iter_(complex<D>& c)
+ : super_(c)
+ {
+ // Ensure N is compatible with D.
+ metal::bool_< N <= D >::check();
+ face_.set_n(N);
+ mln_postcondition(!is_valid());
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ complex_faces_bkd_iter_<N, D>::start()
+ {
+ face_.set_face_id(face_.cplx().template nfaces<N>() - 1);
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ void
+ complex_faces_bkd_iter_<N, D>::next_()
+ {
+ if (is_valid())
+ {
+ unsigned face_id = face_.face_id();
+ if (face_id > 0)
+ /* FIXME: Provide accessor any_face_handle::face_id()
+ returning a mutable reference? This way, we could just
+ write
+
+ ++face_.face_id();
+
+ instead of the following.
+
+ Or add {inc,add}_face_id() services. */
+ face_.set_face_id(face_id - 1);
+ else
+ invalidate();
+ }
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of mln
+
+
+#endif // ! MLN_CORE_COMPLEX_FACES_ITER_HH
--
1.6.0.1