Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
August 2009
- 6 participants
- 108 discussions
* mln/core/concept/graph.hh: Move is_valid() and invalidate()...
* mln/util/internal/graph_base.hh: ... here.
* mln/core/image/vertex_image.hh,
* mln/core/image/edge_image.hh: Add new typedefs for default
related windows and neighborhoods.
* mln/core/internal/site_relative_iterator_base.hh: Add a new
template parameter in order to define the type of the central
element.
* mln/core/neighb.hh,
* mln/core/internal/neighb_niter_impl.hh,
* mln/core/image/graph_elt_neighborhood.hh,
* mln/core/image/graph_elt_window.hh,
* mln/core/internal/window_base.hh: Update accordingly and add a
new typedef center_t.
* mln/core/image/graph_window_piter.hh: Handle the case where the
central element have a different type from the others.
* mln/core/internal/graph_psite_base.hh: Reindent and avoid a
warning.
* mln/util/internal/graph_nbh_iter.hh: Add new typedefs.
* tests/core/image/Makefile.am,
* tests/core/image/vertex_and_edge_image.cc: Add a new test.
---
milena/ChangeLog | 33 ++
milena/mln/core/concept/graph.hh | 30 +-
milena/mln/core/image/edge_image.hh | 13 +-
milena/mln/core/image/graph_elt_neighborhood.hh | 29 +-
milena/mln/core/image/graph_elt_window.hh | 79 ++-
milena/mln/core/image/graph_window_piter.hh | 128 ++++-
milena/mln/core/image/vertex_image.hh | 16 +-
milena/mln/core/internal/graph_psite_base.hh | 584 ++++++++++----------
milena/mln/core/internal/neighb_niter_impl.hh | 8 +-
.../core/internal/site_relative_iterator_base.hh | 59 +-
milena/mln/core/internal/window_base.hh | 6 +-
milena/mln/core/neighb.hh | 9 +-
milena/mln/util/internal/graph_base.hh | 27 +-
milena/mln/util/internal/graph_nbh_iter.hh | 112 +++--
milena/tests/core/image/Makefile.am | 11 +-
milena/tests/core/image/vertex_and_edge_image.cc | 166 ++++++
16 files changed, 858 insertions(+), 452 deletions(-)
create mode 100644 milena/tests/core/image/vertex_and_edge_image.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 6f01493..6d3f30a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,38 @@
2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Improve graph images.
+
+ * mln/core/concept/graph.hh: Move is_valid() and invalidate()...
+ * mln/util/internal/graph_base.hh: ... here.
+
+ * mln/core/image/vertex_image.hh,
+ * mln/core/image/edge_image.hh: Add new typedefs for default
+ related windows and neighborhoods.
+
+ * mln/core/internal/site_relative_iterator_base.hh: Add a new
+ template parameter in order to define the type of the central
+ element.
+
+ * mln/core/neighb.hh,
+ * mln/core/internal/neighb_niter_impl.hh,
+ * mln/core/image/graph_elt_neighborhood.hh,
+ * mln/core/image/graph_elt_window.hh,
+ * mln/core/internal/window_base.hh: Update accordingly and add a
+ new typedef center_t.
+
+ * mln/core/image/graph_window_piter.hh: Handle the case where the
+ central element have a different type from the others.
+
+ * mln/core/internal/graph_psite_base.hh: Reindent and avoid a
+ warning.
+
+ * mln/util/internal/graph_nbh_iter.hh: Add new typedefs.
+
+ * tests/core/image/Makefile.am,
+ * tests/core/image/vertex_and_edge_image.cc: Add a new test.
+
+2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Update documentation.
* doc/examples/accu-wrong-instanciation.cc.raw: Fix an incomplete
diff --git a/milena/mln/core/concept/graph.hh b/milena/mln/core/concept/graph.hh
index 97aee25..c351f9c 100644
--- a/milena/mln/core/concept/graph.hh
+++ b/milena/mln/core/concept/graph.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -72,12 +73,6 @@ namespace mln
template<typename G2>
bool is_subgraph_of(const G2& gr) const;
*/
- /// Return true if this graph is valid.
- /// FIXME: currently it always returns true.
- bool is_valid() const;
- /// Invalidate the graph.
- /// FIXME: does nothing!
- void invalidate();
/*
// Vertex and edges oriented.
util::vertex_id_t v_other(const util::edge_id_t& id_e, const util::vertex_id_t& id_v) const;
@@ -142,29 +137,16 @@ namespace mln
util::edge_id_t (E::*m13)(const util::edge_id_t& id_e, unsigned i) const = & E::e_ith_nbh_edge;
m13 = 0;
+ bool (E::*m14)() const = & E::is_valid;
+ m14 = 0;
+ void (E::*m15)() = & E::invalidate;
+ m15 = 0;
//FIXME: enable this test. Currently does not work because this is
// a templated method.
//bool (E::*m14)(...) = & E::is_subgraph_of;
//m14 = 0;
}
- template <typename E>
- inline
- bool
- Graph<E>::is_valid() const
- {
- //FIXME: should not always return true!
- return true;
- }
-
- template <typename E>
- inline
- void
- Graph<E>::invalidate()
- {
- //FIXME: No op! Should do something.
- }
-
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/core/image/edge_image.hh b/milena/mln/core/image/edge_image.hh
index 2cf9ed8..7da1690 100644
--- a/milena/mln/core/image/edge_image.hh
+++ b/milena/mln/core/image/edge_image.hh
@@ -147,10 +147,17 @@ namespace mln
site_function_t;
typedef mln_result(site_function_t) function_result_t;
- /// Window type
- typedef graph_elt_window<G,p_edges<G,site_function_t> > win_t;
+ /// Edge Window type
+ typedef graph_elt_window<G,p_edges<G,site_function_t> > edge_win_t;
/// Neighborhood type.
- typedef graph_elt_neighborhood<G,p_edges<G,site_function_t> > nbh_t;
+ typedef graph_elt_neighborhood<G,p_edges<G,site_function_t> > edge_nbh_t;
+
+ /// Default Window type
+ typedef edge_win_t win_t;
+
+ /// Default Neighborhood type
+ typedef edge_nbh_t nbh_t;
+
/// Constructors.
/// @{
diff --git a/milena/mln/core/image/graph_elt_neighborhood.hh b/milena/mln/core/image/graph_elt_neighborhood.hh
index a8ac79c..a1a739f 100644
--- a/milena/mln/core/image/graph_elt_neighborhood.hh
+++ b/milena/mln/core/image/graph_elt_neighborhood.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -38,23 +39,31 @@ namespace mln
{
/// Elementary neighborhood on graph class.
- template <typename G, typename S>
+ ///
+ /// \tparam G is a graph type.
+ /// \tparam S is a site set type.
+ /// \tparam S2 is the site set type of the neighbors.
+ //
+ template <typename G, typename S, typename S2 = S>
struct graph_elt_neighborhood
- : public neighb< graph_elt_window<G,S> >
+ : public neighb< graph_elt_window<G,S,S2> >
{
- typedef neighb< graph_elt_window<G,S> > super_;
+ typedef neighb< graph_elt_window<G,S,S2> > super_;
- graph_elt_neighborhood();
+ graph_elt_neighborhood();
};
+
# ifndef MLN_INCLUDE_ONLY
-template <typename G, typename S>
-inline
-graph_elt_neighborhood<G,S>::graph_elt_neighborhood()
-{
-}
+
+ template <typename G, typename S, typename S2>
+ inline
+ graph_elt_neighborhood<G,S,S2>::graph_elt_neighborhood()
+ {
+ }
+
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/core/image/graph_elt_window.hh b/milena/mln/core/image/graph_elt_window.hh
index 0d730e2..867a7bd 100644
--- a/milena/mln/core/image/graph_elt_window.hh
+++ b/milena/mln/core/image/graph_elt_window.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -40,38 +41,63 @@ namespace mln
{
/// Forward declaration
- template <typename G, typename S> class graph_elt_window;
+ template <typename G, typename S, typename S2> class graph_elt_window;
template <typename G, typename F> struct p_edges;
template <typename G, typename F> struct p_vertices;
+ namespace util
+ {
+ template <typename G> class edge;
+ template <typename G> class vertex;
+ };
namespace internal
{
- template <typename G, typename S, typename E>
- struct neighborhood_impl<graph_elt_window<G,S>,E>
- : public neighborhood_extra_impl<graph_elt_window<G,S>,E>
+ template <typename G, typename S, typename S2, typename E>
+ struct neighborhood_impl<graph_elt_window<G,S,S2>,E>
+ : public neighborhood_extra_impl<graph_elt_window<G,S,S2>,E>
{
};
/// Default
/// The given site set parameter is not supported yet!
- template <typename G, typename S>
+ ///
+ /// \p G is the graph type.
+ /// \p S is an image site set from where the center is extracted.
+ /// \p S2 is an image site set from where the neighbors are
+ /// extracted.
+ //
+ template <typename G, typename S, typename S2>
struct graph_window_iter_dispatch;
template <typename G, typename F>
- struct graph_window_iter_dispatch<G, p_edges<G,F> >
+ struct graph_window_iter_dispatch<G, p_edges<G,F>, p_edges<G,F> >
{
- typedef mln_edge_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
- typedef mln_edge_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
+ typedef mln_edge_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
+ typedef mln_edge_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
+
+ typedef p_edges<G,F> target;
};
template <typename G, typename F>
- struct graph_window_iter_dispatch<G, p_vertices<G,F> >
+ struct graph_window_iter_dispatch<G, p_vertices<G,F>, p_vertices<G,F> >
{
- typedef mln_vertex_nbh_vertex_fwd_iter(G) nbh_fwd_iter_;
- typedef mln_vertex_nbh_vertex_bkd_iter(G) nbh_bkd_iter_;
+ typedef mln_vertex_nbh_vertex_fwd_iter(G) nbh_fwd_iter_;
+ typedef mln_vertex_nbh_vertex_bkd_iter(G) nbh_bkd_iter_;
+
+ typedef p_vertices<G,F> target;
+ };
+
+
+ template <typename G, typename F, typename F2>
+ struct graph_window_iter_dispatch<G, p_vertices<G,F>, p_edges<G,F2> >
+ {
+ typedef mln_vertex_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
+ typedef mln_vertex_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
+
+ typedef p_edges<G,F2> target;
};
@@ -81,8 +107,8 @@ namespace mln
namespace trait
{
- template <typename G, typename S>
- struct window_< mln::graph_elt_window<G,S> >
+ template <typename G, typename S, typename S2>
+ struct window_< mln::graph_elt_window<G,S,S2> >
{
typedef trait::window::size::unknown size;
typedef trait::window::support::irregular support;
@@ -94,15 +120,18 @@ namespace mln
/// Elementary window on graph class.
/// \p G is the graph type.
- /// \p S is the image site set.
- template <typename G, typename S>
+ /// \p S is an image site set from where the center is extracted.
+ /// \p S2 is an image site set from where the neighbors are
+ /// extracted.
+ //
+ template <typename G, typename S, typename S2 = S>
class graph_elt_window
- : public graph_window_base<mln_result(S::fun_t),
- graph_elt_window<G,S> >,
- public internal::graph_window_iter_dispatch<G,S>
+ : public graph_window_base<mln_result(S2::fun_t),
+ graph_elt_window<G,S,S2> >,
+ public internal::graph_window_iter_dispatch<G,S,S2>
{
- typedef graph_elt_window<G,S> self_;
- typedef internal::graph_window_iter_dispatch<G,S> super_;
+ typedef graph_elt_window<G,S,S2> self_;
+ typedef internal::graph_window_iter_dispatch<G,S,S2> super_;
typedef typename super_::nbh_fwd_iter_ nbh_fwd_iter_;
typedef typename super_::nbh_bkd_iter_ nbh_bkd_iter_;
@@ -110,10 +139,16 @@ namespace mln
public:
/// Associated types.
/// \{
- typedef S target;
+ typedef typename super_::target target;
/// The type of psite corresponding to the window.
typedef mln_psite(target) psite;
+ /// Type of the window center element.
+ typedef mln_psite(S) center_t;
+
+ /// Type of the graph element pointed by this iterator.
+ typedef mln_graph_element(target) graph_element;
+
/// Site_Iterator type to browse the psites of the window
/// w.r.t. the ordering of vertices.
typedef graph_window_piter<target,self_,nbh_fwd_iter_> fwd_qiter;
diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh
index 4a62572..7812767 100644
--- a/milena/mln/core/image/graph_window_piter.hh
+++ b/milena/mln/core/image/graph_window_piter.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -28,8 +29,10 @@
/// \file
///
-/// Definition of a point iterator on a line_graph window.
+/// Definition of a graph element iterator on a graph window.
+# include <mln/core/concept/site_set.hh>
+# include <mln/core/concept/window.hh>
# include <mln/core/internal/site_relative_iterator_base.hh>
@@ -40,25 +43,63 @@ namespace mln
template <typename S, typename I> class p_graph_piter;
/// Forward iterator on line graph window.
+ ///
+ /// \tparam S is the site set type.
+ /// \tparam W is the window type.
+ /// \tparam I is the underlying iterator type.
+ //
template <typename S, typename W, typename I>
class graph_window_piter
: public internal::site_relative_iterator_base< W,
- graph_window_piter<S,W,I> >
+ graph_window_piter<S,W,I>,
+ typename W::center_t >
{
typedef graph_window_piter<S,W,I> self_;
- typedef internal::site_relative_iterator_base<W,self_> super_;
+ typedef
+ internal::site_relative_iterator_base<W,self_,mln_psite(S)> super_;
public:
/// Associated types
/// \{
+ /// Type of the window elements.
typedef mln_result(S::fun_t) P;
+ /// Type of the window center.
+ typedef typename W::center_t center_t;
+ /// Type of the graph element pointed by this iterator.
+ typedef typename W::graph_element graph_element;
/// \}
/// Construction.
/// \{
graph_window_piter();
+
+
+ // ---------------------------------------------------------
+ // FIXME: probably ugly to provide constructors usable for
+ // specific cases only...
+ // ---------------------------------------------------------
+
+ /// To be used in case the center and neighbor sites have the same
+ /// type and belong to the same site set.
+ ///
+ /// \param win The underlying window.
+ /// \param p_ref Window center.
+ //
+ template <typename Pref>
+ graph_window_piter(const Window<W>& win,
+ const Pref& p_ref);
+
+ /// To be used in case center and neighbors sites do not have the
+ /// same type and do not belong to the same site set.
+ ///
+ /// \param win The underlying window.
+ /// \param target_site_set Site set in which neighbor sites are
+ /// extracted.
+ /// \param p_ref Window center.
+ //
template <typename Pref>
graph_window_piter(const Window<W>& win,
+ const Site_Set<S>& target_site_set,
const Pref& p_ref);
/// \}
@@ -79,11 +120,11 @@ namespace mln
void center_at_(const Pref& c);
/// Do some work while setting the reference site.
- template <typename I2>
- void center_at_(const p_graph_piter<S, I2>& c);
+ template <typename S2, typename I2>
+ void center_at_(const p_graph_piter<S2, I2>& c);
/// Return the graph element pointed by this iterator.
- const mln_graph_element(S)& element() const;
+ const graph_element& element() const;
/// Compute the current psite.
mln_psite(W) compute_p_() const;
@@ -95,8 +136,12 @@ namespace mln
unsigned id() const;
/// \}
+ void change_target_site_set(const S& s);
+ const S& target_site_set() const;
+
private:
I iter_;
+ const S* s_;
};
@@ -106,26 +151,56 @@ namespace mln
template <typename S, typename W, typename I>
inline
graph_window_piter<S,W,I>::graph_window_piter()
+ : s_(0)
{
}
+
template <typename S, typename W, typename I>
template <typename Pref>
inline
graph_window_piter<S,W,I>::graph_window_piter(const Window<W>& win,
const Pref& p_ref)
+ : s_(0)
{
+ // Center and neighbor sites have the same type and belong to
+ // the same site set.
+ mlc_is(center_t, mln_psite(W))::check();
+
this->center_at(p_ref);
this->change_target(exact(win));
+ change_target_site_set(this->center().site_set());
+
mln_postcondition(!this->is_valid());
}
+
+ template <typename S, typename W, typename I>
+ template <typename Pref>
+ inline
+ graph_window_piter<S,W,I>::graph_window_piter(const Window<W>& win,
+ const Site_Set<S>& target_site_set,
+ const Pref& p_ref)
+ : s_(0)
+ {
+ // Center and neighbors sites do not have the same type and do
+ // not belong to the same site set.
+ mlc_is_not(center_t, mln_psite(W))::check();
+
+ this->center_at(p_ref);
+ this->change_target(exact(win));
+ change_target_site_set(exact(target_site_set));
+
+ mln_postcondition(!this->is_valid());
+ }
+
+
template <typename S, typename W, typename I>
inline
bool
graph_window_piter<S,W,I>::is_valid_() const
{
- return iter_.is_valid();
+ return s_ != 0 && s_->is_valid() && iter_.is_valid();
}
template <typename S, typename W, typename I>
@@ -159,15 +234,17 @@ namespace mln
graph_window_piter<S, W, I>::center_at_(const Pref& c)
{
iter_.center_at(c.p_hook_());
+ //FIXME: should we update target site set?
}
template <typename S, typename W, typename I>
- template <typename I2>
+ template <typename S2, typename I2>
inline
void
- graph_window_piter<S, W, I>::center_at_(const p_graph_piter<S, I2>& c)
+ graph_window_piter<S, W, I>::center_at_(const p_graph_piter<S2, I2>& c)
{
iter_.center_at(c.hook_elt_());
+ //FIXME: should we update target site set?
}
template <typename S, typename W, typename I>
@@ -175,24 +252,17 @@ namespace mln
mln_psite(W)
graph_window_piter<S,W,I>::compute_p_() const
{
- return mln_psite(S)(this->center().site_set(), iter_.id());
+ return mln_psite(S)(target_site_set(), iter_.id());
}
template <typename S, typename W, typename I>
inline
- const mln_graph_element(S)&
+ const typename graph_window_piter<S,W,I>::graph_element&
graph_window_piter<S, W, I>::element() const
{
return iter_;
}
-// template <typename S, typename W, typename I>
-// inline
-// graph_window_piter<S, W, I>::operator unsigned() const
-// {
-// return iter_.id();
-// }
-//
template <typename S, typename W, typename I>
inline
unsigned
@@ -201,6 +271,26 @@ namespace mln
return iter_.id();
}
+ template <typename S, typename W, typename I>
+ inline
+ void
+ graph_window_piter<S, W, I>::change_target_site_set(const S& s)
+ {
+ s_ = & s;
+ mln_assertion(s_ != 0);
+ }
+
+ template <typename S, typename W, typename I>
+ inline
+ const S&
+ graph_window_piter<S, W, I>::target_site_set() const
+ {
+ mln_precondition(s_ != 0);
+ mln_precondition(s_->is_valid());
+ return *s_;
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
diff --git a/milena/mln/core/image/vertex_image.hh b/milena/mln/core/image/vertex_image.hh
index d60debc..fd7d2eb 100644
--- a/milena/mln/core/image/vertex_image.hh
+++ b/milena/mln/core/image/vertex_image.hh
@@ -141,7 +141,7 @@ namespace mln
/// Function mapping graph elements to sites.
typedef typename internal::vfsite_selector<P,G>::site_function_t
- site_function_t;
+ site_function_t;
typedef mln_result(site_function_t) function_result_t;
@@ -150,10 +150,20 @@ namespace mln
tag::value_<V>,
tag::graph_<G> > skeleton;
+ typedef p_vertices<G,site_function_t> S;
+
+ /// Vertex Window type
+ typedef graph_elt_window<G,S> vertex_win_t;
+
+ /// Vertex Neighborhood type.
+ typedef graph_elt_neighborhood<G,S> vertex_nbh_t;
+
/// Window type
- typedef graph_elt_window<G,p_vertices<G,site_function_t> > win_t;
+ typedef vertex_win_t win_t;
/// Neighborhood type.
- typedef graph_elt_neighborhood<G,p_vertices<G,site_function_t> > nbh_t;
+ typedef vertex_nbh_t nbh_t;
+
+
/// Constructors.
/// @{
diff --git a/milena/mln/core/internal/graph_psite_base.hh b/milena/mln/core/internal/graph_psite_base.hh
index 2133281..cb3b123 100644
--- a/milena/mln/core/internal/graph_psite_base.hh
+++ b/milena/mln/core/internal/graph_psite_base.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -124,103 +125,104 @@ namespace mln
};
- /* FIXME: Shouldn't those comparisons be part of a much general
- mechanism? */
-
- /// Comparison of two mln::graph_psite_base<S,E> instances.
- /// \{
- /// \brief Is \a lhs equal to \a rhs?
- ///
- /// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::p_vertices.
- template <typename S, typename E>
- bool
- operator==(const graph_psite_base<S,E>& lhs, const graph_psite_base<S,E>& rhs);
-
- /// \brief Is \a lhs not equal to \a rhs?
- ///
- /// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::p_vertices.
- template <typename S, typename E>
- bool
- operator!=(const graph_psite_base<S,E>& lhs, const graph_psite_base<S,E>& rhs);
-
- /// \brief Is \a lhs ``less'' than \a rhs?
- ///
- /// This comparison is required by algorithms sorting psites.
- ///
- /// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::p_vertices.
- template <typename S, typename E>
- bool
- operator< (const graph_psite_base<S,E>& lhs, const graph_psite_base<S,E>& rhs);
- /// \}
-
-
- /// \{
- /// subject_impl specialization (Proxy)
- template <typename S, typename P, typename E>
- struct subject_impl< const graph_psite_base<S,P>&, E >
- {
- const S* target_() const;
- const S& site_set() const;
- const typename S::graph_t& graph() const;
- unsigned id() const;
- bool is_valid() const;
- // operator unsigned() const;
- // operator const typename S::graph_element&() const;
- const typename S::graph_element& element() const;
- const typename S::graph_element& p_hook_() const;
-
- private:
- const E& exact_() const;
- };
-
- template <typename S, typename P, typename E>
- struct subject_impl< graph_psite_base<S,P>&, E > :
- subject_impl< const graph_psite_base<S,P>&, E >
- {
- void change_target(const S& new_target);
- void update_id(unsigned elt_id);
- void invalidate();
+ /* FIXME: Shouldn't those comparisons be part of a much general
+ mechanism? */
+
+ /// Comparison of two mln::graph_psite_base<S,E> instances.
+ /// \{
+ /// \brief Is \a lhs equal to \a rhs?
+ ///
+ /// \pre Arguments \a lhs and \a rhs must belong to the same
+ /// mln::p_vertices.
+ template <typename S, typename E>
+ bool
+ operator==(const graph_psite_base<S,E>& lhs, const graph_psite_base<S,E>& rhs);
- private:
- E& exact_();
- };
- /// \}
+ /// \brief Is \a lhs not equal to \a rhs?
+ ///
+ /// \pre Arguments \a lhs and \a rhs must belong to the same
+ /// mln::p_vertices.
+ template <typename S, typename E>
+ bool
+ operator!=(const graph_psite_base<S,E>& lhs, const graph_psite_base<S,E>& rhs);
+
+ /// \brief Is \a lhs ``less'' than \a rhs?
+ ///
+ /// This comparison is required by algorithms sorting psites.
+ ///
+ /// \pre Arguments \a lhs and \a rhs must belong to the same
+ /// mln::p_vertices.
+ template <typename S, typename E>
+ bool
+ operator< (const graph_psite_base<S,E>& lhs, const graph_psite_base<S,E>& rhs);
+ /// \}
+
+
+ /// \{
+ /// subject_impl specialization (Proxy)
+ template <typename S, typename P, typename E>
+ struct subject_impl< const graph_psite_base<S,P>&, E >
+ {
+ const S* target_() const;
+ const S& site_set() const;
+ const typename S::graph_t& graph() const;
+ unsigned id() const;
+ bool is_valid() const;
+ // operator unsigned() const;
+ // operator const typename S::graph_element&() const;
+ const typename S::graph_element& element() const;
+ const typename S::graph_element& p_hook_() const;
+
+ private:
+ const E& exact_() const;
+ };
+
+ template <typename S, typename P, typename E>
+ struct subject_impl< graph_psite_base<S,P>&, E > :
+ subject_impl< const graph_psite_base<S,P>&, E >
+ {
+ void change_target(const S& new_target);
+ void update_id(unsigned elt_id);
+ void invalidate();
+
+ private:
+ E& exact_();
+ };
+ /// \}
# ifndef MLN_INCLUDE_ONLY
- template <typename S, typename E>
- inline
- graph_psite_base<S,E>::graph_psite_base()
- : s_(0)
- {
- }
+ template <typename S, typename E>
+ inline
+ graph_psite_base<S,E>::graph_psite_base()
+ : s_(0)
+ {
+ }
- template <typename S, typename E>
- inline
- graph_psite_base<S,E>::graph_psite_base(const S& s)
- {
- change_target(s);
- }
+ template <typename S, typename E>
+ inline
+ graph_psite_base<S,E>::graph_psite_base(const S& s)
+ {
+ change_target(s);
+ }
- template <typename S, typename E>
- inline
- graph_psite_base<S,E>::graph_psite_base(const S& s, unsigned id)
- {
- change_target(s);
- update_id(id);
- }
+ template <typename S, typename E>
+ inline
+ graph_psite_base<S,E>::graph_psite_base(const S& s, unsigned id)
+ {
+ change_target(s);
+ update_id(id);
+ }
// The lines below are dedicated/local to this file.
template <typename E, typename S, typename G>
inline
void local_change_graph(E& elt_, S& site_, const G& g)
{
+ (void) site_;
elt_.change_graph(g);
}
template <typename E, typename G>
@@ -232,238 +234,238 @@ namespace mln
}
// End of local stuff.
- template <typename S, typename E>
- inline
- void
- graph_psite_base<S,E>::change_target(const S& new_target)
- {
- s_ = & new_target;
- local_change_graph(elt_, site_, new_target.graph());
- }
-
- template <typename S, typename E>
- inline
- void
- graph_psite_base<S,E>::update_id(unsigned id)
- {
- mln_precondition(s_ != 0);
- elt_.update_id(id);
- site_ = s_->function()(elt_.id());
- }
-
- template <typename S, typename E>
- inline
- const S*
- graph_psite_base<S,E>::target_() const
- {
- return s_;
- }
+ template <typename S, typename E>
+ inline
+ void
+ graph_psite_base<S,E>::change_target(const S& new_target)
+ {
+ s_ = & new_target;
+ local_change_graph(elt_, site_, new_target.graph());
+ }
- template <typename S, typename E>
- inline
- const S&
- graph_psite_base<S,E>::site_set() const
- {
- mln_precondition(s_ != 0);
- return *s_;
- }
-
- template <typename S, typename E>
- inline
- const typename S::graph_t&
- graph_psite_base<S,E>::graph() const
- {
- mln_precondition(s_ != 0);
- return s_->graph();
- }
-
- template <typename S, typename E>
- inline
- typename graph_psite_base<S,E>::id_t
- graph_psite_base<S,E>::id() const
- {
- return elt_.id();
- }
+ template <typename S, typename E>
+ inline
+ void
+ graph_psite_base<S,E>::update_id(unsigned id)
+ {
+ mln_precondition(s_ != 0);
+ elt_.update_id(id);
+ site_ = s_->function()(elt_.id());
+ }
- template <typename S, typename E>
- inline
- bool
- graph_psite_base<S,E>::is_valid() const
- {
- return s_ != 0 && s_->is_valid() && elt_.is_valid();
- }
+ template <typename S, typename E>
+ inline
+ const S*
+ graph_psite_base<S,E>::target_() const
+ {
+ return s_;
+ }
- template <typename S, typename E>
- inline
- void
- graph_psite_base<S,E>::invalidate()
- {
- s_ = 0;
- elt_.invalidate();
- }
-
- template <typename S, typename E>
- inline
- const mln_site(S)&
- graph_psite_base<S,E>::subj_()
- {
- /*FIXME: we may like to enable the following precondition, however, we
- ** can't do that since neighb_*_niters update the psite target after having
- ** taken the adress of the subject.
- */
- // mln_precondition(is_valid());
- return site_;
- }
-
- template <typename S, typename E>
- inline
- graph_psite_base<S,E>::operator unsigned () const
- {
- mln_precondition(is_valid());
- return elt_.id();
- }
+ template <typename S, typename E>
+ inline
+ const S&
+ graph_psite_base<S,E>::site_set() const
+ {
+ mln_precondition(s_ != 0);
+ return *s_;
+ }
- template <typename S, typename E>
- inline
- graph_psite_base<S,E>::operator typename S::graph_element::id_t () const
- {
- mln_precondition(is_valid());
- return elt_.id();
- }
+ template <typename S, typename E>
+ inline
+ const typename S::graph_t&
+ graph_psite_base<S,E>::graph() const
+ {
+ mln_precondition(s_ != 0);
+ return s_->graph();
+ }
- template <typename S, typename E>
- inline
- graph_psite_base<S,E>::operator const typename S::graph_element&() const
- {
- //mln_precondition(is_valid());
- return elt_;
- }
-
- template <typename S, typename E>
- inline
- const typename S::graph_element&
- graph_psite_base<S,E>::element() const
- {
- /*FIXME: we may like to enable the following precondition, however, we
- ** can't do that since neighb_*_niters update the psite target after having
- ** taken the adress of the subject.
- */
- // mln_precondition(is_valid());
- return elt_;
- }
-
- template <typename S, typename E>
- inline
- const typename S::graph_element&
- graph_psite_base<S,E>::p_hook_() const
- {
- return elt_;
- }
+ template <typename S, typename E>
+ inline
+ typename graph_psite_base<S,E>::id_t
+ graph_psite_base<S,E>::id() const
+ {
+ return elt_.id();
+ }
+ template <typename S, typename E>
+ inline
+ bool
+ graph_psite_base<S,E>::is_valid() const
+ {
+ return s_ != 0 && s_->is_valid() && elt_.is_valid();
+ }
- template <typename S, typename P, typename E>
- inline
- const E&
- subject_impl< const graph_psite_base<S,P>&, E >::exact_() const
- {
- return internal::force_exact<const E>(*this);
- }
+ template <typename S, typename E>
+ inline
+ void
+ graph_psite_base<S,E>::invalidate()
+ {
+ s_ = 0;
+ elt_.invalidate();
+ }
- template <typename S, typename P, typename E>
- inline
- const S*
- subject_impl< const graph_psite_base<S,P>&, E >::target_() const
- {
- return exact_().get_subject().target();
- }
+ template <typename S, typename E>
+ inline
+ const mln_site(S)&
+ graph_psite_base<S,E>::subj_()
+ {
+ /*FIXME: we may like to enable the following precondition, however, we
+ ** can't do that since neighb_*_niters update the psite target after having
+ ** taken the adress of the subject.
+ */
+ // mln_precondition(is_valid());
+ return site_;
+ }
- template <typename S, typename P, typename E>
- inline
- const S&
- subject_impl< const graph_psite_base<S,P>&, E >::site_set() const
- {
- return exact_().get_subject().site_set();
- }
+ template <typename S, typename E>
+ inline
+ graph_psite_base<S,E>::operator unsigned () const
+ {
+ mln_precondition(is_valid());
+ return elt_.id();
+ }
+ template <typename S, typename E>
+ inline
+ graph_psite_base<S,E>::operator typename S::graph_element::id_t () const
+ {
+ mln_precondition(is_valid());
+ return elt_.id();
+ }
- template <typename S, typename P, typename E>
- inline
- const typename S::graph_t&
- subject_impl< const graph_psite_base<S,P>&, E >::graph() const
- {
- return exact_().get_subject().graph();
- }
+ template <typename S, typename E>
+ inline
+ graph_psite_base<S,E>::operator const typename S::graph_element&() const
+ {
+ //mln_precondition(is_valid());
+ return elt_;
+ }
- template <typename S, typename P, typename E>
- inline
- unsigned
- subject_impl< const graph_psite_base<S,P>&, E >::id() const
- {
- return exact_().get_subject().id();
- };
+ template <typename S, typename E>
+ inline
+ const typename S::graph_element&
+ graph_psite_base<S,E>::element() const
+ {
+ /*FIXME: we may like to enable the following precondition, however, we
+ ** can't do that since neighb_*_niters update the psite target after having
+ ** taken the adress of the subject.
+ */
+ // mln_precondition(is_valid());
+ return elt_;
+ }
- template <typename S, typename P, typename E>
- inline
- bool
- subject_impl< const graph_psite_base<S,P>&, E >::is_valid() const
- {
- return exact_().get_subject().is_valid();
- }
+ template <typename S, typename E>
+ inline
+ const typename S::graph_element&
+ graph_psite_base<S,E>::p_hook_() const
+ {
+ return elt_;
+ }
- template <typename S, typename P, typename E>
- inline
- const typename S::graph_element&
- subject_impl< const graph_psite_base<S,P>&, E >::element() const
- {
- return exact_().get_subject().element();
- }
- template <typename S, typename P, typename E>
- inline
- const typename S::graph_element&
- subject_impl< const graph_psite_base<S,P>&, E >::p_hook_() const
- {
- return exact_().get_subject().p_hook_();
- }
+ template <typename S, typename P, typename E>
+ inline
+ const E&
+ subject_impl< const graph_psite_base<S,P>&, E >::exact_() const
+ {
+ return internal::force_exact<const E>(*this);
+ }
+ template <typename S, typename P, typename E>
+ inline
+ const S*
+ subject_impl< const graph_psite_base<S,P>&, E >::target_() const
+ {
+ return exact_().get_subject().target();
+ }
- template <typename S, typename P, typename E>
- inline
- E&
- subject_impl< graph_psite_base<S,P>&, E >::exact_()
- {
- return internal::force_exact<E>(*this);
- }
+ template <typename S, typename P, typename E>
+ inline
+ const S&
+ subject_impl< const graph_psite_base<S,P>&, E >::site_set() const
+ {
+ return exact_().get_subject().site_set();
+ }
- template <typename S, typename P, typename E>
- inline
- void
- subject_impl< graph_psite_base<S,P>&, E >::change_target(const S& new_target)
- {
- exact_().get_subject().change_target(new_target);
- }
- template <typename S, typename P, typename E>
- inline
- void
- subject_impl< graph_psite_base<S,P>&, E >::update_id(unsigned id)
- {
- exact_().get_subject().update_id(id);
- };
+ template <typename S, typename P, typename E>
+ inline
+ const typename S::graph_t&
+ subject_impl< const graph_psite_base<S,P>&, E >::graph() const
+ {
+ return exact_().get_subject().graph();
+ }
- template <typename S, typename P, typename E>
- inline
- void
- subject_impl< graph_psite_base<S,P>&, E >::invalidate()
- {
- exact_().get_subject().invalidate();
- }
+ template <typename S, typename P, typename E>
+ inline
+ unsigned
+ subject_impl< const graph_psite_base<S,P>&, E >::id() const
+ {
+ return exact_().get_subject().id();
+ };
+
+ template <typename S, typename P, typename E>
+ inline
+ bool
+ subject_impl< const graph_psite_base<S,P>&, E >::is_valid() const
+ {
+ return exact_().get_subject().is_valid();
+ }
+
+ template <typename S, typename P, typename E>
+ inline
+ const typename S::graph_element&
+ subject_impl< const graph_psite_base<S,P>&, E >::element() const
+ {
+ return exact_().get_subject().element();
+ }
+
+ template <typename S, typename P, typename E>
+ inline
+ const typename S::graph_element&
+ subject_impl< const graph_psite_base<S,P>&, E >::p_hook_() const
+ {
+ return exact_().get_subject().p_hook_();
+ }
+
+
+ template <typename S, typename P, typename E>
+ inline
+ E&
+ subject_impl< graph_psite_base<S,P>&, E >::exact_()
+ {
+ return internal::force_exact<E>(*this);
+ }
+
+ template <typename S, typename P, typename E>
+ inline
+ void
+ subject_impl< graph_psite_base<S,P>&, E >::change_target(const S& new_target)
+ {
+ exact_().get_subject().change_target(new_target);
+ }
+
+ template <typename S, typename P, typename E>
+ inline
+ void
+ subject_impl< graph_psite_base<S,P>&, E >::update_id(unsigned id)
+ {
+ exact_().get_subject().update_id(id);
+ };
+
+ template <typename S, typename P, typename E>
+ inline
+ void
+ subject_impl< graph_psite_base<S,P>&, E >::invalidate()
+ {
+ exact_().get_subject().invalidate();
+ }
# endif // ! MLN_INCLUDE_ONLY
-} // end of namespace internal
+ } // end of namespace internal
- } // end of namespace mln
+} // end of namespace mln
#endif // ! MLN_CORE_INTERNAL_GRAPH_PSITE_BASE_HH
diff --git a/milena/mln/core/internal/neighb_niter_impl.hh b/milena/mln/core/internal/neighb_niter_impl.hh
index 75dfc60..ea44822 100644
--- a/milena/mln/core/internal/neighb_niter_impl.hh
+++ b/milena/mln/core/internal/neighb_niter_impl.hh
@@ -39,7 +39,7 @@ namespace mln
// Forward declaration.
template <typename P, typename W> class graph_window_base;
- template <typename G, typename F> class graph_elt_window;
+ template <typename G, typename F, typename Q> class graph_elt_window;
template <typename G, typename F, typename I> class graph_elt_window_if;
template <typename G, typename F> class line_graph_elt_window;
namespace util
@@ -124,10 +124,10 @@ namespace mln
/// Add more implementation for neighborhoods made from a
/// graph_window_piter.
- template <typename G, typename S, typename E>
- struct neighb_niter_impl<graph_elt_window<G,S>, E>
+ template <typename G, typename S, typename Q, typename E>
+ struct neighb_niter_impl<graph_elt_window<G,S,Q>, E>
: public neighb_niter_impl< graph_window_base< mln_result(S::fun_t),
- graph_elt_window<G,S> >,
+ graph_elt_window<G,S,Q> >,
E >
{
diff --git a/milena/mln/core/internal/site_relative_iterator_base.hh b/milena/mln/core/internal/site_relative_iterator_base.hh
index 4809bf8..de4e5aa 100644
--- a/milena/mln/core/internal/site_relative_iterator_base.hh
+++ b/milena/mln/core/internal/site_relative_iterator_base.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -58,7 +59,7 @@ namespace mln
/// is_valid_, invalidate_ and compute_p_. They shall define
/// NEITHER start_ NOR next_.
///
- template <typename S, typename E>
+ template <typename S, typename E, typename C = mln_psite(S)>
class site_relative_iterator_base : public site_iterator_base< S, E >
{
public:
@@ -80,7 +81,7 @@ namespace mln
const S& site_set() const;
/// The psite around which this iterator moves.
- const mln_psite(S)& center() const;
+ const C& center() const;
/// This overriding is very useful: it adds a test to prevent
/// getting an invalid iterator when its center has moved. Some
@@ -106,7 +107,7 @@ namespace mln
/// A pointer to the center psite around which this iterator
/// moves.
- const mln_psite(S)* c_;
+ const C* c_;
private:
@@ -123,9 +124,9 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
- site_relative_iterator_base<S,E>::site_relative_iterator_base()
+ site_relative_iterator_base<S,E,C>::site_relative_iterator_base()
: c_(0)
{
void (E::*m1)() = & E::do_start_;
@@ -136,77 +137,77 @@ namespace mln
m3 = 0;
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
template <typename P>
inline
void
- site_relative_iterator_base<S,E>::center_at(const P& c)
+ site_relative_iterator_base<S,E,C>::center_at(const P& c)
{
- mlc_converts_to(P, const mln_psite(S)&)::check();
- c_ = & static_cast< const mln_psite(S)& >(c);
+ mlc_converts_to(P, const C&)::check();
+ c_ = & static_cast< const C& >(c);
exact(this)->center_at_(c); // May call some extra code.
this->invalidate();
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
void
- site_relative_iterator_base<S,E>::start_()
+ site_relative_iterator_base<S,E,C>::start_()
{
exact(this)->do_start_();
if (this->is_valid())
p_ = exact(this)->compute_p_();
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
void
- site_relative_iterator_base<S,E>::next_()
+ site_relative_iterator_base<S,E,C>::next_()
{
exact(this)->do_next_();
if (this->is_valid())
p_ = exact(this)->compute_p_();
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
- const mln_psite(S)&
- site_relative_iterator_base<S,E>::center() const
+ const C&
+ site_relative_iterator_base<S,E,C>::center() const
{
mln_precondition(c_ != 0);
return *c_;
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
const S&
- site_relative_iterator_base<S, E>::site_set() const
+ site_relative_iterator_base<S,E,C>::site_set() const
{
mln_precondition(this->s_ != 0);
return *this->s_;
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
const mln_psite(S)&
- site_relative_iterator_base<S,E>::subj_()
+ site_relative_iterator_base<S,E,C>::subj_()
{
mln_assertion(exact(this)->compute_p_() == p_);
return p_;
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
const mln_psite(S)&
- site_relative_iterator_base<S,E>::p_hook_() const
+ site_relative_iterator_base<S,E,C>::p_hook_() const
{
return p_;
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
void
- site_relative_iterator_base<S,E>::change_target(const S& s)
+ site_relative_iterator_base<S,E,C>::change_target(const S& s)
{
this->s_ = & s;
// p might be also updated since it can hold a pointer towards
@@ -216,10 +217,10 @@ namespace mln
this->invalidate();
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
inline
E&
- site_relative_iterator_base<S,E>::update()
+ site_relative_iterator_base<S,E,C>::update()
{
mln_precondition(this->s_ && c_);
p_ = exact(this)->compute_p_();
@@ -227,11 +228,11 @@ namespace mln
return exact(*this);
}
- template <typename S, typename E>
+ template <typename S, typename E, typename C>
template <typename P>
inline
void
- site_relative_iterator_base<S,E>::center_at_(const P&)
+ site_relative_iterator_base<S,E,C>::center_at_(const P&)
{
// Default is no-op, meaning "no extra code".
}
diff --git a/milena/mln/core/internal/window_base.hh b/milena/mln/core/internal/window_base.hh
index 7648b13..0047055 100644
--- a/milena/mln/core/internal/window_base.hh
+++ b/milena/mln/core/internal/window_base.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -57,6 +58,9 @@ namespace mln
/// Site associated type.
typedef mln_site(D) site;
+ /// Type of the window center
+ typedef psite center_t;
+
/// Test if this window can be a neighborhood.
// This method is used in the neighborhood window-adapter.
bool is_neighbable_() const;
diff --git a/milena/mln/core/neighb.hh b/milena/mln/core/neighb.hh
index 57ab311..8ce148e 100644
--- a/milena/mln/core/neighb.hh
+++ b/milena/mln/core/neighb.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -114,7 +115,8 @@ namespace mln
template <typename W>
class neighb_fwd_niter
: public internal::site_relative_iterator_base< neighb<W>,
- neighb_fwd_niter<W> >,
+ neighb_fwd_niter<W>,
+ mln_psite(neighb<W>) >,
public internal::neighb_niter_impl<W, neighb_fwd_niter<W> >
{
public:
@@ -152,7 +154,8 @@ namespace mln
template <typename W>
class neighb_bkd_niter
: public internal::site_relative_iterator_base< neighb<W>,
- neighb_bkd_niter<W> >,
+ neighb_bkd_niter<W>,
+ mln_psite(neighb<W>)>,
public internal::neighb_niter_impl<W, neighb_fwd_niter<W> >
{
public:
diff --git a/milena/mln/util/internal/graph_base.hh b/milena/mln/util/internal/graph_base.hh
index abfcc57..3a9eea9 100644
--- a/milena/mln/util/internal/graph_base.hh
+++ b/milena/mln/util/internal/graph_base.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -101,6 +102,12 @@ namespace mln
/// \{
/// Returns the other adjacent vertex id of a given edge id \p id_e.
vertex_id_t v_other(const edge_id_t& id_e, const vertex_id_t& id_v) const;
+
+ /// Return true if this graph is valid.
+ bool is_valid() const;
+ /// Invalidate the graph.
+ void invalidate();
+
/// \}
// FIXME: We might want to externalize this in routine of
@@ -206,6 +213,24 @@ namespace mln
return exact(this)->has_e(e.id());
}
+
+ template <typename E>
+ inline
+ bool
+ graph_base<E>::is_valid() const
+ {
+ return data_ != 0;
+ }
+
+ template <typename E>
+ inline
+ void
+ graph_base<E>::invalidate()
+ {
+ data_.clean_();
+ }
+
+
/*--------.
| Debug. |
`--------*/
diff --git a/milena/mln/util/internal/graph_nbh_iter.hh b/milena/mln/util/internal/graph_nbh_iter.hh
index 8235b06..35f33b2 100644
--- a/milena/mln/util/internal/graph_nbh_iter.hh
+++ b/milena/mln/util/internal/graph_nbh_iter.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -32,7 +33,8 @@
# include <mln/util/edge.hh>
/// \file
-/// \brief Implementation for graph vertex iterators centered to a vertex.
+/// \brief Implementation for graph vertex iterators centered to a
+/// vertex.
namespace mln
{
@@ -51,11 +53,16 @@ namespace mln
util::vertex<G>,
vertex_nbh_vertex_fwd_iterator<G> >
{
- typedef util::vertex<G> V;
- typedef vertex_nbh_vertex_fwd_iterator<G> self_;
- typedef nbh_iterator_base<G, V, V, self_> super_;
+ typedef util::vertex<G> V;
+ typedef vertex_nbh_vertex_fwd_iterator<G> self_;
+ typedef nbh_iterator_base<G, V, V, self_> super_;
public:
+ /// Type of the iterator center element.
+ typedef V center;
+ /// Type of the iterator targeted elements.
+ typedef V nbh;
+
/// Construction and assignment.
/// \{
vertex_nbh_vertex_fwd_iterator();
@@ -88,11 +95,17 @@ namespace mln
util::vertex<G>,
vertex_nbh_vertex_bkd_iterator<G> >
{
- typedef util::vertex<G> V;
- typedef vertex_nbh_vertex_bkd_iterator<G> self_;
- typedef nbh_iterator_base<G, V, V, self_> super_;
+ typedef util::vertex<G> V;
+
+ typedef vertex_nbh_vertex_bkd_iterator<G> self_;
+ typedef nbh_iterator_base<G, V, V, self_> super_;
public:
+ /// Type of the iterator center element.
+ typedef V center;
+ /// Type of the iterator targeted elements.
+ typedef V nbh;
+
/// Construction and assignment.
/// \{
vertex_nbh_vertex_bkd_iterator();
@@ -130,12 +143,17 @@ namespace mln
util::edge<G>,
vertex_nbh_edge_fwd_iterator<G> >
{
- typedef util::vertex<G> V;
- typedef util::edge<G> E;
- typedef vertex_nbh_edge_fwd_iterator<G> self_;
- typedef nbh_iterator_base<G, V, E, self_> super_;
+ typedef util::vertex<G> V;
+ typedef util::edge<G> E;
+ typedef vertex_nbh_edge_fwd_iterator<G> self_;
+ typedef nbh_iterator_base<G, V, E, self_> super_;
public:
+ /// Type of the iterator center element.
+ typedef V center;
+ /// Type of the iterator targeted elements.
+ typedef E nbh;
+
/// Construction and assignment.
/// \{
vertex_nbh_edge_fwd_iterator();
@@ -169,12 +187,17 @@ namespace mln
util::edge<G>,
vertex_nbh_edge_bkd_iterator<G> >
{
- typedef util::vertex<G> V;
- typedef util::edge<G> E;
- typedef vertex_nbh_edge_bkd_iterator<G> self_;
- typedef nbh_iterator_base<G, V, E, self_> super_;
+ typedef util::vertex<G> V;
+ typedef util::edge<G> E;
+ typedef vertex_nbh_edge_bkd_iterator<G> self_;
+ typedef nbh_iterator_base<G, V, E, self_> super_;
public:
+ /// Type of the iterator center element.
+ typedef V center;
+ /// Type of the iterator targeted elements.
+ typedef E nbh;
+
/// Construction and assignment.
/// \{
vertex_nbh_edge_bkd_iterator();
@@ -212,11 +235,17 @@ namespace mln
util::edge<G>,
edge_nbh_edge_fwd_iterator<G> >
{
- typedef util::edge<G> E;
- typedef edge_nbh_edge_fwd_iterator<G> self_;
- typedef nbh_iterator_base<G, E, E, self_> super_;
+ typedef util::edge<G> E;
+ typedef edge_nbh_edge_fwd_iterator<G> self_;
+ typedef nbh_iterator_base<G, E, E, self_> super_;
public:
+ /// Type of the iterator center element.
+ typedef E center;
+ /// Type of the iterator targeted elements.
+ typedef E nbh;
+
+
/// Construction and assignment.
/// \{
edge_nbh_edge_fwd_iterator();
@@ -250,11 +279,18 @@ namespace mln
util::edge<G>,
edge_nbh_edge_bkd_iterator<G> >
{
- typedef util::edge<G> E;
- typedef edge_nbh_edge_bkd_iterator<G> self_;
- typedef nbh_iterator_base<G, E, E, self_> super_;
+ typedef util::edge<G> E;
+
+ typedef edge_nbh_edge_bkd_iterator<G> self_;
+ typedef nbh_iterator_base<G, E, E, self_> super_;
public:
+
+ /// Type of the iterator center element.
+ typedef E center;
+ /// Type of the iterator targeted elements.
+ typedef E nbh;
+
/// Construction and assignment.
/// \{
edge_nbh_edge_bkd_iterator();
@@ -296,7 +332,7 @@ namespace mln
template <typename C>
inline
vertex_nbh_vertex_fwd_iterator<G>::vertex_nbh_vertex_fwd_iterator(const C& c)
- : super_(c)
+ : super_(c)
{
}
@@ -332,9 +368,9 @@ namespace mln
this->elt_.update_id(this->c_->ith_nbh_vertex(this->i_));
}
- /*-------------------------------`
- | vertex_nbh_vertex_bkd_iterator |
- \-------------------------------*/
+ /*-------------------------------`
+ | vertex_nbh_vertex_bkd_iterator |
+ \-------------------------------*/
template <typename G>
inline
@@ -383,9 +419,9 @@ namespace mln
}
- /*-----------------------------`
- | vertex_nbh_edge_fwd_iterator |
- \-----------------------------*/
+ /*-----------------------------`
+ | vertex_nbh_edge_fwd_iterator |
+ \-----------------------------*/
template <typename G>
inline
@@ -433,9 +469,9 @@ namespace mln
this->elt_.update_id(this->c_->ith_nbh_edge(this->i_));
}
- /*-----------------------------`
- | vertex_nbh_edge_bkd_iterator |
- \-----------------------------*/
+ /*-----------------------------`
+ | vertex_nbh_edge_bkd_iterator |
+ \-----------------------------*/
template <typename G>
inline
@@ -485,9 +521,9 @@ namespace mln
- /*-----------------------------`
- | edge_nbh_edge_fwd_iterator |
- \-----------------------------*/
+ /*-----------------------------`
+ | edge_nbh_edge_fwd_iterator |
+ \-----------------------------*/
template <typename G>
inline
@@ -546,9 +582,9 @@ namespace mln
this->elt_.update_id(e_id);
}
- /*-----------------------------`
- | edge_nbh_edge_bkd_iterator |
- \-----------------------------*/
+ /*-----------------------------`
+ | edge_nbh_edge_bkd_iterator |
+ \-----------------------------*/
template <typename G>
inline
diff --git a/milena/tests/core/image/Makefile.am b/milena/tests/core/image/Makefile.am
index 6266ceb..0bfff01 100644
--- a/milena/tests/core/image/Makefile.am
+++ b/milena/tests/core/image/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+# (LRDE).
#
# This file is part of Olena.
#
@@ -33,19 +34,21 @@ check_PROGRAMS = \
image2d \
image3d \
line_graph_image \
- vertex_image
+ vertex_image \
+ vertex_and_edge_image
noinst_HEADERS = complex_image.hh
complex_image_SOURCES = complex_image.cc
-graph_image_SOURCES = graph_image.cc
+edge_image_SOURCES = edge_image.cc
flat_image_SOURCES = flat_image.cc
+graph_image_SOURCES = graph_image.cc
image1d_SOURCES = image1d.cc
image2d_SOURCES = image2d.cc
image3d_SOURCES = image3d.cc
line_graph_image_SOURCES = line_graph_image.cc
+vertex_and_edge_image_SOURCES = vertex_and_edge_image.cc
vertex_image_SOURCES = vertex_image.cc
-edge_image_SOURCES = edge_image.cc
TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/core/image/vertex_and_edge_image.cc b/milena/tests/core/image/vertex_and_edge_image.cc
new file mode 100644
index 0000000..60a4609
--- /dev/null
+++ b/milena/tests/core/image/vertex_and_edge_image.cc
@@ -0,0 +1,166 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+#include <vector>
+
+#include <mln/core/image/vertex_image.hh>
+#include <mln/core/image/edge_image.hh>
+#include <mln/fun/i2v/array.hh>
+#include <mln/util/graph.hh>
+
+
+
+/* The graph is as follows:
+
+ 0 1 2 3 4
+ .-----------
+ |
+ 0 | 0 2
+ 1 | \ / |
+ 2 | 1 |
+ 3 | \ |
+ 4 | 3-4
+
+*/
+
+static const unsigned X = mln_max(unsigned); // Invalid id.
+
+
+static unsigned expected_fwd_nb[5][3] = { { 0, X, X },
+ { 0, 1, 2 },
+ { 1, 4, X },
+ { 2, 3, X },
+ { 3, 4, X } };
+
+
+static unsigned expected_bkd_nb[5][3] = { { 0, X, X },
+ { 2, 1, 0 },
+ { 4, 1, X },
+ { 3, 2, X },
+ { 4, 3, X } };
+
+
+int main()
+{
+ using namespace mln;
+
+ /*--------.
+ | Graph. |
+ `--------*/
+
+ // Points associated to vertices.
+ typedef fun::i2v::array<point2d> fsite_t;
+ fsite_t sites(5);
+ sites(0) = point2d(0,0); // Point associated to vertex 0.
+ sites(1) = point2d(2,2); // Point associated to vertex 1.
+ sites(2) = point2d(0,4); // Point associated to vertex 2.
+ sites(3) = point2d(4,3); // Point associated to vertex 3.
+ sites(4) = point2d(4,4); // Point associated to vertex 4.
+
+ // Edges.
+ util::graph g;
+
+ // Populate the graph with vertices.
+ g.add_vertices(sites.size());
+
+ // Populate the graph with edges.
+ g.add_edge(0, 1);
+ g.add_edge(1, 2);
+ g.add_edge(1, 3);
+ g.add_edge(3, 4);
+ g.add_edge(4, 2);
+
+ //g.print_debug(std::cout);
+
+ /*-------------.
+ | Graph image. |
+ `-------------*/
+
+ // Vertex values.
+ typedef fun::i2v::array<unsigned> viota_t;
+ viota_t iota(g.v_nmax());
+ for (unsigned i = 0; i < iota.size(); ++i)
+ iota(i) = 10 + i;
+
+
+ // Edge values.
+ typedef fun::i2v::array<unsigned> eiota_t;
+ eiota_t eiota(g.e_nmax());
+ for (unsigned i = 0; i < eiota.size(); ++i)
+ eiota(i) = 20 + i;
+
+
+ typedef vertex_image<void,unsigned> v_ima_t;
+ v_ima_t v_ima(g, iota);
+
+ typedef edge_image<void,unsigned> e_ima_t;
+ e_ima_t e_ima(g, eiota);
+
+
+ // Iterator over the vertex image.
+ mln_piter_(v_ima_t) v(v_ima.domain());
+
+
+ typedef graph_elt_window<util::graph,
+ v_ima_t::domain_t,
+ e_ima_t::domain_t> edge_win_t;
+ edge_win_t win;
+
+ // Forward Iteration
+ {
+ for_all(v)
+ {
+ int i = 0;
+ // Iterator over the neighbor edges in the edge image.
+ mln_qiter_(edge_win_t) e(win, e_ima.domain(), v);
+ for_all(e)
+ {
+ mln_assertion(expected_fwd_nb[v.id()][i++] == e.id());
+ mln_assertion((e.id() + 20) == e_ima(e));
+ }
+ }
+ }
+
+ // Backward Iteration
+ {
+ for_all(v)
+ {
+ int i = 0;
+ // Iterator over the neighbor edges in the edge image.
+ mln_bkd_qiter_(edge_win_t) e(win, e_ima.domain(), v);
+ for_all(e)
+ {
+ mln_assertion(expected_bkd_nb[v.id()][i++] == e.id());
+ mln_assertion((e.id() + 20) == e_ima(e));
+ }
+ }
+ }
+
+
+
+// FIXME: add tests for graph_window_if and graph_neighborhood_if when
+// they support this feature.
+
+}
--
1.5.6.5
1
0
---
ChangeLog | 4 ++++
README | 17 ++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6a03c2a..79cb28f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * README: Be consistent with the documentation.
+
+2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Install scribo headers in a specific scribo include dir.
* bootstrap: Add new arguments to generate_dist_headers.sh
diff --git a/README b/README
index 52fd5b0..41c65cc 100644
--- a/README
+++ b/README
@@ -71,16 +71,19 @@ code or e-mail us.
Installation
============
-To install Olena on your system, type in the classical sequence at
-the command prompt::
+To install Olena on your system, create a `build' directory (even
+though it is not mandatory) and type in the classical sequence at the
+command prompt::
- ./configure
+ mkdir build
+ cd build
+ ../configure
make
make install (as root)
-Note that an installation is specific to the compiler used to install
-it. Indeed, the call to ``./configure`` enables some workarounds and,
-consequently, users must compile with the same compiler to avoid
+Note that an installation is specific to the compiler used to install
+it. Indeed, the call to ``../configure`` enables some workarounds
+and, consequently, users must compile with the same compiler to avoid
compatibility problems.
Between ``make`` and ``make install``, you may also want to run::
@@ -195,7 +198,7 @@ milena
swilena
-
+
python
Some Python bindings for Milena.
--
1.5.6.5
1
0
* doc/examples/accu-wrong-instanciation.cc.raw: Fix an incomplete
namespace specification.
* doc/figures/fill-subimage-cfun-1.ppm,
* doc/outputs/fill-subimage-cfun.txt,
* doc/examples/fill-subimage-cfun.cc,
* doc/examples/split/fill-subimage-cfun-1.cc.raw,
* doc/examples/split/fill-subimage-cfun-2.cc.raw,
* doc/examples/split/fill-subimage-cfun-3.cc.raw: Rename as...
* doc/figures/fill-imageif-cfun-1.ppm,
* doc/outputs/fill-imageif-cfun.txt,
* doc/examples/fill-imageif-cfun.cc,
* doc/examples/split/fill-imageif-cfun-1.cc.raw,
* doc/examples/split/fill-imageif-cfun-2.cc.raw,
* doc/examples/split/fill-imageif-cfun-3.cc.raw: ... this.
* doc/examples/tuto3/first_routine.cc,
* doc/examples/tuto4_genericity_and_algorithms.cc,
* doc/examples/split/tuto3_first_routine-1.cc.raw,
* doc/examples/split/tuto3_first_routine-5.cc.raw,
* doc/examples/split/tuto3_first_routine-7.cc.raw,
* doc/examples/split/tuto4_genericity_and_algorithms-2.cc.raw:
Update sample code
* doc/examples/examples.mk,
* doc/figures/figures.mk,
* doc/outputs/outputs.mk: Regen.
* doc/ref_guide/ref_guide.tex,
* doc/tutorial/tutorial.tex: Fix typos and update according to
some Yann's comments.
---
milena/ChangeLog | 37 ++++++++
.../doc/examples/accu-wrong-instanciation.cc.raw | 2 +-
milena/doc/examples/examples.mk | 6 +-
...{fill-subimage-cfun.cc => fill-imageif-cfun.cc} | 0
...ge-cfun-1.cc.raw => fill-imageif-cfun-1.cc.raw} | 0
...ge-cfun-2.cc.raw => fill-imageif-cfun-2.cc.raw} | 0
...ge-cfun-3.cc.raw => fill-imageif-cfun-3.cc.raw} | 0
.../examples/split/tuto3_first_routine-1.cc.raw | 30 ++++++-
.../examples/split/tuto3_first_routine-5.cc.raw | 4 +-
.../examples/split/tuto3_first_routine-7.cc.raw | 3 +-
.../split/tuto4_genericity_and_algorithms-2.cc.raw | 2 +-
milena/doc/examples/tuto3/first_routine.cc | 19 +++--
.../examples/tuto4_genericity_and_algorithms.cc | 2 +-
milena/doc/figures/figures.mk | 2 +-
...subimage-cfun-1.ppm => fill-imageif-cfun-1.ppm} | Bin 206 -> 206 bytes
...ill-subimage-cfun.txt => fill-imageif-cfun.txt} | 0
milena/doc/outputs/outputs.mk | 2 +-
milena/doc/ref_guide/ref_guide.tex | 30 +++++--
milena/doc/tutorial/tutorial.tex | 94 ++++++++++++++-----
19 files changed, 181 insertions(+), 52 deletions(-)
rename milena/doc/examples/{fill-subimage-cfun.cc => fill-imageif-cfun.cc} (100%)
rename milena/doc/examples/split/{fill-subimage-cfun-1.cc.raw => fill-imageif-cfun-1.cc.raw} (100%)
rename milena/doc/examples/split/{fill-subimage-cfun-2.cc.raw => fill-imageif-cfun-2.cc.raw} (100%)
rename milena/doc/examples/split/{fill-subimage-cfun-3.cc.raw => fill-imageif-cfun-3.cc.raw} (100%)
rename milena/doc/figures/{fill-subimage-cfun-1.ppm => fill-imageif-cfun-1.ppm} (100%)
rename milena/doc/outputs/{fill-subimage-cfun.txt => fill-imageif-cfun.txt} (100%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 1d123b0..6f01493 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,42 @@
2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Update documentation.
+
+ * doc/examples/accu-wrong-instanciation.cc.raw: Fix an incomplete
+ namespace specification.
+
+ * doc/figures/fill-subimage-cfun-1.ppm,
+ * doc/outputs/fill-subimage-cfun.txt,
+ * doc/examples/fill-subimage-cfun.cc,
+ * doc/examples/split/fill-subimage-cfun-1.cc.raw,
+ * doc/examples/split/fill-subimage-cfun-2.cc.raw,
+ * doc/examples/split/fill-subimage-cfun-3.cc.raw: Rename as...
+
+ * doc/figures/fill-imageif-cfun-1.ppm,
+ * doc/outputs/fill-imageif-cfun.txt,
+ * doc/examples/fill-imageif-cfun.cc,
+ * doc/examples/split/fill-imageif-cfun-1.cc.raw,
+ * doc/examples/split/fill-imageif-cfun-2.cc.raw,
+ * doc/examples/split/fill-imageif-cfun-3.cc.raw: ... this.
+
+ * doc/examples/tuto3/first_routine.cc,
+ * doc/examples/tuto4_genericity_and_algorithms.cc,
+ * doc/examples/split/tuto3_first_routine-1.cc.raw,
+ * doc/examples/split/tuto3_first_routine-5.cc.raw,
+ * doc/examples/split/tuto3_first_routine-7.cc.raw,
+ * doc/examples/split/tuto4_genericity_and_algorithms-2.cc.raw:
+ Update sample code
+
+ * doc/examples/examples.mk,
+ * doc/figures/figures.mk,
+ * doc/outputs/outputs.mk: Regen.
+
+ * doc/ref_guide/ref_guide.tex,
+ * doc/tutorial/tutorial.tex: Fix typos and update according to
+ some Yann's comments.
+
+2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Small fixes.
* mln/core/concept/image.hh: Always include data/compare.hh.
diff --git a/milena/doc/examples/accu-wrong-instanciation.cc.raw b/milena/doc/examples/accu-wrong-instanciation.cc.raw
index 27f8a86..888d36e 100644
--- a/milena/doc/examples/accu-wrong-instanciation.cc.raw
+++ b/milena/doc/examples/accu-wrong-instanciation.cc.raw
@@ -1 +1 @@
-data::compute(accu::meta::max, ima);
+data::compute(accu::meta::stat::max, ima);
diff --git a/milena/doc/examples/examples.mk b/milena/doc/examples/examples.mk
index fac55db..c0b75be 100644
--- a/milena/doc/examples/examples.mk
+++ b/milena/doc/examples/examples.mk
@@ -24,6 +24,9 @@ examples/split/fill-3.cc.raw \
examples/split/fill-call-1-1.cc.raw \
examples/split/fill-call-1-2.cc.raw \
examples/split/fill-call-1-3.cc.raw \
+examples/split/fill-imageif-cfun-1.cc.raw \
+examples/split/fill-imageif-cfun-2.cc.raw \
+examples/split/fill-imageif-cfun-3.cc.raw \
examples/split/fill-part-image-1.cc.raw \
examples/split/fill-part-image-2.cc.raw \
examples/split/fill-subdomain-1.cc.raw \
@@ -32,9 +35,6 @@ examples/split/fill-subdomain-3.cc.raw \
examples/split/fill-subdomain-4.cc.raw \
examples/split/fill-subdomain-shorter-1.cc.raw \
examples/split/fill-subdomain-shorter-2.cc.raw \
-examples/split/fill-subimage-cfun-1.cc.raw \
-examples/split/fill-subimage-cfun-2.cc.raw \
-examples/split/fill-subimage-cfun-3.cc.raw \
examples/split/forall-piter-1.cc.raw \
examples/split/fun-p2v-1-1.cc.raw \
examples/split/graph-data-1.cc.raw \
diff --git a/milena/doc/examples/fill-subimage-cfun.cc b/milena/doc/examples/fill-imageif-cfun.cc
similarity index 100%
rename from milena/doc/examples/fill-subimage-cfun.cc
rename to milena/doc/examples/fill-imageif-cfun.cc
diff --git a/milena/doc/examples/split/fill-subimage-cfun-1.cc.raw b/milena/doc/examples/split/fill-imageif-cfun-1.cc.raw
similarity index 100%
rename from milena/doc/examples/split/fill-subimage-cfun-1.cc.raw
rename to milena/doc/examples/split/fill-imageif-cfun-1.cc.raw
diff --git a/milena/doc/examples/split/fill-subimage-cfun-2.cc.raw b/milena/doc/examples/split/fill-imageif-cfun-2.cc.raw
similarity index 100%
rename from milena/doc/examples/split/fill-subimage-cfun-2.cc.raw
rename to milena/doc/examples/split/fill-imageif-cfun-2.cc.raw
diff --git a/milena/doc/examples/split/fill-subimage-cfun-3.cc.raw b/milena/doc/examples/split/fill-imageif-cfun-3.cc.raw
similarity index 100%
rename from milena/doc/examples/split/fill-subimage-cfun-3.cc.raw
rename to milena/doc/examples/split/fill-imageif-cfun-3.cc.raw
diff --git a/milena/doc/examples/split/tuto3_first_routine-1.cc.raw b/milena/doc/examples/split/tuto3_first_routine-1.cc.raw
index 4470aa7..3e66206 100644
--- a/milena/doc/examples/split/tuto3_first_routine-1.cc.raw
+++ b/milena/doc/examples/split/tuto3_first_routine-1.cc.raw
@@ -1,3 +1,26 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/dmorph/image_if.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/data/fill.hh>
+
+#include <mln/labeling/blobs.hh>
+#include <mln/labeling/compute.hh>
+#include <mln/labeling/blobs.hh>
+
+#include <mln/data/compare.hh>
+
+#include <mln/util/array.hh>
+
+#include <mln/value/label_8.hh>
+
+#include <mln/accu/math/count.hh>
+
+#include <mln/pw/all.hh>
+
+#include <tests/data.hh>
+#include <doc/tools/sample_utils.hh>
+
namespace mln
{
@@ -17,7 +40,9 @@ namespace mln
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
- count = labeling::compute(accu::meta::math::count(), lbl, nlabels);
+ count = labeling::compute(accu::meta::math::count(),
+ lbl,
+ nlabels);
mln_concrete(I) output;
initialize(output, ima);
@@ -25,7 +50,8 @@ namespace mln
for (unsigned i = 1; i <= nlabels; ++i)
if (count[i] < 10u)
- data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(), literal::zero);
+ data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(),
+ literal::zero);
trace::exiting("my_algorithm");
return output;
diff --git a/milena/doc/examples/split/tuto3_first_routine-5.cc.raw b/milena/doc/examples/split/tuto3_first_routine-5.cc.raw
index 3d16132..846e805 100644
--- a/milena/doc/examples/split/tuto3_first_routine-5.cc.raw
+++ b/milena/doc/examples/split/tuto3_first_routine-5.cc.raw
@@ -2,4 +2,6 @@
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
- count = labeling::compute(accu::meta::math::count(), lbl, nlabels);
+ count = labeling::compute(accu::meta::math::count(),
+ lbl,
+ nlabels);
diff --git a/milena/doc/examples/split/tuto3_first_routine-7.cc.raw b/milena/doc/examples/split/tuto3_first_routine-7.cc.raw
index 7a9c927..71c730c 100644
--- a/milena/doc/examples/split/tuto3_first_routine-7.cc.raw
+++ b/milena/doc/examples/split/tuto3_first_routine-7.cc.raw
@@ -1,3 +1,4 @@
for (unsigned i = 1; i <= nlabels; ++i)
if (count[i] < 10u)
- data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(), literal::zero);
+ data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(),
+ literal::zero);
diff --git a/milena/doc/examples/split/tuto4_genericity_and_algorithms-2.cc.raw b/milena/doc/examples/split/tuto4_genericity_and_algorithms-2.cc.raw
index edae3e8..2c08459 100644
--- a/milena/doc/examples/split/tuto4_genericity_and_algorithms-2.cc.raw
+++ b/milena/doc/examples/split/tuto4_genericity_and_algorithms-2.cc.raw
@@ -1 +1 @@
- box2d roi = make::box2d(20, 20, 40, 40);
+ box2d roi = make::box2d(20, 20, 39, 39);
diff --git a/milena/doc/examples/tuto3/first_routine.cc b/milena/doc/examples/tuto3/first_routine.cc
index 7b0725b..609fd4e 100644
--- a/milena/doc/examples/tuto3/first_routine.cc
+++ b/milena/doc/examples/tuto3/first_routine.cc
@@ -1,5 +1,7 @@
-/// \file doc/examples/tuto3/first_routine.cc
+/// \file
+/// \brief First generic routine.
+// \{
#include <mln/core/image/image2d.hh>
#include <mln/core/image/dmorph/image_if.hh>
#include <mln/core/alias/neighb2d.hh>
@@ -23,7 +25,6 @@
#include <tests/data.hh>
#include <doc/tools/sample_utils.hh>
-// \{
namespace mln
{
@@ -43,7 +44,9 @@ namespace mln
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
- count = labeling::compute(accu::meta::math::count(), lbl, nlabels);
+ count = labeling::compute(accu::meta::math::count(),
+ lbl,
+ nlabels);
mln_concrete(I) output;
initialize(output, ima);
@@ -51,7 +54,8 @@ namespace mln
for (unsigned i = 1; i <= nlabels; ++i)
if (count[i] < 10u)
- data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(), literal::zero);
+ data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(),
+ literal::zero);
trace::exiting("my_algorithm");
return output;
@@ -88,7 +92,9 @@ namespace sandbox
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
- count = labeling::compute(accu::meta::math::count(), lbl, nlabels);
+ count = labeling::compute(accu::meta::math::count(),
+ lbl,
+ nlabels);
// \}
// \{
@@ -100,7 +106,8 @@ namespace sandbox
// \{
for (unsigned i = 1; i <= nlabels; ++i)
if (count[i] < 10u)
- data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(), literal::zero);
+ data::fill((output | (pw::value(lbl) == pw::cst(i))).rw(),
+ literal::zero);
// \}
// \{
diff --git a/milena/doc/examples/tuto4_genericity_and_algorithms.cc b/milena/doc/examples/tuto4_genericity_and_algorithms.cc
index b906a60..78237a4 100644
--- a/milena/doc/examples/tuto4_genericity_and_algorithms.cc
+++ b/milena/doc/examples/tuto4_genericity_and_algorithms.cc
@@ -81,7 +81,7 @@ int main()
image2d<value::rgb8> lena_bak = duplicate(lena);
// \{
- box2d roi = make::box2d(20, 20, 40, 40);
+ box2d roi = make::box2d(20, 20, 39, 39);
// \}
// \{
data::fill((lena | roi).rw(), literal::green);
diff --git a/milena/doc/figures/figures.mk b/milena/doc/figures/figures.mk
index 1ae617c..38fc1d1 100644
--- a/milena/doc/figures/figures.mk
+++ b/milena/doc/figures/figures.mk
@@ -8,11 +8,11 @@ figures/extend-4.ppm \
figures/extend-5.ppm \
figures/fill-1.ppm \
figures/fill-2.ppm \
+figures/fill-imageif-cfun-1.ppm \
figures/fill-subdomain-1.pbm \
figures/fill-subdomain-2.ppm \
figures/fill-subdomain-3.ppm \
figures/fill-subdomain-4.ppm \
-figures/fill-subimage-cfun-1.ppm \
figures/ima2d-rot-1.ppm \
figures/ima2d-rot-2.ppm \
figures/ima_save.pbm \
diff --git a/milena/doc/figures/fill-subimage-cfun-1.ppm b/milena/doc/figures/fill-imageif-cfun-1.ppm
similarity index 100%
rename from milena/doc/figures/fill-subimage-cfun-1.ppm
rename to milena/doc/figures/fill-imageif-cfun-1.ppm
diff --git a/milena/doc/outputs/fill-subimage-cfun.txt b/milena/doc/outputs/fill-imageif-cfun.txt
similarity index 100%
rename from milena/doc/outputs/fill-subimage-cfun.txt
rename to milena/doc/outputs/fill-imageif-cfun.txt
diff --git a/milena/doc/outputs/outputs.mk b/milena/doc/outputs/outputs.mk
index 88f892b..ac71800 100644
--- a/milena/doc/outputs/outputs.mk
+++ b/milena/doc/outputs/outputs.mk
@@ -10,10 +10,10 @@ outputs/estim-sites.txt \
outputs/extend.txt \
outputs/extension-ignore.txt \
outputs/fill-call-1.txt \
+outputs/fill-imageif-cfun.txt \
outputs/fill-part-image.txt \
outputs/fill-subdomain-shorter.txt \
outputs/fill-subdomain.txt \
-outputs/fill-subimage-cfun.txt \
outputs/fill.txt \
outputs/first_routine.txt \
outputs/forall-piter.txt \
diff --git a/milena/doc/ref_guide/ref_guide.tex b/milena/doc/ref_guide/ref_guide.tex
index 4acf619..d978d3e 100644
--- a/milena/doc/ref_guide/ref_guide.tex
+++ b/milena/doc/ref_guide/ref_guide.tex
@@ -249,6 +249,7 @@ Before writing your first program, please be aware of these hints:
\begin{verbatim}
$ g++ -DNDEBUG -Ipath/to/mln my_program.cc
\end{verbatim}
+%$
\item If you decide to use optimization flags to compile for debugging,
prefer using \code{-O1}. It is much faster to compile and it gives good
@@ -256,6 +257,17 @@ $ g++ -DNDEBUG -Ipath/to/mln my_program.cc
\end{itemize}
+
+%====================================
+\clearpage
+\newpage
+\doxychapter{concepts}{Concepts}
+
+
+
+
+
+
%====================================
\clearpage
\newpage
@@ -309,7 +321,7 @@ Name & Description \\
\hline
\type{point2d} & 2D point on a regular grid \\
\type{point} & Generic point ($n$D) on a regular grid \\
-\type{util::vec} & Algebraic vector \\
+\type{algebra::vec} & Algebraic vector \\
\type{util::vertex} & Graph vertex \\
\type{util::edge} & Graph edge \\
\end{tabular}
@@ -488,8 +500,8 @@ Value type & underlying data type \\
\type{int\_u8} & \type{unsigned char} \\
\type{int\_u16} & \type{unsigned short} \\
\type{int\_u32} & \type{unsigned int} \\
-\type{rgb16} & \type{mln::util::vec$<$unsigned short$>$} \\
-\type{rgb8} & \type{mln::util::vec$<$unsigned char$>$} \\
+\type{rgb16} & \type{mln::algebra::vec$<$unsigned short$>$} \\
+\type{rgb8} & \type{mln::algebra::vec$<$unsigned char$>$} \\
\end{tabular} \\
@@ -1499,7 +1511,7 @@ Output:
Then, use \code{labeling::compute()} with the bbox accumulator:
\doxycode[3]{labeling-compute}
-\code{labeling::compute()} hold an accumulator for each component, which means it
+\code{labeling::compute()} holds an accumulator for each component, which means it
returns an array of accumulator results.
In this case, it returns an array of \type{box2d}.
@@ -1619,14 +1631,14 @@ In this example, the image is restricted to its odd lines. A new image is
created in which odd lines are in red and others in black.
Here is the simple C function used as predicate:
-\doxycode[1]{fill-subimage-cfun}
+\doxycode[1]{fill-imageif-cfun}
Restrict the image with it:
-\doxycode[3]{fill-subimage-cfun}
+\doxycode[3]{fill-imageif-cfun}
Output:
\begin{center}
-\doxyfigure[1]{fill-subimage-cfun}{3cm}
+\doxyfigure[1]{fill-imageif-cfun}{3cm}
\end{center}
%
\medskip
@@ -1827,10 +1839,10 @@ Output:
Name & Description & Possible values \\
\hline
literal::zero & Generic zero value. Can be used with various types such as
-util::vec, dpoint\dots & n.a.\\
+algebra::vec, dpoint\dots & n.a.\\
& & \\
literal::one & Generic one value. Can be used with various types such as
-util::vec, dpoint\dots & n.a.\\
+algebra::vec, dpoint\dots & n.a.\\
& & \\
literal::origin & Generic value for the origin point on a grid.& n.a.\\
& & \\
diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex
index 407c982..7ddbb60 100644
--- a/milena/doc/tutorial/tutorial.tex
+++ b/milena/doc/tutorial/tutorial.tex
@@ -116,23 +116,27 @@ Therefore it is not possible to present all the functionalities in a
tutorial.
-Milena targets several audiences: \textit{end users}, \textit{designers} and
-\textit{providers}. \textit{End users} want to apply and assemble algorithms
-to solve image processing, pattern recognition or computer vision problems,
-\textit{designers} build new algorithms and \textit{providers} are interested
-in developing their own data structures and extend an existing library.
+Milena targets several audiences: \textit{assemblers},
+\textit{designers}, \textit{providers} and
+\textit{architects}. \textit{Assemblers} want to apply and assemble
+algorithms to solve image processing, pattern recognition or computer
+vision problems, \textit{designers} build new algorithms,
+\textit{providers} are interested in developing their own data
+structures and extend an existing library and \textit{architects} are
+basically developpers extending the core library.
-Whatever the kind of user you are, the key to learning how to use Milena is to
-become familiar with its palette of objects and the way of combining them.
+Whatever the kind of user you are, the key to learning how to use
+Milena is to become familiar with its palette of objects and the way
+of combining them.
-As an \textit{end user}, you may start with this simple tutorial and the Quick
+As an \textit{assemblers}, you may start with this simple tutorial and the Quick
tour \tofix{ref}. They describe and illustrate the key features of the library.
-\textit{End users} getting familiar with Milena and \textit{designers}, should
+\textit{Assemblers} getting familiar with Milena and \textit{designers}, should
take a look at the Quick Reference Guide \tofix{ref!}.
It is a more detailed explanations of the library's features.
-\textit{end users} and \textit{designers} may be also interested by all the
+\textit{Assemblers} and \textit{designers} may be also interested by all the
examples provided with the documentation and the tutorial. The source code is
available in \hpath{milena/doc/examples} \tofix{ref} and is usually pointed
out and commented by the documentation.
@@ -256,17 +260,17 @@ Once downloaded, you just need to uncompress the archive.
For the '.tar.gz' archive:
\begin{verbatim}
-$ tar zxvf olena-1.0.tar.gz
+$ tar zxvf olena.tar.gz
\end{verbatim}
For the '.tar.bz2' archive:
\begin{verbatim}
-$ tar jxvf olena-1.0.tar.bz2
+$ tar jxvf olena.tar.bz2
\end{verbatim}
Then, enter the new created directory:
\begin{verbatim}
-$ cd olena-1.0
+$ cd olena
\end{verbatim}
@@ -439,7 +443,7 @@ This tutorial is not the only documentation of Milena. Other documents are avail
functionalities of Milena.
Hints and full examples are also provided. The sample codes are commented
and each concept in the library is detailed. This is the reference document for any
- \textit{end user} and \textit{algorithm designer}.
+ \textit{assembler} and \textit{algorithm designer}.
\item \dir{HTML user doc} --- The full documentation of the library. The full
API is described in details. Each part of the library is classified by
@@ -603,7 +607,7 @@ script before configuring the build directory.
Run the following:
\begin{verbatim}
-$ cd /my/path/to/olena-1.0
+$ cd /my/path/to/olena
$ ./bootstrap
\end{verbatim}
@@ -619,7 +623,7 @@ When it's done, you are ready to configure the build directory.
First, make sure you are at the root directory of the milena source:
\begin{verbatim}
-$ cd /my/path/to/olena-1.0
+$ cd /my/path/to/olena
\end{verbatim}
First, create and enter a build directory:
@@ -632,6 +636,9 @@ We are now about to configure the build directory. This process will create
the necessary files to compile documentation, examples and tools and prepare the
installation.
+Note that once the configuration ends the build directory cannot be
+moved elsewhere without following the following steps again.
+
\textbf{Important Note}: the installation path prefix must be chosen at this step.
By default, Milena will be installed in /usr/local but you may like to install
it elsewhere. To do so, pass the option \textit{-{}-prefix=/installation/path/prefix}
@@ -674,7 +681,7 @@ First, be sure to be in the build directory. If you followed the previous
steps, the build directory should be in the Milena sources root directory.
\begin{verbatim}
-$ cd /my/path/to/olena-1.0/build
+$ cd /my/path/to/olena/build
\end{verbatim}
If you did not change the default install path prefix, set to
@@ -716,14 +723,14 @@ Examples are part of the documentation. The sources are located in
To compile the examples simply run:
\begin{verbatim}
-$ cd /my/path/to/olena-1.0/build/milena/doc/examples
+$ cd /my/path/to/olena/build/milena/doc/examples
$ make
\end{verbatim}
These examples can produce outputs and images. May be you would like
to run all the examples and take a look at the outputs? To do so, run:
\begin{verbatim}
-$ cd /my/path/to/olena-1.0/build/milena/doc/examples
+$ cd /my/path/to/olena/build/milena/doc/examples
$ make examples
\end{verbatim}
@@ -751,7 +758,7 @@ seed2tiling.cc & \tofix{description} \\
To build these tools, run:
\begin{verbatim}
-$ cd /my/path/to/olena-1.0/build/milena/tools
+$ cd /my/path/to/olena/build/milena/tools
$ make
\end{verbatim}
@@ -764,7 +771,7 @@ extending the library.
In order to build and run it, just do the following:
\begin{verbatim}
-$ cd /my/path/to/olena-1.0/build/milena/tests
+$ cd /my/path/to/olena/build/milena/tests
$ make check
\end{verbatim}
@@ -783,6 +790,7 @@ In the installation path prefix, Milena's files are located in:
\item include/mln/ --- The library. All the headers are located here.
\item share/olena/images --- Mesh sample files which may be used with
example programs.
+ \item share/olena/doc --- HTML and PDF documentation.
\end{itemize}
\vspace{2cm}
@@ -810,6 +818,9 @@ implementation would look like this one:
\doxyrawcode{tuto3/fill_non_generic}
+See milena/doc/examples/tuto3/fill\_non\_generic.cc.
+
+
In this example, there are a lot of \B{implicit} assumptions about the input:
\begin{itemize}
\item The input image has to be 2D;
@@ -1147,7 +1158,7 @@ then the image itself which stores the values.
%**************************
-\doxysection{tuto4images}{Sites}
+\doxysection{tuto4sites}{Sites}
A pixel is an element having both information, localization and
value. In Milena, we make a difference between a pixel, a pixel value and a pixel
@@ -1158,12 +1169,14 @@ For instance, in an image defined on a 2D regular grid, it is a 2D point with
\doxycode{tuto4_point2d}
-The image site type is defined by its underlying site set.
+Output:
+\doxyoutput{tuto4_point2d}
+The image site type is defined by its underlying site set.
%**************************
-\doxysection{tuto4images}{Site sets}
+\doxysection{tuto4sitesets}{Site sets}
Site sets are mainly used to define image domains. They hold all the available
sites in an image, consequently they do not store any values.
@@ -1181,7 +1194,36 @@ A list of available site sets is available in section \ref{siteset}.
In this section, we will detail how to create common site sets.
-This is actually simple.
+The most used site set is \type{mln::box}. The main reason is that
+common images have this kind of domain. Since it is a plain set only
+two sites are needed to define a box: the top left corner, \var{pmin},
+and the bottom right corner, \var{pmax}.
+
+By default, \var{pmin} is set to \val{(0,0)} so a box can be
+constructed from given \var{pmax} coordinates:
+
+\doxycode[1]{tuto4_site_set_create}
+
+This box is defined from \val{(0,0)} to \val{(4,4)} :
+
+\doxymoutput[1]{tuto4_site_set_create}
+
+A box can also starts from a site different from \val{(0,0)}.
+
+\doxycode[4]{tuto4_site_set_create}
+
+This box is defined from \val{(0,0)} to \val{(4,4)} :
+
+\doxymoutput[3]{tuto4_site_set_create}
+
+
+Another common site set is \type{p\_array}. It contains only sites which have been added to it.
+
+\doxycode[2]{tuto4_site_set_create}
+
+This site only contains :
+
+\doxymoutput[2]{tuto4_site_set_create}
%--------------------------
@@ -1206,6 +1248,8 @@ In this section, we will detail how to create common images.
%--------------------------
\doxysubsection{tuto4accessdata}{Accessing data}
+
+
\vspace{2cm}
\begin{center}
\tutotoc{tuto3}{tuto5}
--
1.5.6.5
1
0
* mln/core/concept/image.hh: Always include data/compare.hh.
* tests/Makefile.am,
* tests/core/other/graph_elt_neighborhood.cc,
* mln/core/site_set/p_vertices.hh,
* mln/core/site_set/p_vertices_psite.hh,
* mln/core/internal/image_base.hh,
* mln/core/internal/site_iterator_base.hh: Revamp header.
* mln/core/site_set/p_array.hh: Add 'resize' member.
* mln/draw/line.hh: Make a warning more explicit.
* mln/fun/accu_result.hh: Fix guards.
* mln/labeling/superpose.hh: Add missing includes.
* mln/morpho/opening/all.hh: Reindent.
* mln/util/array.hh: Fix an invalid return type in obj_().
* mln/util/vertex.hh: Add a missing precondition.
* mln/value/lut_vec.hh: Fix wrong documentation.
---
milena/ChangeLog | 29 +++++++++++++++++++++
milena/mln/core/concept/image.hh | 1 +
milena/mln/core/internal/image_base.hh | 3 +-
milena/mln/core/internal/site_iterator_base.hh | 3 +-
milena/mln/core/site_set/p_array.hh | 14 +++++++++-
milena/mln/core/site_set/p_vertices.hh | 4 +-
milena/mln/core/site_set/p_vertices_psite.hh | 13 +++++++--
milena/mln/draw/line.hh | 9 ++++--
milena/mln/fun/accu_result.hh | 5 ++-
milena/mln/labeling/superpose.hh | 2 +
milena/mln/morpho/opening/all.hh | 15 +++++------
milena/mln/util/array.hh | 14 ++++++---
milena/mln/util/vertex.hh | 4 ++-
milena/mln/value/lut_vec.hh | 6 ++--
milena/tests/Makefile.am | 3 +-
milena/tests/core/other/graph_elt_neighborhood.cc | 3 +-
16 files changed, 96 insertions(+), 32 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 5f80dc6..1d123b0 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,32 @@
+2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Small fixes.
+
+ * mln/core/concept/image.hh: Always include data/compare.hh.
+
+ * tests/Makefile.am,
+ * tests/core/other/graph_elt_neighborhood.cc,
+ * mln/core/site_set/p_vertices.hh,
+ * mln/core/site_set/p_vertices_psite.hh,
+ * mln/core/internal/image_base.hh,
+ * mln/core/internal/site_iterator_base.hh: Revamp header.
+
+ * mln/core/site_set/p_array.hh: Add 'resize' member.
+
+ * mln/draw/line.hh: Make a warning more explicit.
+
+ * mln/fun/accu_result.hh: Fix guards.
+
+ * mln/labeling/superpose.hh: Add missing includes.
+
+ * mln/morpho/opening/all.hh: Reindent.
+
+ * mln/util/array.hh: Fix an invalid return type in obj_().
+
+ * mln/util/vertex.hh: Add a missing precondition.
+
+ * mln/value/lut_vec.hh: Fix wrong documentation.
+
2009-08-17 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Some changes to help Edwin find a bug.
diff --git a/milena/mln/core/concept/image.hh b/milena/mln/core/concept/image.hh
index 8c620bc..6c0d860 100644
--- a/milena/mln/core/concept/image.hh
+++ b/milena/mln/core/concept/image.hh
@@ -47,6 +47,7 @@
# include <mln/tag/init.hh>
+# include <mln/data/compare.hh>
namespace mln
{
diff --git a/milena/mln/core/internal/image_base.hh b/milena/mln/core/internal/image_base.hh
index 8975256..f1ba4f9 100644
--- a/milena/mln/core/internal/image_base.hh
+++ b/milena/mln/core/internal/image_base.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
diff --git a/milena/mln/core/internal/site_iterator_base.hh b/milena/mln/core/internal/site_iterator_base.hh
index e5fd07d..4f45287 100644
--- a/milena/mln/core/internal/site_iterator_base.hh
+++ b/milena/mln/core/internal/site_iterator_base.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
diff --git a/milena/mln/core/site_set/p_array.hh b/milena/mln/core/site_set/p_array.hh
index 27c739b..218a95a 100644
--- a/milena/mln/core/site_set/p_array.hh
+++ b/milena/mln/core/site_set/p_array.hh
@@ -145,6 +145,9 @@ namespace mln
/// Clear this set.
void clear();
+ /// Update the size of this array.
+ void resize(size_t size);
+
/// Return the \p i-th site (constant).
const P& operator[](unsigned i) const;
@@ -211,7 +214,7 @@ namespace mln
bool is_valid() const;
operator util::index() const;
- operator int() const; // To interoperate, e.g., with fun::i2v expecting an int.
+ operator int() const; // To interoperate, e.g., with fun::i2v expecting an int.
operator unsigned() const; // To avoid ambiguity when an unsigned is expected.
void update_() const;
@@ -437,6 +440,15 @@ namespace mln
template <typename P>
inline
+ void
+ p_array<P>::resize(size_t size)
+ {
+ mln_precondition(size >= 0);
+ vect_.resize(size);
+ }
+
+ template <typename P>
+ inline
const P&
p_array<P>::operator[](unsigned i) const
{
diff --git a/milena/mln/core/site_set/p_vertices.hh b/milena/mln/core/site_set/p_vertices.hh
index ddb6a7c..c8497c0 100644
--- a/milena/mln/core/site_set/p_vertices.hh
+++ b/milena/mln/core/site_set/p_vertices.hh
@@ -1,5 +1,5 @@
-
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
diff --git a/milena/mln/core/site_set/p_vertices_psite.hh b/milena/mln/core/site_set/p_vertices_psite.hh
index 8249f74..320796f 100644
--- a/milena/mln/core/site_set/p_vertices_psite.hh
+++ b/milena/mln/core/site_set/p_vertices_psite.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -38,9 +39,14 @@
namespace mln
{
- // Forward declaration.
+ // Forward declarations.
template <typename G, typename F> class p_vertices;
- namespace internal { template <typename Subject, typename E> struct subject_impl; }
+ namespace internal
+ {
+
+ template <typename Subject, typename E> struct subject_impl;
+
+ }
template <typename G, typename F>
@@ -187,6 +193,7 @@ namespace mln
} // end of namespace mln::internal
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
diff --git a/milena/mln/draw/line.hh b/milena/mln/draw/line.hh
index 74445be..f5cbffb 100644
--- a/milena/mln/draw/line.hh
+++ b/milena/mln/draw/line.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -73,8 +74,10 @@ namespace mln
{
I& ima = exact(ima_);
mln_precondition(ima.is_valid());
- if (! ima.has(beg) || ! ima.has(end))
- trace::warning("Begin or end site is not part of the given image.");
+ if (! ima.has(beg))
+ trace::warning("Begin site is not part of the given image.");
+ if (! ima.has(end))
+ trace::warning("End site is not part of the given image.");
data::paste(pw::cst(v) | p_line2d(beg, end),
safe(ima).rw());
}
diff --git a/milena/mln/fun/accu_result.hh b/milena/mln/fun/accu_result.hh
index da36fc2..77bf47a 100644
--- a/milena/mln/fun/accu_result.hh
+++ b/milena/mln/fun/accu_result.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -66,4 +67,4 @@ namespace mln
} // end of namespace mln
-#endif /* ! MLN_FUN_ACCU_RESULT_HH */
+#endif // ! MLN_FUN_ACCU_RESULT_HH
diff --git a/milena/mln/labeling/superpose.hh b/milena/mln/labeling/superpose.hh
index 2054649..7d0b3e3 100644
--- a/milena/mln/labeling/superpose.hh
+++ b/milena/mln/labeling/superpose.hh
@@ -34,6 +34,8 @@
# include <mln/core/concept/image.hh>
# include <mln/util/array.hh>
# include <mln/labeling/relabel.hh>
+# include <mln/data/paste.hh>
+# include <mln/pw/all.hh>
namespace mln
{
diff --git a/milena/mln/morpho/opening/all.hh b/milena/mln/morpho/opening/all.hh
index 7092503..ccfd1d5 100644
--- a/milena/mln/morpho/opening/all.hh
+++ b/milena/mln/morpho/opening/all.hh
@@ -31,13 +31,12 @@
/// File that includes all opening operators.
-#include <mln/morpho/opening/algebraic.hh>
-#include <mln/morpho/opening/area.hh>
-#include <mln/morpho/opening/area_on_vertices.hh>
-#include <mln/morpho/opening/height.hh>
-#include <mln/morpho/opening/leveling.hh>
-#include <mln/morpho/opening/structural.hh>
-#include <mln/morpho/opening/volume.hh>
-
+# include <mln/morpho/opening/algebraic.hh>
+# include <mln/morpho/opening/area.hh>
+# include <mln/morpho/opening/area_on_vertices.hh>
+# include <mln/morpho/opening/height.hh>
+# include <mln/morpho/opening/leveling.hh>
+# include <mln/morpho/opening/structural.hh>
+# include <mln/morpho/opening/volume.hh>
#endif // ! MLN_MORPHO_OPENING_ALL_HH
diff --git a/milena/mln/util/array.hh b/milena/mln/util/array.hh
index d94534d..b9f4798 100644
--- a/milena/mln/util/array.hh
+++ b/milena/mln/util/array.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -223,6 +224,7 @@ namespace mln
array_fwd_iter<T> >
{
public:
+ typedef typename array<T>::ro_result subj_t;
/// Constructors
/// @{
@@ -252,7 +254,7 @@ namespace mln
T element() const;
// As a Proxy.
- T subj_();
+ subj_t subj_();
/// Give the current index.
unsigned index_() const;
@@ -273,6 +275,8 @@ namespace mln
array_bkd_iter<T> >
{
public:
+ typedef typename array<T>::ro_result subj_t;
+
/// Constructors
/// @{
/// Constructor without argument.
@@ -301,7 +305,7 @@ namespace mln
T element() const;
// As a Proxy.
- T subj_();
+ subj_t subj_();
/// Give the current index.
unsigned index_() const;
@@ -639,7 +643,7 @@ namespace mln
template <typename T>
inline
- T
+ typename array_fwd_iter<T>::subj_t
array_fwd_iter<T>::subj_()
{
mln_precondition(is_valid());
@@ -733,7 +737,7 @@ namespace mln
template <typename T>
inline
- T
+ typename array_bkd_iter<T>::subj_t
array_bkd_iter<T>::subj_()
{
mln_precondition(is_valid());
diff --git a/milena/mln/util/vertex.hh b/milena/mln/util/vertex.hh
index f6bece5..e1a151c 100644
--- a/milena/mln/util/vertex.hh
+++ b/milena/mln/util/vertex.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -327,6 +328,7 @@ namespace mln
void
vertex<G>::change_graph(const G& g)
{
+ mln_precondition(g.is_valid());
g_ = g;
}
diff --git a/milena/mln/value/lut_vec.hh b/milena/mln/value/lut_vec.hh
index 58379d7..7886dc1 100644
--- a/milena/mln/value/lut_vec.hh
+++ b/milena/mln/value/lut_vec.hh
@@ -95,15 +95,15 @@ namespace mln
/// Constructors
/// @{
- /// Constructor from a Site_set and any Function_v2v.
+ /// Constructor from a value set and any Function_v2v.
template <typename F>
lut_vec(const S& vset, const Function_v2v<F>& f);
- /// Constructor from a Site_set and any fun::i2v::array.
+ /// Constructor from a value set and any fun::i2v::array.
template <typename V>
lut_vec(const S& vset, const Function_v2v< fun::i2v::array<V> >& f);
- /// Constructor from a Site_set and any util::array.
+ /// Constructor from a value set and any util::array.
template <typename V>
lut_vec(const S& vset, const Function_v2v< util::array<V> >& f);
/// @}
diff --git a/milena/tests/Makefile.am b/milena/tests/Makefile.am
index b4acaa9..39987d0 100644
--- a/milena/tests/Makefile.am
+++ b/milena/tests/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+# Laboratory (LRDE).
#
# This file is part of Olena.
#
diff --git a/milena/tests/core/other/graph_elt_neighborhood.cc b/milena/tests/core/other/graph_elt_neighborhood.cc
index 40b8cea..7206d92 100644
--- a/milena/tests/core/other/graph_elt_neighborhood.cc
+++ b/milena/tests/core/other/graph_elt_neighborhood.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
--
1.5.6.5
1
0
19 Aug '09
---
scribo/ChangeLog | 8 ++++++--
scribo/src/Makefile.am | 18 ++++++++++++++----
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 4cabf03..4aab740 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,11 +1,15 @@
2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * src/Makefile.am: Link 'recognition' example to libtiff.
+
+2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Fix generation of headers.mk in Scribo.
- * scribo/Makefile.am: Add new arguments to
+ * Makefile.am: Add new arguments to
generate_dist_headers.sh.
- * scribo/headers.mk: Update.
+ * headers.mk: Update.
2009-08-17 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
diff --git a/scribo/src/Makefile.am b/scribo/src/Makefile.am
index a7b6289..a7a5259 100644
--- a/scribo/src/Makefile.am
+++ b/scribo/src/Makefile.am
@@ -62,9 +62,19 @@ table_rebuild_rank_SOURCES = table_rebuild_rank.cc
text_in_photo_SOURCES = text_in_photo.cc
thin_bboxes_SOURCES = thin_bboxes.cc
+
if HAVE_TESSERACT
- bin_PROGRAMS += recognition
- recognition_SOURCES = recognition.cc
- recognition_CPPFLAGS = $(AM_CPPFLAGS) $(TESSERACT_CPPFLAGS)
- recognition_LDFLAGS = $(AM_LDFLAGS) $(TESSERACT_LDFLAGS) -lpthread
+if HAVE_TIFF
+
+ bin_PROGRAMS += recognition
+ recognition_SOURCES = recognition.cc
+ recognition_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(TESSERACT_CPPFLAGS) \
+ $(TIFF_CPPFLAGS)
+ recognition_LDFLAGS = $(AM_LDFLAGS) \
+ $(TESSERACT_LDFLAGS) \
+ $(TIFF_LDFLAGS) \
+ -lpthread
+
+endif HAVE_TIFF
endif HAVE_TESSERACT
--
1.5.6.5
1
0
* scribo/Makefile.am: Add new arguments to
generate_dist_headers.sh.
* scribo/headers.mk: Update.
---
scribo/ChangeLog | 9 +++++++++
scribo/Makefile.am | 4 ++--
scribo/headers.mk | 12 ++++++++++--
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index fc68e94..4cabf03 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,12 @@
+2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Fix generation of headers.mk in Scribo.
+
+ * scribo/Makefile.am: Add new arguments to
+ generate_dist_headers.sh.
+
+ * scribo/headers.mk: Update.
+
2009-08-17 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix missing qualification for left and right.
diff --git a/scribo/Makefile.am b/scribo/Makefile.am
index 4b1c5a2..3fb05fd 100644
--- a/scribo/Makefile.am
+++ b/scribo/Makefile.am
@@ -30,7 +30,7 @@ REGEN_SUBDIRS += tests
regen-am:
cd $(srcdir) \
&& $(abs_top_srcdir)/build-aux/generate_dist_headers.sh \
- . headers.mk nodist-headers
+ . headers.mk nodist-headers scribo scribo
# FIXME: Change generate_dist_headers.sh so that the action looks like this:
#
@@ -39,6 +39,6 @@ regen-am:
$(srcdir)/headers.mk: $(top_srcdir)/build-aux/generate_dist_headers.sh
cd $(srcdir) \
&& $(abs_top_srcdir)/build-aux/generate_dist_headers.sh \
- . headers.mk nodist-headers
+ . headers.mk nodist-headers scribo scribo
include $(srcdir)/headers.mk
diff --git a/scribo/headers.mk b/scribo/headers.mk
index 382343c..0aa7b35 100644
--- a/scribo/headers.mk
+++ b/scribo/headers.mk
@@ -1,6 +1,6 @@
## Generated by `generate_dist_headers.sh', do not edit by hand.
-
-nobase_include_HEADERS = \
+scribodir = $(includedir)/scribo
+nobase_scribo_HEADERS = \
./all.hh \
./binarization/simple.hh \
./core/all.hh \
@@ -32,9 +32,11 @@ nobase_include_HEADERS = \
./extract/primitive/objects.hh \
./filter/all.hh \
./filter/large_objects.hh \
+./filter/small_object_groups.hh \
./filter/small_objects.hh \
./filter/thick_objects.hh \
./filter/thin_objects.hh \
+./fun/v2b/small_objects_filter.hh \
./make/all.hh \
./make/debug_filename.hh \
./make/influence_zone_graph.hh \
@@ -63,6 +65,7 @@ nobase_include_HEADERS = \
./text/grouping/group_from_graph.hh \
./text/grouping/group_from_single_link.hh \
./text/grouping/group_with_graph.hh \
+./text/grouping/group_with_rag.hh \
./text/grouping/group_with_several_graphes.hh \
./text/grouping/group_with_several_left_links.hh \
./text/grouping/group_with_several_right_links.hh \
@@ -73,6 +76,7 @@ nobase_include_HEADERS = \
./text/grouping/internal/find_left_link.hh \
./text/grouping/internal/find_right_link.hh \
./text/grouping/internal/find_root.hh \
+./text/grouping/internal/have_link_valid.hh \
./text/grouping/internal/init_link_array.hh \
./text/grouping/internal/is_link_valid.hh \
./text/grouping/internal/update_graph_link.hh \
@@ -80,3 +84,7 @@ nobase_include_HEADERS = \
./text/recognition.hh \
./util/all.hh \
./util/text.hh
+
+#<<lrde
+nobase_scribo_HEADERS +=
+#>>
--
1.5.6.5
1
0
19 Aug '09
* bootstrap: Add new arguments to generate_dist_headers.sh
* build-aux/generate_dist_headers.sh: Allow to specify a specific
include directory.
---
ChangeLog | 9 +++++++++
bootstrap | 2 +-
build-aux/generate_dist_headers.sh | 27 +++++++++++++++++++++++----
3 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 49781e0..6a03c2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-08-19 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Install scribo headers in a specific scribo include dir.
+
+ * bootstrap: Add new arguments to generate_dist_headers.sh
+
+ * build-aux/generate_dist_headers.sh: Allow to specify a specific
+ include directory.
+
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Fix installation of non distributed files.
diff --git a/bootstrap b/bootstrap
index 53bf1c2..17324b4 100755
--- a/bootstrap
+++ b/bootstrap
@@ -132,7 +132,7 @@ set -x
run milena `pwd`/build-aux/generate_dist_headers.sh mln ./headers.mk ./nodist-headers
# Generate scribo/headers.mk
-run scribo `pwd`/build-aux/generate_dist_headers.sh . headers.mk nodist-headers
+run scribo `pwd`/build-aux/generate_dist_headers.sh . headers.mk nodist-headers scribo scribo
# Generate lists of files to be part of the distribution
# for the tutorial.
diff --git a/build-aux/generate_dist_headers.sh b/build-aux/generate_dist_headers.sh
index 02898b5..2cace34 100755
--- a/build-aux/generate_dist_headers.sh
+++ b/build-aux/generate_dist_headers.sh
@@ -8,8 +8,8 @@
# Use the C locale to have a deterministic sort.
export LC_ALL=C
-if [ $# -ne 3 ]; then
- echo "$0 <scanned_dir> <output> <nodist-headers>"
+if [ $# -ne 3 ] && [ $# -ne 5 ]; then
+ echo "$0 <scanned_dir> <output> <nodist-headers> [<module name> <inc_path>]"
exit 1
fi
@@ -22,11 +22,21 @@ test -f "$nodist_headers" \
echo "Generating $output..." >&2
rm -f "$output"
-cat <<EOF > "$output"
+
+if [ $# -eq 5 ]; then
+ cat <<EOF > "$output"
+## Generated by \`$me', do not edit by hand.
+$4dir = \$(includedir)/$5
+nobase_$4_HEADERS = \\
+EOF
+else
+ cat <<EOF > "$output"
## Generated by \`$me', do not edit by hand.
nobase_include_HEADERS = \\
EOF
+fi
+
find $scanned_dir -type f -a \( -name '*.hh' -o -name '*.hxx' \) \
| sort \
@@ -44,10 +54,19 @@ echo $last_line >> $output # put the cleaned last line back.
#
# Non distributed headers will be installed if the installation
# process is launched from the repository copy.
-cat <<EOF >> "$output"
+if [ $# -eq 5 ]; then
+ cat <<EOF >> "$output"
+
+#<<lrde
+nobase_$4_HEADERS += \\
+EOF
+else
+ cat <<EOF >> "$output"
+
#<<lrde
nobase_include_HEADERS += \\
EOF
+fi
cat $nodist_headers | sed -e 's/$/ \\/g' >> $output
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Some changes to help Edwin find a bug.
* mln/core/site_set/p_queue_fast.hh (has): De-activate invariant
to help Edwin debugging.
* mln/core/internal/graph_psite_base.hh
(local_change_graph): New.
(change_target): Call local_change_graph so that the target
changes when site_ and elt_ are the same, i.e., psite is site,
that is, a vertex or an edge.
* mln/morpho/tree/data.hh: Add debugging code.
* mln/util/internal/graph_base.hh (data_hook_): New.
* mln/util/edge.hh (change_target): New; is it really useful?
core/internal/graph_psite_base.hh | 18 +++++++++++++++++-
core/site_set/p_queue_fast.hh | 2 +-
morpho/tree/data.hh | 27 ++++++++++++++++++++++++---
util/edge.hh | 15 +++++++++++++++
util/internal/graph_base.hh | 11 ++++++++++-
5 files changed, 67 insertions(+), 6 deletions(-)
Index: mln/core/site_set/p_queue_fast.hh
--- mln/core/site_set/p_queue_fast.hh (revision 4368)
+++ mln/core/site_set/p_queue_fast.hh (working copy)
@@ -202,7 +202,7 @@
if (p.index() < 0 || unsigned(p.index()) >= nsites())
return false;
// The type of rhs below is mln_site(p_array<P>).
- mln_invariant(p.to_site() == (*this)[p.index()]);
+// mln_invariant(p.to_site() == (*this)[p.index()]);
return true;
}
Index: mln/core/internal/graph_psite_base.hh
--- mln/core/internal/graph_psite_base.hh (revision 4368)
+++ mln/core/internal/graph_psite_base.hh (working copy)
@@ -216,13 +216,29 @@
update_id(id);
}
+ // The lines below are dedicated/local to this file.
+ template <typename E, typename S, typename G>
+ inline
+ void local_change_graph(E& elt_, S& site_, const G& g)
+ {
+ elt_.change_graph(g);
+ }
+ template <typename E, typename G>
+ inline
+ void local_change_graph(E& elt_, E& site_, const G& g)
+ {
+ elt_.change_graph(g);
+ site_.change_graph(g);
+ }
+ // End of local stuff.
+
template <typename S, typename E>
inline
void
graph_psite_base<S,E>::change_target(const S& new_target)
{
s_ = & new_target;
- elt_.change_graph(new_target.graph());
+ local_change_graph(elt_, site_, new_target.graph());
}
template <typename S, typename E>
Index: mln/morpho/tree/data.hh
--- mln/morpho/tree/data.hh (revision 4368)
+++ mln/morpho/tree/data.hh (working copy)
@@ -434,8 +434,19 @@
mln_rvalue_(mln_ch_value(I, mln_psite(I)))
data<I,S>::parent(const mln_psite(I)& p) const
{
- mln_precondition(is_valid());
- mln_precondition(parent_.domain().has(p));
+ // HERE
+
+// mln_precondition(is_valid());
+// mln_rvalue(parent_t) tmp;
+// if (! parent_.domain().has(p))
+// {
+// std::cout << "KO next" << std::endl;
+// std::cout << p << std::endl;
+// std::cout << parent_.domain() << std::endl;
+// }
+// else
+// std::cout << "ok next" << std::endl;
+// mln_precondition(parent_.domain().has(p));
return parent_(p);
}
@@ -647,10 +658,20 @@
return;
mln_invariant(p_.is_valid());
+ std::cout << "children(p).size = " << s_->children(p_).nsites() << std::endl;
+ if (s_->children(p_).nsites() != 0)
+ {
+ std::cout << "elt[0] = " << s_->children(p_)[0].to_site().graph().data_hook_() << std::endl;
+ std::cout << "elt[0] = " << s_->children(p_)[0] << std::endl;
+ }
+
+ std::cout << s_->children(p_) << std::endl;
+
mln_fwd_piter(T::nodes_t) child(s_->children(p_));
for_all(child)
{
- mln_invariant(s_->parent(child) == p_);
+ std::cout << child.to_site().graph().data_hook_() << std::endl;
+ // mln_invariant(s_->parent(child) == p_);
stack_.push_back(child);
}
}
Index: mln/util/internal/graph_base.hh
--- mln/util/internal/graph_base.hh (revision 4368)
+++ mln/util/internal/graph_base.hh (working copy)
@@ -110,7 +110,8 @@
\param[in] ostr The output stream. */
void print_debug(std::ostream& ostr) const;
-
+ /// Hook to data; for debugging purpose.
+ const util::tracked_ptr< mln::internal::data<E> >& data_hook_() const;
protected:
@@ -234,6 +235,14 @@
<< std::endl;
}
+ template<typename E>
+ inline
+ const util::tracked_ptr< mln::internal::data<E> >&
+ graph_base<E>::data_hook_() const
+ {
+ return data_;
+ }
+
} // end of namespace mln::util::internal
} // end of namespace mln::util
Index: mln/util/edge.hh
--- mln/util/edge.hh (revision 4368)
+++ mln/util/edge.hh (working copy)
@@ -35,6 +35,8 @@
# include <mln/util/internal/edge_impl.hh>
# include <mln/core/concept/proxy.hh>
# include <mln/core/concept/site.hh>
+# include <mln/core/internal/pseudo_site_base.hh>
+
namespace mln
{
@@ -134,6 +136,7 @@
edge_id_t ith_nbh_edge(unsigned i) const;
/// \}
+
private:
G g_;
edge_id_t id_;
@@ -156,6 +159,18 @@
+ namespace if_possible
+ {
+ template <typename G>
+ void change_target(mln::util::edge<G>& e, const G& new_target)
+ {
+ std::cout << "YES: specialization change_target(edge, graph)" << std::endl;
+ e.change_graph(new_target);
+ }
+
+ } // end of namespace mln::if_possible
+
+
namespace internal
{
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Some fixes.
* edwin/exec/zi.cc: Fix nlabel missing incr.
zi.cc | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
Index: edwin/exec/zi.cc
--- edwin/exec/zi.cc (revision 4367)
+++ edwin/exec/zi.cc (working copy)
@@ -227,7 +227,8 @@
edge_image<void, value::int_u8> color_dist_ima;
{
util::array<value::rgb8> mean_colors;
- convert::from_to(labeling::compute(accu::stat::mean<value::rgb8>(), source, labels, nlabel),
+ typedef accu::stat::mean<value::rgb8, algebra::vec<3,float>, value::rgb8> A;
+ convert::from_to(labeling::compute(A(), source, labels, nlabel.next()),
mean_colors);
typedef vertex_image<void, value::rgb8, util::graph> V;
@@ -240,7 +241,7 @@
edge_image<void, float> orientation_ima;
{
util::array<mln_psite_(I)> mass_centers;
- convert::from_to(labeling::compute(accu::center<mln_psite_(I)>(), labels, nlabel),
+ convert::from_to(labeling::compute(accu::center<mln_psite_(I)>(), labels, nlabel.next()),
mass_centers);
typedef vertex_image<void, mln_psite_(I), util::graph> V;
@@ -257,20 +258,24 @@
typedef morpho::tree::data< E, p_array<mln_psite_(E)> > T;
p_array< mln_psite_(E) > s = data::sort_psites_decreasing(e_ima);
mln_ch_value_(E, bool) mask;
- T tree(e_ima, s, E::nbh_t ());
+
+ E::nbh_t e_nbh;
+ T tree(e_ima, s, e_nbh);
// debug
- std::cout << izg;
+ // std::cout << izg;
//
- {
- mln_node_piter_(T) n(tree);
- for_all(n)
- {
- (void) tree.f(n);
- (void) tree.f(tree.parent(n));
- }
+// {
+// mln_node_piter_(T) n(tree);
+// for_all(n)
+// {
+// (void) tree.f(n);
+// (void) tree.f(tree.parent(n));
+// }
- }
+// }
+
+ std::cout << "tree domain = " << tree.domain() << std::endl;
std::cout << tree;
{
@@ -328,7 +333,7 @@
L nlabel_b;
mln_ch_value_(E, L) e_ima_labels = labeling::blobs(mask, E::nbh_t (), nlabel_b);
std::cout << "Labels (febore): " << nlabel << " (now): " << nlabel_b << std::endl;
- util::array<L> tr((unsigned)nlabel + 1);
+ util::array<L> tr(nlabel.next());
mln_edge_iter_(util::graph) e(izg);
for_all(e)
{
1
0
4365: mln/fun/i2v/array.hh: Use fun::internal::selector_from_result.
by Guillaume Lazzara 17 Aug '09
by Guillaume Lazzara 17 Aug '09
17 Aug '09
---
milena/ChangeLog | 4 ++++
milena/mln/fun/i2v/array.hh | 23 +++--------------------
2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 8de7538..ac8a3fa 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * mln/fun/i2v/array.hh: Use fun::internal::selector_from_result.
+
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* mln/labeling/relabel.hh: Add missing preconditions.
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
diff --git a/milena/mln/fun/i2v/array.hh b/milena/mln/fun/i2v/array.hh
index 209623c..f60629d 100644
--- a/milena/mln/fun/i2v/array.hh
+++ b/milena/mln/fun/i2v/array.hh
@@ -37,6 +37,7 @@
# include <mln/metal/equal.hh>
# include <mln/tag/init.hh>
+# include <mln/fun/internal/selector.hh>
namespace mln
{
@@ -88,27 +89,9 @@ namespace mln
namespace i2v
{
-
- namespace internal
- {
-
- template <typename T, bool B = false >
- struct array_selector_
- : public Function_v2v< i2v::array<T> >
- {
- };
-
- template <typename T>
- struct array_selector_<T,true>
- : public Function_v2b< i2v::array<T> >
- {
- };
-
- } // end of namespace mln::fun::i2v::internal
-
-
template <typename T>
- class array : public internal::array_selector_<T,mlc_equal(T,bool)::value>
+ class array
+ : public fun::internal::selector_from_result_<T, array<T> >::ret
{
public:
--
1.5.6.5
1
0