2664: Convert iterators on complexes to algebraic faces.

* mln/topo/internal/complex_relative_iterator_base.hh (topo::internal::complex_relative_iterator_base) (topo::internal::forward_complex_relative_iterator_base) (topo::internal::backward_complex_relative_iterator_base): Add a template parameter C, for the type of the center face, which might be different from F, the type of the iterated faces. (topo::internal::complex_relative_iterator_base::center_type): New typedef. Use it as type of... (topo::internal::complex_relative_iterator_base::c_): ...this member. (topo::internal::complex_relative_iterator_base::center_at): Adjust. * mln/topo/internal/complex_iterator_base.hh: Adjust documentation. * mln/topo/adj_lower_face_iter.hh, * mln/topo/adj_higher_face_iter.hh, * mln/topo/adj_lower_dim_connected_n_face_iter.hh, * mln/topo/adj_higher_dim_connected_n_face_iter.hh, * mln/topo/center_only_iter.hh, * mln/topo/internal/complex_relative_iterator_sequence: Adjust. Pass algebraic_face<D> as parameter F to super class, and face<D> as as parameter C. * mln/topo/adj_m_face_iter.hh: Likewise. (adj_m_face_iterator<D>::update_adj_faces__): Have the algorithm take the sign (orientation) of the face into account. * mln/topo/adj_lower_higher_face_iter.hh: Remove a useless header inclusion. --- milena/ChangeLog | 34 +++++ .../topo/adj_higher_dim_connected_n_face_iter.hh | 18 ++- milena/mln/topo/adj_higher_face_iter.hh | 6 +- .../topo/adj_lower_dim_connected_n_face_iter.hh | 14 ++- milena/mln/topo/adj_lower_face_iter.hh | 6 +- milena/mln/topo/adj_lower_higher_face_iter.hh | 2 - milena/mln/topo/adj_m_face_iter.hh | 49 +++++-- milena/mln/topo/center_only_iter.hh | 4 +- milena/mln/topo/internal/complex_iterator_base.hh | 2 +- .../internal/complex_relative_iterator_base.hh | 150 ++++++++++---------- .../internal/complex_relative_iterator_sequence.hh | 6 +- 11 files changed, 187 insertions(+), 104 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index e7adf55..e32143d 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,39 @@ 2008-10-23 Roland Levillain <roland@lrde.epita.fr> + Convert iterators on complexes to algebraic faces. + + * mln/topo/internal/complex_relative_iterator_base.hh + (topo::internal::complex_relative_iterator_base) + (topo::internal::forward_complex_relative_iterator_base) + (topo::internal::backward_complex_relative_iterator_base): + Add a template parameter C, for the type of the center face, which + might be different from F, the type of the iterated faces. + (topo::internal::complex_relative_iterator_base::center_type): + New typedef. + Use it as type of... + (topo::internal::complex_relative_iterator_base::c_): + ...this member. + (topo::internal::complex_relative_iterator_base::center_at): + Adjust. + * mln/topo/internal/complex_iterator_base.hh: + Adjust documentation. + * mln/topo/adj_lower_face_iter.hh, + * mln/topo/adj_higher_face_iter.hh, + * mln/topo/adj_lower_dim_connected_n_face_iter.hh, + * mln/topo/adj_higher_dim_connected_n_face_iter.hh, + * mln/topo/center_only_iter.hh, + * mln/topo/internal/complex_relative_iterator_sequence: + Adjust. + Pass algebraic_face<D> as parameter F to super class, and face<D> + as as parameter C. + * mln/topo/adj_m_face_iter.hh: Likewise. + (adj_m_face_iterator<D>::update_adj_faces__): Have the + algorithm take the sign (orientation) of the face into account. + * mln/topo/adj_lower_higher_face_iter.hh: Remove a useless header + inclusion. + +2008-10-23 Roland Levillain <roland@lrde.epita.fr> + Convert mln::topo::complex to algebraic faces. * mln/topo/complex.hh diff --git a/milena/mln/topo/adj_higher_dim_connected_n_face_iter.hh b/milena/mln/topo/adj_higher_dim_connected_n_face_iter.hh index be619cb..921575e 100644 --- a/milena/mln/topo/adj_higher_dim_connected_n_face_iter.hh +++ b/milena/mln/topo/adj_higher_dim_connected_n_face_iter.hh @@ -37,7 +37,7 @@ # include <set> # include <mln/topo/internal/complex_relative_iterator_base.hh> -# include <mln/topo/face.hh> +# include <mln/topo/algebraic_face.hh> namespace mln @@ -65,12 +65,14 @@ namespace mln template <unsigned D> class adj_higher_dim_connected_n_face_fwd_iter : public internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_higher_dim_connected_n_face_fwd_iter<D> >, - private internal::adj_higher_dim_connected_n_face_iterator<D> + private internal::adj_higher_dim_connected_n_face_iterator<D> { private: typedef adj_higher_dim_connected_n_face_fwd_iter<D> self_; typedef internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: @@ -100,12 +102,14 @@ namespace mln template <unsigned D> class adj_higher_dim_connected_n_face_bkd_iter : public internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_higher_dim_connected_n_face_bkd_iter<D> >, - private internal::adj_higher_dim_connected_n_face_iterator<D> + private internal::adj_higher_dim_connected_n_face_iterator<D> { private: typedef adj_higher_dim_connected_n_face_bkd_iter<D> self_; typedef internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: @@ -138,7 +142,7 @@ namespace mln /// The actual implementation of the computation of the set of /// faces adjacent to the reference face. void update_adj_faces__(const face<D>& center, - std::vector< face<D> >& adj_faces); + std::vector< algebraic_face<D> >& adj_faces); }; } // end of namespace mln::topo::internal @@ -225,7 +229,7 @@ namespace mln inline void adj_higher_dim_connected_n_face_iterator<D>::update_adj_faces__(const face<D>& center, - std::vector< face<D> >& adj_faces) + std::vector< algebraic_face<D> >& adj_faces) { // Reset the result container. adj_faces.clear(); @@ -235,8 +239,8 @@ namespace mln added to the pool of adjacent faces. We use an std::set because the lookup is cheaper (O(log(n)) vs O(n) for a vector, where n is the size of the containers. */ - std::set< face<D> > faces_set; - typedef std::vector< face<D> > faces_t; + std::set< algebraic_face<D> > faces_set; + typedef std::vector< algebraic_face<D> > faces_t; // The set of (n+1)-faces adjacent to CENTER. faces_t shared_higher_faces = center.higher_dim_adj_faces(); diff --git a/milena/mln/topo/adj_higher_face_iter.hh b/milena/mln/topo/adj_higher_face_iter.hh index cfea904..e51d678 100644 --- a/milena/mln/topo/adj_higher_face_iter.hh +++ b/milena/mln/topo/adj_higher_face_iter.hh @@ -33,7 +33,7 @@ /// adjacent (n+1)-faces of a (reference) n-face in a complex. # include <mln/topo/internal/complex_relative_iterator_base.hh> -# include <mln/topo/face.hh> +# include <mln/topo/algebraic_face.hh> namespace mln @@ -57,10 +57,12 @@ namespace mln template <unsigned D> class adj_higher_face_fwd_iter : public internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_higher_face_fwd_iter<D> > { typedef adj_higher_face_fwd_iter<D> self_; typedef internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: @@ -87,10 +89,12 @@ namespace mln template <unsigned D> class adj_higher_face_bkd_iter : public internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_higher_face_bkd_iter<D> > { typedef adj_higher_face_bkd_iter<D> self_; typedef internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: diff --git a/milena/mln/topo/adj_lower_dim_connected_n_face_iter.hh b/milena/mln/topo/adj_lower_dim_connected_n_face_iter.hh index 181d439..9d35482 100644 --- a/milena/mln/topo/adj_lower_dim_connected_n_face_iter.hh +++ b/milena/mln/topo/adj_lower_dim_connected_n_face_iter.hh @@ -37,7 +37,7 @@ # include <set> # include <mln/topo/internal/complex_relative_iterator_base.hh> -# include <mln/topo/face.hh> +# include <mln/topo/algebraic_face.hh> namespace mln @@ -65,12 +65,14 @@ namespace mln template <unsigned D> class adj_lower_dim_connected_n_face_fwd_iter : public internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_lower_dim_connected_n_face_fwd_iter<D> >, private internal::adj_lower_dim_connected_n_face_iterator<D> { private: typedef adj_lower_dim_connected_n_face_fwd_iter<D> self_; typedef internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: @@ -100,12 +102,14 @@ namespace mln template <unsigned D> class adj_lower_dim_connected_n_face_bkd_iter : public internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_lower_dim_connected_n_face_bkd_iter<D> >, private internal::adj_lower_dim_connected_n_face_iterator<D> { private: typedef adj_lower_dim_connected_n_face_bkd_iter<D> self_; typedef internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: @@ -138,7 +142,7 @@ namespace mln /// The actual implementation of the computation of the set of /// faces adjacent to the reference face. void update_adj_faces__(const face<D>& center, - std::vector< face<D> >& adj_faces); + std::vector< algebraic_face<D> >& adj_faces); }; } // end of namespace mln::topo::internal @@ -225,7 +229,7 @@ namespace mln inline void adj_lower_dim_connected_n_face_iterator<D>::update_adj_faces__(const face<D>& center, - std::vector< face<D> >& adj_faces) + std::vector< algebraic_face<D> >& adj_faces) { // Reset the result container. adj_faces.clear(); @@ -235,8 +239,8 @@ namespace mln added to the pool of adjacent faces. We use an std::set because the lookup is cheaper (O(log(n)) vs O(n) for a vector, where n is the size of the containers. */ - std::set< face<D> > faces_set; - typedef std::vector< face<D> > faces_t; + std::set< algebraic_face<D> > faces_set; + typedef std::vector< algebraic_face<D> > faces_t; // The set of (n-1)-faces adjacent to CENTER. faces_t shared_lower_faces = center.lower_dim_adj_faces(); diff --git a/milena/mln/topo/adj_lower_face_iter.hh b/milena/mln/topo/adj_lower_face_iter.hh index e8f5f3f..88cc8f2 100644 --- a/milena/mln/topo/adj_lower_face_iter.hh +++ b/milena/mln/topo/adj_lower_face_iter.hh @@ -33,7 +33,7 @@ /// adjacent (n-1)-faces of a (reference) n-face in a complex. # include <mln/topo/internal/complex_relative_iterator_base.hh> -# include <mln/topo/face.hh> +# include <mln/topo/algebraic_face.hh> namespace mln @@ -57,11 +57,13 @@ namespace mln template <unsigned D> class adj_lower_face_fwd_iter : public internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_lower_face_fwd_iter<D> > { private: typedef adj_lower_face_fwd_iter<D> self_; typedef internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: @@ -88,11 +90,13 @@ namespace mln template <unsigned D> class adj_lower_face_bkd_iter : public internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_lower_face_bkd_iter<D> > { private: typedef adj_lower_face_bkd_iter<D> self_; typedef internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: diff --git a/milena/mln/topo/adj_lower_higher_face_iter.hh b/milena/mln/topo/adj_lower_higher_face_iter.hh index e28b64a..dcd11c2 100644 --- a/milena/mln/topo/adj_lower_higher_face_iter.hh +++ b/milena/mln/topo/adj_lower_higher_face_iter.hh @@ -37,8 +37,6 @@ # include <mln/topo/adj_lower_face_iter.hh> # include <mln/topo/adj_higher_face_iter.hh> -# include <mln/topo/face.hh> - namespace mln { diff --git a/milena/mln/topo/adj_m_face_iter.hh b/milena/mln/topo/adj_m_face_iter.hh index f54a341..d9ed9e5 100644 --- a/milena/mln/topo/adj_m_face_iter.hh +++ b/milena/mln/topo/adj_m_face_iter.hh @@ -70,12 +70,14 @@ namespace mln template <unsigned D> class adj_m_face_fwd_iter : public internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_m_face_fwd_iter<D> >, public internal::adj_m_face_iterator<D> { private: typedef adj_m_face_fwd_iter<D> self_; typedef internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; typedef internal::adj_m_face_iterator<D> impl_; @@ -115,12 +117,14 @@ namespace mln template <unsigned D> class adj_m_face_bkd_iter : public internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, adj_m_face_bkd_iter<D> >, public internal::adj_m_face_iterator<D> { private: typedef adj_m_face_bkd_iter<D> self_; typedef internal::backward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; typedef internal::adj_m_face_iterator<D> impl_; @@ -168,7 +172,7 @@ namespace mln /// The actual implementation of the computation of the set of /// faces adjacent to the reference face. void update_adj_faces__(const face<D>& center, - std::vector< face<D> >& adj_faces); + std::vector< algebraic_face<D> >& adj_faces); /// The dimension of the iterated faces. unsigned m_; @@ -278,22 +282,23 @@ namespace mln inline void adj_m_face_iterator<D>::update_adj_faces__(const face<D>& center, - std::vector< face<D> >& adj_faces) + std::vector< algebraic_face<D> >& adj_faces) { adj_faces.clear(); if (center.n() == m_) return; - typedef std::vector < topo::face<D> > faces_t; - typedef std::set < topo::face<D> > faces_set_t; + typedef std::vector < topo::algebraic_face<D> > faces_t; + typedef std::set < topo::algebraic_face<D> > faces_set_t; /* FIXME: p_faces is redundant; we could use adj_faces directly. */ /* The adjacent p-faces being built; initialized with CENTER, and filled with q-faces at each step, until q reaches m_. */ - faces_t p_faces(1, center); + faces_t p_faces(1, + make_algebraic_face(center, true)); // The set of faces being built. /* FIXME: This pattern is recurring in Milena---using an std::set (or any fast associative container) to improve @@ -314,14 +319,34 @@ namespace mln faces_t q_faces = g->n() < m_ ? g->higher_dim_adj_faces() : g->lower_dim_adj_faces(); - // Don't insert a face twice. - for (typename faces_t::const_iterator h = q_faces.begin(); + /* Traverse the higher- or lower-dimension adjacent + faces of G in the natural order if G's sign is + positive, or in the reverse order if G's sign is + negative. */ + /* FIXME: Factor; the code if the two branches is the + same, except for the iteration order. */ + if (g->sign()) + { + for (typename faces_t::const_iterator h = q_faces.begin(); h != q_faces.end(); ++h) - if (work_faces_set.find(*h) == work_faces_set.end()) - { - work_faces.push_back(*h); - work_faces_set.insert(*h); - } + // Don't insert a face twice. + if (work_faces_set.find(*h) == work_faces_set.end()) + { + work_faces.push_back(*h); + work_faces_set.insert(*h); + } + } + else + { + for (typename faces_t::const_reverse_iterator h = + q_faces.rbegin(); h != q_faces.rend(); ++h) + // Don't insert a face twice. + if (work_faces_set.find(*h) == work_faces_set.end()) + { + work_faces.push_back(*h); + work_faces_set.insert(*h); + } + } } work_faces.swap(p_faces); work_faces.clear(); diff --git a/milena/mln/topo/center_only_iter.hh b/milena/mln/topo/center_only_iter.hh index d55ffca..c2d2a6e 100644 --- a/milena/mln/topo/center_only_iter.hh +++ b/milena/mln/topo/center_only_iter.hh @@ -74,11 +74,13 @@ namespace mln template <unsigned D> class center_only_iter : public internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, center_only_iter<D> > { private: typedef center_only_iter<D> self_; typedef internal::forward_complex_relative_iterator_base< face<D>, + algebraic_face<D>, self_ > super_; public: @@ -122,7 +124,7 @@ namespace mln { mln_precondition(this->c_); this->adj_faces_.clear(); - this->adj_faces_.push_back(*this->c_); + this->adj_faces_.push_back(make_algebraic_face(*this->c_, true)); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/topo/internal/complex_iterator_base.hh b/milena/mln/topo/internal/complex_iterator_base.hh index 015ad7d..ceb86f3 100644 --- a/milena/mln/topo/internal/complex_iterator_base.hh +++ b/milena/mln/topo/internal/complex_iterator_base.hh @@ -50,7 +50,7 @@ | ,--------------+--------------. | | - complex_set_iterator_base<F, E> complex_relative_iterator_base<F, E> + complex_set_iterator_base<F, E> complex_relative_iterator_base<C, F, E> \endverbatim */ diff --git a/milena/mln/topo/internal/complex_relative_iterator_base.hh b/milena/mln/topo/internal/complex_relative_iterator_base.hh index 630f0f0..4925952 100644 --- a/milena/mln/topo/internal/complex_relative_iterator_base.hh +++ b/milena/mln/topo/internal/complex_relative_iterator_base.hh @@ -36,14 +36,14 @@ \verbatim - complex_relative_iterator_base<F, E> + complex_relative_iterator_base<C, F, E> ^ | ,--------------+--------------. | | - forward_complex_relative_iterator_base<F, E> | + forward_complex_relative_iterator_base<C, F, E> | | - backward_complex_relative_iterator_base<F, E> + backward_complex_relative_iterator_base<C, F, E> \endverbatim */ @@ -68,20 +68,24 @@ namespace mln namespace internal { - /*-------------------------------------------------------. - | topo::internal::complex_relative_iterator_base<F, E>. | - `-------------------------------------------------------*/ + /*----------------------------------------------------------. + | topo::internal::complex_relative_iterator_base<C, F, E>. | + `----------------------------------------------------------*/ /// \brief Factoring class for relative iterators on mln::complex. /// + /// \arg \p C The type of the center face handle. /// \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_relative_iterator_base : public complex_iterator_base<F, E> + template <typename C, typename F, typename E> + class complex_relative_iterator_base : + public complex_iterator_base<F, E> { - typedef complex_relative_iterator_base<F, E> self_; + typedef complex_relative_iterator_base<C, F, E> self_; public: + /// The type of the center face. + typedef C center_type; /// The type of the iterated faces. typedef F face_type; @@ -95,7 +99,7 @@ namespace mln /// Manipulation. /// \{ /// Change the center face. - void center_at(const F& c); + void center_at(const center_type& c); /// Start an iteration. void start(); @@ -106,7 +110,7 @@ namespace mln protected: /// A pointer to the center face around which this iterator /// moves. - const face_type* c_; + const center_type* c_; // The type of the set of vicinity sites (adjacent face handles). typedef std::vector<face_type> adj_faces_t; @@ -116,21 +120,22 @@ namespace mln - /*---------------------------------------------------------------. - | topo::internal::forward_complex_relative_iterator_base<F, E>. | - `---------------------------------------------------------------*/ + /*------------------------------------------------------------------. + | topo::internal::forward_complex_relative_iterator_base<C, F, E>. | + `------------------------------------------------------------------*/ /// \brief Factoring class for forward relative iterators on /// mln::complex. /// + /// \arg \p C The type of the center face handle. /// \arg \p F The type of the face handle. /// \arg \p E The type exact type of the iterator. - template <typename F, typename E> + template <typename C, typename F, typename E> class forward_complex_relative_iterator_base - : public complex_relative_iterator_base<F, E> + : public complex_relative_iterator_base<C, F, E> { - typedef forward_complex_relative_iterator_base<F, E> self_; - typedef complex_relative_iterator_base<F, E> super_; + typedef forward_complex_relative_iterator_base<C, F, E> self_; + typedef complex_relative_iterator_base<C, F, E> super_; public: typedef F face_type; @@ -166,21 +171,22 @@ namespace mln }; - /*----------------------------------------------------------------. - | topo::internal::backward_complex_relative_iterator_base<F, E>. | - `----------------------------------------------------------------*/ + /*-------------------------------------------------------------------. + | topo::internal::backward_complex_relative_iterator_base<C, F, E>. | + `-------------------------------------------------------------------*/ /// \brief Factoring class for backward relative iterators on /// mln::complex. /// + /// \arg \p C The type of the center face handle. /// \arg \p F The type of the face handle. /// \arg \p E The type exact type of the iterator. - template <typename F, typename E> + template <typename C, typename F, typename E> class backward_complex_relative_iterator_base - : public complex_relative_iterator_base<F, E> + : public complex_relative_iterator_base<C, F, E> { - typedef backward_complex_relative_iterator_base<F, E> self_; - typedef complex_relative_iterator_base<F, E> super_; + typedef backward_complex_relative_iterator_base<C, F, E> self_; + typedef complex_relative_iterator_base<C, F, E> super_; public: typedef F face_type; @@ -219,13 +225,13 @@ namespace mln # ifndef MLN_INCLUDE_ONLY - /*-------------------------------------------------------. - | topo::internal::complex_relative_iterator_base<F, E>. | - `-------------------------------------------------------*/ + /*----------------------------------------------------------. + | topo::internal::complex_relative_iterator_base<C, F, E>. | + `----------------------------------------------------------*/ - template <typename F, typename E> + template <typename C, typename F, typename E> inline - complex_relative_iterator_base<F, E>::complex_relative_iterator_base() + complex_relative_iterator_base<C, F, E>::complex_relative_iterator_base() : c_(0) { // Check for required methods in E. @@ -235,10 +241,10 @@ namespace mln exact(this)->invalidate(); } - template <typename F, typename E> + template <typename C, typename F, typename E> template <typename Fref> inline - complex_relative_iterator_base<F, E>::complex_relative_iterator_base(const Fref& f_ref) + complex_relative_iterator_base<C, F, E>::complex_relative_iterator_base(const Fref& f_ref) { // Check for required methods in E. void (E::*m)() = & E::update_adj_faces_; @@ -247,29 +253,29 @@ namespace mln center_at(f_ref); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - complex_relative_iterator_base<F, E>::center_at(const F& c) + complex_relative_iterator_base<C, F, E>::center_at(const C& c) { c_ = &c; exact(this)->invalidate(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - complex_relative_iterator_base<F, E>::start() + complex_relative_iterator_base<C, F, E>::start() { exact(this)->do_start_(); if (exact(this)->is_valid()) exact(this)->update_f_(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - complex_relative_iterator_base<F, E>::next_() + complex_relative_iterator_base<C, F, E>::next_() { exact(this)->do_next_(); if (exact(this)->is_valid()) @@ -278,122 +284,122 @@ namespace mln - /*---------------------------------------------------------------. - | topo::internal::forward_complex_relative_iterator_base<F, E>. | - `---------------------------------------------------------------*/ + /*------------------------------------------------------------------. + | topo::internal::forward_complex_relative_iterator_base<C, F, E>. | + `------------------------------------------------------------------*/ - template <typename F, typename E> + template <typename C, typename F, typename E> inline - forward_complex_relative_iterator_base<F, E>::forward_complex_relative_iterator_base() + forward_complex_relative_iterator_base<C, F, E>::forward_complex_relative_iterator_base() { } - template <typename F, typename E> + template <typename C, typename F, typename E> template <typename Fref> inline - forward_complex_relative_iterator_base<F, E>::forward_complex_relative_iterator_base(const Fref& f_ref) + forward_complex_relative_iterator_base<C, F, E>::forward_complex_relative_iterator_base(const Fref& f_ref) : super_(f_ref) { } - template <typename F, typename E> + template <typename C, typename F, typename E> inline bool - forward_complex_relative_iterator_base<F, E>::is_valid() const + forward_complex_relative_iterator_base<C, F, E>::is_valid() const { return i_ != this->adj_faces_.end(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - forward_complex_relative_iterator_base<F, E>::invalidate() + forward_complex_relative_iterator_base<C, F, E>::invalidate() { i_ = this->adj_faces_.end(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - forward_complex_relative_iterator_base<F, E>::do_start_() + forward_complex_relative_iterator_base<C, F, E>::do_start_() { exact(this)->update_adj_faces_(); i_ = this->adj_faces_.begin(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - forward_complex_relative_iterator_base<F, E>::do_next_() + forward_complex_relative_iterator_base<C, F, E>::do_next_() { ++i_; } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - forward_complex_relative_iterator_base<F, E>::update_f_() + forward_complex_relative_iterator_base<C, F, E>::update_f_() { mln_precondition(is_valid()); this->f_ = *i_; } - /*----------------------------------------------------------------. - | topo::internal::backward_complex_relative_iterator_base<F, E>. | - `----------------------------------------------------------------*/ + /*-------------------------------------------------------------------. + | topo::internal::backward_complex_relative_iterator_base<C, F, E>. | + `-------------------------------------------------------------------*/ - template <typename F, typename E> + template <typename C, typename F, typename E> inline - backward_complex_relative_iterator_base<F, E>::backward_complex_relative_iterator_base() + backward_complex_relative_iterator_base<C, F, E>::backward_complex_relative_iterator_base() { } - template <typename F, typename E> + template <typename C, typename F, typename E> template <typename Fref> inline - backward_complex_relative_iterator_base<F, E>::backward_complex_relative_iterator_base(const Fref& f_ref) + backward_complex_relative_iterator_base<C, F, E>::backward_complex_relative_iterator_base(const Fref& f_ref) : super_(f_ref) { } - template <typename F, typename E> + template <typename C, typename F, typename E> inline bool - backward_complex_relative_iterator_base<F, E>::is_valid() const + backward_complex_relative_iterator_base<C, F, E>::is_valid() const { return i_ != this->adj_faces_.rend(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - backward_complex_relative_iterator_base<F, E>::invalidate() + backward_complex_relative_iterator_base<C, F, E>::invalidate() { i_ = this->adj_faces_.rend(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - backward_complex_relative_iterator_base<F, E>::do_start_() + backward_complex_relative_iterator_base<C, F, E>::do_start_() { exact(this)->update_adj_faces_(); i_ = this->adj_faces_.rbegin(); } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - backward_complex_relative_iterator_base<F, E>::do_next_() + backward_complex_relative_iterator_base<C, F, E>::do_next_() { ++i_; } - template <typename F, typename E> + template <typename C, typename F, typename E> inline void - backward_complex_relative_iterator_base<F, E>::update_f_() + backward_complex_relative_iterator_base<C, F, E>::update_f_() { mln_precondition(is_valid()); this->f_ = *i_; diff --git a/milena/mln/topo/internal/complex_relative_iterator_sequence.hh b/milena/mln/topo/internal/complex_relative_iterator_sequence.hh index d0756f4..57b4843 100644 --- a/milena/mln/topo/internal/complex_relative_iterator_sequence.hh +++ b/milena/mln/topo/internal/complex_relative_iterator_sequence.hh @@ -63,6 +63,8 @@ namespace mln typedef complex_relative_iterator_sequence<I1, I2, E> self_; public: + /// The type of the center face. + typedef typename I1::center_type center_type; /// The type of the iterated faces. typedef typename I1::face_type face_type; @@ -76,7 +78,7 @@ namespace mln /// Manipulation. /// \{ /// Change the center face. - void center_at(const face& c); + void center_at(const center_type& c); /// Test if the iterator is valid. bool is_valid() const; @@ -145,7 +147,7 @@ namespace mln template <typename I1, typename I2, typename E> inline void - complex_relative_iterator_sequence<I1, I2, E>::center_at(const face& c) + complex_relative_iterator_sequence<I1, I2, E>::center_at(const center_type& c) { iter1_.center_at(c); iter2_.center_at(c); -- 1.5.6.5
participants (1)
-
Roland Levillain