
* mln/topo/complex.hh (connect_(const n_face<N, D>&, const n_face<N + 1, D>&)): Turn method into... (connect_(const algebraic_n_face<N, D>&, const n_face<N + 1, D>&)): ...this. (complex<D>::add_face): Adjust. (internal::lower_dim_faces_set_mixin<N, D>::print) (higher_dim_faces_set_mixin<N, D>::print): Adjust. * mln/topo/face_data.hh: Adjust friends. (internal::lower_dim_faces_data_mixin<N, D>::lower_dim_faces_type) (internal::higher_dim_faces_data_mixin<N, D>::higher_dim_faces_type): New typedefs. Use them as types of... (internal::lower_dim_faces_data_mixin<N, D>::lower_dim_faces_) (internal::higher_dim_faces_data_mixin<N, D>::higher_dim_faces_): ...these members. (internal::lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face) (internal::higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face): Convert to algebraic n-faces. --- milena/ChangeLog | 25 +++++++++++++++++++++++++ milena/mln/topo/complex.hh | 31 +++++++++++++++++++++---------- milena/mln/topo/face_data.hh | 24 +++++++++++++++--------- 3 files changed, 61 insertions(+), 19 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 5395ca0..e7adf55 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,30 @@ 2008-10-23 Roland Levillain <roland@lrde.epita.fr> + Convert mln::topo::complex to algebraic faces. + + * mln/topo/complex.hh + (connect_(const n_face<N, D>&, const n_face<N + 1, D>&)): + Turn method into... + (connect_(const algebraic_n_face<N, D>&, const n_face<N + 1, D>&)): + ...this. + (complex<D>::add_face): Adjust. + (internal::lower_dim_faces_set_mixin<N, D>::print) + (higher_dim_faces_set_mixin<N, D>::print): + Adjust. + * mln/topo/face_data.hh: Adjust friends. + (internal::lower_dim_faces_data_mixin<N, D>::lower_dim_faces_type) + (internal::higher_dim_faces_data_mixin<N, D>::higher_dim_faces_type): + New typedefs. + Use them as types of... + (internal::lower_dim_faces_data_mixin<N, D>::lower_dim_faces_) + (internal::higher_dim_faces_data_mixin<N, D>::higher_dim_faces_): + ...these members. + (internal::lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face) + (internal::higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face): + Convert to algebraic n-faces. + +2008-10-23 Roland Levillain <roland@lrde.epita.fr> + Convert n-faces set to algebraic faces. * milena/mln/topo/n_faces_set.hh diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh index e6330e2..00a2bb2 100644 --- a/milena/mln/topo/complex.hh +++ b/milena/mln/topo/complex.hh @@ -44,8 +44,8 @@ # 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/algebraic_face.hh> +# include <mln/topo/algebraic_n_face.hh> # include <mln/topo/n_faces_set.hh> # include <mln/topo/complex_iterators.hh> @@ -204,14 +204,15 @@ namespace mln apply_if_dim_matches_(unsigned n, const UnaryFunction& f) const; /// \} - /// \brief connect two faces. + /// \brief Connect two algebraic faces. /// - /// \param f1 A face of dimension \p N + /// \param f1 An algebraic face of dimension \p N /// \param f2 A face of dimension \p N + 1 /// /// \pre \p N must be lower or equal to \p D. template <unsigned N> - void connect_(const n_face<N, D>& f1, const n_face<N + 1, D>& f2); + void connect_(const algebraic_n_face<N, D>& f1, + const n_face<N + 1, D>& f2); }; @@ -494,7 +495,8 @@ namespace mln n_face<N + 1, D> complex<D>::add_face(const n_faces_set<N, D>& adjacent_faces) { - typedef typename std::vector< n_face<N, D> >::const_iterator iter_t; + typedef typename std::vector< algebraic_n_face<N, D> >::const_iterator + iter_t; // Ensure ADJACENT_FACES are already part of the complex. if (!HAS_NDEBUG) @@ -515,6 +517,10 @@ namespace mln // Connect F and its ADJACENT_FACES. for (iter_t a = adjacent_faces.faces().begin(); a != adjacent_faces.faces().end(); ++a) + /* Connect + - algebraic n-face *A, + - and an (n+1)-algebraic face based on FH and having the + sign of *A. */ connect_(*a, fh); return fh; } @@ -629,12 +635,17 @@ namespace mln template <unsigned N> inline void - complex<D>::connect_(const n_face<N, D>& f1, const n_face<N + 1, D>& f2) + complex<D>::connect_(const algebraic_n_face<N, D>& f1, + const n_face<N + 1, D>& f2) { // Ensure N is compatible with D. metal::bool_< N <= D >::check(); - f1.data().connect_higher_dim_face(f2); + /* Connect + - F1, an algebraic n-face, + - and AF2, an algebraic (n+1)-face based on F2 and having the + sign of F1. */ + f1.data().connect_higher_dim_face(make_algebraic_n_face(f2, f1.sign())); f2.data().connect_lower_dim_face(f1); } @@ -801,7 +812,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< n_face<N - 1, D> >::const_iterator l = + for (typename std::vector< algebraic_n_face<N - 1, D> >::const_iterator l = f.lower_dim_faces_.begin(); l != f.lower_dim_faces_.end(); ++l) ostr << l->face_id() << " "; } @@ -812,7 +823,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< n_face<N + 1, D> >::const_iterator h = + for (typename std::vector< algebraic_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_data.hh b/milena/mln/topo/face_data.hh index 27e78cd..1cee9e1 100644 --- a/milena/mln/topo/face_data.hh +++ b/milena/mln/topo/face_data.hh @@ -36,7 +36,7 @@ # include <vector> -# include <mln/topo/n_face.hh> +# include <mln/topo/algebraic_n_face.hh> namespace mln @@ -110,31 +110,37 @@ namespace mln template <unsigned N, unsigned D> class lower_dim_faces_data_mixin { + typedef std::vector< algebraic_n_face<N - 1, D> > lower_dim_faces_type; + public: - void connect_lower_dim_face (const n_face<N - 1, D>& f); + void connect_lower_dim_face(const algebraic_n_face<N - 1, D>& f); + private: friend class mln::topo::internal::lower_dim_faces_set_mixin<N, D>; friend class mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>; - friend std::vector< n_face<N - 1, D> > + friend lower_dim_faces_type mln::topo::n_face<N, D>::lower_dim_adj_faces() const; // FIXME: Rename as lower_dim_adj_faces_ (as well as related members). - std::vector< n_face<N - 1, D> > lower_dim_faces_; + lower_dim_faces_type lower_dim_faces_; }; template <unsigned N, unsigned D> class higher_dim_faces_data_mixin { + typedef std::vector< algebraic_n_face<N + 1, D> > higher_dim_faces_type; + public: - void connect_higher_dim_face(const n_face<N + 1, D>& f); + void connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f); + private: friend class mln::topo::internal::higher_dim_faces_set_mixin<N, D>; friend class mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>; - friend std::vector< n_face<N + 1, D> > + friend higher_dim_faces_type mln::topo::n_face<N, D>::higher_dim_adj_faces() const; // FIXME: Rename as higher_dim_adj_faces_ (as well as related members). - std::vector< n_face<N + 1, D> > higher_dim_faces_; + higher_dim_faces_type higher_dim_faces_; }; /// \} @@ -149,7 +155,7 @@ namespace mln 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_data_mixin<N, D>::connect_lower_dim_face(const algebraic_n_face<N - 1, D>& f) { lower_dim_faces_.push_back(f); } @@ -157,7 +163,7 @@ namespace mln 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_data_mixin<N, D>::connect_higher_dim_face(const algebraic_n_face<N + 1, D>& f) { higher_dim_faces_.push_back(f); } -- 1.5.6.5