2993: Revamp neighborhoods and windows based on graph.

* tests/all_headers.cc, * mln/all.hh: Add new 'all' header and update the related test. * mln/core/neighb.hh, * mln/core/internal/site_relative_iterator_base.hh, * mln/core/internal/neighborhood_base.hh, * mln/core/alias/neighb2d.hh: Fix comments. * mln/core/internal/graph_neighborhood_base.hh, * mln/core/image/line_graph_neighborhood_piter.hh, * mln/core/image/line_graph_elt_neighborhood.hh, * mln/core/image/graph_neighborhood_piter.hh, * mln/core/image/graph_elt_neighborhood.hh: removed. Not needed anymore. The neighborhood is deduced from the window. * mln/core/image/line_graph_window_piter.hh, * mln/core/image/line_graph_elt_window.hh, * mln/core/image/graph_window_piter.hh, * mln/core/image/graph_elt_window.hh: revamp. Use the new graph iterators correctly. * mln/core/internal/graph_psite_base.hh: add a new method element(). * mln/core/internal/line_graph_vicinity_piter.hh, * mln/core/internal/graph_relative_piter.hh: removed. Not needed anymore since graph and line graph share the same piter object. * mln/core/internal/graph_window_base.hh: revamp and cleanup. * mln/core/site_set/p_graph_piter.hh: add new methods such as graph(). * mln/core/site_set/p_edges.hh, * mln/core/site_set/p_vertices.hh: add a new typedef for the function type. * mln/util/internal/graph_nbh_iter.hh: add default constructor. * mln/util/internal/graph_nbh_iter_base.hh: fix invalidate_(). * tests/core/image/graph_image.cc, * tests/core/image/line_graph_image.cc: fix tests. * tests/unit_test/Makefile.am, * tests/unit_test/mln_all.cc, * tests/unit_test/mln_canvas_distance_front.cc, * tests/unit_test/mln_core_image_graph_elt_neighborhood.cc, * tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc, * tests/unit_test/mln_core_image_line_graph_elt_piter.cc, * tests/unit_test/mln_core_internal_graph_neighborhood_base.cc, * tests/unit_test/mln_core_internal_graph_relative_piter.cc, * tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc, * tests/unit_test/mln_transform_distance.cc, * tests/unit_test/mln_transform_distance_front.cc, * tests/unit_test/mln_transform_influence_zone_front.cc, * tests/unit_test/mln_transform_internal_all.cc, * tests/unit_test/mln_transform_internal_distance_functor.cc, * tests/unit_test/mln_transform_internal_influence_zone_functor.cc: Update unit tests. * tests/util/line_graph.cc: remove useless debug. --- milena/ChangeLog | 65 +++++ milena/{tests/all_headers.cc => mln/all.hh} | 14 +- milena/mln/core/alias/neighb2d.hh | 86 ++++---- milena/mln/core/image/graph_elt_neighborhood.hh | 119 --------- milena/mln/core/image/graph_elt_window.hh | 71 ++---- milena/mln/core/image/graph_neighborhood_piter.hh | 267 -------------------- milena/mln/core/image/graph_window_piter.hh | 197 ++++----------- .../mln/core/image/line_graph_elt_neighborhood.hh | 119 --------- milena/mln/core/image/line_graph_elt_window.hh | 70 ++---- .../core/image/line_graph_neighborhood_piter.hh | 267 -------------------- milena/mln/core/image/line_graph_window_piter.hh | 265 ------------------- .../mln/core/internal/graph_neighborhood_base.hh | 95 ------- milena/mln/core/internal/graph_psite_base.hh | 12 + milena/mln/core/internal/graph_relative_piter.hh | 113 --------- milena/mln/core/internal/graph_window_base.hh | 44 ++-- .../mln/core/internal/line_graph_vicinity_piter.hh | 138 ---------- milena/mln/core/internal/neighborhood_base.hh | 2 +- .../core/internal/site_relative_iterator_base.hh | 4 +- milena/mln/core/neighb.hh | 5 +- milena/mln/core/site_set/p_edges.hh | 3 + milena/mln/core/site_set/p_graph_piter.hh | 24 ++- milena/mln/core/site_set/p_vertices.hh | 2 + milena/mln/util/internal/graph_nbh_iter.hh | 119 ++++----- milena/mln/util/internal/graph_nbh_iter_base.hh | 11 +- milena/tests/all_headers.cc | 68 +----- milena/tests/core/image/graph_image.cc | 16 +- milena/tests/core/image/line_graph_image.cc | 39 ++- milena/tests/unit_test/Makefile.am | 28 ++- milena/tests/unit_test/mln_all.cc | 8 + .../tests/unit_test/mln_canvas_distance_front.cc | 8 + .../mln_core_image_graph_elt_neighborhood.cc | 8 - .../mln_core_image_line_graph_elt_neighborhood.cc | 8 - .../mln_core_image_line_graph_elt_piter.cc | 8 + .../mln_core_internal_graph_neighborhood_base.cc | 8 - .../mln_core_internal_graph_relative_piter.cc | 8 - .../mln_core_internal_line_graph_vicinity_piter.cc | 8 - milena/tests/unit_test/mln_transform_distance.cc | 8 - .../unit_test/mln_transform_distance_front.cc | 8 + .../mln_transform_influence_zone_front.cc | 8 + .../tests/unit_test/mln_transform_internal_all.cc | 8 + .../mln_transform_internal_distance_functor.cc | 8 + ...ln_transform_internal_influence_zone_functor.cc | 8 + milena/tests/util/line_graph.cc | 3 - 43 files changed, 451 insertions(+), 1927 deletions(-) copy milena/{tests/all_headers.cc => mln/all.hh} (94%) delete mode 100644 milena/mln/core/image/graph_elt_neighborhood.hh delete mode 100644 milena/mln/core/image/graph_neighborhood_piter.hh delete mode 100644 milena/mln/core/image/line_graph_elt_neighborhood.hh delete mode 100644 milena/mln/core/image/line_graph_neighborhood_piter.hh delete mode 100644 milena/mln/core/image/line_graph_window_piter.hh delete mode 100644 milena/mln/core/internal/graph_neighborhood_base.hh delete mode 100644 milena/mln/core/internal/graph_relative_piter.hh delete mode 100644 milena/mln/core/internal/line_graph_vicinity_piter.hh create mode 100644 milena/tests/unit_test/mln_all.cc create mode 100644 milena/tests/unit_test/mln_canvas_distance_front.cc delete mode 100644 milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc delete mode 100644 milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc create mode 100644 milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc delete mode 100644 milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc delete mode 100644 milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc delete mode 100644 milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc delete mode 100644 milena/tests/unit_test/mln_transform_distance.cc create mode 100644 milena/tests/unit_test/mln_transform_distance_front.cc create mode 100644 milena/tests/unit_test/mln_transform_influence_zone_front.cc create mode 100644 milena/tests/unit_test/mln_transform_internal_all.cc create mode 100644 milena/tests/unit_test/mln_transform_internal_distance_functor.cc create mode 100644 milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc diff --git a/milena/ChangeLog b/milena/ChangeLog index 2105013..bf954d2 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,68 @@ +2008-12-04 Guillaume Lazzara <z@lrde.epita.fr> + + Revamp neighborhoods and windows based on graph. + + * tests/all_headers.cc, + * mln/all.hh: Add new 'all' header and update the related test. + + * mln/core/neighb.hh, + * mln/core/internal/site_relative_iterator_base.hh, + * mln/core/internal/neighborhood_base.hh, + * mln/core/alias/neighb2d.hh: Fix comments. + + * mln/core/internal/graph_neighborhood_base.hh, + * mln/core/image/line_graph_neighborhood_piter.hh, + * mln/core/image/line_graph_elt_neighborhood.hh, + * mln/core/image/graph_neighborhood_piter.hh, + * mln/core/image/graph_elt_neighborhood.hh: removed. Not needed + anymore. The neighborhood is deduced from the window. + + * mln/core/image/line_graph_window_piter.hh, + * mln/core/image/line_graph_elt_window.hh, + * mln/core/image/graph_window_piter.hh, + * mln/core/image/graph_elt_window.hh: revamp. Use the new graph + iterators correctly. + + * mln/core/internal/graph_psite_base.hh: add a new method element(). + + * mln/core/internal/line_graph_vicinity_piter.hh, + * mln/core/internal/graph_relative_piter.hh: removed. Not needed + anymore since graph and line graph share the same piter object. + + * mln/core/internal/graph_window_base.hh: revamp and cleanup. + + * mln/core/site_set/p_graph_piter.hh: add new methods such as graph(). + + * mln/core/site_set/p_edges.hh, + * mln/core/site_set/p_vertices.hh: add a new typedef for the function + type. + + * mln/util/internal/graph_nbh_iter.hh: add default constructor. + + * mln/util/internal/graph_nbh_iter_base.hh: fix invalidate_(). + + * tests/core/image/graph_image.cc, + * tests/core/image/line_graph_image.cc: fix tests. + + * tests/unit_test/Makefile.am, + * tests/unit_test/mln_all.cc, + * tests/unit_test/mln_canvas_distance_front.cc, + * tests/unit_test/mln_core_image_graph_elt_neighborhood.cc, + * tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc, + * tests/unit_test/mln_core_image_line_graph_elt_piter.cc, + * tests/unit_test/mln_core_internal_graph_neighborhood_base.cc, + * tests/unit_test/mln_core_internal_graph_relative_piter.cc, + * tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc, + * tests/unit_test/mln_transform_distance.cc, + * tests/unit_test/mln_transform_distance_front.cc, + * tests/unit_test/mln_transform_influence_zone_front.cc, + * tests/unit_test/mln_transform_internal_all.cc, + * tests/unit_test/mln_transform_internal_distance_functor.cc, + * tests/unit_test/mln_transform_internal_influence_zone_functor.cc: + Update unit tests. + + * tests/util/line_graph.cc: remove useless debug. + 2008-12-04 Thierry Geraud <thierry.geraud@lrde.epita.fr> Make tests compile without warnings. diff --git a/milena/tests/all_headers.cc b/milena/mln/all.hh similarity index 94% copy from milena/tests/all_headers.cc copy to milena/mln/all.hh index 34da33b..f095601 100644 --- a/milena/tests/all_headers.cc +++ b/milena/mln/all.hh @@ -1,5 +1,4 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// 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 @@ -26,9 +25,12 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file tests/all_headers.cc +#ifndef MLN_ALL_HH_ +# define MLN_ALL_HH_ + +/// \file mln/all.hh /// -/// Tests with all headers. (check norris tests) +/// File that includes all the headers. #include <mln/util/all.hh> #include <mln/fun/p2v/all.hh> @@ -98,7 +100,5 @@ #include <mln/essential/2d.hh> #include <mln/essential/3d.hh> -int main () -{ +#endif // ! MLN_ALL_HH_ -} diff --git a/milena/mln/core/alias/neighb2d.hh b/milena/mln/core/alias/neighb2d.hh index de5971f..6f78450 100644 --- a/milena/mln/core/alias/neighb2d.hh +++ b/milena/mln/core/alias/neighb2d.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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 @@ -28,13 +28,13 @@ #ifndef MLN_CORE_ALIAS_NEIGHB2D_HH # define MLN_CORE_ALIAS_NEIGHB2D_HH -/*! \file mln/core/alias/neighb2d.hh - * - * \brief Definition of the mln::neighb2d alias and of some classical - * 2D neighborhoods. - * - * \todo Add symmetry and non-centering tests in conversion. - */ +/// \file mln/core/alias/neighb2d.hh +/// +/// Definition of the mln::neighb2d alias and of some classical +/// 2D neighborhoods. +/// +/// \todo Add symmetry and non-centering tests in conversion. + # include <cmath> # include <mln/core/alias/window2d.hh> @@ -45,9 +45,9 @@ namespace mln { - /*! \brief Type alias for a neighborhood defined on the 2D square - * grid with integer coordinates. - */ + /// Type alias for a neighborhood defined on the 2D square + /// grid with integer coordinates. + /// typedef neighb<window2d> neighb2d; } @@ -56,47 +56,47 @@ namespace mln namespace mln { - /*! \brief 4-connectivity neighborhood on the 2D grid. - * - * - o - - * o x o - * - o - - * - * \return A neighb2d. - */ + /// 4-connectivity neighborhood on the 2D grid. + /// + /// - o - + /// o x o + /// - o - + /// + /// \return A neighb2d. + /// const neighb2d& c4(); - /*! \brief 8-connectivity neighborhood on the 2D grid. - * - * o o o - * o x o - * o o o - * - * \return A neighb2d. - */ + /// 8-connectivity neighborhood on the 2D grid. + /// + /// o o o + /// o x o + /// o o o + /// + /// \return A neighb2d. + /// const neighb2d& c8(); - /*! \brief Horizontal 2-connectivity neighborhood on the 2D grid. - * - * - - - - * o x o - * - - - - * - * \return A neighb2d. - */ + /// Horizontal 2-connectivity neighborhood on the 2D grid. + /// + /// - - - + /// o x o + /// - - - + /// + /// \return A neighb2d. + /// const neighb2d& c2_row(); - /*! \brief Vertical 2-connectivity neighborhood on the 2D grid. - * - * - o - - * - x - - * - o - - * - * \return A neighb2d. - */ + /// Vertical 2-connectivity neighborhood on the 2D grid. + /// + /// - o - + /// - x - + /// - o - + /// + /// \return A neighb2d. + /// const neighb2d& c2_col(); diff --git a/milena/mln/core/image/graph_elt_neighborhood.hh b/milena/mln/core/image/graph_elt_neighborhood.hh deleted file mode 100644 index 8ec022b..0000000 --- a/milena/mln/core/image/graph_elt_neighborhood.hh +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2007, 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH -# define MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH - -/// \file mln/core/image/graph_elt_neighborhood.hh -/// Definition of the elementary ``neighborhood'' on a graph. - -# include <set> - -# include <mln/core/concept/neighborhood.hh> -# include <mln/core/internal/graph_neighborhood_base.hh> -# include <mln/core/site_set/p_vertices_psite.hh> -# include <mln/core/image/graph_neighborhood_piter.hh> - -# include <mln/core/image/graph_elt_window.hh> - - -namespace mln -{ - // Fwd decls. - template <typename G, typename F, typename N> class graph_neighborhood_fwd_piter; - template <typename G, typename F, typename N> class graph_neighborhood_bkd_piter; - - - /// Elementary neighborhood on graph class. - template <typename G, typename F> - class graph_elt_neighborhood - : public graph_neighborhood_base<G, - F, - p_vertices_psite<G, F>, - graph_elt_neighborhood<G, F> > - { - typedef graph_elt_neighborhood<G, F> self_; - - public: - /// Associated types. - /// \{ - /// The type of psite corresponding to the neighborhood. - typedef p_vertices_psite<G, F> psite; - - /// Site_Iterator type to browse the psites of the - /// neighborhood w.r.t. the ordering of vertices. - typedef graph_neighborhood_fwd_piter<G, F, self_> fwd_niter; - - /// Site_Iterator type to browse the psites of the - /// neighborhood w.r.t. the reverse ordering of vertices. - typedef graph_neighborhood_bkd_piter<G, F, self_> bkd_niter; - - /// The default niter type. - typedef fwd_niter niter; - /// \} - - - /// Services for iterators. - /// \{ - /// Compute the set of sites for this neighborhood around \a piter. - template <typename Piter> - void compute_sites_(Site_Iterator<Piter>& piter) const; - /// \} - - protected: - typedef graph_neighborhood_base<G, F, psite, self_> super_; - typedef typename super_::sites_t sites_t; - }; - - -# ifndef MLN_INCLUDE_ONLY - - template <typename G, typename F> - template <typename Piter> - inline - void - graph_elt_neighborhood<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const - { - Piter& piter = exact(piter_); - unsigned central_vertex = piter.center().v().id(); - const G& g = piter.center().graph(); - - sites_t& sites = piter.sites(); - sites.clear(); - - // Adjacent vertices. - for (unsigned i = 0; i < g.v_nmax_nbh_vertices(central_vertex); ++i) - sites.insert(g.v_ith_nbh_vertex(central_vertex, i)); - } - -# endif // ! MLN_INCLUDE_ONLY - -} // end of namespace mln - - -#endif // ! MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH diff --git a/milena/mln/core/image/graph_elt_window.hh b/milena/mln/core/image/graph_elt_window.hh index f33b90a..b48d668 100644 --- a/milena/mln/core/image/graph_elt_window.hh +++ b/milena/mln/core/image/graph_elt_window.hh @@ -30,12 +30,14 @@ # define MLN_CORE_IMAGE_GRAPH_ELT_WINDOW_HH /// \file mln/core/image/graph_elt_window.hh +/// /// Definition of the elementary ``window'' on a graph. # include <mln/core/concept/window.hh> +# include <mln/core/internal/neighborhood_base.hh> # include <mln/core/internal/graph_window_base.hh> -# include <mln/core/site_set/p_vertices_psite.hh> # include <mln/core/image/graph_window_piter.hh> +# include <mln/core/site_set/p_vertices.hh> namespace mln @@ -44,10 +46,21 @@ namespace mln /// Forward declaration template <typename G, typename F> class graph_elt_window; + namespace internal + { + + template <typename G, typename F, typename E> + struct neighborhood_impl<graph_elt_window<G,F>,E> + : public neighborhood_extra_impl<graph_elt_window<G,F>,E> + { + }; + + } // end of namespace mln::internal + + namespace trait { - ///FIXME: check that! template <typename G, typename F> struct window_< mln::graph_elt_window<G, F> > { @@ -61,68 +74,36 @@ namespace mln /// \brief Elementary window on graph class. template <typename G, typename F> - class graph_elt_window : public graph_window_base< - G, - F, - p_vertices_psite<G, F>, - graph_elt_window<G, F> > + class graph_elt_window : public graph_window_base<mln_result(F), + graph_elt_window<G,F> > { typedef graph_elt_window<G, F> self_; + typedef mln_vertex_nbh_vertex_fwd_iter(G) nbh_fwd_iter_; + typedef mln_vertex_nbh_vertex_bkd_iter(G) nbh_bkd_iter_; + public: /// Associated types. /// \{ + typedef p_vertices<G,F> S; /// The type of psite corresponding to the window. - typedef p_vertices_psite<G, F> psite; + typedef mln_psite(S) psite; - /// \brief Site_Iterator type to browse the psites of the window + /// Site_Iterator type to browse the psites of the window /// w.r.t. the ordering of vertices. - typedef graph_window_fwd_piter<G, F, self_> fwd_qiter; + typedef graph_window_piter<S,self_,nbh_fwd_iter_> fwd_qiter; - /// \brief Site_Iterator type to browse the psites of the window + /// Site_Iterator type to browse the psites of the window /// w.r.t. the reverse ordering of vertices. - typedef graph_window_bkd_piter<G, F, self_> bkd_qiter; + typedef graph_window_piter<S,self_,nbh_bkd_iter_> bkd_qiter; /// The default qiter type. typedef fwd_qiter qiter; /// \} - /// Services for iterators. - /// \{ - /// Compute the set of sites for this window around \a piter. - template <typename Piter> - void compute_sites_(Site_Iterator<Piter>& piter) const; - /// \} - - protected: - typedef graph_window_base<G, F, psite, self_> super_; - typedef typename super_::sites_t sites_t; }; - -# ifndef MLN_INCLUDE_ONLY - - template <typename G, typename F> - template <typename Piter> - inline - void - graph_elt_window<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const - { - Piter& piter = exact(piter_); - const G& g = piter.center().graph(); - - unsigned central_vertex = piter.center().v().id(); - sites_t& sites = piter.sites(); - sites.clear(); - - sites.insert(central_vertex); - for (unsigned i = 0; i < g.v_nmax_nbh_vertices(central_vertex); ++i) - sites.insert(g.v_ith_nbh_vertex(central_vertex, i)); - } - -# endif // ! MLN_INCLUDE_ONLY - } // end of namespace mln diff --git a/milena/mln/core/image/graph_neighborhood_piter.hh b/milena/mln/core/image/graph_neighborhood_piter.hh deleted file mode 100644 index 5c8d1c8..0000000 --- a/milena/mln/core/image/graph_neighborhood_piter.hh +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (C) 2007, 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_IMAGE_GRAPH_NEIGHBORHOOD_PITER_HH -# define MLN_CORE_IMAGE_GRAPH_NEIGHBORHOOD_PITER_HH - -/// \file mln/core/image/graph_neighborhood_piter.hh -/// \brief Definition of a point iterator on a graph neighborhood. - -# include <mln/core/internal/graph_relative_piter.hh> - -namespace mln -{ - - /*----------------------------------------. - | graph_neighborhood_fwd_piter<G, F, N>. | - `----------------------------------------*/ - - /// \p G Graph type. - /// \p F function i2p used in the p_vertices<G, F>. - /// \p N Type of the neighborhood. - template <typename G, typename F, typename N> - class graph_neighborhood_fwd_piter : - public internal::graph_relative_piter< mln_result(F), N, - graph_neighborhood_fwd_piter<G, F, N> > - { - typedef graph_neighborhood_fwd_piter<G, F, N> self_; - typedef internal::graph_relative_piter<mln_result(F), N, self_> super_; - - public: - /// The Point_Site type. - typedef mln_psite(N) psite; - - public: - /// Construction. - /// \{ - graph_neighborhood_fwd_piter(); - template <typename Pref> - graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref); - /// \} - - /// Manipulation. - /// \{ - /// Test if the iterator is valid. - bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); - - /// Start an iteration. - void do_start_(); - /// Go to the next point. - void do_next_(); - - /// Compute the current psite. - psite compute_p_() const; - /// \} - - private: - /// An iterator on the set of adjacent edges. - typename super_::sites_t::const_iterator i_; - }; - - - /*----------------------------------------. - | graph_neighborhood_bkd_piter<G, F, N>. | - `----------------------------------------*/ - - template <typename G, typename F, typename N> - class graph_neighborhood_bkd_piter : - public internal::graph_relative_piter< mln_result(F), N, - graph_neighborhood_bkd_piter<G, F, N> > - { - typedef graph_neighborhood_bkd_piter<G, F, N> self_; - typedef internal::graph_relative_piter<mln_result(F), N, self_> super_; - - /// The Point_Site type. - typedef mln_psite(N) psite; - - public: - /// Construction. - /// \{ - graph_neighborhood_bkd_piter(); - template <typename Pref> - graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref); - /// \} - - /// Manipulation. - /// \{ - /// Test if the iterator is valid. - bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); - - /// Start an iteration. - void do_start_(); - /// Go to the next point. - void do_next_(); - - /// Compute the current psite. - psite compute_p_() const; - /// \} - - private: - /// An iterator on the set of adjacent edges. - typename super_::sites_t::const_reverse_iterator i_; - }; - - - -# ifndef MLN_INCLUDE_ONLY - - /*----------------------------------------. - | graph_neighborhood_fwd_piter<G, F, N>. | - `----------------------------------------*/ - - template <typename G, typename F, typename N> - inline - graph_neighborhood_fwd_piter<G, F, N>::graph_neighborhood_fwd_piter() - { - } - - template <typename G, typename F, typename N> - template <typename Pref> - inline - graph_neighborhood_fwd_piter<G, F, N>::graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref) - : super_(p_ref) - { - this->change_target(exact(nbh)); - } - - template <typename G, typename F, typename N> - inline - bool - graph_neighborhood_fwd_piter<G, F, N>::is_valid_() const - { - return i_ != this->sites_.end(); - } - - template <typename G, typename F, typename N> - inline - void - graph_neighborhood_fwd_piter<G, F, N>::invalidate_() - { - i_ = this->sites_.end(); - } - - template <typename G, typename F, typename N> - inline - void - graph_neighborhood_fwd_piter<G, F, N>::do_start_() - { - this->site_set().compute_sites_(*this); - i_ = this->sites_.begin(); - } - - template <typename G, typename F, typename N> - inline - void - graph_neighborhood_fwd_piter<G, F, N>::do_next_() - { - ++i_; - } - - template <typename G, typename F, typename N> - inline - mln_psite(N) - graph_neighborhood_fwd_piter<G, F, N>::compute_p_() const - { - return p_vertices_psite<G, F>(this->center().site_set(), *i_); - } - - - /*----------------------------------------. - | graph_neighborhood_bkd_piter<G, F, N>. | - `----------------------------------------*/ - - template <typename G, typename F, typename N> - inline - graph_neighborhood_bkd_piter<G, F, N>::graph_neighborhood_bkd_piter() - { - } - - template <typename G, typename F, typename N> - template <typename Pref> - inline - graph_neighborhood_bkd_piter<G, F, N>::graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref) - : super_(p_ref) - { - this->change_target(exact(nbh)); - } - - template <typename G, typename F, typename N> - inline - bool - graph_neighborhood_bkd_piter<G, F, N>::is_valid_() const - { - return i_ != this->sites_.rend(); - } - - template <typename G, typename F, typename N> - inline - void - graph_neighborhood_bkd_piter<G, F, N>::invalidate_() - { - i_ = this->sites_.rend(); - } - - template <typename G, typename F, typename N> - inline - void - graph_neighborhood_bkd_piter<G, F, N>::do_start_() - { - this->site_set().compute_sites_(*this); - i_ = this->sites_.rbegin(); - } - - template <typename G, typename F, typename N> - inline - void - graph_neighborhood_bkd_piter<G, F, N>::do_next_() - { - ++i_; - } - - template <typename G, typename F, typename N> - inline - mln_psite(N) - graph_neighborhood_bkd_piter<G, F, N>::compute_p_() const - { - return p_vertices_psite<G, F>(this->center().site_set(), *i_); - } - - -# endif // ! MLN_INCLUDE_ONLY - -} // end of namespace mln - -#endif // ! MLN_CORE_IMAGE_GRAPH_NEIGHBORHOOD_PITER_HH diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh index 33d9a9a..d95963f 100644 --- a/milena/mln/core/image/graph_window_piter.hh +++ b/milena/mln/core/image/graph_window_piter.hh @@ -30,81 +30,43 @@ # define MLN_CORE_IMAGE_GRAPH_WINDOW_PITER_HH /// \file mln/core/image/graph_window_piter.hh -/// \brief Definition of a point iterator on a graph window. +/// +/// Definition of a point iterator on a line_graph window. + + +# include <mln/core/internal/site_relative_iterator_base.hh> -# include <mln/core/internal/graph_relative_piter.hh> namespace mln { - /*----------------------------------. - | graph_window_fwd_piter<G, F, W>. | - `----------------------------------*/ - - /// \brief Forward iterator on graph window. - template <typename G, typename F, typename W> - class graph_window_fwd_piter : - public internal::graph_relative_piter< mln_result(F), W, graph_window_fwd_piter<G, F, W> > + /// Forward iterator on line graph window. + template <typename S, typename W, typename I> + class graph_window_piter + : public internal::site_relative_iterator_base< W, + graph_window_piter<S,W,I> > { - typedef graph_window_fwd_piter<G, F, W> self_; - typedef internal::graph_relative_piter<mln_result(F), W, self_> super_; - - public: - /// The Point_Site type. - typedef mln_psite(W) psite; + typedef graph_window_piter<S,W,I> self_; + typedef internal::site_relative_iterator_base<W,self_> super_; public: - /// Construction. - /// \{ - graph_window_fwd_piter(); - template <typename Pref> - graph_window_fwd_piter(const Window<W>& win, const Pref& p_ref); - /// \} - - /// Manipulation. + /// Associated types /// \{ - /// Test if the iterator is valid. - bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); + typedef mln_result(S::fun_t) P; + enum { dim = P::dim }; - /// Start an iteration. - void do_start_(); - /// Go to the next point. - void do_next_(); - - /// Compute the current psite. - psite compute_p_() const; + // FIXME: Dummy typedef. + typedef void dpoint; + // FIXME: Dummy value. + typedef void mesh; /// \} - private: - /// An iterator on the set of adjacent vertices. - typename super_::sites_t::const_iterator i_; - }; - - - /*----------------------------------. - | graph_window_bkd_piter<G, F, W>. | - `----------------------------------*/ - - /// \brief Backward iterator on graph window. - template <typename G, typename F, typename W> - class graph_window_bkd_piter : - public internal::graph_relative_piter< mln_result(F), W, graph_window_bkd_piter<G, F, W> > - { - typedef graph_window_bkd_piter<G, F, W> self_; - typedef internal::graph_relative_piter<mln_result(F), W, self_> super_; - - public: - /// The Point_Site type. - typedef mln_psite(W) psite; - - public: /// Construction. /// \{ - graph_window_bkd_piter(); + graph_window_piter(); template <typename Pref> - graph_window_bkd_piter(const Window<W>& win, const Pref& p_ref); + graph_window_piter(const Window<W>& win, + const Pref& p_ref); /// \} /// Manipulation. @@ -120,139 +82,72 @@ namespace mln void do_next_(); /// Compute the current psite. - psite compute_p_() const; + mln_psite(W) compute_p_() const; /// \} private: - /// An iterator on the set of adjacent vertices. - typename super_::sites_t::const_reverse_iterator i_; + I iter_; }; - # ifndef MLN_INCLUDE_ONLY - /*-------------------------------. - | graph_window_fwd_piter<G, F, W>. | - `-------------------------------*/ - - template <typename G, typename F, typename W> - inline - graph_window_fwd_piter<G, F, W>::graph_window_fwd_piter() - { - } - - template <typename G, typename F, typename W> - template <typename Pref> - inline - graph_window_fwd_piter<G, F, W>::graph_window_fwd_piter(const Window<W>& win, - const Pref& p_ref) - : super_(p_ref) - { - this->change_target(exact(win)); - } - - template <typename G, typename F, typename W> - inline - bool - graph_window_fwd_piter<G, F, W>::is_valid_() const - { - return i_ != this->sites_.end(); - } - - template <typename G, typename F, typename W> - inline - void - graph_window_fwd_piter<G, F, W>::invalidate_() - { - i_ = this->sites_.end(); - } - - template <typename G, typename F, typename W> - inline - void - graph_window_fwd_piter<G, F, W>::do_start_() - { - this->site_set().compute_sites_(*this); - i_ = this->sites_.begin(); - } - - template <typename G, typename F, typename W> - inline - void - graph_window_fwd_piter<G, F, W>::do_next_() - { - ++i_; - } - - template <typename G, typename F, typename W> - inline - mln_psite(W) - graph_window_fwd_piter<G, F, W>::compute_p_() const - { - return p_vertices_psite<G, F>(this->center().site_set(), *i_); - } - - - /*-------------------------------. - | graph_window_bkd_piter<G, F, W>. | - `-------------------------------*/ - template <typename G, typename F, typename W> + template <typename S, typename W, typename I> inline - graph_window_bkd_piter<G, F, W>::graph_window_bkd_piter() + graph_window_piter<S,W,I>::graph_window_piter() { } - template <typename G, typename F, typename W> + template <typename S, typename W, typename I> template <typename Pref> inline - graph_window_bkd_piter<G, F, W>::graph_window_bkd_piter(const Window<W>& win, - const Pref& p_ref) - : super_(p_ref) + graph_window_piter<S,W,I>::graph_window_piter(const Window<W>& win, + const Pref& p_ref) + : iter_(p_ref.hook_iter_()) { this->change_target(exact(win)); + center_at(p_ref); } - template <typename G, typename F, typename W> + template <typename S, typename W, typename I> inline bool - graph_window_bkd_piter<G, F, W>::is_valid_() const + graph_window_piter<S,W,I>::is_valid_() const { - return i_ != this->sites_.rend(); + return iter_.is_valid(); } - template <typename G, typename F, typename W> + template <typename S, typename W, typename I> inline void - graph_window_bkd_piter<G, F, W>::invalidate_() + graph_window_piter<S,W,I>::invalidate_() { - i_ = this->sites_.rend(); + iter_.invalidate(); } - template <typename G, typename F, typename W> + template <typename S, typename W, typename I> inline void - graph_window_bkd_piter<G, F, W>::do_start_() + graph_window_piter<S,W,I>::do_start_() { - this->site_set().compute_sites_(*this); - i_ = this->sites_.rbegin(); + iter_.start(); } - template <typename G, typename F, typename W> + template <typename S, typename W, typename I> inline void - graph_window_bkd_piter<G, F, W>::do_next_() + graph_window_piter<S,W,I>::do_next_() { - ++i_; + iter_.next(); } - template <typename G, typename F, typename W> + template <typename S, typename W, typename I> inline mln_psite(W) - graph_window_bkd_piter<G, F, W>::compute_p_() const + graph_window_piter<S,W,I>::compute_p_() const { - return p_vertices_psite<G, F>(this->center().site_set(), *i_); + return mln_psite(S)(this->center().site_set(), iter_.id()); } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/core/image/line_graph_elt_neighborhood.hh b/milena/mln/core/image/line_graph_elt_neighborhood.hh deleted file mode 100644 index 99dabe4..0000000 --- a/milena/mln/core/image/line_graph_elt_neighborhood.hh +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2007, 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_IMAGE_LINE_GRAPH_ELT_NEIGHBORHOOD_HH -# define MLN_CORE_IMAGE_LINE_GRAPH_ELT_NEIGHBORHOOD_HH - -/// \file mln/core/image/line_graph_elt_neighborhood.hh -/// -/// Definition of the elementary ``neighborhood'' on a line graph. - -# include <set> - -# include <mln/core/concept/neighborhood.hh> -# include <mln/core/internal/graph_neighborhood_base.hh> -# include <mln/core/site_set/p_edges_psite.hh> -# include <mln/core/image/line_graph_neighborhood_piter.hh> - -# include <mln/core/image/line_graph_elt_window.hh> - - -namespace mln -{ - - /// Elementary neighborhood on line graph class. - template <typename G, typename F> - class line_graph_elt_neighborhood - : public graph_neighborhood_base<G, - F, - p_edges_psite<G, F>, - line_graph_elt_neighborhood<G, F> > - { - typedef line_graph_elt_neighborhood<G, F> self_; - - public: - /// Associated types. - /// \{ - /// The type of psite corresponding to the neighborhood. - typedef p_edges_psite<G, F> psite; - - /// Site_Iterator type to browse the psites of the - /// neighborhood w.r.t. the ordering of edges. - typedef line_graph_neighborhood_fwd_piter<G, F, self_> fwd_niter; - - /// Site_Iterator type to browse the psites of the - /// neighborhood w.r.t. the reverse ordering of edges. - typedef line_graph_neighborhood_bkd_piter<G, F, self_> bkd_niter; - - /// The default niter type. - typedef fwd_niter niter; - /// \} - - /// Services for iterators. - /// \{ - /// Compute the set of sites for this neighborhood around \a piter. - template <typename Piter> - void compute_sites_(Site_Iterator<Piter>& piter) const; - /// \} - - protected: - typedef graph_neighborhood_base<G, F, psite, self_> super_; - typedef typename super_::sites_t sites_t; - }; - - - -# ifndef MLN_INCLUDE_ONLY - - template <typename G, typename F> - template <typename Piter> - inline - void - line_graph_elt_neighborhood<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const - { - Piter& piter = exact(piter_); - unsigned central_edge = piter.center().e().id(); - sites_t& sites = piter.sites(); - sites.clear(); - - const G& g = piter.center().site_set().graph(); - - for (unsigned i = 0; i < g.e_nmax_nbh_edges(central_edge); ++i) - { - unsigned n = g.e_ith_nbh_edge(central_edge, i); - if (n != central_edge) - sites.insert(g.e_ith_nbh_edge(central_edge, i)); - } - } - -# endif // ! MLN_INCLUDE_ONLY - -} // end of namespace mln - - -#endif // ! MLN_CORE_IMAGE_LINE_GRAPH_ELT_NEIGHBORHOOD_HH diff --git a/milena/mln/core/image/line_graph_elt_window.hh b/milena/mln/core/image/line_graph_elt_window.hh index fa88558..c1b910c 100644 --- a/milena/mln/core/image/line_graph_elt_window.hh +++ b/milena/mln/core/image/line_graph_elt_window.hh @@ -34,9 +34,10 @@ /// Definition of the elementary ``window'' on a line graph. # include <mln/core/concept/window.hh> +# include <mln/core/internal/neighborhood_base.hh> # include <mln/core/internal/graph_window_base.hh> -# include <mln/core/site_set/p_edges_psite.hh> -# include <mln/core/image/line_graph_window_piter.hh> +# include <mln/core/image/graph_window_piter.hh> +# include <mln/core/site_set/p_edges.hh> namespace mln @@ -45,10 +46,20 @@ namespace mln /// Forward declaration template <typename G, typename F> class line_graph_elt_window; + namespace internal + { + + template <typename G, typename F, typename E> + struct neighborhood_impl<line_graph_elt_window<G,F>,E> + : public neighborhood_extra_impl<line_graph_elt_window<G,F>,E> + { + }; + + } // end of namespace mln::internal + namespace trait { - ///FIXME: check that! template <typename G, typename F> struct window_< mln::line_graph_elt_window<G, F> > { @@ -60,69 +71,36 @@ namespace mln } // end of namespace mln::trait - /// \brief Elementary window on line graph class. + /// Elementary window on line graph class. template <typename G, typename F> - class line_graph_elt_window : public graph_window_base< - G, - F, - p_edges_psite<G, F>, - line_graph_elt_window<G, F> > + class line_graph_elt_window : public graph_window_base<mln_result(F), + line_graph_elt_window<G, F> > { typedef line_graph_elt_window<G, F> self_; + typedef mln_edge_nbh_edge_fwd_iter(G) nbh_fwd_iter_; + typedef mln_edge_nbh_edge_bkd_iter(G) nbh_bkd_iter_; public: /// Associated types. /// \{ - /// The type of psite corresponding to the window. - typedef p_edges_psite<G, F> psite; + typedef p_edges<G,F> S; + // The type of psite corresponding to the window. + typedef mln_psite(S) psite; /// Site_Iterator type to browse the psites of the window /// w.r.t. the ordering of edges. - typedef line_graph_window_fwd_piter<G, F, self_> fwd_qiter; + typedef graph_window_piter<S,self_,nbh_fwd_iter_> fwd_qiter; /// Site_Iterator type to browse the psites of the window /// w.r.t. the reverse ordering of edges. - typedef line_graph_window_bkd_piter<G, F, self_> bkd_qiter; + typedef graph_window_piter<S,self_,nbh_bkd_iter_> bkd_qiter; /// The default qiter type. typedef fwd_qiter qiter; - - - /// Services for iterators. - /// \{ - /// Compute the set of sites for this window around \a piter. - template <typename Piter> - void compute_sites_(Site_Iterator<Piter>& piter) const; /// \} - protected: - typedef graph_window_base<G, F, psite, self_> super_; - typedef typename super_::sites_t sites_t; }; - -# ifndef MLN_INCLUDE_ONLY - - template <typename G, typename F> - template <typename Piter> - inline - void - line_graph_elt_window<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const - { - Piter& piter = exact(piter_); - unsigned central_edge = piter.center().e().id(); - sites_t& sites = piter.sites(); - sites.clear(); - - const G& g = piter.center().site_set().graph(); - - sites.insert(central_edge); - for (unsigned i = 0; i < g.e_nmax_nbh_edges(central_edge); ++i) - sites.insert(g.e_ith_nbh_edge(central_edge, i)); - } - -# endif // ! MLN_INCLUDE_ONLY - } // end of namespace mln diff --git a/milena/mln/core/image/line_graph_neighborhood_piter.hh b/milena/mln/core/image/line_graph_neighborhood_piter.hh deleted file mode 100644 index 26a258b..0000000 --- a/milena/mln/core/image/line_graph_neighborhood_piter.hh +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (C) 2007, 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_IMAGE_LINE_GRAPH_NEIGHBORHOOD_PITER_HH -# define MLN_CORE_IMAGE_LINE_GRAPH_NEIGHBORHOOD_PITER_HH - -/// \file mln/core/image/line_graph_neighborhood_piter.hh -/// \brief Definition of a point iterator on a line graph neighborhood. - -# include <mln/core/internal/line_graph_vicinity_piter.hh> - -namespace mln -{ - - /*------------------------------------------. - | line_graph_neighborhood_fwd_piter<G, F, N>. | - `------------------------------------------*/ - - /// \brief Forward iterator on line graph neighborhood. - template <typename G, typename F, typename N> - class line_graph_neighborhood_fwd_piter : - public internal::line_graph_vicinity_piter_< mln_result(F), N, - line_graph_neighborhood_fwd_piter<G, F, N> > - { - typedef line_graph_neighborhood_fwd_piter<G, F, N> self_; - typedef internal::line_graph_vicinity_piter_<mln_result(F), N, self_> super_; - - public: - /// The Point_Site type. - typedef mln_psite(N) psite; - - public: - /// Construction. - /// \{ - line_graph_neighborhood_fwd_piter(); - template <typename Pref> - line_graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref); - /// \} - - /// Manipulation. - /// \{ - /// Test if the iterator is valid. - bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); - - /// Start an iteration. - void do_start_(); - /// Go to the next point. - void do_next_(); - - /// Compute the current psite. - psite compute_p_() const; - /// \} - - private: - /// An iterator on the set of adjacent edges. - typename super_::sites_t::const_iterator i_; - }; - - - /*------------------------------------------. - | line_graph_neighborhood_bkd_piter<G, F, N>. | - `------------------------------------------*/ - - /// \brief Backward iterator on line graph neighborhood. - template <typename G, typename F, typename N> - class line_graph_neighborhood_bkd_piter : - public internal::line_graph_vicinity_piter_< mln_result(F), N, - line_graph_neighborhood_bkd_piter<G, F, N> > - { - typedef line_graph_neighborhood_bkd_piter<G, F, N> self_; - typedef internal::line_graph_vicinity_piter_<mln_result(F), N, self_> super_; - - public: - /// The Point_Site type. - typedef mln_psite(N) psite; - - public: - /// Construction. - /// \{ - line_graph_neighborhood_bkd_piter(); - template <typename Pref> - line_graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref); - /// \} - - /// Manipulation. - /// \{ - /// Test if the iterator is valid. - bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); - - /// Start an iteration. - void do_start_(); - /// Go to the next point. - void do_next_(); - - /// Compute the current psite. - psite compute_p_() const; - /// \} - - private: - /// An iterator on the set of adjacent edges. - typename super_::sites_t::const_reverse_iterator i_; - }; - - - -# ifndef MLN_INCLUDE_ONLY - - /*------------------------------------------. - | line_graph_neighborhood_fwd_piter<G, F, N>. | - `------------------------------------------*/ - - template <typename G, typename F, typename N> - inline - line_graph_neighborhood_fwd_piter<G, F, N>::line_graph_neighborhood_fwd_piter() - { - } - - template <typename G, typename F, typename N> - template <typename Pref> - inline - line_graph_neighborhood_fwd_piter<G, F, N>::line_graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref) - : super_(p_ref) - { - this->change_target(exact(nbh)); - } - - template <typename G, typename F, typename N> - inline - bool - line_graph_neighborhood_fwd_piter<G, F, N>::is_valid_() const - { - return i_ != this->sites_.end(); - } - - template <typename G, typename F, typename N> - inline - void - line_graph_neighborhood_fwd_piter<G, F, N>::invalidate_() - { - i_ = this->sites_.end(); - } - - template <typename G, typename F, typename N> - inline - void - line_graph_neighborhood_fwd_piter<G, F, N>::do_start_() - { - this->site_set().compute_sites_(*this); - i_ = this->sites_.begin(); - } - - template <typename G, typename F, typename N> - inline - void - line_graph_neighborhood_fwd_piter<G, F, N>::do_next_() - { - ++i_; - } - - template <typename G, typename F, typename N> - inline - mln_psite(N) - line_graph_neighborhood_fwd_piter<G, F, N>::compute_p_() const - { - return p_edges_psite<G, F>(this->center().site_set(), *i_); - } - - - /*------------------------------------------. - | line_graph_neighborhood_bkd_piter<G, F, N>. | - `------------------------------------------*/ - - template <typename G, typename F, typename N> - inline - line_graph_neighborhood_bkd_piter<G, F, N>::line_graph_neighborhood_bkd_piter() - { - } - - template <typename G, typename F, typename N> - template <typename Pref> - inline - line_graph_neighborhood_bkd_piter<G, F, N>::line_graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh, - const Pref& p_ref) - : super_(p_ref) - { - this->change_target(exact(nbh)); - } - - template <typename G, typename F, typename N> - inline - bool - line_graph_neighborhood_bkd_piter<G, F, N>::is_valid_() const - { - return i_ != this->sites_.rend(); - } - - template <typename G, typename F, typename N> - inline - void - line_graph_neighborhood_bkd_piter<G, F, N>::invalidate_() - { - i_ = this->sites_.rend(); - } - - template <typename G, typename F, typename N> - inline - void - line_graph_neighborhood_bkd_piter<G, F, N>::do_start_() - { - this->site_set().compute_sites_(*this); - i_ = this->sites_.rbegin(); - } - - template <typename G, typename F, typename N> - inline - void - line_graph_neighborhood_bkd_piter<G, F, N>::do_next_() - { - ++i_; - } - - template <typename G, typename F, typename N> - inline - mln_psite(N) - line_graph_neighborhood_bkd_piter<G, F, N>::compute_p_() const - { - return p_edges_psite<G, F>(this->center().site_set(), *i_); - } - -# endif // ! MLN_INCLUDE_ONLY - -} // end of namespace mln - - -#endif // ! MLN_CORE_IMAGE_LINE_GRAPH_NEIGHBORHOOD_PITER_HH diff --git a/milena/mln/core/image/line_graph_window_piter.hh b/milena/mln/core/image/line_graph_window_piter.hh deleted file mode 100644 index 0ddc48f..0000000 --- a/milena/mln/core/image/line_graph_window_piter.hh +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (C) 2007, 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_IMAGE_LINE_GRAPH_WINDOW_PITER_HH -# define MLN_CORE_IMAGE_LINE_GRAPH_WINDOW_PITER_HH - -/// \file mln/core/image/line_graph_window_piter.hh -/// \brief Definition of a point iterator on a line_graph window. - -# include <mln/core/internal/line_graph_vicinity_piter.hh> - -namespace mln -{ - - /*------------------------------------. - | line_graph_window_fwd_piter<G, F, W>. | - `------------------------------------*/ - - /// \brief Forward iterator on line graph window. - template <typename G, typename F, typename W> - class line_graph_window_fwd_piter - : public internal::line_graph_vicinity_piter_<mln_result(F), W, - line_graph_window_fwd_piter<G, F, W> > - { - typedef line_graph_window_fwd_piter<G, F, W> self_; - typedef internal::line_graph_vicinity_piter_<mln_result(F), W, self_> super_; - - public: - /// The Point_Site type. - typedef mln_psite(W) psite; - - public: - /// Construction. - /// \{ - line_graph_window_fwd_piter(); - template <typename Pref> - line_graph_window_fwd_piter(const Window<W>& win, - const Pref& p_ref); - /// \} - - /// Manipulation. - /// \{ - /// Test if the iterator is valid. - bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); - - /// Start an iteration. - void do_start_(); - /// Go to the next point. - void do_next_(); - - /// Compute the current psite. - psite compute_p_() const; - /// \} - - private: - /// An iterator on the set of adjacent edges. - typename super_::sites_t::const_iterator i_; - }; - - - /*------------------------------------. - | line_graph_window_bkd_piter<G, F, W>. | - `------------------------------------*/ - - /// \brief Backward iterator on line graph window. - template <typename G, typename F, typename W> - class line_graph_window_bkd_piter - : public internal::line_graph_vicinity_piter_<mln_result(F), W, line_graph_window_bkd_piter<G, F, W> > - { - typedef line_graph_window_bkd_piter<G, F, W> self_; - typedef internal::line_graph_vicinity_piter_<mln_result(F), W, self_> super_; - - public: - /// The Point_Site type. - typedef mln_psite(W) psite; - - public: - /// Construction. - /// \{ - line_graph_window_bkd_piter(); - template <typename Pref> - line_graph_window_bkd_piter(const Window<W>& win, - const Pref& p_ref); - /// \} - - /// Manipulation. - /// \{ - /// Test if the iterator is valid. - bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); - - /// Start an iteration. - void do_start_(); - /// Go to the next point. - void do_next_(); - - /// Compute the current psite. - psite compute_p_() const; - /// \} - - private: - /// An iterator on the set of adjacent edges. - typename super_::sites_t::const_reverse_iterator i_; - }; - - - -# ifndef MLN_INCLUDE_ONLY - - /*------------------------------------. - | line_graph_window_fwd_piter<G, F, W>. | - `------------------------------------*/ - - template <typename G, typename F, typename W> - inline - line_graph_window_fwd_piter<G, F, W>::line_graph_window_fwd_piter() - { - } - - template <typename G, typename F, typename W> - template <typename Pref> - inline - line_graph_window_fwd_piter<G, F, W>::line_graph_window_fwd_piter(const Window<W>& win, - const Pref& p_ref) - : super_(p_ref) - { - this->change_target(exact(win)); - } - - template <typename G, typename F, typename W> - inline - bool - line_graph_window_fwd_piter<G, F, W>::is_valid_() const - { - return i_ != this->sites_.end(); - } - - template <typename G, typename F, typename W> - inline - void - line_graph_window_fwd_piter<G, F, W>::invalidate_() - { - i_ = this->sites_.end(); - } - - template <typename G, typename F, typename W> - inline - void - line_graph_window_fwd_piter<G, F, W>::do_start_() - { - this->site_set().compute_sites_(*this); - i_ = this->sites_.begin(); - } - - template <typename G, typename F, typename W> - inline - void - line_graph_window_fwd_piter<G, F, W>::do_next_() - { - ++i_; - } - - template <typename G, typename F, typename W> - inline - mln_psite(W) - line_graph_window_fwd_piter<G, F, W>::compute_p_() const - { - return p_edges_psite<G, F>(this->center().site_set(), *i_); - } - - - /*------------------------------------. - | line_graph_window_bkd_piter<G, F, W>. | - `------------------------------------*/ - - template <typename G, typename F, typename W> - inline - line_graph_window_bkd_piter<G, F, W>::line_graph_window_bkd_piter() - { - } - - template <typename G, typename F, typename W> - template <typename Pref> - inline - line_graph_window_bkd_piter<G, F, W>::line_graph_window_bkd_piter(const Window<W>& win, - const Pref& p_ref) - : super_(p_ref) - { - this->change_target(exact(win)); - } - - template <typename G, typename F, typename W> - inline - bool - line_graph_window_bkd_piter<G, F, W>::is_valid_() const - { - return i_ != this->sites_.rend(); - } - - template <typename G, typename F, typename W> - inline - void - line_graph_window_bkd_piter<G, F, W>::invalidate_() - { - i_ = this->sites_.rend(); - } - - template <typename G, typename F, typename W> - inline - void - line_graph_window_bkd_piter<G, F, W>::do_start_() - { - this->site_set().compute_sites_(*this); - i_ = this->sites_.rbegin(); - } - - template <typename G, typename F, typename W> - inline - void - line_graph_window_bkd_piter<G, F, W>::do_next_() - { - ++i_; - } - - template <typename G, typename F, typename W> - inline - mln_psite(W) - line_graph_window_bkd_piter<G, F, W>::compute_p_() const - { - return p_edges_psite<G, F>(this->center().site_set(), *i_); - } - -# endif // ! MLN_INCLUDE_ONLY - -} // end of namespace mln - -#endif // ! MLN_CORE_IMAGE_LINE_GRAPH_WINDOW_PITER_HH diff --git a/milena/mln/core/internal/graph_neighborhood_base.hh b/milena/mln/core/internal/graph_neighborhood_base.hh deleted file mode 100644 index 451e527..0000000 --- a/milena/mln/core/internal/graph_neighborhood_base.hh +++ /dev/null @@ -1,95 +0,0 @@ -// 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_INTERNAL_GRAPH_NEIGHBORHOOD_BASE_HH -# define MLN_CORE_INTERNAL_GRAPH_NEIGHBORHOOD_BASE_HH - -/// \file mln/internal/graph_neighborhood_base.hh -/// -/// FIXME: doc - -# include <set> -# include <mln/core/concept/neighborhood.hh> - -namespace mln -{ - - template <typename G, typename F, typename P, typename E> - class graph_neighborhood_base : public Neighborhood< E > - { - typedef graph_neighborhood_base<G, F, P, E> self_; - - public: - /// Associated types. - /// \{ - /// The type of site corresponding to the neighborhood. - typedef mln_site(P) site; - - // The type of the set of neighborhood sites (ids adjacent to the - // reference psite). - typedef std::set<unsigned> sites_t; - /// \} - - /// Conversions. - /// \{ - /// The window type corresponding to this neighborhood. - typedef E window; - /// Create a window corresponding to this neighborhood. - E win() const; - /// \} - - protected: - graph_neighborhood_base(); - }; - -} // end of namespace mln - -# ifndef MLN_INCLUDE_ONLY - -namespace mln -{ - - template <typename G, typename F, typename P, typename E> - inline - graph_neighborhood_base<G, F, P, E>::graph_neighborhood_base() - { - } - - template <typename G, typename F, typename P, typename E> - inline - E - graph_neighborhood_base<G, F, P, E>::win() const - { - return E(); - } - -} // end of namespace mln - -# endif // !MLN_INCLUDE_ONLY - -#endif // !MLN_CORE_INTERNAL_GRAPH_NEIGHBORHOOD_BASE_HH - diff --git a/milena/mln/core/internal/graph_psite_base.hh b/milena/mln/core/internal/graph_psite_base.hh index c42e145..2309862 100644 --- a/milena/mln/core/internal/graph_psite_base.hh +++ b/milena/mln/core/internal/graph_psite_base.hh @@ -93,6 +93,9 @@ namespace mln /// Conversion towards the graph element (vertex or edge). operator const typename S::graph_element&() const; + /// Explicit conversion towards the graph element (vertex or edge). + const typename S::graph_element& element() const; + protected: /// Constructors. @@ -257,6 +260,15 @@ namespace mln return elt_; } + template <typename S, typename E> + inline + const typename S::graph_element& + graph_psite_base<S,E>::element() const + { + mln_precondition(is_valid()); + return elt_; + } + /*--------------. | Comparisons. | diff --git a/milena/mln/core/internal/graph_relative_piter.hh b/milena/mln/core/internal/graph_relative_piter.hh deleted file mode 100644 index 5b09421..0000000 --- a/milena/mln/core/internal/graph_relative_piter.hh +++ /dev/null @@ -1,113 +0,0 @@ -// 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_INTERNAL_GRAPH_RELATIVE_PITER_HH -# define MLN_CORE_INTERNAL_GRAPH_RELATIVE_PITER_HH - -/// \file mln/core/internal/graph_relative_piter.hh -/// \brief Factored implementation for point iterators on a graph windows -/// and graph neighborhoods. - -# include <set> - -# include <mln/core/internal/site_relative_iterator_base.hh> - -/* FIXME: Factor those classes: - - - mln::internal::graph_relative_piter.hh - - mln::internal::line_graph_relative_piter.hh */ - -namespace mln -{ - - namespace internal - { - - /// \brief Base for iterator on a graph vicinity. - template <typename P, typename S, typename E> - class graph_relative_piter - : public internal::site_relative_iterator_base< S, E > - { - public: - enum { dim = P::dim }; - - // FIXME: Dummy typedef. - typedef void dpoint; - // FIXME: Dummy value. - typedef void mesh; - - // The type of the set of sites (adjacent vertex ids). - typedef std::set<unsigned> sites_t; - - public: - /// Return the set of sites (adjacent vertex ids). - sites_t& sites(); - - protected: - /// Construction. - /// \{ - graph_relative_piter(); - template <typename Pref> - graph_relative_piter(const Pref& p_ref); - /// \} - - protected: - /// The set of edge ids adjacent to the reference psite. - sites_t sites_; - }; - -# ifndef MLN_INCLUDE_ONLY - - template <typename P, typename S, typename E> - inline - graph_relative_piter<P, S, E>::graph_relative_piter() - { - } - - template <typename P, typename S, typename E> - template <typename Pref> - inline - graph_relative_piter<P, S, E>::graph_relative_piter(const Pref& p_ref) - { - center_at(p_ref); - } - - template <typename P, typename S, typename E> - inline - std::set<unsigned>& - graph_relative_piter<P, S, E>::sites() - { - return sites_; - } - -# endif // ! MLN_INCLUDE_ONLY - - } // end of namespace mln::internal - -} // end of namespace mln - -#endif // ! MLN_CORE_INTERNAL_GRAPH_RELATIVE_PITER_HH diff --git a/milena/mln/core/internal/graph_window_base.hh b/milena/mln/core/internal/graph_window_base.hh index 0ea95ec..115e680 100644 --- a/milena/mln/core/internal/graph_window_base.hh +++ b/milena/mln/core/internal/graph_window_base.hh @@ -28,7 +28,6 @@ #ifndef MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH # define MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH -# include <set> # include <mln/core/concept/window.hh> /// \file mln/internal/graph_window_base.hh @@ -38,10 +37,10 @@ namespace mln { - template <typename G, typename F, typename P, typename E> - class graph_window_base : public Window< E > + template <typename P, typename E> + class graph_window_base : public Window<E> { - typedef graph_window_base<G, F, P, E> self_; + typedef graph_window_base<P, E> self_; public: /// Associated types. @@ -49,10 +48,6 @@ namespace mln /// The type of site corresponding to the window. typedef mln_site(P) site; - // The type of the set of window sites (ids adjacent to the - // reference psite). - typedef std::set<unsigned> sites_t; - // FIXME: This is a dummy value. typedef void dpsite; /// \} @@ -87,63 +82,62 @@ namespace mln graph_window_base(); }; -} // end of namespace mln # ifndef MLN_INCLUDE_ONLY -namespace mln -{ - template <typename G, typename F, typename P, typename E> + + template <typename P, typename E> inline - graph_window_base<G, F, P, E>::graph_window_base() + graph_window_base<P,E>::graph_window_base() { } - template <typename G, typename F, typename P, typename E> + template <typename P, typename E> inline bool - graph_window_base<G, F, P, E>::is_empty() const + graph_window_base<P,E>::is_empty() const { return false; } - template <typename G, typename F, typename P, typename E> + template <typename P, typename E> inline bool - graph_window_base<G, F, P, E>::is_centered() const + graph_window_base<P,E>::is_centered() const { return false; } - template <typename G, typename F, typename P, typename E> + template <typename P, typename E> inline bool - graph_window_base<G, F, P, E>::is_symmetric() const + graph_window_base<P,E>::is_symmetric() const { return true; } - template <typename G, typename F, typename P, typename E> + template <typename P, typename E> inline unsigned - graph_window_base<G, F, P, E>::delta() const + graph_window_base<P,E>::delta() const { // Dummy value (see the interface of the method above). return 0; } - template <typename G, typename F, typename P, typename E> + template <typename P, typename E> inline - graph_window_base<G, F, P, E>& - graph_window_base<G, F, P, E>::sym() + graph_window_base<P,E>& + graph_window_base<P,E>::sym() { return *this; } -} // end of namespace mln # endif // !MLN_INCLUDE_ONLY +} // end of namespace mln + #endif // !MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH diff --git a/milena/mln/core/internal/line_graph_vicinity_piter.hh b/milena/mln/core/internal/line_graph_vicinity_piter.hh deleted file mode 100644 index 9ef41e6..0000000 --- a/milena/mln/core/internal/line_graph_vicinity_piter.hh +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (C) 2007, 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. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#ifndef MLN_CORE_INTERNAL_LINE_GRAPH_VICINITY_PITER_HH -# define MLN_CORE_INTERNAL_LINE_GRAPH_VICINITY_PITER_HH - -/// \file mln/core/internal/line_graph_vicinity_piter.hh -/// \brief Factored implementation for point iterators on a line graph windows -/// and line graph neighborhoods, called "vicinities". - -# include <set> - -# include <mln/core/internal/site_relative_iterator_base.hh> - -/* FIXME: Factor those classes: - - - mln::internal::graph_vicinity_piter.hh - - mln::internal::line_graph_vicinity_piter.hh */ - - -namespace mln -{ - - // FIXME: Consider renaming line_graph_vicinity_piter_ as - // line_graph_relative_piter_. - - - namespace internal - { - - /// \brief Base for iterator on a line graph vicinity. - template <typename P, typename S, typename E> - class line_graph_vicinity_piter_ - : public internal::site_relative_iterator_base< S, E > - { - public: - enum { dim = P::dim }; - - // FIXME: Dummy typedef. - typedef void dpoint; - // FIXME: Dummy typedef. - typedef void mesh; - - // The type of the set of vicinity sites (adjacent edge ids). - typedef std::set<unsigned> sites_t; - - public: - /// Return the set of sites (adjacent edge ids). - sites_t& sites(); - - protected: - /// Construction. - /// \{ - line_graph_vicinity_piter_(); - template <typename Pref> - line_graph_vicinity_piter_(const Pref& p_ref); - /// \} - - protected: - /// The set of edge ids adjacent to the reference psite. - sites_t sites_; - }; - - - /// Print an mln::line_graph_vicinity_piter_<P, S, E>. - template <typename P, typename S, typename E> - inline - std::ostream& - operator<<(std::ostream& ostr, - const line_graph_vicinity_piter_<P, S, E>& p); - - - -# ifndef MLN_INCLUDE_ONLY - - template <typename P, typename S, typename E> - inline - line_graph_vicinity_piter_<P, S, E>::line_graph_vicinity_piter_() - { - } - - template <typename P, typename S, typename E> - template <typename Pref> - inline - line_graph_vicinity_piter_<P, S, E>::line_graph_vicinity_piter_(const Pref& p_ref) - { - center_at(p_ref); - } - - template <typename P, typename S, typename E> - inline - std::set<unsigned>& - line_graph_vicinity_piter_<P, S, E>::sites() - { - return sites_; - } - - - template <typename P, typename S, typename E> - inline - std::ostream& - operator<<(std::ostream& ostr, const line_graph_vicinity_piter_<P, S, E>& p) - { - return ostr << p.unproxy_(); - } - -# endif // ! MLN_INCLUDE_ONLY - - } // end of namespace mln::internal - -} // end of namespace mln - -#endif // ! MLN_CORE_INTERNAL_LINE_GRAPH_VICINITY_PITER_HH diff --git a/milena/mln/core/internal/neighborhood_base.hh b/milena/mln/core/internal/neighborhood_base.hh index 13feebf..4879fc1 100644 --- a/milena/mln/core/internal/neighborhood_base.hh +++ b/milena/mln/core/internal/neighborhood_base.hh @@ -159,7 +159,7 @@ namespace mln neighborhood_impl<W,E>::size() const { mlc_is(mln_trait_window_size(W), - trait::window::size::fixed)::check(); + trait::window::size::fixed)::check(); return exact(this)->win().size(); } diff --git a/milena/mln/core/internal/site_relative_iterator_base.hh b/milena/mln/core/internal/site_relative_iterator_base.hh index 9b3a7d4..01e5f19 100644 --- a/milena/mln/core/internal/site_relative_iterator_base.hh +++ b/milena/mln/core/internal/site_relative_iterator_base.hh @@ -94,7 +94,7 @@ namespace mln /// Hook to the current location. const mln_psite(S)& p_hook_() const; - /// Change the site set targeted by this iterator. + /// Change the site set targeted by this iterator. void change_target(const S& s); /// Warning: this method is an advanced tool provided for very @@ -111,7 +111,7 @@ namespace mln const mln_psite(S)* c_; private: - + /// The psite designated by this iterator. mln_psite(S) p_; }; diff --git a/milena/mln/core/neighb.hh b/milena/mln/core/neighb.hh index ffc8699..d54b229 100644 --- a/milena/mln/core/neighb.hh +++ b/milena/mln/core/neighb.hh @@ -1,4 +1,5 @@ // Copyright (C) 2007, 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 @@ -178,7 +179,7 @@ protected: mln_bkd_qiter(W) i_; }; - + # ifndef MLN_INCLUDE_ONLY @@ -363,7 +364,7 @@ protected: { return i_.compute_p_(); } - + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln diff --git a/milena/mln/core/site_set/p_edges.hh b/milena/mln/core/site_set/p_edges.hh index a5ef4b1..b1d46f2 100644 --- a/milena/mln/core/site_set/p_edges.hh +++ b/milena/mln/core/site_set/p_edges.hh @@ -72,6 +72,9 @@ namespace mln /// Graph associated type. typedef G graph_t; + /// Function associated type. + typedef F fun_t; + /// Type of graph edge. typedef util::edge<G> edge; diff --git a/milena/mln/core/site_set/p_graph_piter.hh b/milena/mln/core/site_set/p_graph_piter.hh index 37c3ed3..543a817 100644 --- a/milena/mln/core/site_set/p_graph_piter.hh +++ b/milena/mln/core/site_set/p_graph_piter.hh @@ -82,6 +82,12 @@ namespace mln /// Return the underlying graph element. mln_q_subject(iter) element(); + /// Return the graph associated to the target S. + const typename S::graph_t& graph() const; + + /// Return the underlying iterator. + const iter& hook_iter_() const; + private: /// Update the psite corresponding to this iterator. @@ -162,7 +168,23 @@ namespace mln mln_q_subject(I) p_graph_piter<S,I>::element() { - return iter_.subj_(); + return this->subj_(); + } + + template <typename S, typename I> + inline + const typename S::graph_t& + p_graph_piter<S,I>::graph() const + { + return this->site_set().graph(); + } + + template <typename S, typename I> + inline + const I& + p_graph_piter<S,I>::hook_iter_() const + { + return iter_; } template <typename S, typename I> diff --git a/milena/mln/core/site_set/p_vertices.hh b/milena/mln/core/site_set/p_vertices.hh index 4fe0fa2..adbe55d 100644 --- a/milena/mln/core/site_set/p_vertices.hh +++ b/milena/mln/core/site_set/p_vertices.hh @@ -76,6 +76,8 @@ namespace mln /// Graph associated type. typedef G graph_t; + /// Function associated type. + typedef F fun_t; /// Type of graph vertex. typedef util::vertex<G> vertex; diff --git a/milena/mln/util/internal/graph_nbh_iter.hh b/milena/mln/util/internal/graph_nbh_iter.hh index 0780cab..d06a008 100644 --- a/milena/mln/util/internal/graph_nbh_iter.hh +++ b/milena/mln/util/internal/graph_nbh_iter.hh @@ -60,6 +60,7 @@ namespace mln public: /// Construction and assignment. /// \{ + vertex_nbh_vertex_fwd_iterator(); template <typename C> vertex_nbh_vertex_fwd_iterator(const C& c); /// \} @@ -69,8 +70,6 @@ namespace mln /// \{ /// Test if the iterator is valid. bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); /// \} /// Start an iteration. @@ -98,6 +97,7 @@ namespace mln public: /// Construction and assignment. /// \{ + vertex_nbh_vertex_bkd_iterator(); template <typename C> vertex_nbh_vertex_bkd_iterator(const C& c); /// \} @@ -107,8 +107,6 @@ namespace mln /// \{ /// Test if the iterator is valid. bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); /// \} /// Start an iteration. @@ -142,6 +140,7 @@ namespace mln public: /// Construction and assignment. /// \{ + vertex_nbh_edge_fwd_iterator(); template <typename C> vertex_nbh_edge_fwd_iterator(const C& c); /// \} @@ -151,8 +150,6 @@ namespace mln /// \{ /// Test if the iterator is valid. bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); /// \} /// Start an iteration. @@ -182,6 +179,7 @@ namespace mln public: /// Construction and assignment. /// \{ + vertex_nbh_edge_bkd_iterator(); template <typename C> vertex_nbh_edge_bkd_iterator(const C& c); /// \} @@ -191,8 +189,6 @@ namespace mln /// \{ /// Test if the iterator is valid. bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); /// \} /// Start an iteration. @@ -225,6 +221,7 @@ namespace mln public: /// Construction and assignment. /// \{ + edge_nbh_edge_fwd_iterator(); template <typename C> edge_nbh_edge_fwd_iterator(const C& c); /// \} @@ -234,8 +231,6 @@ namespace mln /// \{ /// Test if the iterator is valid. bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); /// \} /// Start an iteration. @@ -264,6 +259,7 @@ namespace mln public: /// Construction and assignment. /// \{ + edge_nbh_edge_bkd_iterator(); template <typename C> edge_nbh_edge_bkd_iterator(const C& c); /// \} @@ -273,8 +269,6 @@ namespace mln /// \{ /// Test if the iterator is valid. bool is_valid_() const; - /// Invalidate the iterator. - void invalidate_(); /// \} /// Start an iteration. @@ -294,6 +288,11 @@ namespace mln | vertex_nbh_vertex_fwd_iterator | \-------------------------------*/ + template <typename G> + inline + vertex_nbh_vertex_fwd_iterator<G>::vertex_nbh_vertex_fwd_iterator() + { + } template <typename G> template <typename C> @@ -308,15 +307,7 @@ namespace mln bool vertex_nbh_vertex_fwd_iterator<G>::is_valid_() const { - return this->i_ < this->c_->nmax_nbh_vertices(); - } - - template <typename G> - inline - void - vertex_nbh_vertex_fwd_iterator<G>::invalidate_() - { - this->i_ = this->p_.graph().v_nmax(); + return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_vertices(); } template <typename G> @@ -347,6 +338,11 @@ namespace mln | vertex_nbh_vertex_bkd_iterator | \-------------------------------*/ + template <typename G> + inline + vertex_nbh_vertex_bkd_iterator<G>::vertex_nbh_vertex_bkd_iterator() + { + } template <typename G> template <typename C> @@ -361,15 +357,7 @@ namespace mln bool vertex_nbh_vertex_bkd_iterator<G>::is_valid_() const { - return this->i_ < this->c_->nmax_nbh_vertices(); - } - - template <typename G> - inline - void - vertex_nbh_vertex_bkd_iterator<G>::invalidate_() - { - this->i_ = this->p_.graph().v_nmax(); + return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_vertices(); } template <typename G> @@ -402,27 +390,25 @@ namespace mln \-----------------------------*/ template <typename G> - template <typename C> inline - vertex_nbh_edge_fwd_iterator<G>::vertex_nbh_edge_fwd_iterator(const C& c) - : super_(c) + vertex_nbh_edge_fwd_iterator<G>::vertex_nbh_edge_fwd_iterator() { } template <typename G> + template <typename C> inline - bool - vertex_nbh_edge_fwd_iterator<G>::is_valid_() const + vertex_nbh_edge_fwd_iterator<G>::vertex_nbh_edge_fwd_iterator(const C& c) + : super_(c) { - return this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> inline - void - vertex_nbh_edge_fwd_iterator<G>::invalidate_() + bool + vertex_nbh_edge_fwd_iterator<G>::is_valid_() const { - this->i_ = this->p_.graph().e_nmax(); + return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> @@ -454,27 +440,25 @@ namespace mln \-----------------------------*/ template <typename G> - template <typename C> inline - vertex_nbh_edge_bkd_iterator<G>::vertex_nbh_edge_bkd_iterator(const C& c) - : super_(c) + vertex_nbh_edge_bkd_iterator<G>::vertex_nbh_edge_bkd_iterator() { } template <typename G> + template <typename C> inline - bool - vertex_nbh_edge_bkd_iterator<G>::is_valid_() const + vertex_nbh_edge_bkd_iterator<G>::vertex_nbh_edge_bkd_iterator(const C& c) + : super_(c) { - return this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> inline - void - vertex_nbh_edge_bkd_iterator<G>::invalidate_() + bool + vertex_nbh_edge_bkd_iterator<G>::is_valid_() const { - this->i_ = this->p_.graph().e_nmax(); + return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> @@ -508,27 +492,25 @@ namespace mln \-----------------------------*/ template <typename G> - template <typename C> inline - edge_nbh_edge_fwd_iterator<G>::edge_nbh_edge_fwd_iterator(const C& c) - : super_(c) + edge_nbh_edge_fwd_iterator<G>::edge_nbh_edge_fwd_iterator() { } template <typename G> + template <typename C> inline - bool - edge_nbh_edge_fwd_iterator<G>::is_valid_() const + edge_nbh_edge_fwd_iterator<G>::edge_nbh_edge_fwd_iterator(const C& c) + : super_(c) { - return this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> inline - void - edge_nbh_edge_fwd_iterator<G>::invalidate_() + bool + edge_nbh_edge_fwd_iterator<G>::is_valid_() const { - this->i_ = this->p_.graph().e_nmax(); + return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> @@ -552,9 +534,10 @@ namespace mln void edge_nbh_edge_fwd_iterator<G>::update_() { - // We shall encounter vertices which are part of the - // current edge. - // We do not want them to be part of the edge neighbors. + // We shall encounter the current edge in its neighborhood + // since it is computed thanks to the edge neighboors of its + // two vertices. + // We do not want the current edge to be part of its neighbors. unsigned e_id = this->c_->ith_nbh_edge(this->i_); while (e_id == this->c_->id()) { @@ -570,27 +553,25 @@ namespace mln \-----------------------------*/ template <typename G> - template <typename C> inline - edge_nbh_edge_bkd_iterator<G>::edge_nbh_edge_bkd_iterator(const C& c) - : super_(c) + edge_nbh_edge_bkd_iterator<G>::edge_nbh_edge_bkd_iterator() { } template <typename G> + template <typename C> inline - bool - edge_nbh_edge_bkd_iterator<G>::is_valid_() const + edge_nbh_edge_bkd_iterator<G>::edge_nbh_edge_bkd_iterator(const C& c) + : super_(c) { - return this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> inline - void - edge_nbh_edge_bkd_iterator<G>::invalidate_() + bool + edge_nbh_edge_bkd_iterator<G>::is_valid_() const { - this->i_ = this->p_.graph().e_nmax(); + return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges(); } template <typename G> diff --git a/milena/mln/util/internal/graph_nbh_iter_base.hh b/milena/mln/util/internal/graph_nbh_iter_base.hh index f6f02ea..11fbadd 100644 --- a/milena/mln/util/internal/graph_nbh_iter_base.hh +++ b/milena/mln/util/internal/graph_nbh_iter_base.hh @@ -75,6 +75,7 @@ namespace mln protected: /// Construction and assignment. /// \{ + nbh_iterator_base(); template <typename C2> nbh_iterator_base(const C2& c); /// \} @@ -90,6 +91,12 @@ namespace mln # ifndef MLN_INCLUDE_ONLY template <typename G, typename C, typename P, typename E> + inline + nbh_iterator_base<G, C, P, E>::nbh_iterator_base() + { + } + + template <typename G, typename C, typename P, typename E> template <typename C2> inline nbh_iterator_base<G, C, P, E>::nbh_iterator_base(const C2& c) @@ -112,7 +119,7 @@ namespace mln void nbh_iterator_base<G, C, P, E>::invalidate() { - exact(this)->invalidate_(); + i_ = mln_max(unsigned); } template <typename G, typename C, typename P, typename E> @@ -168,7 +175,7 @@ namespace mln nbh_iterator_base<G, C, P, E>::center_at(const C2& c) { internal::get_adr(c_, c); - mln_precondition(c_ != 0); + mln_postcondition(c_ != 0); invalidate(); } diff --git a/milena/tests/all_headers.cc b/milena/tests/all_headers.cc index 34da33b..7e7071e 100644 --- a/milena/tests/all_headers.cc +++ b/milena/tests/all_headers.cc @@ -30,73 +30,7 @@ /// /// Tests with all headers. (check norris tests) -#include <mln/util/all.hh> -#include <mln/fun/p2v/all.hh> -#include <mln/fun/x2x/all.hh> -#include <mln/fun/v2v/all.hh> -#include <mln/fun/i2v/all.hh> -#include <mln/fun/all.hh> -#include <mln/fun/x2v/all.hh> -#include <mln/fun/p2b/all.hh> -#include <mln/extension/all.hh> -#include <mln/histo/all.hh> -#include <mln/trait/op/all.hh> -#include <mln/trait/all.hh> -#include <mln/trait/value/all.hh> -#include <mln/win/all.hh> -#include <mln/core/routine/all.hh> -#include <mln/core/trait/all.hh> -#include <mln/core/def/all.hh> -#include <mln/core/internal/check/image_all.hh> -#include <mln/core/image/all.hh> -#include <mln/core/site_set/all.hh> -#include <mln/io/pbm/all.hh> -#include <mln/io/pfm/all.hh> -#include <mln/io/pgm/all.hh> -#include <mln/io/all.hh> -#include <mln/io/fits/all.hh> -#include <mln/io/pnm/all.hh> -#include <mln/io/ppm/all.hh> -#include <mln/make/all.hh> -#include <mln/canvas/morpho/all.hh> -#include <mln/canvas/all.hh> -#include <mln/canvas/browsing/all.hh> -#include <mln/estim/all.hh> -#include <mln/arith/all.hh> -#include <mln/display/all.hh> -#include <mln/test/all.hh> -#include <mln/border/all.hh> -#include <mln/trace/all.hh> -#include <mln/debug/all.hh> -#include <mln/morpho/elementary/all.hh> -#include <mln/morpho/all.hh> -#include <mln/accu/all.hh> -#include <mln/pw/all.hh> -#include <mln/linear/all.hh> -#include <mln/metal/all.hh> -#include <mln/metal/math/all.hh> -#include <mln/set/all.hh> -#include <mln/convert/impl/all.hh> -#include <mln/convert/all.hh> -#include <mln/geom/all.hh> -#include <mln/literal/all.hh> -#include <mln/level/approx/all.hh> -#include <mln/level/all.hh> -#include <mln/level/naive/all.hh> -#include <mln/math/all.hh> -#include <mln/norm/all.hh> -#include <mln/logical/all.hh> -#include <mln/draw/all.hh> -#include <mln/value/builtin/all.hh> -#include <mln/value/all.hh> -#include <mln/value/internal/all.hh> -#include <mln/value/concept/all.hh> -#include <mln/tag/all.hh> -#include <mln/labeling/all.hh> - -#include <mln/essential/1d.hh> -#include <mln/essential/2d.hh> -#include <mln/essential/3d.hh> +#include <mln/all.hh> int main () { diff --git a/milena/tests/core/image/graph_image.cc b/milena/tests/core/image/graph_image.cc index 3614807..5055387 100644 --- a/milena/tests/core/image/graph_image.cc +++ b/milena/tests/core/image/graph_image.cc @@ -26,7 +26,8 @@ // Public License. /// \file tests/core/image/graph_image.cc -/// \brief Tests on mln::graph_image. +/// +/// Tests on mln::graph_image. #include <vector> @@ -43,7 +44,6 @@ #include <mln/fun/ops.hh> #include <mln/value/ops.hh> #include <mln/core/image/graph_elt_window.hh> -#include <mln/core/image/graph_elt_neighborhood.hh> #include <mln/fun/i2v/array.hh> @@ -52,6 +52,7 @@ #include <mln/debug/draw_graph.hh> #include <mln/debug/println.hh> #include <mln/core/concept/function.hh> +#include <mln/core/neighb.hh> template <typename S> struct viota_t : public mln::Function_p2v< viota_t<S> > @@ -183,9 +184,11 @@ int main() for_all (p) mln_assertion(ima(p) == i++); + typedef graph_elt_window<util::graph, fsite_t> win_t; + typedef neighb<win_t> neigh_t; + { // Window - Forward iteration - typedef graph_elt_window<util::graph, fsite_t> win_t; win_t win; mln_qiter_(win_t) q(win, p); for_all (p) @@ -199,7 +202,6 @@ int main() { // Window - Backward iteration - typedef graph_elt_window<util::graph, fsite_t> win_t; win_t win; mln_bkd_qiter_(win_t) q(win, p); for_all (p) @@ -213,8 +215,7 @@ int main() { // Neighborhood - Forward iteration - typedef graph_elt_neighborhood<util::graph, fsite_t> neigh_t; - neigh_t neigh; + neigh_t neigh(win_t()); mln_niter_(neigh_t) n(neigh, p); for_all (p) { @@ -229,8 +230,7 @@ int main() { // Neighborhood - Backward iteration - typedef graph_elt_neighborhood<util::graph, fsite_t> neigh_t; - neigh_t neigh; + neigh_t neigh(win_t()); mln_bkd_niter_(neigh_t) n(neigh, p); for_all (p) { diff --git a/milena/tests/core/image/line_graph_image.cc b/milena/tests/core/image/line_graph_image.cc index 360623c..e40055a 100644 --- a/milena/tests/core/image/line_graph_image.cc +++ b/milena/tests/core/image/line_graph_image.cc @@ -26,7 +26,8 @@ // Public License. /// \file tests/core/image/graph_image.cc -/// \brief Tests on mln::graph_image. +/// +/// Tests on mln::graph_image. #include <vector> @@ -35,8 +36,8 @@ //#include <mln/core/image/line_graph_image.hh> #include <mln/core/image/line_graph_elt_window.hh> -#include <mln/core/image/line_graph_elt_neighborhood.hh> #include <mln/core/site_set/p_edges.hh> +#include <mln/core/neighb.hh> #include <mln/fun/i2v/array.hh> @@ -130,17 +131,30 @@ int main() | Iterators. | `------------*/ + mln_edge_iter_(util::graph) ei(g); + mln_edge_nbh_edge_iter_(util::graph) en(ei); + + for_all(ei) + { + std::cout << ei << std::endl; + for_all(en) + std::cout << en << std::endl; + std::cout << "-----" << std::endl; + } + // Manual iteration over the domain of IMA. mln_piter_(ima_t) p(ima.domain()); unsigned i = 10; for_all (p) mln_assertion(ima(p) == i++); + typedef line_graph_elt_window<util::graph, fsite_t> win_t; + typedef neighb<win_t> neigh_t; + { // Window - Forward iteration - typedef line_graph_elt_window<util::graph, fsite_t> win_t; win_t win; - mln_qiter_(win_t) q(win, p); + mln_fwd_qiter_(win_t) q(win, p); for_all (p) { std::cout << "neighbors of " << p << " (" << ima(p) << "), " @@ -148,11 +162,11 @@ int main() for_all (q) std::cout << " " << q << " (level = " << ima(q) << ")" << std::endl; } + std::cout << std::endl; } { // Window - Backward iteration - typedef line_graph_elt_window<util::graph, fsite_t> win_t; win_t win; mln_bkd_qiter_(win_t) q(win, p); for_all (p) @@ -162,37 +176,38 @@ int main() for_all (q) std::cout << " " << q << " (level = " << ima(q) << ")" << std::endl; } + std::cout << std::endl; } { // Neighborhood - Forward iteration - typedef line_graph_elt_neighborhood<util::graph, fsite_t> neigh_t; - neigh_t neigh; - mln_niter_(neigh_t) n(neigh, p); + neigh_t neigh(win_t()); + mln_fwd_niter_(neigh_t) n(neigh, p); for_all (p) { std::cout << "neighbors of " << p << " (" << ima(p) << "), " << std::endl; for_all (n) { - mln_assertion(n != p); std::cout << " " << n << " (level = " << ima(n) << ")" << std::endl; + mln_assertion(n != p); } } + std::cout << std::endl; } { // Neighborhood - Backward iteration - typedef line_graph_elt_neighborhood<util::graph, fsite_t> neigh_t; - neigh_t neigh; + neigh_t neigh(win_t()); mln_bkd_niter_(neigh_t) n(neigh, p); for_all (p) { std::cout << "neighbors of " << p << " (" << ima(p) << "), " << std::endl; for_all (n) { - mln_assertion(n != p); std::cout << " " << n << " (level = " << ima(n) << ")" << std::endl; + mln_assertion(n != p); } } + std::cout << std::endl; } std::cout << std::endl; diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am index 469cce2..ebd8c53 100644 --- a/milena/tests/unit_test/Makefile.am +++ b/milena/tests/unit_test/Makefile.am @@ -231,6 +231,7 @@ mln_fun_x2v_l1_norm\ mln_fun_x2v_nneighbor\ mln_fun_x2v_essential\ mln_fun_essential\ +mln_all\ mln_convert_to_p_set\ mln_convert_to\ mln_convert_to_upper_window\ @@ -473,6 +474,7 @@ mln_canvas_browsing_essential\ mln_canvas_chamfer\ mln_canvas_distance_geodesic\ mln_canvas_all\ +mln_canvas_distance_front\ mln_canvas_morpho_all\ mln_canvas_morpho_algebraic_union_find\ mln_canvas_morpho_essential\ @@ -711,14 +713,12 @@ mln_core_internal_force_exact\ mln_core_internal_image_base\ mln_core_internal_check_image_fastest\ mln_core_internal_check_image_all\ -mln_core_internal_line_graph_vicinity_piter\ mln_core_internal_fixme\ mln_core_internal_morpher_lvalue\ mln_core_internal_image_domain_morpher\ mln_core_internal_image_primary\ mln_core_internal_set_of\ mln_core_internal_complex_window_p_base\ -mln_core_internal_graph_relative_piter\ mln_core_internal_graph_window_base\ mln_core_internal_piter_adaptor\ mln_core_internal_weighted_window_base\ @@ -730,7 +730,6 @@ mln_core_internal_image_identity\ mln_core_internal_pseudo_site_base\ mln_core_internal_window_base\ mln_core_internal_box_impl\ -mln_core_internal_graph_neighborhood_base\ mln_core_internal_site_set_iterator_base\ mln_core_contract\ mln_core_all\ @@ -857,7 +856,6 @@ mln_core_image_lazy_image\ mln_core_image_t_image\ mln_core_image_hexa_piter\ mln_core_image_value_enc_image\ -mln_core_image_graph_elt_neighborhood\ mln_core_image_sub_image_if\ mln_core_image_all\ mln_core_image_mono_rle_image\ @@ -882,8 +880,8 @@ mln_core_image_image1d\ mln_core_image_extension_val\ mln_core_image_image_if\ mln_core_image_hexa\ -mln_core_image_line_graph_elt_neighborhood\ mln_core_image_extended\ +mln_core_image_line_graph_elt_piter\ mln_core_image_image2d_h\ mln_core_image_line_graph_neighborhood_piter\ mln_core_image_line_graph_window_piter\ @@ -915,9 +913,13 @@ mln_test_all\ mln_test_positive\ mln_test_essential\ mln_transform_distance_geodesic\ +mln_transform_internal_all\ +mln_transform_internal_distance_functor\ +mln_transform_internal_influence_zone_functor\ mln_transform_all\ +mln_transform_influence_zone_front\ +mln_transform_distance_front\ mln_transform_influence_zone_geodesic\ -mln_transform_distance\ mln_transform_essential\ mln_arith_includes\ mln_arith_plus\ @@ -1238,6 +1240,7 @@ mln_fun_x2v_l1_norm_SOURCES = mln_fun_x2v_l1_norm.cc mln_fun_x2v_nneighbor_SOURCES = mln_fun_x2v_nneighbor.cc mln_fun_x2v_essential_SOURCES = mln_fun_x2v_essential.cc mln_fun_essential_SOURCES = mln_fun_essential.cc +mln_all_SOURCES = mln_all.cc mln_convert_to_p_set_SOURCES = mln_convert_to_p_set.cc mln_convert_to_SOURCES = mln_convert_to.cc mln_convert_to_upper_window_SOURCES = mln_convert_to_upper_window.cc @@ -1480,6 +1483,7 @@ mln_canvas_browsing_essential_SOURCES = mln_canvas_browsing_essential.cc mln_canvas_chamfer_SOURCES = mln_canvas_chamfer.cc mln_canvas_distance_geodesic_SOURCES = mln_canvas_distance_geodesic.cc mln_canvas_all_SOURCES = mln_canvas_all.cc +mln_canvas_distance_front_SOURCES = mln_canvas_distance_front.cc mln_canvas_morpho_all_SOURCES = mln_canvas_morpho_all.cc mln_canvas_morpho_algebraic_union_find_SOURCES = mln_canvas_morpho_algebraic_union_find.cc mln_canvas_morpho_essential_SOURCES = mln_canvas_morpho_essential.cc @@ -1718,14 +1722,12 @@ mln_core_internal_force_exact_SOURCES = mln_core_internal_force_exact.cc mln_core_internal_image_base_SOURCES = mln_core_internal_image_base.cc mln_core_internal_check_image_fastest_SOURCES = mln_core_internal_check_image_fastest.cc mln_core_internal_check_image_all_SOURCES = mln_core_internal_check_image_all.cc -mln_core_internal_line_graph_vicinity_piter_SOURCES = mln_core_internal_line_graph_vicinity_piter.cc mln_core_internal_fixme_SOURCES = mln_core_internal_fixme.cc mln_core_internal_morpher_lvalue_SOURCES = mln_core_internal_morpher_lvalue.cc mln_core_internal_image_domain_morpher_SOURCES = mln_core_internal_image_domain_morpher.cc mln_core_internal_image_primary_SOURCES = mln_core_internal_image_primary.cc mln_core_internal_set_of_SOURCES = mln_core_internal_set_of.cc mln_core_internal_complex_window_p_base_SOURCES = mln_core_internal_complex_window_p_base.cc -mln_core_internal_graph_relative_piter_SOURCES = mln_core_internal_graph_relative_piter.cc mln_core_internal_graph_window_base_SOURCES = mln_core_internal_graph_window_base.cc mln_core_internal_piter_adaptor_SOURCES = mln_core_internal_piter_adaptor.cc mln_core_internal_weighted_window_base_SOURCES = mln_core_internal_weighted_window_base.cc @@ -1737,7 +1739,6 @@ mln_core_internal_image_identity_SOURCES = mln_core_internal_image_identity.cc mln_core_internal_pseudo_site_base_SOURCES = mln_core_internal_pseudo_site_base.cc mln_core_internal_window_base_SOURCES = mln_core_internal_window_base.cc mln_core_internal_box_impl_SOURCES = mln_core_internal_box_impl.cc -mln_core_internal_graph_neighborhood_base_SOURCES = mln_core_internal_graph_neighborhood_base.cc mln_core_internal_site_set_iterator_base_SOURCES = mln_core_internal_site_set_iterator_base.cc mln_core_contract_SOURCES = mln_core_contract.cc mln_core_all_SOURCES = mln_core_all.cc @@ -1864,7 +1865,6 @@ mln_core_image_lazy_image_SOURCES = mln_core_image_lazy_image.cc mln_core_image_t_image_SOURCES = mln_core_image_t_image.cc mln_core_image_hexa_piter_SOURCES = mln_core_image_hexa_piter.cc mln_core_image_value_enc_image_SOURCES = mln_core_image_value_enc_image.cc -mln_core_image_graph_elt_neighborhood_SOURCES = mln_core_image_graph_elt_neighborhood.cc mln_core_image_sub_image_if_SOURCES = mln_core_image_sub_image_if.cc mln_core_image_all_SOURCES = mln_core_image_all.cc mln_core_image_mono_rle_image_SOURCES = mln_core_image_mono_rle_image.cc @@ -1889,8 +1889,8 @@ mln_core_image_image1d_SOURCES = mln_core_image_image1d.cc mln_core_image_extension_val_SOURCES = mln_core_image_extension_val.cc mln_core_image_image_if_SOURCES = mln_core_image_image_if.cc mln_core_image_hexa_SOURCES = mln_core_image_hexa.cc -mln_core_image_line_graph_elt_neighborhood_SOURCES = mln_core_image_line_graph_elt_neighborhood.cc mln_core_image_extended_SOURCES = mln_core_image_extended.cc +mln_core_image_line_graph_elt_piter_SOURCES = mln_core_image_line_graph_elt_piter.cc mln_core_image_image2d_h_SOURCES = mln_core_image_image2d_h.cc mln_core_image_line_graph_neighborhood_piter_SOURCES = mln_core_image_line_graph_neighborhood_piter.cc mln_core_image_line_graph_window_piter_SOURCES = mln_core_image_line_graph_window_piter.cc @@ -1922,9 +1922,13 @@ mln_test_all_SOURCES = mln_test_all.cc mln_test_positive_SOURCES = mln_test_positive.cc mln_test_essential_SOURCES = mln_test_essential.cc mln_transform_distance_geodesic_SOURCES = mln_transform_distance_geodesic.cc +mln_transform_internal_all_SOURCES = mln_transform_internal_all.cc +mln_transform_internal_distance_functor_SOURCES = mln_transform_internal_distance_functor.cc +mln_transform_internal_influence_zone_functor_SOURCES = mln_transform_internal_influence_zone_functor.cc mln_transform_all_SOURCES = mln_transform_all.cc +mln_transform_influence_zone_front_SOURCES = mln_transform_influence_zone_front.cc +mln_transform_distance_front_SOURCES = mln_transform_distance_front.cc mln_transform_influence_zone_geodesic_SOURCES = mln_transform_influence_zone_geodesic.cc -mln_transform_distance_SOURCES = mln_transform_distance.cc mln_transform_essential_SOURCES = mln_transform_essential.cc mln_arith_includes_SOURCES = mln_arith_includes.cc mln_arith_plus_SOURCES = mln_arith_plus.cc diff --git a/milena/tests/unit_test/mln_all.cc b/milena/tests/unit_test/mln_all.cc new file mode 100644 index 0000000..f266315 --- /dev/null +++ b/milena/tests/unit_test/mln_all.cc @@ -0,0 +1,8 @@ +// Unit test for mln/all.hh. +// Generated file, do not modify. +#include <mln/all.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_canvas_distance_front.cc b/milena/tests/unit_test/mln_canvas_distance_front.cc new file mode 100644 index 0000000..cc59ee1 --- /dev/null +++ b/milena/tests/unit_test/mln_canvas_distance_front.cc @@ -0,0 +1,8 @@ +// Unit test for mln/canvas/distance_front.hh. +// Generated file, do not modify. +#include <mln/canvas/distance_front.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc b/milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc deleted file mode 100644 index caf3e89..0000000 --- a/milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc +++ /dev/null @@ -1,8 +0,0 @@ -// Unit test for mln/core/image/graph_elt_neighborhood.hh. -// Generated file, do not modify. -#include <mln/core/image/graph_elt_neighborhood.hh> - -int main() -{ - // Nothing. -} diff --git a/milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc b/milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc deleted file mode 100644 index 1a11c81..0000000 --- a/milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc +++ /dev/null @@ -1,8 +0,0 @@ -// Unit test for mln/core/image/line_graph_elt_neighborhood.hh. -// Generated file, do not modify. -#include <mln/core/image/line_graph_elt_neighborhood.hh> - -int main() -{ - // Nothing. -} diff --git a/milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc b/milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc new file mode 100644 index 0000000..7d83066 --- /dev/null +++ b/milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc @@ -0,0 +1,8 @@ +// Unit test for mln/core/image/line_graph_elt_piter.hh. +// Generated file, do not modify. +#include <mln/core/image/line_graph_elt_piter.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc b/milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc deleted file mode 100644 index 868f61a..0000000 --- a/milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc +++ /dev/null @@ -1,8 +0,0 @@ -// Unit test for mln/core/internal/graph_neighborhood_base.hh. -// Generated file, do not modify. -#include <mln/core/internal/graph_neighborhood_base.hh> - -int main() -{ - // Nothing. -} diff --git a/milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc b/milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc deleted file mode 100644 index 8237c21..0000000 --- a/milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc +++ /dev/null @@ -1,8 +0,0 @@ -// Unit test for mln/core/internal/graph_relative_piter.hh. -// Generated file, do not modify. -#include <mln/core/internal/graph_relative_piter.hh> - -int main() -{ - // Nothing. -} diff --git a/milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc b/milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc deleted file mode 100644 index 7f0afa8..0000000 --- a/milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc +++ /dev/null @@ -1,8 +0,0 @@ -// Unit test for mln/core/internal/line_graph_vicinity_piter.hh. -// Generated file, do not modify. -#include <mln/core/internal/line_graph_vicinity_piter.hh> - -int main() -{ - // Nothing. -} diff --git a/milena/tests/unit_test/mln_transform_distance.cc b/milena/tests/unit_test/mln_transform_distance.cc deleted file mode 100644 index 32bfcb4..0000000 --- a/milena/tests/unit_test/mln_transform_distance.cc +++ /dev/null @@ -1,8 +0,0 @@ -// Unit test for mln/transform/distance.hh. -// Generated file, do not modify. -#include <mln/transform/distance.hh> - -int main() -{ - // Nothing. -} diff --git a/milena/tests/unit_test/mln_transform_distance_front.cc b/milena/tests/unit_test/mln_transform_distance_front.cc new file mode 100644 index 0000000..b938d12 --- /dev/null +++ b/milena/tests/unit_test/mln_transform_distance_front.cc @@ -0,0 +1,8 @@ +// Unit test for mln/transform/distance_front.hh. +// Generated file, do not modify. +#include <mln/transform/distance_front.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_transform_influence_zone_front.cc b/milena/tests/unit_test/mln_transform_influence_zone_front.cc new file mode 100644 index 0000000..48bcfa3 --- /dev/null +++ b/milena/tests/unit_test/mln_transform_influence_zone_front.cc @@ -0,0 +1,8 @@ +// Unit test for mln/transform/influence_zone_front.hh. +// Generated file, do not modify. +#include <mln/transform/influence_zone_front.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_transform_internal_all.cc b/milena/tests/unit_test/mln_transform_internal_all.cc new file mode 100644 index 0000000..f4429cb --- /dev/null +++ b/milena/tests/unit_test/mln_transform_internal_all.cc @@ -0,0 +1,8 @@ +// Unit test for mln/transform/internal/all.hh. +// Generated file, do not modify. +#include <mln/transform/internal/all.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_transform_internal_distance_functor.cc b/milena/tests/unit_test/mln_transform_internal_distance_functor.cc new file mode 100644 index 0000000..e802447 --- /dev/null +++ b/milena/tests/unit_test/mln_transform_internal_distance_functor.cc @@ -0,0 +1,8 @@ +// Unit test for mln/transform/internal/distance_functor.hh. +// Generated file, do not modify. +#include <mln/transform/internal/distance_functor.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc b/milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc new file mode 100644 index 0000000..0a84c0b --- /dev/null +++ b/milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc @@ -0,0 +1,8 @@ +// Unit test for mln/transform/internal/influence_zone_functor.hh. +// Generated file, do not modify. +#include <mln/transform/internal/influence_zone_functor.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/util/line_graph.cc b/milena/tests/util/line_graph.cc index 655007c..1a65dee 100644 --- a/milena/tests/util/line_graph.cc +++ b/milena/tests/util/line_graph.cc @@ -111,9 +111,6 @@ int main() mln_assertion((v.nmax_nbh_edges() == 0 && i == 0) || i != v.nmax_nbh_edges()); } } - std::cout << g << std::endl; - std::cout << "----" << std::endl; - std::cout << lg << std::endl; { mln_edge_fwd_iter_(LG) e(lg); mln_edge_nbh_edge_fwd_iter_(LG) n(e); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara