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
- 9625 discussions
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-09-12 Guillaume Lazzara <z(a)lrde.epita.fr>
Fix few tests.
* milena/mln/core/site_set/p_complex.hh,
* milena/mln/core/site_set/p_complex_piter.hh,
* milena/mln/core/site_set/p_faces.hh,
* milena/mln/core/site_set/p_bgraph_piter.hh,
* milena/mln/core/site_set/p_graph_piter.hh:
remove useless '_' in class names.
* milena/tests/canvas/browsing/directional.cc,
* milena/tests/canvas/browsing/fwd.cc,
* milena/tests/canvas/browsing/snake_fwd.cc: rename point to site.
* milena/mln/core/alias/dpoint2d_h.hh,
* milena/mln/core/alias/point2d_h.hh,
* milena/tests/algebra/h_vec.cc,
* milena/tests/core/alias/point2d.cc,
* milena/tests/core/alias/point1d.cc: Use def::coord instead of int.
* milena/tests/set/diff.cc,
* milena/tests/core/site_set/p_image2d.cc: Update.
---
mln/core/alias/dpoint2d_h.hh | 2 -
mln/core/alias/point2d_h.hh | 2 -
mln/core/site_set/p_bgraph_piter.hh | 4 +-
mln/core/site_set/p_complex.hh | 4 +-
mln/core/site_set/p_complex_piter.hh | 10 +++---
mln/core/site_set/p_faces.hh | 4 +-
mln/core/site_set/p_graph_piter.hh | 9 ++----
tests/algebra/h_vec.cc | 10 +++---
tests/canvas/browsing/directional.cc | 2 -
tests/canvas/browsing/fwd.cc | 2 -
tests/canvas/browsing/snake_fwd.cc | 2 -
tests/core/alias/point1d.cc | 2 -
tests/core/alias/point2d.cc | 2 -
tests/core/site_set/p_image2d.cc | 15 +++++-----
tests/set/diff.cc | 52 +++++++++++++++++------------------
15 files changed, 61 insertions(+), 61 deletions(-)
Index: branches/cleanup-2008/milena/tests/core/site_set/p_image2d.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/site_set/p_image2d.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/core/site_set/p_image2d.cc (revision 2240)
@@ -30,19 +30,20 @@
* \brief Tests on mln::p_image2d.
*/
-#include <mln/core/p_image2d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/site_set/p_image.hh>
int main()
{
using namespace mln;
trace::quiet = false;
- p_image2d<point2d> ps(20,20);
- ps
- .insert(make::point2d(6, 9))
- .insert(make::point2d(4, 2))
- .insert(make::point2d(4, 2))
- .insert(make::point2d(5, 1));
+ image2d<bool> ima(box2d(20,20));
+ p_image<image2d<bool> > ps(ima);
+ ps.insert(make::point2d(6, 9));
+ ps.insert(make::point2d(4, 2));
+ ps.insert(make::point2d(4, 2));
+ ps.insert(make::point2d(5, 1));
mln_assertion(ps.nsites() == 3);
ps.remove(make::point2d(5, 1));
Index: branches/cleanup-2008/milena/tests/core/alias/point1d.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/alias/point1d.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/core/alias/point1d.cc (revision 2240)
@@ -43,7 +43,7 @@
// assignment
p[0] = 4;
- algebra::vec<1,int> v = p;
+ algebra::vec<1,def::coord> v = p;
std::cout << v << std::endl;
p.ind() += 1;
Index: branches/cleanup-2008/milena/tests/core/alias/point2d.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/alias/point2d.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/core/alias/point2d.cc (revision 2240)
@@ -74,5 +74,5 @@
for (unsigned i = 0; i < p.dim; ++i)
mln_assertion(q[i] == 0);
- std::cout << 3.4 * algebra::vec<2, int>(p) << std::endl;
+ std::cout << 3.4 * algebra::vec<2, def::coord>(p) << std::endl;
}
Index: branches/cleanup-2008/milena/tests/set/diff.cc
===================================================================
--- branches/cleanup-2008/milena/tests/set/diff.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/set/diff.cc (revision 2240)
@@ -39,20 +39,20 @@
{
window<dpoint2d> win1;
- win1
- .insert( 2, 7)
- .insert( 2, 1)
- .insert(-4, 0)
- .insert( 0, 0)
- .insert( 1, 1)
- .insert( 6, 5);
+ win1.insert( 2, 7);
+ win1.insert( 2, 1);
+ win1.insert(-4, 0);
+ win1.insert( 0, 0);
+ win1.insert( 1, 1);
+ win1.insert( 6, 5);
+
window<dpoint2d> win2;
- win2
- .insert( 2, 7)
- .insert(-2, 1)
- .insert(-4, 0)
- .insert( 1,-1)
- .insert( 6, 5);
+ win2.insert( 2, 7);
+ win2.insert(-2, 1);
+ win2.insert(-4, 0);
+ win2.insert( 1,-1);
+ win2.insert( 6, 5);
+
window<dpoint2d> win3 = set::diff(win1, win2);
mln_assertion(win3.has(dpoint2d( 2, 1)));
mln_assertion(win3.has(dpoint2d( 0, 0)));
@@ -66,20 +66,20 @@
{
p_set<point2d> pst1;
- pst1
- .insert(point2d( 2, 7))
- .insert(point2d( 2, 1))
- .insert(point2d(-4, 0))
- .insert(point2d( 0, 0))
- .insert(point2d( 1, 1))
- .insert(point2d( 6, 5));
+ pst1.insert(point2d( 2, 7));
+ pst1.insert(point2d( 2, 1));
+ pst1.insert(point2d(-4, 0));
+ pst1.insert(point2d( 0, 0));
+ pst1.insert(point2d( 1, 1));
+ pst1.insert(point2d( 6, 5));
+
p_set<point2d> pst2;
- pst2
- .insert(point2d( 2, 7))
- .insert(point2d(-2, 1))
- .insert(point2d(-4, 0))
- .insert(point2d( 1,-1))
- .insert(point2d( 6, 5));
+ pst2.insert(point2d( 2, 7));
+ pst2.insert(point2d(-2, 1));
+ pst2.insert(point2d(-4, 0));
+ pst2.insert(point2d( 1,-1));
+ pst2.insert(point2d( 6, 5));
+
p_set<point2d> pst3 = set::diff(pst1, pst2);
mln_assertion(pst3.has(point2d( 2, 1)));
mln_assertion(pst3.has(point2d( 0, 0)));
Index: branches/cleanup-2008/milena/tests/algebra/h_vec.cc
===================================================================
--- branches/cleanup-2008/milena/tests/algebra/h_vec.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/algebra/h_vec.cc (revision 2240)
@@ -36,11 +36,11 @@
using namespace mln;
-void run_in_3d(const algebra::vec<3, int>&)
+void run_in_3d(const algebra::vec<3, def::coord>&)
{
}
-void run_in_3d_h(const algebra::h_vec<3, int>&)
+void run_in_3d_h(const algebra::h_vec<3, def::coord>&)
{
}
@@ -53,10 +53,10 @@
int main()
{
- algebra::vec<3, int> x;
- algebra::h_vec<3, int> w = x.to_h_vec();
+ algebra::vec<3, def::coord> x;
+ algebra::h_vec<3, def::coord> w = x.to_h_vec();
- typedef algebra::h_vec<3, int> p3d;
+ typedef algebra::h_vec<3, def::coord> p3d;
p3d p;
run_in_3d(p.to_vec());
Index: branches/cleanup-2008/milena/tests/canvas/browsing/directional.cc
===================================================================
--- branches/cleanup-2008/milena/tests/canvas/browsing/directional.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/canvas/browsing/directional.cc (revision 2240)
@@ -44,7 +44,7 @@
struct assign_browsing_functor
{
typedef I_ I;
- enum { dim = I::point::dim };
+ enum { dim = I::site::dim };
I input;
Index: branches/cleanup-2008/milena/tests/canvas/browsing/fwd.cc
===================================================================
--- branches/cleanup-2008/milena/tests/canvas/browsing/fwd.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/canvas/browsing/fwd.cc (revision 2240)
@@ -42,7 +42,7 @@
struct assign_browsing_functor
{
typedef I_ I;
- enum { dim = I::point::dim };
+ enum { dim = I::site::dim };
I input;
Index: branches/cleanup-2008/milena/tests/canvas/browsing/snake_fwd.cc
===================================================================
--- branches/cleanup-2008/milena/tests/canvas/browsing/snake_fwd.cc (revision 2239)
+++ branches/cleanup-2008/milena/tests/canvas/browsing/snake_fwd.cc (revision 2240)
@@ -41,7 +41,7 @@
template <typename I, typename F>
struct assign_browsing_functor
{
- enum { dim = I::point::dim };
+ enum { dim = I::site::dim };
I input;
Index: branches/cleanup-2008/milena/mln/core/site_set/p_graph_piter.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/p_graph_piter.hh (revision 2239)
+++ branches/cleanup-2008/milena/mln/core/site_set/p_graph_piter.hh (revision 2240)
@@ -41,7 +41,6 @@
template <typename P> class p_graph;
template <typename P> class graph_psite;
-
/*------------------------.
| p_graph_fwd_piter_<P>. |
`------------------------*/
@@ -49,10 +48,10 @@
/// \brief Forward iterator on point sites of a mln::p_graph<P>.
template <typename P>
class p_graph_fwd_piter_
- : public internal::site_iterator_base_< P, p_graph_fwd_piter_<P> >
+ : public internal::site_iterator_base< P, p_graph_fwd_piter_<P> >
{
typedef p_graph_fwd_piter_<P> self_;
- typedef internal::site_iterator_base_< P, self_ > super_;
+ typedef internal::site_iterator_base< P, self_ > super_;
public:
// Make definitions from super class available.
@@ -125,10 +124,10 @@
/// \brief Backward iterator on point sites of a mln::p_graph<P>.
template <typename P>
class p_graph_bkd_piter_
- : public internal::site_iterator_base_< P, p_graph_bkd_piter_<P> >
+ : public internal::site_iterator_base< P, p_graph_bkd_piter_<P> >
{
typedef p_graph_bkd_piter_<P> self_;
- typedef internal::site_iterator_base_< P, self_ > super_;
+ typedef internal::site_iterator_base< P, self_ > super_;
public:
// Make definitions from super class available.
Index: branches/cleanup-2008/milena/mln/core/site_set/p_bgraph_piter.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/p_bgraph_piter.hh (revision 2239)
+++ branches/cleanup-2008/milena/mln/core/site_set/p_bgraph_piter.hh (revision 2240)
@@ -49,10 +49,10 @@
// FIXME: check the constraint due to the boost iterators
template<typename P>
class p_bgraph_piter_
- : public internal::site_iterator_base_< P, p_bgraph_piter_<P> >
+ : public internal::site_iterator_base< P, p_bgraph_piter_<P> >
{
typedef p_bgraph_piter_<P> self_;
- typedef internal::site_iterator_base_< P, self_ > super_;
+ typedef internal::site_iterator_base< P, self_ > super_;
typedef std::pair<typename p_bgraph<P>::node_iterator,
typename p_bgraph<P>::node_iterator> iterators_type_;
Index: branches/cleanup-2008/milena/mln/core/site_set/p_complex.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/p_complex.hh (revision 2239)
+++ branches/cleanup-2008/milena/mln/core/site_set/p_complex.hh (revision 2240)
@@ -31,7 +31,7 @@
/// \file mln/core/site_set/p_complex.hh
/// \brief Definition of a point set based on a complex.
-# include <mln/core/internal/point_set_base.hh>
+# include <mln/core/internal/site_set_base.hh>
# include <mln/accu/bbox.hh>
# include <mln/util/tracked_ptr.hh>
@@ -59,7 +59,7 @@
/// dimension \p D (a \p D-complex).
template <unsigned D, typename P>
struct p_complex
- : public internal::point_set_base_< complex_psite<D, P>,
+ : public internal::site_set_base_< complex_psite<D, P>,
p_complex<D, P> >
{
/// \brief Construct a complex psite set from a complex.
Index: branches/cleanup-2008/milena/mln/core/site_set/p_complex_piter.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/p_complex_piter.hh (revision 2239)
+++ branches/cleanup-2008/milena/mln/core/site_set/p_complex_piter.hh (revision 2240)
@@ -30,7 +30,7 @@
# include <limits>
-# include <mln/core/internal/point_iterator_base.hh>
+# include <mln/core/internal/site_iterator_base.hh>
# include <mln/core/site_set/p_complex.hh>
# include <mln/core/complex_psite.hh>
@@ -55,10 +55,10 @@
/// \brief Forward iterator on point sites of a mln::p_complex<D, P>.
template <unsigned D, typename P>
class p_complex_fwd_piter_
- : public internal::point_iterator_base_< P, p_complex_fwd_piter_<D, P> >
+ : public internal::site_iterator_base< P, p_complex_fwd_piter_<D, P> >
{
typedef p_complex_fwd_piter_<D, P> self_;
- typedef internal::point_iterator_base_< P, self_ > super_;
+ typedef internal::site_iterator_base< P, self_ > super_;
public:
// Make definitions from super class available.
@@ -148,10 +148,10 @@
/// \brief Backward iterator on point sites of a mln::p_complex<D, P>.
template <unsigned D, typename P>
class p_complex_bkd_piter_
- : public internal::point_iterator_base_< P, p_complex_bkd_piter_<D, P> >
+ : public internal::site_iterator_base< P, p_complex_bkd_piter_<D, P> >
{
typedef p_complex_bkd_piter_<D, P> self_;
- typedef internal::point_iterator_base_< P, self_ > super_;
+ typedef internal::site_iterator_base< P, self_ > super_;
public:
// Make definitions from super class available.
Index: branches/cleanup-2008/milena/mln/core/site_set/p_faces.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/site_set/p_faces.hh (revision 2239)
+++ branches/cleanup-2008/milena/mln/core/site_set/p_faces.hh (revision 2240)
@@ -32,7 +32,7 @@
/// \brief Definition of a point set based on the set of n-faces of a
/// complex.
-# include <mln/core/internal/point_set_base.hh>
+# include <mln/core/internal/site_set_base.hh>
# include <mln/accu/bbox.hh>
# include <mln/util/tracked_ptr.hh>
@@ -57,7 +57,7 @@
/// dimension \p D (a \p D-complex).
template <unsigned N, unsigned D, typename P>
struct p_faces
- : public internal::point_set_base_< faces_psite<N, D, P>,
+ : public internal::site_set_base_< faces_psite<N, D, P>,
p_faces<N, D, P> >
{
/// \brief Construct a complex psite set from a complex.
Index: branches/cleanup-2008/milena/mln/core/alias/point2d_h.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/alias/point2d_h.hh (revision 2239)
+++ branches/cleanup-2008/milena/mln/core/alias/point2d_h.hh (revision 2240)
@@ -42,7 +42,7 @@
/// \brief Type alias for a point defined on the 2D hexagonal grid
/// with integer coordinates.
- typedef point_<grid::hexa, int> point2d_h;
+ typedef point<grid::hexa, def::coord> point2d_h;
} // end of namespace mln
Index: branches/cleanup-2008/milena/mln/core/alias/dpoint2d_h.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/alias/dpoint2d_h.hh (revision 2239)
+++ branches/cleanup-2008/milena/mln/core/alias/dpoint2d_h.hh (revision 2240)
@@ -44,7 +44,7 @@
/*! \brief Type alias for a delta-point defined on the 2D square
* grid with integer coordinates.
*/
- typedef dpoint_<mln::grid::hexa, int> dpoint2d_h;
+ typedef dpoint<mln::grid::hexa, def::coord> dpoint2d_h;
} // end of namespace mln
1
0
URL: https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog:
2008-09-12 Maxime van Noppen <yabo(a)lrde.epita.fr>
Handle functions and the 'var' keyword
* concrete-syn/concrete-syn.sdf: Add escape sequence for FunctionType.
* scoolt/Declaration.str: Handle function declarations and the 'var' keyword.
* scoolt/Expression.str: Consider identifiers as expressions.
* scoolt/Function.str: New.
* scoolt/Type.str: Const-reference non-scalar types.
concrete-syn/concrete-syn.sdf | 1
scoolt/Declaration.str | 49 +++++++++++++++++++++++++++++-------------
scoolt/Expression.str | 5 ++++
scoolt/Function.str | 17 ++++++++++++++
scoolt/Type.str | 20 +++++++++++++++--
5 files changed, 75 insertions(+), 17 deletions(-)
Index: branches/scool-ng/src/scoolt/Expression.str
===================================================================
--- branches/scool-ng/src/scoolt/Expression.str (revision 77)
+++ branches/scool-ng/src/scoolt/Expression.str (revision 78)
@@ -9,3 +9,8 @@
ExpressionToCxx:
Integer(int) -> CxxInt(int)
+
+ ExpressionToCxx:
+ idf -> cxx_idf
+ where
+ <IdentifierToCxx> idf => cxx_idf
Index: branches/scool-ng/src/scoolt/Type.str
===================================================================
--- branches/scool-ng/src/scoolt/Type.str (revision 77)
+++ branches/scool-ng/src/scoolt/Type.str (revision 78)
@@ -1,8 +1,24 @@
module Type
-imports libstratego-lib Cxx Scool Type
+imports libstratego-lib Cxx Scool
rules
+ IsScalar:
+ SimpleType(type) -> type
+ where
+ <eq> (type, "char")
+ <+ <eq> (type, "bool")
+ <+ <eq> (type, "short")
+ <+ <eq> (type, "int")
+ <+ <eq> (type, "float")
+ <+ <eq> (type, "double")
+
TypeToCxx:
- SimpleType(t) -> CxxType(t)
+ SimpleType(type) -> CxxType(type)
+
+ TypeToConstRefCxx:
+ type -> CxxConstType(CxxRefType(<TypeToCxx> type))
+ where
+ <not (IsScalar)> type
+ ; <not (?ReferenceType(_))> type
Index: branches/scool-ng/src/scoolt/Declaration.str
===================================================================
--- branches/scool-ng/src/scoolt/Declaration.str (revision 77)
+++ branches/scool-ng/src/scoolt/Declaration.str (revision 78)
@@ -1,32 +1,51 @@
module Declaration
-imports libstratego-lib Cxx Scool Type Expression
+imports libstratego-lib Cxx Scool Type Expression Function
rules
+ ////////////////////////////////////////////////////////////////////////////////
+ // Variables //
+ ////////////////////////////////////////////////////////////////////////////////
+
DeclarationToCxx:
- |[ ~i : ~t; ]| -> ![ const ~cxx_t ~cxx_i; ]!
+ |[ ~idf : ~type; ]| -> ![ const ~cxx_type ~cxx_idf; ]!
where
- <TypeToCxx> t => cxx_t
- ; <IdentifierToCxx> i => cxx_i
+ <TypeToCxx> type => cxx_type
+ ; <IdentifierToCxx> idf => cxx_idf
DeclarationToCxx:
- |[ var ~i : ~t; ]| -> ![ ~cxx_t ~cxx_i; ]!
+// |[ var ~i : ~t; ]| -> ![ ~cxx_t ~cxx_i; ]!
+ SimpleDeclaration(Some("var"), idf, type, None()) -> ![ ~cxx_type ~cxx_idf; ]!
where
- <TypeToCxx> t => cxx_t
- ; <IdentifierToCxx> i => cxx_i
+ <TypeToCxx> type => cxx_type
+ ; <IdentifierToCxx> idf => cxx_idf
DeclarationToCxx:
- |[ ~i : ~t = ~exp:e; ]| -> ![ const ~cxx_t ~cxx_i = ~exp:cxx_e; ]!
+ |[ ~idf : ~type = ~exp:exp; ]| -> ![ const ~cxx_type ~cxx_idf = ~exp:cxx_exp; ]!
where
- <TypeToCxx> t => cxx_t
- ; <IdentifierToCxx> i => cxx_i
- ; <ExpressionToCxx> e => cxx_e
+ <TypeToCxx> type => cxx_type
+ ; <IdentifierToCxx> idf => cxx_idf
+ ; <ExpressionToCxx> exp => cxx_exp
DeclarationToCxx:
- |[ var ~i : ~t = ~exp:e; ]| -> ![ ~cxx_t ~cxx_i = ~exp:cxx_e; ]!
+// |[ var ~i : ~t = ~exp:exp; ]| -> ![ ~cxx_t ~cxx_i = ~exp:cxx_exp; ]!
+ SimpleDeclaration(Some("var"), idf, type, Some(Initialiser(exp))) -> ![ ~cxx_type ~cxx_idf = ~exp:cxx_exp; ]!
where
- <TypeToCxx> t => cxx_t
- ; <IdentifierToCxx> i => cxx_i
- ; <ExpressionToCxx> e => cxx_e
+ <TypeToCxx> type => cxx_type
+ ; <IdentifierToCxx> idf => cxx_idf
+ ; <ExpressionToCxx> exp => cxx_exp
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Functions //
+ ////////////////////////////////////////////////////////////////////////////////
+
+ DeclarationToCxx:
+ |[ ~idf : ~ft:fun_type; ]| -> CxxFun([], cxx_ret_type, cxx_idf, cxx_args)
+ where
+ <IdentifierToCxx> idf => cxx_idf
+ ; <TypeToCxx> <GetReturnType> fun_type => cxx_ret_type
+ ; <ArgumentsToCxx> <GetArguments> fun_type => cxx_args
+
Index: branches/scool-ng/src/scoolt/Function.str
===================================================================
--- branches/scool-ng/src/scoolt/Function.str (revision 0)
+++ branches/scool-ng/src/scoolt/Function.str (revision 78)
@@ -0,0 +1,17 @@
+module Function
+
+imports libstratego-lib Cxx Scool Type
+
+rules
+
+ GetReturnType:
+ FunctionType(_, _, ret_type) -> ret_type
+
+ GetArguments:
+ FunctionType(_, args, _) -> args
+
+ ArgumentsToCxx:
+ ArgumentsDeclaration(arg_list) -> <map (ArgumentToCxx)> arg_list
+
+ ArgumentToCxx:
+ TypedId(idf, type) -> (<TypeToConstRefCxx <+ TypeToCxx> type, <IdentifierToCxx> idf)
Index: branches/scool-ng/src/concrete-syn/concrete-syn.sdf
===================================================================
--- branches/scool-ng/src/concrete-syn/concrete-syn.sdf (revision 77)
+++ branches/scool-ng/src/concrete-syn/concrete-syn.sdf (revision 78)
@@ -13,6 +13,7 @@
"~" StrategoTerm -> Identifier {cons("FromTerm"), prefer}
"~" StrategoTerm -> SimpleType {cons("FromTerm"), prefer}
+ "~ft:" StrategoTerm -> FunctionType {cons("FromTerm"), prefer}
"~exp:" StrategoTerm -> Expression {cons("FromTerm"), prefer}
--
\__/ \__/
(00) Maxime `yabo` van Noppen (00)
___) \ Epita 2009 / (___
(_____/ \_____)
1
0
URL: https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog:
2008-09-12 Maxime van Noppen <yabo(a)lrde.epita.fr>
Add tests
* function/c++_ast/declaration_001.aterm: New.
* function/c++_ast/declaration_002.aterm: New.
* function/c++_ast/declaration_003.aterm: New.
* function/scool_ast/static_dynamic_parameters_005.aterm: New.
* function/scool_src/static_dynamic_parameters_005.scl: New.
* variable/c++_ast/declaration_003.aterm: New.
* variable/c++_ast/declaration_004.aterm: New.
* variable/c++_ast/declaration_008.aterm: New.
* variable/c++_ast/mixed_declarations_001.aterm: New.
* variable/scool_ast/declaration_008.aterm: New.
* variable/scool_src/declaration_008.scl: New.
* variable/c++_ast/declaration_001.aterm,
* variable/c++_ast/declaration_007.aterm: Update regarding grammar changes.
function/c++_ast/declaration_001.aterm | 1 +
function/c++_ast/declaration_002.aterm | 1 +
function/c++_ast/declaration_003.aterm | 1 +
function/scool_ast/static_dynamic_parameters_005.aterm | 1 +
function/scool_src/static_dynamic_parameters_005.scl | 1 +
variable/c++_ast/declaration_001.aterm | 2 +-
variable/c++_ast/declaration_003.aterm | 1 +
variable/c++_ast/declaration_004.aterm | 1 +
variable/c++_ast/declaration_007.aterm | 2 +-
variable/c++_ast/declaration_008.aterm | 1 +
variable/c++_ast/mixed_declarations_001.aterm | 1 +
variable/scool_ast/declaration_008.aterm | 1 +
variable/scool_src/declaration_008.scl | 1 +
13 files changed, 13 insertions(+), 2 deletions(-)
Index: branches/scool-ng/tests/function/c++_ast/declaration_001.aterm
===================================================================
--- branches/scool-ng/tests/function/c++_ast/declaration_001.aterm (revision 0)
+++ branches/scool-ng/tests/function/c++_ast/declaration_001.aterm (revision 77)
@@ -0,0 +1 @@
+CxxProgram([CxxFun([],CxxType("void"),CxxId("foo"),[])])
Index: branches/scool-ng/tests/function/c++_ast/declaration_002.aterm
===================================================================
--- branches/scool-ng/tests/function/c++_ast/declaration_002.aterm (revision 0)
+++ branches/scool-ng/tests/function/c++_ast/declaration_002.aterm (revision 77)
@@ -0,0 +1 @@
+CxxProgram([CxxFun([],CxxType("void"),CxxId("foo"),[(CxxType("int"),CxxId("a"))])])
Index: branches/scool-ng/tests/function/c++_ast/declaration_003.aterm
===================================================================
--- branches/scool-ng/tests/function/c++_ast/declaration_003.aterm (revision 0)
+++ branches/scool-ng/tests/function/c++_ast/declaration_003.aterm (revision 77)
@@ -0,0 +1 @@
+CxxProgram([CxxFun([],CxxType("void"),CxxId("foo"),[(CxxType("int"),CxxId("a")),(CxxConstType(CxxRefType(CxxType("bar"))),CxxId("b"))])])
Index: branches/scool-ng/tests/function/scool_ast/static_dynamic_parameters_005.aterm
===================================================================
--- branches/scool-ng/tests/function/scool_ast/static_dynamic_parameters_005.aterm (revision 0)
+++ branches/scool-ng/tests/function/scool_ast/static_dynamic_parameters_005.aterm (revision 77)
@@ -0,0 +1 @@
+Program([FunctionDefinition(None,Identifier("f"),FunctionType(Some(ParametersDeclaration([TypedId(Identifier("T"),"type"),TypedId(Identifier("U"),"type")])),ArgumentsDeclaration([TypedId(Identifier("a"),SimpleType("T")),TypedId(Identifier("b"),SimpleType("U"))]),SimpleType("T")),Identifier("a"))])
Index: branches/scool-ng/tests/function/scool_src/static_dynamic_parameters_005.scl
===================================================================
--- branches/scool-ng/tests/function/scool_src/static_dynamic_parameters_005.scl (revision 0)
+++ branches/scool-ng/tests/function/scool_src/static_dynamic_parameters_005.scl (revision 77)
@@ -0,0 +1 @@
+f : [T : type, U : type] (a : T, b : U) -> T => a;
Index: branches/scool-ng/tests/variable/c++_ast/declaration_004.aterm
===================================================================
--- branches/scool-ng/tests/variable/c++_ast/declaration_004.aterm (revision 0)
+++ branches/scool-ng/tests/variable/c++_ast/declaration_004.aterm (revision 77)
@@ -0,0 +1 @@
+CxxProgram([CxxDecl(CxxType("int"),CxxId("i"),CxxInt("42"))])
Index: branches/scool-ng/tests/variable/c++_ast/declaration_007.aterm
===================================================================
--- branches/scool-ng/tests/variable/c++_ast/declaration_007.aterm (revision 76)
+++ branches/scool-ng/tests/variable/c++_ast/declaration_007.aterm (revision 77)
@@ -1 +1 @@
-CxxProgram([CxxDecl(CxxConstType(CxxType("int")),Identifier("i"))])
+CxxProgram([CxxDecl(CxxConstType(CxxType("int")),CxxId("i"))])
Index: branches/scool-ng/tests/variable/c++_ast/declaration_008.aterm
===================================================================
--- branches/scool-ng/tests/variable/c++_ast/declaration_008.aterm (revision 0)
+++ branches/scool-ng/tests/variable/c++_ast/declaration_008.aterm (revision 77)
@@ -0,0 +1 @@
+CxxProgram([CxxDecl(CxxType("int"),CxxId("i"),CxxId("j"))])
Index: branches/scool-ng/tests/variable/c++_ast/mixed_declarations_001.aterm
===================================================================
--- branches/scool-ng/tests/variable/c++_ast/mixed_declarations_001.aterm (revision 0)
+++ branches/scool-ng/tests/variable/c++_ast/mixed_declarations_001.aterm (revision 77)
@@ -0,0 +1 @@
+CxxProgram([CxxDecl(CxxConstType(CxxType("int")),CxxId("answer"),CxxInt("42")),CxxDecl(CxxType("int"),CxxId("i")),CxxDecl(CxxType("int"),CxxId("j"),CxxId("i"))])
Index: branches/scool-ng/tests/variable/c++_ast/declaration_001.aterm
===================================================================
--- branches/scool-ng/tests/variable/c++_ast/declaration_001.aterm (revision 76)
+++ branches/scool-ng/tests/variable/c++_ast/declaration_001.aterm (revision 77)
@@ -1 +1 @@
-CxxProgram([CxxDecl(CxxConstType(CxxType("int")),Identifier("i"))])
+CxxProgram([CxxDecl(CxxConstType(CxxType("int")),CxxId("i"))])
Index: branches/scool-ng/tests/variable/c++_ast/declaration_003.aterm
===================================================================
--- branches/scool-ng/tests/variable/c++_ast/declaration_003.aterm (revision 0)
+++ branches/scool-ng/tests/variable/c++_ast/declaration_003.aterm (revision 77)
@@ -0,0 +1 @@
+CxxProgram([CxxDecl(CxxType("int"),CxxId("i"))])
Index: branches/scool-ng/tests/variable/scool_ast/declaration_008.aterm
===================================================================
--- branches/scool-ng/tests/variable/scool_ast/declaration_008.aterm (revision 0)
+++ branches/scool-ng/tests/variable/scool_ast/declaration_008.aterm (revision 77)
@@ -0,0 +1 @@
+Program([SimpleDeclaration(Some("var"),Identifier("i"),SimpleType("int"),Some(Initialiser(Identifier("j"))))])
Index: branches/scool-ng/tests/variable/scool_src/declaration_008.scl
===================================================================
--- branches/scool-ng/tests/variable/scool_src/declaration_008.scl (revision 0)
+++ branches/scool-ng/tests/variable/scool_src/declaration_008.scl (revision 77)
@@ -0,0 +1 @@
+var i : int = j;
--
\__/ \__/
(00) Maxime `yabo` van Noppen (00)
___) \ Epita 2009 / (___
(_____/ \_____)
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make tests on some queue types pass.
* tests/core/site_set/p_queue_fast.cc: Update.
* tests/core/site_set/p_queue.cc: Likewise.
* tests/core/site_set/p_priority_queue.cc
(operator[]): De-activate since priority queues do not (cannot)
have such a method.
(has): Likewise; replace the calls to this method by calling...
* mln/set/has.hh: ...this new procedure.
It is useful when a site set is not "point-wise" random
accessible.
* mln/core/site_set/p_priority.hh (Q): New static check.
mln/core/site_set/p_priority.hh | 14 +++--
mln/set/has.hh | 85 ++++++++++++++++++++++++++++++++
tests/core/site_set/p_priority_queue.cc | 55 +++++++++++---------
tests/core/site_set/p_queue.cc | 14 ++---
tests/core/site_set/p_queue_fast.cc | 14 ++---
5 files changed, 139 insertions(+), 43 deletions(-)
Index: tests/core/site_set/p_queue_fast.cc
--- tests/core/site_set/p_queue_fast.cc (revision 2238)
+++ tests/core/site_set/p_queue_fast.cc (working copy)
@@ -32,6 +32,8 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/site_set/p_queue_fast.hh>
+#include <mln/geom/bbox.hh>
+#include <mln/make/box2d.hh>
@@ -40,18 +42,16 @@
using namespace mln;
p_queue_fast<point2d> q;
- q
- .push(make::point2d(6, 9))
- .push(make::point2d(5, 1))
- .push(make::point2d(4, 2));
+ q.push(point2d(6, 9));
+ q.push(point2d(5, 1));
+ q.push(point2d(4, 2));
mln_assertion(q.nsites() == 3);
- std::cout << q.bbox() << std::endl;
- std::cout << q << std::endl;
+ mln_assertion(geom::bbox(q) == make::box2d(4,1, 6,9));
q.pop();
mln_assertion(q.nsites() == 2);
point2d p = q.front();
mln_assertion(q.nsites() == 2);
- mln_assertion(p == make::point2d(5, 1));
+ mln_assertion(p == point2d(5, 1));
}
Index: tests/core/site_set/p_queue.cc
--- tests/core/site_set/p_queue.cc (revision 2238)
+++ tests/core/site_set/p_queue.cc (working copy)
@@ -32,6 +32,8 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/site_set/p_queue.hh>
+#include <mln/geom/bbox.hh>
+#include <mln/make/box2d.hh>
@@ -40,18 +42,16 @@
using namespace mln;
p_queue<point2d> q;
- q
- .push(make::point2d(6, 9))
- .push(make::point2d(5, 1))
- .push(make::point2d(4, 2));
+ q.push(point2d(6, 9));
+ q.push(point2d(5, 1));
+ q.push(point2d(4, 2));
mln_assertion(q.nsites() == 3);
- std::cout << q.bbox() << std::endl;
- std::cout << q << std::endl;
+ mln_assertion(geom::bbox(q) == make::box2d(4,1, 6,9));
q.pop();
mln_assertion(q.nsites() == 2);
point2d p = q.front();
mln_assertion(q.nsites() == 2);
- mln_assertion(p == make::point2d(5, 1));
+ mln_assertion(p == point2d(5, 1));
}
Index: tests/core/site_set/p_priority_queue.cc
--- tests/core/site_set/p_priority_queue.cc (revision 2238)
+++ tests/core/site_set/p_priority_queue.cc (working copy)
@@ -32,12 +32,18 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/site_set/p_priority.hh>
+#include <mln/core/site_set/p_queue.hh>
+#include <mln/geom/bbox.hh>
+#include <mln/make/box2d.hh>
+#include <mln/set/has.hh>
+
int main ()
{
using namespace mln;
- p_priority<point2d, unsigned> q;
+ typedef p_queue<point2d> Q;
+ p_priority<unsigned, Q> q;
point2d p1 (6, 9);
point2d p2 (5, 1);
point2d p3 (4, 2);
@@ -46,53 +52,52 @@
mln_assertion (q.nsites() == 0);
- q.push_force (p3);
- q.push_force (p1, 3);
- q.push_force (p2, 5);
+ q.push(0, p3);
+ q.push(3, p1);
+ q.push(5, p2);
- std::cout << q.bbox () << std::endl;
- std::cout << q << std::endl;
+ mln_assertion(geom::bbox(q) == make::box2d(4,1, 6,9));
mln_assertion (!q.is_empty ());
- mln_assertion (q.has (p1));
- mln_assertion (q.has (p2));
- mln_assertion (q.has (p3));
+ mln_assertion(set::has(q, p1));
+ mln_assertion(set::has(q, p2));
+ mln_assertion(set::has(q, p3));
mln_assertion (q.nsites() == 3);
mln_assertion (q.front () == p2);
q.pop ();
- mln_assertion (q.has (p1));
- mln_assertion (!q.has (p2));
- mln_assertion (q.has (p3));
+ mln_assertion(set::has(q, p1));
+ mln_assertion(! set::has(q, p2));
+ mln_assertion(set::has(q, p3));
mln_assertion (q.nsites() == 2);
mln_assertion (q.front () == p1);
q.pop ();
- mln_assertion (!q.has (p1));
- mln_assertion (!q.has (p2));
- mln_assertion (q.has (p3));
+ mln_assertion(! set::has(q, p1));
+ mln_assertion(! set::has(q, p2));
+ mln_assertion(set::has(q, p3));
mln_assertion (q.nsites() == 1);
mln_assertion (q.front () == p3);
q.pop ();
- mln_assertion (!q.has (p1));
- mln_assertion (!q.has (p2));
- mln_assertion (!q.has (p3));
+ mln_assertion(! set::has(q, p1));
+ mln_assertion(! set::has(q, p2));
+ mln_assertion(! set::has(q, p3));
mln_assertion (q.nsites() == 0);
mln_assertion (q.is_empty ());
- q.push_force (p3);
- q.push_force (p2, 5);
- q.push_force (p1, 3);
-
- mln_assertion (q[2] == p3);
- mln_assertion (q[1] == p1);
- mln_assertion (q[0] == p2);
+ q.push(0, p3);
+ q.push(5, p2);
+ q.push(3, p1);
+
+// mln_assertion(q[2] == p3);
+// mln_assertion(q[1] == p1);
+// mln_assertion(q[0] == p2);
q.clear ();
mln_assertion (q.is_empty ());
}
Index: mln/core/site_set/p_priority.hh
--- mln/core/site_set/p_priority.hh (revision 2238)
+++ mln/core/site_set/p_priority.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -68,11 +68,16 @@
/*! \brief Priority queue class.
*
- * FIXME
+ * The parameter \p P is the type of the priorities (for instance
+ * unsigned).
+ *
+ * The parameter \p Q is a type of queue (for instance
+ * p_queue<point2d>).
*/
template <typename P, typename Q>
class p_priority : public internal::site_set_base_< mln_site(Q),
- p_priority<P,Q> >
+ p_priority<P,Q> >,
+ private mlc_is_a(Q, Site_Set)::check_t
{
typedef p_priority<P,Q> self_;
public:
@@ -267,7 +272,8 @@
p_priority<P,Q>::front() const
{
mln_precondition(! this->is_empty()); // Also test invariants.
- return q_[highest_priority()].front();
+ std::map<P,Q>& q__ = const_cast< std::map<P,Q>& >(q_);
+ return q__[highest_priority()].front();
}
template <typename P, typename Q>
Index: mln/set/has.hh
--- mln/set/has.hh (revision 0)
+++ mln/set/has.hh (revision 0)
@@ -0,0 +1,85 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_SET_HAS_HH
+# define MLN_SET_HAS_HH
+
+/*! \file mln/set/has.hh
+ *
+ * \brief Algorithm that tests if a site set has a given site.
+ *
+ * \todo Layout and specialize.
+ */
+
+# include <mln/core/concept/site_set.hh>
+
+
+
+namespace mln
+{
+
+ namespace set
+ {
+
+ /// FIXME
+ template <typename S>
+ bool
+ has(const Site_Set<S>& s, const mln_site(S)& e);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename S>
+ bool
+ has(const Site_Set<S>& s_, const mln_site(S)& e)
+ {
+ trace::entering("set::has");
+ const S& s = exact(s_);
+
+ mln_precondition(s.is_valid());
+ bool found = false;
+
+ mln_piter(S) p(s);
+ for_all(p)
+ if (p == e)
+ {
+ found = true;
+ break;
+ }
+
+ trace::exiting("set::has");
+ return found;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::set
+
+} // end of namespace mln
+
+
+#endif // ! MLN_SET_HAS_HH
1
0
12 Sep '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update fill_with_image and fill_with_value.
* mln/level/fill_with_image.hh
(fill_with_image_tests): New.
(generic): Strengthen signature and use tests.
(impl): Move specialized impl into...
* mln/level/fill_with_image.spe.hh: ...this new file.
Update.
* mln/level/fill_with_value.hh,
* mln/level/fill_with_value.spe.hh: Likewise.
* mln/level/fill.spe.hh: Remove; dead empty file.
fill_with_image.hh | 48 ++++++------
fill_with_image.spe.hh | 84 ++++++++++++++++++++++
fill_with_value.hh | 129 +++++++---------------------------
fill_with_value.spe.hh | 185 ++++++++++++-------------------------------------
4 files changed, 183 insertions(+), 263 deletions(-)
Index: mln/level/fill_with_image.hh
--- mln/level/fill_with_image.hh (revision 2236)
+++ mln/level/fill_with_image.hh (working copy)
@@ -38,6 +38,9 @@
# include <mln/core/concept/image.hh>
# include <mln/core/image/inplace.hh>
+// Specializations are in:
+# include <mln/level/fill_with_image.spe.hh>
+
namespace mln
{
@@ -62,6 +65,24 @@
# ifndef MLN_INCLUDE_ONLY
+ namespace internal
+ {
+
+ template <typename I, typename J>
+ inline
+ void fill_with_image_tests(Image<I>& ima, const Image<J>& data)
+ {
+ mlc_is(mln_trait_image_value_io(I),
+ mln::trait::image::value_io::read_write)::check();
+ mlc_converts_to(mln_value(J), mln_value(I))::check();
+ mln_precondition(exact(ima).has_data());
+ mln_precondition(exact(data).has_data());
+ mln_precondition(exact(ima).domain() <= exact(data).domain());
+ }
+
+ } // end of namespace mln::level::internal
+
+
namespace impl
{
@@ -70,9 +91,10 @@
template <typename I, typename J>
inline
- void fill_with_image(I& ima, const J& data)
+ void fill_with_image(Image<I>& ima, const Image<J>& data)
{
trace::entering("level::impl::generic::fill_with_image");
+ internal::fill_with_image_tests(ima, data);
mln_piter(I) p(ima.domain());
for_all(p)
@@ -83,37 +105,19 @@
} // end if namespace mln::level::impl::generic
-
- // Selector.
-
- template <typename I, typename J>
- inline
- void fill_with_image_(I& ima, const J& data)
- {
- generic::fill_with_image(ima, data);
- }
-
} // end of namespace mln::level::impl
-
/// Facade.
template <typename I, typename J>
inline
- void fill_with_image(Image<I>& ima_, const Image<J>& data_)
+ void fill_with_image(Image<I>& ima, const Image<J>& data)
{
trace::entering("level::fill_with_image");
- mlc_is(mln_trait_image_value_io(I),
- mln::trait::image::value_io::read_write)::check();
- mlc_converts_to(mln_value(J), mln_value(I))::check();
-
- I& ima = exact(ima_);
- const J& data = exact(data_);
- mln_precondition(ima.domain() <= data.domain());
-
- impl::fill_with_image_(ima, data);
+ internal::fill_with_image_tests(ima, data);
+ internal::fill_with_image_dispatch(ima, data);
trace::exiting("level::fill_with_image");
}
Index: mln/level/fill_with_value.spe.hh
--- mln/level/fill_with_value.spe.hh (revision 2236)
+++ mln/level/fill_with_value.spe.hh (working copy)
@@ -25,77 +25,60 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+#ifndef MLN_LEVEL_FILL_WITH_VALUE_SPE_HH
+# define MLN_LEVEL_FILL_WITH_VALUE_SPE_HH
+
+/// \file mln/level/fill_with_value.spe.hh
+/// Specializations for mln::level::fill_with_value.
+///
+/// \todo See todos in mln/level/fill.hh
+
#ifndef MLN_LEVEL_FILL_WITH_VALUE_HH
-# define MLN_LEVEL_FILL_WITH_VALUE_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_FILL_WITH_VALUE_HH
-/*! \file mln/level/fill_with_value.hh
- *
- * \brief Fill an image with a value, that is, set all pixel values to
- * the given value.
- *
- * \todo Overload for fastest images.
- * \todo Handle all value_storage properties (piecewise, etc.)
- * \todo Make memset_ work and use it when appropriate.
- * \todo Move specializations in a extra file.
- * \toto Activate fill_with_value_cell_wise.
- */
-
-# include <cstdlib>
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/image/inplace.hh>
-# include <mln/core/image/instant.hh>
+# ifndef MLN_INCLUDE_ONLY
+
namespace mln
{
namespace level
{
- /*! Fill the whole image \p ima with the single value \p v.
- *
- * \param[in,out] ima The image to be filled.
- * \param[in] val The value to assign to all sites.
- *
- * \pre \p ima has to be initialized.
- *
- * \todo Optimize when \p ima is large and sizeof(mln_value(I)) > 1.
- */
- template <typename I, typename V>
- void fill_with_value(Image<I>& ima, const V& val);
-
-
- // Case of instant images.
+ namespace internal
+ {
template <typename I, typename V>
- void fill_with_value(const Image< instant_<I> >& ima, const V& val);
+ inline
+ void fill_with_value_tests(Image<I>& ima, const V& val);
+ }
-
-# ifndef MLN_INCLUDE_ONLY
+ // Implementations.
+ // ----------------
namespace impl
{
- template <typename I>
- inline
- void fill_with_value_site_wise_any(I& ima, const mln_value(I)& val)
+ namespace generic
{
- trace::entering("level::impl::fill_with_value_site_wise_any");
+ template <typename I, typename V>
+ void fill_with_value(Image<I>& ima, const V& val);
+ }
- mln_piter(I) p(ima.domain());
- for_all(p)
- ima(p) = val;
- trace::exiting("level::impl::fill_with_value_site_wise_any");
- }
+ // FIXME: Add specializations here...
template <typename I, typename V>
inline
- void fill_with_value_site_wise_one_block(I& ima, const V& val)
+ void fill_with_value_one_block(Image<I>& ima_, const V& val)
{
- trace::entering("level::impl::fill_with_value_site_wise_one_block");
+ trace::entering("level::impl::fill_with_value_one_block");
+
+ I& ima = exact(ima_);
+ internal::fill_with_value_tests(ima, val);
// level::memset_(ima, ima.point_at_index(0), v, ima.nelements());
const unsigned n = ima.nelements();
@@ -103,126 +86,50 @@
for (unsigned i = 0; i < n; ++i)
*ptr++ = val;
- trace::exiting("level::impl::fill_with_value_site_wise_one_block");
+ trace::exiting("level::impl::fill_with_value_one_block");
}
-
template <typename I, typename V>
inline
- void fill_with_value_cell_wise(I& ima, const V& val)
+ void fill_with_value_cell_wise(Image<I>& ima_, const V& val)
{
trace::entering("level::impl::fill_with_value_cell_wise");
- abort();
+ I& ima = exact(ima_);
+ internal::fill_with_value_tests(ima, val);
- // mln_viter(I) v(ima.values());
- // for_all(v)
- // v.change_to(val);
+ mln_viter(I) v(ima.values());
+ for_all(v)
+ v.change_to(val);
trace::exiting("level::impl::fill_with_value_cell_wise");
}
+ } // end of namespace mln::level::impl
- namespace dispatch
- {
-
- // Cases for "value_browsing == site_wise_only" w.r.t. value_storage.
-
- template <typename I, typename V>
- inline
- void fill_with_value_site_wise_(mln::trait::image::value_storage::any,
- I& ima, const V& val)
- {
- fill_with_value_site_wise_any(ima, val);
- }
-
- template <typename I, typename V>
- inline
- void fill_with_value_site_wise_(mln::trait::image::value_storage::one_block,
- I& ima, const V& val)
- {
- fill_with_value_site_wise_one_block(ima, val);
- }
-
- // Case site_wise -> selector w.r.t. value_storage.
-
- template <typename I, typename V>
- inline
- void fill_with_value_site_wise(I& ima, const V& val)
- {
- fill_with_value_site_wise_(mln_trait_image_value_storage(I)(),
- ima, val);
- }
-
-
- // Cases w.r.t. value_browsing.
- template <typename I, typename V>
- inline
- void fill_with_value_(mln::trait::image::value_browsing::site_wise_only,
- I& ima, const V& val)
- {
- fill_with_value_site_wise(ima, val);
- }
+ // Dispatch.
+ // ---------
- template <typename I, typename V>
- inline
- void fill_with_value_(mln::trait::image::value_browsing::cell_wise,
- I& ima, const V& val)
+ namespace internal
{
- fill_with_value_cell_wise(ima, val);
- }
-
- // Selector w.r.t. value_browsing.
template <typename I, typename V>
inline
- void fill_with_value_(I& ima, const V& val)
+ void fill_with_value_dispatch(Image<I>& ima, const V& val)
{
- fill_with_value_(mln_trait_image_value_browsing(I)(),
- ima, val);
+ impl::generic::fill_with_value(ima, val);
}
- } // end of namespace mln::level::impl::dispatch
-
- } // end of namespace mln::level::impl
+ } // end of namespace mln::level::internal
+ } // end of namespace mln::level
- /// Facade.
-
- template <typename I, typename V>
- inline
- void fill_with_value(Image<I>& ima, const V& val)
- {
- trace::entering("level::fill");
-
- mlc_is(mln_trait_image_value_io(I),
- mln::trait::image::value_io::read_write)::check();
- mlc_converts_to(V, mln_value(I))::check();
-
- mln_precondition(exact(ima).has_data());
-
- impl::dispatch::fill_with_value_(exact(ima), exact(val));
-
- trace::exiting("level::fill");
- }
-
-
- // Un-instant.
-
- template <typename I, typename V>
- void fill_with_value(const Image< instant_<I> >& ima, const V& val)
- {
- fill_with_value(exact(ima).un_instant_(), val);
- }
+} // end of namespace mln
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::level
-} // end of namespace mln
-
-
-#endif // ! MLN_LEVEL_FILL_WITH_VALUE_HH
+#endif // ! MLN_LEVEL_FILL_WITH_VALUE_SPE_HH
Index: mln/level/fill_with_value.hh
--- mln/level/fill_with_value.hh (revision 2236)
+++ mln/level/fill_with_value.hh (working copy)
@@ -38,6 +38,7 @@
* \todo Make memset_ work and use it when appropriate.
* \todo Move specializations in a extra file.
* \toto Activate fill_with_value_cell_wise.
+ * \todo Optimize when \p ima is large and sizeof(mln_value(I)) > 1.
*/
# include <cstdlib>
@@ -46,6 +47,9 @@
# include <mln/core/image/inplace.hh>
# include <mln/core/image/instant.hh>
+// Specializations are in:
+# include <mln/level/fill_with_value.spe.hh>
+
namespace mln
{
@@ -59,8 +63,6 @@
* \param[in] val The value to assign to all sites.
*
* \pre \p ima has to be initialized.
- *
- * \todo Optimize when \p ima is large and sizeof(mln_value(I)) > 1.
*/
template <typename I, typename V>
void fill_with_value(Image<I>& ima, const V& val);
@@ -74,138 +76,61 @@
# ifndef MLN_INCLUDE_ONLY
- namespace impl
- {
-
- template <typename I>
- inline
- void fill_with_value_site_wise_any(I& ima, const mln_value(I)& val)
+ namespace internal
{
- trace::entering("level::impl::fill_with_value_site_wise_any");
-
- mln_piter(I) p(ima.domain());
- for_all(p)
- ima(p) = val;
-
- trace::exiting("level::impl::fill_with_value_site_wise_any");
- }
-
template <typename I, typename V>
inline
- void fill_with_value_site_wise_one_block(I& ima, const V& val)
+ void fill_with_value_tests(Image<I>& ima, const V& val)
{
- trace::entering("level::impl::fill_with_value_site_wise_one_block");
-
- // level::memset_(ima, ima.point_at_index(0), v, ima.nelements());
- const unsigned n = ima.nelements();
- mln_value(I)* ptr = ima.buffer();
- for (unsigned i = 0; i < n; ++i)
- *ptr++ = val;
-
- trace::exiting("level::impl::fill_with_value_site_wise_one_block");
- }
-
-
- template <typename I, typename V>
- inline
- void fill_with_value_cell_wise(I& ima, const V& val)
- {
- trace::entering("level::impl::fill_with_value_cell_wise");
-
- abort();
-
- // mln_viter(I) v(ima.values());
- // for_all(v)
- // v.change_to(val);
-
- trace::exiting("level::impl::fill_with_value_cell_wise");
+ mlc_is(mln_trait_image_value_io(I),
+ mln::trait::image::value_io::read_write)::check();
+ mlc_converts_to(mln_exact(V), mln_value(I))::check();
+ mln_precondition(exact(ima).has_data());
}
+ } // end of namespace mln::level::internal
- namespace dispatch
- {
-
- // Cases for "value_browsing == site_wise_only" w.r.t. value_storage.
-
- template <typename I, typename V>
- inline
- void fill_with_value_site_wise_(mln::trait::image::value_storage::any,
- I& ima, const V& val)
- {
- fill_with_value_site_wise_any(ima, val);
- }
- template <typename I, typename V>
- inline
- void fill_with_value_site_wise_(mln::trait::image::value_storage::one_block,
- I& ima, const V& val)
+ namespace impl
{
- fill_with_value_site_wise_one_block(ima, val);
- }
- // Case site_wise -> selector w.r.t. value_storage.
-
- template <typename I, typename V>
- inline
- void fill_with_value_site_wise(I& ima, const V& val)
+ namespace generic
{
- fill_with_value_site_wise_(mln_trait_image_value_storage(I)(),
- ima, val);
- }
-
-
- // Cases w.r.t. value_browsing.
template <typename I, typename V>
- inline
- void fill_with_value_(mln::trait::image::value_browsing::site_wise_only,
- I& ima, const V& val)
+ void fill_with_value(Image<I>& ima_, const V& val)
{
- fill_with_value_site_wise(ima, val);
- }
+ trace::entering("level::impl::generic::fill_with_value");
- template <typename I, typename V>
- inline
- void fill_with_value_(mln::trait::image::value_browsing::cell_wise,
- I& ima, const V& val)
- {
- fill_with_value_cell_wise(ima, val);
- }
+ I& ima = exact(ima_);
+ internal::fill_with_value_tests(ima, val);
- // Selector w.r.t. value_browsing.
+ mln_value(I) v = exact(val);
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ ima(p) = v;
- template <typename I, typename V>
- inline
- void fill_with_value_(I& ima, const V& val)
- {
- fill_with_value_(mln_trait_image_value_browsing(I)(),
- ima, val);
+ trace::exiting("level::impl::generic::fill_with_value");
}
- } // end of namespace mln::level::impl::dispatch
+ } // end if namespace mln::level::impl::generic
} // end of namespace mln::level::impl
-
/// Facade.
template <typename I, typename V>
inline
void fill_with_value(Image<I>& ima, const V& val)
{
- trace::entering("level::fill");
-
- mlc_is(mln_trait_image_value_io(I),
- mln::trait::image::value_io::read_write)::check();
- mlc_converts_to(V, mln_value(I))::check();
-
- mln_precondition(exact(ima).has_data());
+ trace::entering("level::fill_with_value");
- impl::dispatch::fill_with_value_(exact(ima), exact(val));
+ internal::fill_with_value_tests(ima, val);
+ internal::fill_with_value_dispatch(ima, val);
- trace::exiting("level::fill");
+ trace::exiting("level::fill_with_value");
}
Index: mln/level/fill_with_image.spe.hh
--- mln/level/fill_with_image.spe.hh (revision 0)
+++ mln/level/fill_with_image.spe.hh (revision 0)
@@ -0,0 +1,84 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_LEVEL_FILL_WITH_IMAGE_SPE_HH
+# define MLN_LEVEL_FILL_WITH_IMAGE_SPE_HH
+
+/*! \file mln/level/fill_with_image.spe.hh
+ *
+ * \brief Specializations for mln::level::fill_with_image.
+ *
+ * \todo Add specializations then rewrite the dispatch.
+ */
+
+# ifndef MLN_LEVEL_FILL_WITH_IMAGE_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_FILL_WITH_IMAGE_HH
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename I, typename J>
+ void fill_with_image(const Image<I>& data, Image<J>& destination);
+ }
+
+ // FIXME: Add specializations here...
+
+ } // end of namespace mln::level::impl
+
+ namespace internal
+ {
+
+ template <typename I, typename J>
+ inline
+ void fill_with_image_dispatch(Image<I>& ima, const Image<J>& data)
+ {
+ impl::generic::fill_with_image(ima, data);
+ }
+
+ } // end of namespace mln::level::internal
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+#endif // ! MLN_LEVEL_FILL_WITH_IMAGE_HH
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Alexandre Abraham <abraham(a)lrde.epita.fr>
Fix Bugs In Watershed.
* abraham/tests/morpho/test_component_tree.cc: Update some printing
functions.
* abraham/tests/morpho/test_watershed.cc: Idem.
* abraham/tests/morpho/test_watershed_topo.cc: Make it clean.
* abraham/tests/morpho/ref/src/lib/lwshedtopo.c: Remove debug printing.
* abraham/mln/morpho/basic_najman.hh: Fix bugs
basic_najman::compressTree: New
basic_najman::removeOneSonNodes(): New.
mln/morpho/basic_najman.hh | 386 +++++++++++++++++++---------------
tests/morpho/ref/src/lib/lwshedtopo.c | 4
tests/morpho/test_component_tree.cc | 8
tests/morpho/test_watershed.cc | 4
tests/morpho/test_watershed_topo.cc | 38 ---
5 files changed, 241 insertions(+), 199 deletions(-)
Index: abraham/tests/morpho/test_component_tree.cc
--- abraham/tests/morpho/test_component_tree.cc (revision 2236)
+++ abraham/tests/morpho/test_component_tree.cc (working copy)
@@ -107,9 +107,11 @@
test_tree<image2d<int_u8>::psite> *res = new test_tree<image2d<int_u8>::psite>(ima.Par_node(root));
- p_array<image2d<int_u8>::psite>::fwd_piter it (n.children);
- for_all(it)
- res->insert_child(test_convert(ima, it.to_psite()));
+ // p_array<image2d<int_u8>::psite>::fwd_piter it (n.children);
+ // for_all(it)
+ // res->insert_child(test_convert(ima, it.to_psite()));
+ for (unsigned i=0; i < n.children.size(); ++i)
+ res->insert_child(test_convert(ima, n.children[i]));
return res;
}
Index: abraham/tests/morpho/test_watershed.cc
--- abraham/tests/morpho/test_watershed.cc (revision 2236)
+++ abraham/tests/morpho/test_watershed.cc (working copy)
@@ -22,9 +22,9 @@
// #define TEST
- io::pgm::load(input, "./images/test_watershed.pgm");
+ //io::pgm::load(input, "./images/test_watershed.pgm");
// io::pgm::load(input, "./images/little_test.pgm");
- // io::pgm::load(input, "./images/test_2.pgm");
+ io::pgm::load(input, "./images/test_4.pgm");
// io::pgm::load(input, "./images/lena_light.pgm");
// io::pgm::load(mverif, "./images/result_m_watershed.pgm");
Index: abraham/tests/morpho/test_watershed_topo.cc
--- abraham/tests/morpho/test_watershed_topo.cc (revision 2236)
+++ abraham/tests/morpho/test_watershed_topo.cc (working copy)
@@ -13,49 +13,27 @@
#include <string>
#include <iostream>
-int print_and_exit (std::string s)
-{
- std::cerr << s << std::endl;
- return 1;
-}
-
-int main ()
+int main (int argc, const char* argv [])
{
using namespace mln;
using value::int_u8;
typedef image2d<int_u8> image2dint;
- image2dint input, mverif, wverif;
+ image2dint input;
- // #define TEST
+ if (argc != 2) {
+ std::cerr << "usage: " << argv[0] << " in.pgm out.pgm" << std::endl;
+ return 1;
+ }
- // io::pgm::load(input, "./images/test_watershed.pgm");
- // io::pgm::load(input, "./images/little_test.pgm");
- io::pgm::load(input, "./images/test_4.pgm");
- // io::pgm::load(input, "../../img/dots.pgm");
- //io::pgm::load(input, "./images/+irm6.pgm");
-
- // io::pgm::load(input, "./images/lena_light.pgm");
- // io::pgm::load(mverif, "./images/result_m_watershed.pgm");
- // io::pgm::load(wverif, "./images/result_topo_watershed.pgm");
+ io::pgm::load(input, argv[1]);
morpho::basic_najman< image2d<int_u8>, neighb2d> n(input, c4());
- /*
- image2dint::fwd_piter it(input.domain());
- for_all(it)
- {
- input(it) = input(it)/17;
- mverif(it) = mverif(it)/17;
- }
- */
-
- // io::tikz::save(input, "start.tex");
-
n.gotopo();
- io::pgm::save(n.pima, "out.pgm");
+ io::pgm::save(n.pima, argv[2]);
return 0;
}
Index: abraham/tests/morpho/ref/src/lib/lwshedtopo.c
--- abraham/tests/morpho/ref/src/lib/lwshedtopo.c (revision 2236)
+++ abraham/tests/morpho/ref/src/lib/lwshedtopo.c (working copy)
@@ -266,13 +266,13 @@
}
}
}
- //#ifdef _DEBUG_
+ #ifdef _DEBUG_
for (i=0; i<logn; i++) {
for (j=0; j<nbRepresent; j++)
printf("M[%d][%d] = %d - ", i, j, Minim[i][j]);
printf("\n");
}
- //#endif
+ #endif
return Minim;
}
Index: abraham/mln/morpho/basic_najman.hh
--- abraham/mln/morpho/basic_najman.hh (revision 2236)
+++ abraham/mln/morpho/basic_najman.hh (working copy)
@@ -21,16 +21,16 @@
class najman_distance
{
public:
- typedef mln_psite(I) psite;
+ typedef mln_point(I) point;
najman_distance(const Image<I>& ima);
/// Is \a x greater than \a y?
- bool operator()(const psite& x, const psite& y);
+ bool operator()(const point& x, const point& y);
// mln_value(I)
int
- D(const mln_psite(I)& x);
+ D(const mln_point(I)& x);
private:
const I& ima_;
@@ -52,14 +52,14 @@
template <typename I>
// mln_value(I)
int
- najman_distance<I>::D(const mln_psite(I)& x)
+ najman_distance<I>::D(const mln_point(I)& x)
{
const I& ima = exact(ima_);
mln_piter(I) it(ima.domain());
it.start();
- mln_psite(I) min = it.to_point();
+ mln_point(I) min = it.to_point();
for_all(it)
{
@@ -82,7 +82,7 @@
template <typename I>
bool
- najman_distance<I>::operator()(const mln_psite(I)& x, const mln_psite(I)& y)
+ najman_distance<I>::operator()(const mln_point(I)& x, const mln_point(I)& y)
{
if (ima_(x) < ima_(y))
return false;
@@ -437,43 +437,49 @@
struct basic_najman
{
- typedef mln_psite(I) psite;
+ typedef mln_point(I) point;
struct node {
mln_value(I) level;
int area;
int highest;
- p_array<mln_psite(I)> children;
+ typedef mln_point(I) point;
+ // Can't modify the points in a p_array
+ // p_array<mln_point(I)> children;
+ std::vector<point> children;
void addChildren(const node& n)
{
- typename p_array<mln_psite(I)>::fwd_piter it(n.children);
- for (it.start();
- it.is_valid();
- it.next())
- children.append(it.to_psite());
+ // typename p_array<mln_point(I)>::fwd_piter it(n.children);
+ // for (it.start();
+ // it.is_valid();
+ // it.next())
+ // children.append(it.to_point());
+ for (unsigned i=0; i < n.children.size(); ++i)
+ children.push_back(n.children[i]);
}
- void addChild(const psite n)
+ void addChild(const point p)
{
- children.append(n);
+ // children.append(n);
+ children.push_back(p);
}
}; // struct node
I pima;
const Neighborhood<N>& nbh;
- mln_ch_value(I, psite) Par_node;
- mln_ch_value(I, psite) Par_tree;
+ mln_ch_value(I, point) Par_node;
+ mln_ch_value(I, point) Par_tree;
mln_ch_value(I, int) Rnk_tree;
mln_ch_value(I, int) Rnk_node;
- mln_ch_value(I, psite) subtreeRoot;
+ mln_ch_value(I, point) subtreeRoot;
mln_ch_value(I, node) nodes;
mln_ch_value(I, bool) isproc;
- psite Root;
- p_array<mln_psite(I)> S;
- // std::map<psite,psite> M; // to keep the root of any point.
+ point Root;
+ p_array<mln_point(I)> S;
+ // std::map<point,point> M; // to keep the root of any point.
// Ctor
basic_najman(const Image<I>& i,
@@ -490,33 +496,33 @@
{
}
- void MakeSet_tree(psite x)
+ void MakeSet_tree(point x)
{
Par_tree(x) = x;
Rnk_tree(x) = 0;
}
- void MakeSet_node(psite x)
+ void MakeSet_node(point x)
{
Par_node(x) = x;
Rnk_node(x) = 0;
}
- psite Find_tree(psite x)
+ point Find_tree(point x)
{
if (Par_tree(x) != x)
Par_tree(x) = Find_tree(Par_tree(x));
return Par_tree(x);
}
- void swap(psite& x, psite& y)
+ void swap(point& x, point& y)
{
- psite memo = x;
+ point memo = x;
x = y;
y = memo;
}
- psite Find_node(psite x)
+ point Find_node(point x)
{
if (Par_node(x) != x)
Par_node(x) = Find_node(Par_node(x));
@@ -548,7 +554,7 @@
level::fill(isproc, false);
for (int ip = 0; ip < int(S.npoints()); ++ip)
{
- psite p = S[ip];
+ point p = S[ip];
MakeSet_node(p);
MakeSet_tree(p);
// if (subtreeRoot.hold(p))
@@ -561,20 +567,20 @@
void BuildComponentTree()
{
- typename p_array<mln_psite(I)>::fwd_piter ip(S);
+ typename p_array<mln_point(I)>::fwd_piter ip(S);
for_all(ip)
{
- psite p = ip.to_point();
+ point p = ip.to_point();
- psite curCanonicalElt = Find_tree(p);
- psite curNode = Find_node(subtreeRoot(curCanonicalElt));
+ point curCanonicalElt = Find_tree(p);
+ point curNode = Find_node(subtreeRoot(curCanonicalElt));
mln_niter(N) q(nbh, p);
for_all(q)
if (pima.has(q) and isproc(q) and pima(q) <= pima(p))
{
- psite adjCanonicalElt = Find_tree(q);
- psite adjNode = Find_node(subtreeRoot(adjCanonicalElt));
+ point adjCanonicalElt = Find_tree(q);
+ point adjNode = Find_node(subtreeRoot(adjCanonicalElt));
if (curNode != adjNode)
{
if (nodes(curNode).level == nodes(adjNode).level)
@@ -595,7 +601,7 @@
// Pour garder une map de correspondance point <-> local_root
// for (int ip = 0; ip < int(S.size()); ++ip)
// {
- // psite p = S[ip];
+ // point p = S[ip];
// M(p) = Find_node(p);
// }
@@ -603,14 +609,14 @@
for_all(r)
Par_node(r) = Find_node(r);
- Root = subtreeRoot(Find_tree(Find_node(psite(0, 0))));
+ Root = subtreeRoot(Find_tree(Find_node(point(0, 0))));
}
- psite MergeNode(psite& node1, psite& node2)
+ point MergeNode(point& node1, point& node2)
{
- psite tmpNode = Link_node(node1, node2);
- psite tmpNode2;
+ point tmpNode = Link_node(node1, node2);
+ point tmpNode2;
if (tmpNode == node2)
{
nodes(node2).addChildren(nodes(node1));
@@ -626,7 +632,7 @@
return tmpNode;
}
- psite Link_tree(psite x, psite y)
+ point Link_tree(point x, point y)
{
if (Rnk_tree(x) > Rnk_tree(y))
swap(x, y);
@@ -637,7 +643,7 @@
return y;
}
- psite Link_node(psite x, psite y)
+ point Link_node(point x, point y)
{
if (Rnk_node(x) > Rnk_node(y))
swap(x, y);
@@ -664,7 +670,7 @@
{
for(unsigned int j = 0; j < img.domain().len(1); ++j)
{
- C l = (img(psite(i, j)));//.row() * img.domain().len(1) + (img(psite(i, j))).col();
+ C l = (img(point(i, j)));//.row() * img.domain().len(1) + (img(point(i, j))).col();
std::cout << " " << l << " ";
}
std::cout << std::endl;
@@ -673,40 +679,41 @@
- void print_tree(psite p)
+ void print_tree(point p)
{
node& n = nodes(p);
- std::cout << "psite " << p << "(" << n.level << ")=" << (p.row() * exact(subtreeRoot).domain().len(1) + p.col()) << " : ";
+ std::cout << "point " << p << "(" << n.level << ")=" << (p.row() * exact(subtreeRoot).domain().len(1) + p.col()) << " : ";
- typename p_array<mln_psite(I)>::fwd_piter it(n.children);
+ typename p_array<mln_point(I)>::fwd_piter it(n.children);
for_all(it)
{
- psite q = it.to_psite();
+ point q = it.to_point();
std::cout << q << "=" << (q.row() * subtreeRoot.domain().len(1) + q.col()) << " ";
}
std::cout << std::endl;
for_all(it)
{
- print_tree(it.to_psite());
+ print_tree(it.to_point());
}
}
- psite lca (psite a, psite b)
+ point lca (point a, point b)
{
- psite r = lca_rec(Root, Par_node(a), Par_node(b));
+ // point r = lca_rec(Root, Par_node(a), Par_node(b));
+ point r = lca_rec(Root, a, b);
// These two conditions make the lca become a plca
// if (r == Par_node(a))
- // return psite(-1, -1);
+ // return point(-1, -1);
// if (r == Par_node(b))
- // return psite(-1, -1);
+ // return point(-1, -1);
return r;
}
- psite lca_rec (psite cur, psite a, psite b)
+ point lca_rec (point cur, point a, point b)
{
// FIXME : naive implementation, make something better
@@ -721,16 +728,19 @@
// We're on a leaf, the point has not been found
- if (nodes(cur).children.npoints() == 0)
- return psite (-1, -1);
+ // if (nodes(cur).children.npoints() == 0)
+ if (nodes(cur).children.size() == 0)
+ return point (-1, -1);
- psite tmp, acc = psite(-1, -1);
+ point tmp, acc = point(-1, -1);
int n = 0;
- typename p_array<mln_psite(I)>::fwd_piter it(nodes(cur).children);
- for_all(it)
- {
- tmp = lca_rec(it.to_psite(), a, b);
- if (tmp != psite(-1, -1))
+ // typename p_array<mln_point(I)>::fwd_piter it(nodes(cur).children);
+ // for_all(it)
+ for (unsigned i=0; i < nodes(cur).children.size(); ++i)
+ {
+ // tmp = lca_rec(it.to_point(), a, b);
+ tmp = lca_rec(nodes(cur).children[i], a, b);
+ if (tmp != point(-1, -1))
{
// On of the point has been encountered in a child branch
@@ -760,13 +770,13 @@
return acc;
}
- psite min (p_set<psite>& components)
+ point min (p_set<point>& components)
{
if (components.npoints() == 0)
- return psite(-1, -1);
+ return point(-1, -1);
- typename p_set<psite>::fwd_piter it(components);
- psite min = components[0];
+ typename p_set<point>::fwd_piter it(components);
+ point min = components[0];
for_all(it)
if (pima(it.to_point()) < pima(min))
@@ -775,13 +785,13 @@
return min;
}
- psite max (p_set<psite>& components)
+ point max (p_set<point>& components)
{
if (components.npoints() == 0)
- return psite(-1, -1);
+ return point(-1, -1);
- typename p_set<psite>::fwd_piter it(components);
- psite max = components[0];
+ typename p_set<point>::fwd_piter it(components);
+ point max = components[0];
for_all(it)
if (pima(it.to_point()) > pima(max))
@@ -791,166 +801,165 @@
}
- psite highest_fork (p_set<psite>& components)
+ point highest_fork (p_set<point>& components)
{
if (components.npoints() == 0)
{
std::cerr << "highest fork : empty set" << std::endl;
- return psite(-1, -1);
+ return point(-1, -1);
}
// if (components.npoints() == 1)
// return components[0];
- psite
+ point
m = min(components),
hfork = m;
- typename p_set<psite>::fwd_piter it(components);
+ typename p_set<point>::fwd_piter it(components);
for_all(it)
{
// Can't remove the point from the set
if (it.to_point() == m)
continue;
- psite c = lca(hfork, it.to_point());
+ point c = lca(hfork, it.to_point());
if (c != it.to_point())
// hfork = it.to_point();
hfork = c;
}
if (nodes(m).level == nodes(hfork).level)
- return psite(-1, -1);
+ return point(-1, -1);
return hfork;
}
- psite w_destructible(psite p)
+ point w_destructible(point p)
{
mln_niter(N) q(nbh, p);
- p_set<psite> v;
+ p_set<point> v;
for_all(q)
if (pima.has(q) && pima(q) < pima(p))
v.insert(Par_node(q));
if (v.npoints() == 0)
- return psite(-1, -1);
+ return point(-1, -1);
- psite hf = highest_fork(v);
+ point hf = highest_fork(v);
- if (hf == psite(-1, -1))
+ if (hf == point(-1, -1))
return min(v);
if (nodes(hf).level <= pima(p))
return hf;
- return psite(-1, -1);
+ return point(-1, -1);
}
- psite m_destructible(psite p)
+ point m_destructible(point p)
{
mln_niter(N) q(nbh, p);
- p_set<psite> v = p_set<psite>();
+ p_set<point> v = p_set<point>();
for_all(q)
if (pima.has(q) && pima(q) < pima(p))
v.insert(Par_node(q));
if (v.npoints() == 0)
- return psite(-1, -1);
+ return point(-1, -1);
- if (nodes(min(v)).children.npoints() != 0)
- return (psite(-1, -1));
+ // if (nodes(min(v)).children.npoints() != 0)
+ if (nodes(min(v)).children.size() != 0)
+ return (point(-1, -1));
//std::cout << "hf of " << p << ":" << v;
- psite hf = highest_fork(v);
+ point hf = highest_fork(v);
//std::cout << " is " << hf << std::endl;
- if (hf == psite(-1, -1))
+ if (hf == point(-1, -1))
return min(v);
- return psite(-1, -1);
+ return point(-1, -1);
}
- psite w_constructible(psite p)
+ point w_constructible(point p)
{
mln_niter(N) q(nbh, p);
- p_set<psite> v;
+ p_set<point> v;
for_all(q)
if (pima.has(q) && pima(q) > pima(p))
v.insert(Par_node(q));
if (v.npoints() == 0)
- return psite(-1, -1);
+ return point(-1, -1);
if (v.npoints() == 1)
- {
- if (nodes(v[0]).children.npoints() == 1)
- std::cout << "SINGL QUI MERDE" << std::endl;
return v[0];
- }
- psite
+ point
c = max(v),
cmax = c;
- typename p_set<psite>::fwd_piter it(v);
+ typename p_set<point>::fwd_piter it(v);
for_all(it)
{
// Can't remove the point from the set
if (it.to_point() == cmax)
continue;
- psite c1 = lca_opt(c, it.to_point());
+ point c1 = lca_opt(c, it.to_point());
+ // point c2 = lca(c, it.to_point());
+
+ // if (c1 != c2)
+ // std::cout << "DIFF LCA! points : " << c << " and " << it.to_point() << " opt : " << c1 << " classic : " << c2 << std::endl;
+
if (c1 != it.to_point())
c = c1;
}
if (nodes(c).level <= pima(p))
- return psite(-1, -1);
-
- if (nodes(c).children.npoints() == 1)
- std::cout << "LCA QUI MERDE" << std::endl;
+ return point(-1, -1);
return c;
}
- psite w_constructible_slow(psite p)
+ point w_constructible_slow(point p)
{
mln_niter(N) q(nbh, p);
- p_set<psite> v;
+ p_set<point> v;
for_all(q)
if (pima.has(q) && pima(q) > pima(p))
v.insert(Par_node(q));
if (v.npoints() == 0)
- return psite(-1, -1);
+ return point(-1, -1);
if (v.npoints() == 1)
return v[0];
- psite
+ point
c = max(v),
cmax = c;
- typename p_set<psite>::fwd_piter it(v);
+ typename p_set<point>::fwd_piter it(v);
for_all(it)
{
// Can't remove the point from the set
if (it.to_point() == cmax)
continue;
- psite c1 = lca(c, it.to_point());
+ point c1 = lca(c, it.to_point());
if (c1 != it.to_point())
c = c1;
}
if (nodes(c).level <= pima(p))
- return psite(-1, -1);
+ return point(-1, -1);
return c;
}
@@ -961,8 +970,8 @@
// FIXME : make a better priority function
typedef
- std::priority_queue< psite, std::vector<psite>, util::greater_psite<I> >
- // std::priority_queue< psite, std::vector<psite>, util::najman_distance<I> >
+ std::priority_queue< point, std::vector<point>, util::greater_psite<I> >
+ // std::priority_queue< point, std::vector<point>, util::najman_distance<I> >
ordered_queue_type;
@@ -974,14 +983,14 @@
mln_piter(I) it(pima.domain());
for_all(it)
- if (m_destructible(it.to_point()) != psite(-1, -1))
+ if (m_destructible(it.to_point()) != point(-1, -1))
{
//std::cout << "init: push " << it.to_point() << std::endl;
l.push(it.to_point());
isproc(it.to_point()) = true;
}
- psite p, i;
+ point p, i;
while (!l.empty())
{
// Extract priority queue
@@ -994,7 +1003,7 @@
i = m_destructible(p);
//std::cout << "point " << p << "is m-destructible " << i << std::endl;
- if (i != psite(-1, -1))
+ if (i != point(-1, -1))
{
pima(p) = nodes(i).level - 1 ;
Par_node(p) = i;
@@ -1002,10 +1011,10 @@
mln_niter(N) q(nbh, p);
for_all(q)
if (pima.has(q) && !isproc(q))
- if (m_destructible(q) != psite(-1, -1))
+ if (m_destructible(q) != point(-1, -1))
{
- // if (q == psite(1, 1))
- // std::cout << "psite(1, 1) ajoute dans la boucle" << std::endl;
+ // if (q == point(1, 1))
+ // std::cout << "point(1, 1) ajoute dans la boucle" << std::endl;
// Add priority queue
l.push(q);
@@ -1019,7 +1028,7 @@
void w_watershed()
{
- std::map< mln_value(I), std::set<psite> > L;
+ std::map< mln_value(I), std::set<point> > L;
// Setting the min and the max of the image
mln_value(I) k, kmin, kmax;
@@ -1027,24 +1036,24 @@
// For k From kmin to kmax - 1 Do Lk <- <empty set>
for (k = kmin; k < kmax; k++)
- L[k] = std::set<psite>();
+ L[k] = std::set<point>();
// I K(pima.domain(), pima.border());
mln_ch_value(I, int) K(pima.domain(), pima.border());
level::fill(K, 73320);
- mln_ch_value(I, psite) H(pima.domain(), pima.border());
+ mln_ch_value(I, point) H(pima.domain(), pima.border());
// For All p of E do
mln_piter(I) it(pima.domain());
for_all(it)
{
- psite p = it.to_point();
+ point p = it.to_point();
// i <- W-Destructible(p)
- psite i = w_destructible(p);
+ point i = w_destructible(p);
// If i != infinity then
- if (i != psite(-1, -1))
+ if (i != point(-1, -1))
{
L[nodes(i).level - 1].insert(p);
K(p) = nodes(i).level - 1;
@@ -1054,11 +1063,11 @@
for (k = kmin; k < kmax; k++)
{
- std::set<psite>& Lk = L[k];
+ std::set<point>& Lk = L[k];
while (!Lk.empty())
{
- psite p = *(Lk.begin());
+ point p = *(Lk.begin());
Lk.erase(p);
if (K(p) == 73320)
@@ -1073,8 +1082,8 @@
for_all(q)
if (pima.has(q) && k < pima(q))
{
- psite i = w_destructible(q);
- if (i == psite(-1, -1))
+ point i = w_destructible(q);
+ if (i == point(-1, -1))
K(q) = 10000;
else
if (K(q) != nodes(i).level - 1)
@@ -1092,8 +1101,8 @@
std::cout << "cas improbable" << std::endl;
- psite i = w_destructible(p);
- if (i == psite(-1, -1))
+ point i = w_destructible(p);
+ if (i == point(-1, -1))
K(p) = 10000;
else
if (K(p) != nodes(i).level - 1)
@@ -1112,16 +1121,17 @@
}
- void revert_tree (psite p)
+ void revert_tree (point p)
{
node& n = nodes(p);
n.level = 255 - n.level;
- typename p_array<mln_psite(I)>::fwd_piter it(n.children);
-
- for_all(it)
- revert_tree(it.to_psite());
+ // typename p_array<mln_point(I)>::fwd_piter it(n.children);
+ // for_all(it)
+ // revert_tree(it.to_point());
+ for (unsigned i=0; i < n.children.size(); ++i)
+ revert_tree(n.children[i]);
}
void gotopo()
@@ -1132,6 +1142,10 @@
BuildComponentTree();
std::cout << " done" << std::endl;
+ std::cout << "Compressing tree..." << std::endl;
+ compressTree();
+ std::cout << " done" << std::endl;
+
mln_piter(I) p (pima.domain());
for_all(p)
pima(p) = 255 - pima(p);
@@ -1166,14 +1180,15 @@
// Not used
// level::fill(isproc, false);
- util::fah_queue < psite, mln_value(I) > l;
+ util::fah_queue < point, mln_value(I) > l;
mln_value(I) max = mln_max(mln_value(I));
// Flag C-maxima
level::fill(cmax, false);
mln_piter(I) it(Par_node.domain());
for_all(it)
- if (nodes(Par_node(it.to_point())).children.npoints() == 0)
+ // if (nodes(Par_node(it.to_point())).children.npoints() == 0)
+ if (nodes(Par_node(it.to_point())).children.size() == 0)
cmax(it.to_point()) = true;
// Optimisation : enqueue minima's neighbours
@@ -1196,32 +1211,34 @@
// Main loop
while(!l.is_empty())
{
- psite x = l.top();
+ point x = l.top();
l.pop();
enqueued(x) = false;
- psite c = w_constructible(x);
- // psite d = w_constructible_slow(x);
+ point c = w_constructible(x);
+ // point d = w_constructible_slow(x);
//if (c != d)
// std::cerr << "COUILLE AVEC LE LCA : " << x << " donne " << c << " au lieu de " << d << std::endl;
- if (c != psite(-1, -1))
+ if (c != point(-1, -1))
{
pima(x) = nodes(c).level;
Par_node(x) = c;
// isproc(x) = true;
- if (nodes(c).children.npoints() == 0)
+ // if (nodes(c).children.npoints() == 0)
+ if (nodes(c).children.size() == 0)
cmax(x) = true;
else
- if (nodes(c).children.npoints() > 1)
+ // if (nodes(c).children.npoints() > 1)
+ if (nodes(c).children.size() > 1)
{
}
else
{
- std::cerr << "ERREUR COMPOSANTE BRANCHE " << nodes(c).children.npoints() << std::endl;
+ std::cerr << "ERREUR COMPOSANTE BRANCHE " << nodes(c).children.size() << std::endl;
}
@@ -1233,7 +1250,7 @@
l.push(q, max - pima(q));
}
- } // if (c != psite(-1, -1))
+ } // if (c != point(-1, -1))
} // while(!l.empty())
for_all(it)
@@ -1246,23 +1263,26 @@
int *euler;
int *depth;
int ctree_size;
- std::map<psite, int> pos;
- psite *repr;
+ std::map<point, int> pos;
+ point *repr;
int *minim;
int **Minim;
- void compute_ctree_size (psite p)
+ void compute_ctree_size (point p)
{
ctree_size += 1;
node& n = nodes(p);
- typename p_array<mln_psite(I)>::fwd_piter it(n.children);
- for_all(it)
- compute_ctree_size(it.to_point());
+ // typename p_array<mln_point(I)>::fwd_piter it(n.children);
+ // for_all(it)
+ // compute_ctree_size(it.to_point());
+
+ for (unsigned i=0; i < n.children.size(); ++i)
+ compute_ctree_size(n.children[i]);
}
- void build_euler_tour_rec(psite p, int &position, int d)
+ void build_euler_tour_rec(point p, int &position, int d)
{
if (pos.find(p) == pos.end())
pos[p] = position;
@@ -1273,16 +1293,24 @@
++position;
node& n = nodes(p);
- typename p_array<mln_psite(I)>::fwd_piter it(n.children);
- for_all(it)
+ // typename p_array<mln_point(I)>::fwd_piter it(n.children);
+ // for_all(it)
+ // {
+ // build_euler_tour_rec(it.to_point(), position, d+1);
+ // depth[position] = d; // Not optimized
+ // euler[position] = pos[p];
+ // repr[position] = p; // Pas necessaire?
+ // ++position;
+ // }
+
+ for(unsigned i=0; i < n.children.size(); ++i)
{
- build_euler_tour_rec(it.to_point(), position, d+1);
+ build_euler_tour_rec(n.children[i], position, d+1);
depth[position] = d; // Not optimized
euler[position] = pos[p];
repr[position] = p; // Pas necessaire?
++position;
}
-
}
void build_euler_tour ()
@@ -1295,7 +1323,7 @@
// FIXME : free this
euler = new int[size];
depth = new int[size];
- repr = new psite[size];
+ repr = new point[size];
int position = 0;
build_euler_tour_rec(Root, position, 0);
@@ -1341,7 +1369,7 @@
} // void build_minim ()
- psite lca_opt (psite a, psite b)
+ point lca_opt (point a, point b)
{
int
m = pos[a],
@@ -1367,6 +1395,40 @@
}
}
+
+ void removeOneSonNodes(point *p, mln_ch_value(I, point) &newPar_node)
+ {
+ node &n = nodes(*p);
+
+ if (n.children.size() == 1) // this node has 1 son, delete it
+ {
+ n.area = -1;
+ newPar_node(*p) = n.children[0];
+ *p = n.children[0];
+ removeOneSonNodes(p, newPar_node);
+ }
+ else // there is more than one son, recursive call
+ {
+ for (unsigned i = 0; i < n.children.size(); ++i)
+ removeOneSonNodes(&(n.children[i]), newPar_node);
+ }
+ }
+
+
+ void compressTree()
+ {
+ mln_ch_value(I, point) newPar_node(Par_node.domain(), Par_node.border());
+
+ // Remove the nodes with one son
+ removeOneSonNodes(&Root, newPar_node);
+
+ // Update the references on deleted nodes
+ mln_piter(I) p(Par_node.domain());
+ for_all(p)
+ while (nodes(Par_node(p)).area == -1)
+ Par_node(p) = newPar_node(Par_node(p));
+ }
+
}; // struct basic_najman
}; // namespace morpho
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix level fill.
* mln/level/fill.hh: Fix missing exact.
fill.hh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 2235)
+++ mln/level/fill.hh (working copy)
@@ -82,7 +82,7 @@
template <typename I, typename D>
void fill_dispatch(Image<I>& ima, const D& data)
{
- fill_dispatch_overload(ima, exact(data));
+ fill_dispatch_overload(exact(ima), exact(data));
}
// dispatch_overload
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix update in level fill.
* mln/level/fill.hh: Fix update.
fill.hh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 2234)
+++ mln/level/fill.hh (working copy)
@@ -88,26 +88,27 @@
// dispatch_overload
template <typename I>
- void fill_dispatch_overload(Image<I>& ima, const mln_value(I)& v)
+ void fill_dispatch_overload(I& ima, const mln_value(I)& v)
{
mln::level::fill_with_value(ima, v);
}
template <typename I, typename J>
- void fill_dispatch_overload(Image<I>& ima, const Image<J>& data)
+ void fill_dispatch_overload(I& ima, const Image<J>& data)
{
mln::level::fill_with_image(ima, data);
}
template <typename I, typename F>
- void fill_dispatch_overload(Image<I>& ima, const Function<F>& f)
+ void fill_dispatch_overload(I& ima, const Function<F>& f)
{
mlc_converts_to(mln_result(F), mln_value(I))::check();
- mln::level::fill_with_image(ima, f | ima.domain());
+ mln::level::fill_with_image(ima,
+ exact(f) | ima.domain());
}
template <typename I, typename R, typename A>
- void fill_dispatch_overload(Image<I>& ima, R (*f)(A))
+ void fill_dispatch_overload(I& ima, R (*f)(A))
{
mlc_converts_to(R, mln_value(I))::check();
mln::level::fill_with_image(ima,
@@ -115,10 +116,9 @@
}
template <typename I, typename V, unsigned N>
- void fill_dispatch_overload(Image<I>& ima_, V (&arr)[N])
+ void fill_dispatch_overload(I& ima, V (&arr)[N])
{
mlc_converts_to(V, mln_value(I))::check();
- I& ima = exact(ima_);
mln_precondition(N == ima.nsites());
mln_fwd_piter(I) p(ima.domain());
unsigned i = 0;
1
0
12 Sep '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Get rid of the deprecated 'npoints' name.
* tools/area_flooding.cc,
* tests/core/other/dpoints_pixter.cc,
* mln/core/site_set/p_bgraph.hh,
* mln/core/site_set/p_bgraph_piter.hh,
* mln/core/site_set/p_complex.hh,
* mln/core/site_set/p_line_graph.hh,
* mln/core/site_set/p_faces.hh,
* mln/core/site_set/p_graph.hh,
* mln/core/image/bgraph_image.hh,
* mln/core/image/fi_adaptor.hh,
* mln/core/internal/run_image.hh,
* mln/core/concept/doc/image.hh,
* mln/draw/graph.hh,
* mln/level/sort_psites.hh,
* mln/convert/to_p_array.hh,
* mln/geom/pmin_pmax.hh,
* mln/set/is_subset_of.hh,
* mln/morpho/rank_filter.hh,
* mln/morpho/Rd.hh,
* sandbox/duhamel/queue_p_priority.cc,
* sandbox/duhamel/mesh_p.hh,
* sandbox/duhamel/queue_p_fast.hh,
* sandbox/duhamel/queue_p_priority.hh,
* sandbox/duhamel/labeling_algo.hh,
* sandbox/pellegrin/set/test/p_queue_fast.cc,
* sandbox/pellegrin/set/test/p_priority_queue_fast.cc,
* sandbox/pellegrin/set/test/p_queue.cc,
* sandbox/pellegrin/set/test/p_priority_queue.cc,
* sandbox/pellegrin/set/test/p_runs.cc,
* sandbox/pellegrin/set/test/pset_if.cc,
* sandbox/pellegrin/set/test/p_set.cc,
* sandbox/pellegrin/set/test/p_priority_queue_fast_with_array.cc,
* sandbox/pellegrin/set/core/p_priority_queue_fast.hh,
* sandbox/pellegrin/set/core/p_bgraph.hh,
* sandbox/pellegrin/set/core/p_run.hh,
* sandbox/pellegrin/set/core/p_line_graph.hh,
* sandbox/pellegrin/set/core/pset_if.hh,
* sandbox/pellegrin/set/core/p_array.hh,
* sandbox/pellegrin/set/core/concept/point_set.hh,
* sandbox/pellegrin/set/core/p_queue.hh,
* sandbox/pellegrin/set/core/p_priority_queue.hh,
* sandbox/pellegrin/set/core/p_runs.hh,
* sandbox/pellegrin/set/core/p_priority_queue_fast_with_array.hh,
* sandbox/pellegrin/set/core/p_set.hh,
* sandbox/pellegrin/set/core/line2d.hh,
* sandbox/pellegrin/set/core/internal/multi_set.hh,
* sandbox/pellegrin/set/core/internal/uni_set.hh,
* sandbox/pellegrin/set/core/p_graph.hh,
* sandbox/pellegrin/set/core/p_queue_fast.hh,
* sandbox/aroumougame/skeleton/test_image3d.cc,
* sandbox/aroumougame/skeleton/thinning.hh,
* sandbox/nivault/plugin-gimp/src/gimp-image.hh,
* sandbox/jardonnet/test/icp_ref.cc,
* sandbox/jardonnet/test/icp.cc,
* sandbox/jardonnet/registration/final_qk.hh,
* sandbox/jardonnet/registration/cov.hh,
* sandbox/jardonnet/registration/exp_val.hh,
* sandbox/jardonnet/registration/save.hh,
* sandbox/jardonnet/registration/tools.hh,
* sandbox/jardonnet/registration/quat7.hh,
* sandbox/jardonnet/registration/cloud.hh,
* sandbox/jardonnet/registration/icp_ref.hh,
* sandbox/jardonnet/registration/icp.hh,
* sandbox/jardonnet/registration/projection.hh,
* sandbox/jardonnet/registration/center.hh,
* sandbox/geraud/fllt/fllt.hh,
* sandbox/geraud/fllt/simple_tests.cc,
* sandbox/geraud/fllt/fllt.svg.1.cc,
* sandbox/geraud/fllt/fllt.svg.7.hh,
* sandbox/geraud/fllt/fllt.svg.2.cc,
* sandbox/geraud/fllt/fllt.svg.3.cc,
* sandbox/geraud/fllt/fllt.svg.4.cc,
* sandbox/geraud/fllt/fllt.svg.5.cc,
* sandbox/geraud/fllt/fllt.svg.6.cc,
* sandbox/geraud/fllt/connected_filters/area_filter.hh,
* sandbox/geraud/fllt/fllt_test.hh,
* sandbox/geraud/fllt.svg.7.hh,
* sandbox/geraud/p_runs__with_dedicated_piter.hh,
* sandbox/geraud/fllt.svg.6.cc,
* sandbox/garrigues/level_set.hh,
* sandbox/garrigues/fllt/fllt_simple.svg.1.cc,
* sandbox/garrigues/fllt/merge.hh,
* sandbox/garrigues/fllt/fllt_simple.svg.3.cc,
* sandbox/garrigues/fllt/fllt_simple.cc,
* sandbox/garrigues/fllt/types.hh,
* sandbox/garrigues/fllt/fllt_theo.cc,
* sandbox/garrigues/fllt/compute_level_set_fast2.hh,
* sandbox/garrigues/fllt/fllt_merge.hh,
* sandbox/garrigues/fllt/fllt_optimized.hh,
* sandbox/garrigues/fllt/debug.hh,
* sandbox/garrigues/fllt/compute_level_set_fast.hh,
* sandbox/garrigues/fllt/fllt_simple.svg.2.cc,
* sandbox/garrigues/fllt/compute_level_set.hh,
* sandbox/garrigues/tiled_image2d/tiled_image2d.hh,
* sandbox/abraham/mln/morpho/basic_najman.hh
(npoints): Update token to...
(nsites): ...this.
mln/convert/to_p_array.hh | 2
mln/core/concept/doc/image.hh | 2
mln/core/image/bgraph_image.hh | 2
mln/core/image/fi_adaptor.hh | 2
mln/core/internal/run_image.hh | 2
mln/core/site_set/p_bgraph.hh | 6
mln/core/site_set/p_bgraph_piter.hh | 2
mln/core/site_set/p_complex.hh | 6
mln/core/site_set/p_faces.hh | 6
mln/core/site_set/p_graph.hh | 14 -
mln/core/site_set/p_line_graph.hh | 12 -
mln/draw/graph.hh | 2
mln/geom/pmin_pmax.hh | 4
mln/level/sort_psites.hh | 4
mln/morpho/Rd.hh | 2
mln/morpho/rank_filter.hh | 2
mln/set/is_subset_of.hh | 2
sandbox/abraham/mln/morpho/basic_najman.hh | 38 ++---
sandbox/aroumougame/skeleton/test_image3d.cc | 6
sandbox/aroumougame/skeleton/thinning.hh | 74 +++++-----
sandbox/duhamel/labeling_algo.hh | 2
sandbox/duhamel/mesh_p.hh | 4
sandbox/duhamel/queue_p_fast.hh | 10 -
sandbox/duhamel/queue_p_priority.cc | 10 -
sandbox/duhamel/queue_p_priority.hh | 18 +-
sandbox/garrigues/fllt/compute_level_set.hh | 18 +-
sandbox/garrigues/fllt/compute_level_set_fast.hh | 14 -
sandbox/garrigues/fllt/compute_level_set_fast2.hh | 14 -
sandbox/garrigues/fllt/debug.hh | 10 -
sandbox/garrigues/fllt/fllt_merge.hh | 4
sandbox/garrigues/fllt/fllt_optimized.hh | 4
sandbox/garrigues/fllt/fllt_simple.cc | 30 ++--
sandbox/garrigues/fllt/fllt_simple.svg.1.cc | 8 -
sandbox/garrigues/fllt/fllt_simple.svg.2.cc | 8 -
sandbox/garrigues/fllt/fllt_simple.svg.3.cc | 30 ++--
sandbox/garrigues/fllt/fllt_theo.cc | 18 +-
sandbox/garrigues/fllt/merge.hh | 6
sandbox/garrigues/fllt/types.hh | 20 +-
sandbox/garrigues/level_set.hh | 8 -
sandbox/garrigues/tiled_image2d/tiled_image2d.hh | 2
sandbox/geraud/fllt.svg.6.cc | 32 ++--
sandbox/geraud/fllt.svg.7.hh | 18 +-
sandbox/geraud/fllt/connected_filters/area_filter.hh | 4
sandbox/geraud/fllt/fllt.hh | 22 +-
sandbox/geraud/fllt/fllt.svg.1.cc | 2
sandbox/geraud/fllt/fllt.svg.2.cc | 10 -
sandbox/geraud/fllt/fllt.svg.3.cc | 6
sandbox/geraud/fllt/fllt.svg.4.cc | 10 -
sandbox/geraud/fllt/fllt.svg.5.cc | 10 -
sandbox/geraud/fllt/fllt.svg.6.cc | 32 ++--
sandbox/geraud/fllt/fllt.svg.7.hh | 18 +-
sandbox/geraud/fllt/fllt_test.hh | 18 +-
sandbox/geraud/fllt/simple_tests.cc | 4
sandbox/geraud/p_runs__with_dedicated_piter.hh | 2
sandbox/jardonnet/registration/center.hh | 6
sandbox/jardonnet/registration/cloud.hh | 10 -
sandbox/jardonnet/registration/cov.hh | 6
sandbox/jardonnet/registration/exp_val.hh | 6
sandbox/jardonnet/registration/final_qk.hh | 20 +-
sandbox/jardonnet/registration/icp.hh | 12 -
sandbox/jardonnet/registration/icp_ref.hh | 4
sandbox/jardonnet/registration/projection.hh | 16 +-
sandbox/jardonnet/registration/quat7.hh | 4
sandbox/jardonnet/registration/save.hh | 10 -
sandbox/jardonnet/registration/tools.hh | 8 -
sandbox/jardonnet/test/icp.cc | 12 -
sandbox/jardonnet/test/icp_ref.cc | 10 -
sandbox/nivault/plugin-gimp/src/gimp-image.hh | 2
sandbox/pellegrin/set/core/concept/point_set.hh | 10 -
sandbox/pellegrin/set/core/internal/multi_set.hh | 10 -
sandbox/pellegrin/set/core/internal/uni_set.hh | 10 -
sandbox/pellegrin/set/core/line2d.hh | 6
sandbox/pellegrin/set/core/p_array.hh | 12 -
sandbox/pellegrin/set/core/p_bgraph.hh | 6
sandbox/pellegrin/set/core/p_graph.hh | 10 -
sandbox/pellegrin/set/core/p_line_graph.hh | 4
sandbox/pellegrin/set/core/p_priority_queue.hh | 18 +-
sandbox/pellegrin/set/core/p_priority_queue_fast.hh | 18 +-
sandbox/pellegrin/set/core/p_priority_queue_fast_with_array.hh | 18 +-
sandbox/pellegrin/set/core/p_queue.hh | 10 -
sandbox/pellegrin/set/core/p_queue_fast.hh | 10 -
sandbox/pellegrin/set/core/p_run.hh | 10 -
sandbox/pellegrin/set/core/p_runs.hh | 12 -
sandbox/pellegrin/set/core/p_set.hh | 10 -
sandbox/pellegrin/set/core/pset_if.hh | 4
sandbox/pellegrin/set/test/p_priority_queue.cc | 10 -
sandbox/pellegrin/set/test/p_priority_queue_fast.cc | 10 -
sandbox/pellegrin/set/test/p_priority_queue_fast_with_array.cc | 16 +-
sandbox/pellegrin/set/test/p_queue.cc | 6
sandbox/pellegrin/set/test/p_queue_fast.cc | 6
sandbox/pellegrin/set/test/p_runs.cc | 4
sandbox/pellegrin/set/test/p_set.cc | 2
sandbox/pellegrin/set/test/pset_if.cc | 2
tests/core/other/dpoints_pixter.cc | 6
tools/area_flooding.cc | 2
95 files changed, 492 insertions(+), 492 deletions(-)
Index: tools/area_flooding.cc
--- tools/area_flooding.cc (revision 2233)
+++ tools/area_flooding.cc (working copy)
@@ -114,7 +114,7 @@
nbh_t nbh;
unsigned area = 0;
- unsigned max_area = input.npoints();
+ unsigned max_area = input.nsites();
unsigned nregions = mln_max(unsigned);
unsigned max_nregions = atoi(argv[1]);
Index: tests/core/other/dpoints_pixter.cc
--- tests/core/other/dpoints_pixter.cc (revision 2233)
+++ tests/core/other/dpoints_pixter.cc (working copy)
@@ -40,7 +40,7 @@
template <typename I, typename W>
-void test_fill(I& ima, const W& win, unsigned npoints)
+void test_fill(I& ima, const W& win, unsigned nsites)
{
mln_piter(I) p(ima.domain());
mln_fwd_qixter(I, W) fq(ima, win, p);
@@ -49,7 +49,7 @@
unsigned i = 0;
for_all(fq)
++i, fq.val() = 51;
- mln_assertion(i == npoints);
+ mln_assertion(i == nsites);
}
mln_bkd_qixter(I, W) bq(ima, win, p);
for_all(p)
@@ -57,7 +57,7 @@
unsigned i = 0;
for_all(bq)
++i, bq.val() = 42;
- mln_assertion(i == npoints);
+ mln_assertion(i == nsites);
}
}
Index: mln/core/site_set/p_bgraph.hh
--- mln/core/site_set/p_bgraph.hh (revision 2233)
+++ mln/core/site_set/p_bgraph.hh (working copy)
@@ -78,7 +78,7 @@
p_bgraph (graph* gr);
/// Return The number of points (i.e., nodes) in the graph.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of lines (i.e., edges) in the graph.
std::size_t nlines() const;
@@ -131,7 +131,7 @@
template<typename P>
inline
std::size_t
- p_bgraph<P>::npoints() const
+ p_bgraph<P>::nsites() const
{
return boost::num_vertices(*gr_);
}
@@ -161,7 +161,7 @@
// Check whether P is compatible with this psite set.
(&p.pg() == this) &&
// Check that the node id of P belongs to the range of valid node ids.
- (p.id() < this->npoints());
+ (p.id() < this->nsites());
}
Index: mln/core/site_set/p_bgraph_piter.hh
--- mln/core/site_set/p_bgraph_piter.hh (revision 2233)
+++ mln/core/site_set/p_bgraph_piter.hh (working copy)
@@ -118,7 +118,7 @@
p_bgraph_piter_<P>::p_bgraph_piter_(const p_bgraph<P>& pg)
: pg_(pg),
// Initialize psite_ to a dummy value.
- psite_(pg, pg_.npoints()),
+ psite_(pg, pg_.nsites()),
p_()
{
iterators_ = boost::vertices(pg_.to_graph());
Index: mln/core/site_set/p_complex.hh
--- mln/core/site_set/p_complex.hh (revision 2233)
+++ mln/core/site_set/p_complex.hh (working copy)
@@ -82,7 +82,7 @@
/// number of \em faces.
///
/// Required by the mln::Point_Set concept.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of faces in the complex.
std::size_t nfaces() const;
@@ -161,7 +161,7 @@
{
// FIXME: Dummy initialization.
accu::bbox<P> a;
- for (unsigned i = 0; i < npoints(); ++i)
+ for (unsigned i = 0; i < nsites(); ++i)
a.take(P());
bb_ = a.to_result();
}
@@ -169,7 +169,7 @@
template <unsigned D, typename P>
inline
std::size_t
- p_complex<D, P>::npoints() const
+ p_complex<D, P>::nsites() const
{
return nfaces();
}
Index: mln/core/site_set/p_line_graph.hh
--- mln/core/site_set/p_line_graph.hh (revision 2233)
+++ mln/core/site_set/p_line_graph.hh (working copy)
@@ -79,7 +79,7 @@
/// line graph.
///
/// Required by the mln::Point_Set concept.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of vertices in the graph.
std::size_t nvertices() const;
@@ -155,7 +155,7 @@
template <typename P>
inline
std::size_t
- p_line_graph<P>::npoints() const
+ p_line_graph<P>::nsites() const
{
return nedges();
}
@@ -213,8 +213,8 @@
p_line_graph<P>::adjacent(const util::edge_id& lhs,
const util::edge_id& rhs) const
{
- mln_assertion(lhs < this->npoints());
- mln_assertion(rhs < this->npoints());
+ mln_assertion(lhs < this->nsites());
+ mln_assertion(rhs < this->nsites());
// Ensure LHS and RHS are *not* equal.
if (lhs == rhs)
@@ -248,8 +248,8 @@
p_line_graph<P>::adjacent_or_equal(const util::edge_id& lhs,
const util::edge_id& rhs) const
{
- mln_assertion(lhs < this->npoints());
- mln_assertion(rhs < this->npoints());
+ mln_assertion(lhs < this->nsites());
+ mln_assertion(rhs < this->nsites());
// Check whether LHS and RHS are equal.
if (lhs == rhs)
Index: mln/core/site_set/p_faces.hh
--- mln/core/site_set/p_faces.hh (revision 2233)
+++ mln/core/site_set/p_faces.hh (working copy)
@@ -79,7 +79,7 @@
/// number of \em faces.
///
/// Required by the mln::Point_Set concept.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of faces in the complex.
std::size_t nfaces() const;
@@ -135,7 +135,7 @@
// FIXME: Dummy initialization.
accu::bbox<P> a;
- for (unsigned i = 0; i < npoints(); ++i)
+ for (unsigned i = 0; i < nsites(); ++i)
a.take(P());
bb_ = a.to_result();
}
@@ -143,7 +143,7 @@
template <unsigned N, unsigned D, typename P>
inline
std::size_t
- p_faces<N, D, P>::npoints() const
+ p_faces<N, D, P>::nsites() const
{
return nfaces();
}
Index: mln/core/site_set/p_graph.hh
--- mln/core/site_set/p_graph.hh (revision 2233)
+++ mln/core/site_set/p_graph.hh (working copy)
@@ -71,7 +71,7 @@
/// the number of \em vertices.
///
/// Required by the mln::Point_Set concept.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of vertices in the graph.
std::size_t nvertices() const;
@@ -160,7 +160,7 @@
: gr_ (new util::graph<P>(gr))
{
accu::bbox<P> a;
- for (unsigned i = 0; i < npoints(); ++i)
+ for (unsigned i = 0; i < nsites(); ++i)
a.take(gr_->vertex_data(i));
bb_ = a.to_result();
}
@@ -168,7 +168,7 @@
template <typename P>
inline
std::size_t
- p_graph<P>::npoints() const
+ p_graph<P>::nsites() const
{
return nvertices();
}
@@ -256,8 +256,8 @@
p_graph<P>::adjacent(const util::vertex_id& lhs,
const util::vertex_id& rhs) const
{
- mln_assertion(lhs < this->npoints());
- mln_assertion(rhs < this->npoints());
+ mln_assertion(lhs < this->nsites());
+ mln_assertion(rhs < this->nsites());
// Ensure LHS and RHS are *not* equal.
if (rhs == lhs)
@@ -291,8 +291,8 @@
p_graph<P>::adjacent_or_equal(const util::vertex_id& lhs,
const util::vertex_id& rhs) const
{
- mln_assertion(lhs < this->npoints());
- mln_assertion(rhs < this->npoints());
+ mln_assertion(lhs < this->nsites());
+ mln_assertion(rhs < this->nsites());
// Check whether LHS and RHS are equal.
if (lhs == rhs)
Index: mln/core/image/bgraph_image.hh
--- mln/core/image/bgraph_image.hh (revision 2233)
+++ mln/core/image/bgraph_image.hh (working copy)
@@ -202,7 +202,7 @@
inline
bgraph_image<P, V>::bgraph_image(const p_bgraph<P>& g)
{
- init_(g, std::vector<V>(g.npoints()));
+ init_(g, std::vector<V>(g.nsites()));
}
template <typename P, typename V>
Index: mln/core/image/fi_adaptor.hh
--- mln/core/image/fi_adaptor.hh (revision 2233)
+++ mln/core/image/fi_adaptor.hh (working copy)
@@ -310,7 +310,7 @@
fi_adaptor<I>::nelements() const
{
mln_precondition(this->has_data());
- return this->data_->b_.npoints();
+ return this->data_->b_.nsites();
}
template <typename I>
Index: mln/core/internal/run_image.hh
--- mln/core/internal/run_image.hh (revision 2233)
+++ mln/core/internal/run_image.hh (working copy)
@@ -102,7 +102,7 @@
run_image_<T, P, E>::compression() const
{
return float(exact(this)->data_->size_mem()) /
- float (sizeof(T) * exact(this)->data_->domain_.bbox().npoints());
+ float (sizeof(T) * exact(this)->data_->domain_.bbox().nsites());
}
template <typename T, typename P, typename E>
Index: mln/core/concept/doc/image.hh
--- mln/core/concept/doc/image.hh (revision 2233)
+++ mln/core/concept/doc/image.hh (working copy)
@@ -176,7 +176,7 @@
/*! \brief Give the number of points of the image domain.
*/
- std::size_t npoints() const;
+ std::size_t nsites() const;
};
Index: mln/draw/graph.hh
--- mln/draw/graph.hh (revision 2233)
+++ mln/draw/graph.hh (working copy)
@@ -103,7 +103,7 @@
pg.gr_->vertex_data(pg.gr_->edge(l).v2()),
edge_v);
// Draw the points (vertices).
- for (size_t p = 0; p < pg.npoints(); ++p)
+ for (size_t p = 0; p < pg.nsites(); ++p)
exact(ima)(pg.gr_->vertex_data(p)) = vertex_v;
}
Index: mln/level/sort_psites.hh
--- mln/level/sort_psites.hh (revision 2233)
+++ mln/level/sort_psites.hh (working copy)
@@ -149,7 +149,7 @@
loc[i] = loc[i-1] + h[i-1];
// computing output data
- std::vector<mln_psite(I)> vec(input.npoints());
+ std::vector<mln_psite(I)> vec(input.nsites());
mln_fwd_piter(I) p(input.domain());
for_all(p)
vec[loc[vset.index_of(input(p))]++] = p;
@@ -193,7 +193,7 @@
loc[i] = loc[i+1] + h[i+1];
// computing output data
- std::vector<mln_psite(I)> vec(input.npoints());
+ std::vector<mln_psite(I)> vec(input.nsites());
mln_fwd_piter(I) p(input.domain());
for_all(p)
vec[loc[vset.index_of(input(p))]++] = p;
Index: mln/convert/to_p_array.hh
--- mln/convert/to_p_array.hh (revision 2233)
+++ mln/convert/to_p_array.hh (working copy)
@@ -68,7 +68,7 @@
{
const S& pset = exact(pset_);
p_array<mln_psite(S)> v;
- v.reserve(pset.npoints());
+ v.reserve(pset.nsites());
// FIXME: Why mln_fwd_piter and not mln_piter?
mln_fwd_piter(S) p(pset);
for_all(p)
Index: mln/geom/pmin_pmax.hh
--- mln/geom/pmin_pmax.hh (revision 2233)
+++ mln/geom/pmin_pmax.hh (working copy)
@@ -150,7 +150,7 @@
void
pmin_pmax(const Site_Set<S>& s, mln_point(S)& pmin, mln_point(S)& pmax)
{
- mln_precondition(exact(s).npoints() != 0);
+ mln_precondition(exact(s).nsites() != 0);
impl::pmin_pmax_(exact(s), pmin, pmax);
}
@@ -159,7 +159,7 @@
std::pair<mln_point(S), mln_point(S)>
pmin_pmax(const Site_Set<S>& s)
{
- mln_precondition(exact(s).npoints() != 0);
+ mln_precondition(exact(s).nsites() != 0);
typedef mln_point(S) P;
std::pair<P, P> tmp;
pmin_pmax(s, tmp.first, tmp.second); // Calls the previous version.
Index: mln/set/is_subset_of.hh
--- mln/set/is_subset_of.hh (revision 2233)
+++ mln/set/is_subset_of.hh (working copy)
@@ -58,7 +58,7 @@
Pl lhs = exact(lhs_);
Pr rhs = exact(rhs_);
- if (lhs.npoints() > rhs.npoints())
+ if (lhs.nsites() > rhs.nsites())
{
trace::exiting("set::is_subset_of");
return false;
Index: mln/morpho/rank_filter.hh
--- mln/morpho/rank_filter.hh (revision 2233)
+++ mln/morpho/rank_filter.hh (working copy)
@@ -69,7 +69,7 @@
mln_concrete(I) output;
initialize(output, input);
- accu::rank_<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).npoints());
+ accu::rank_<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).nsites());
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
Index: mln/morpho/Rd.hh
--- mln/morpho/Rd.hh (revision 2233)
+++ mln/morpho/Rd.hh (working copy)
@@ -85,7 +85,7 @@
loc[255] = 0;
for (int l = 254; l >= 0; --l)
loc[l] = loc[l+1] + h[l+1];
- std::vector<mln_psite(I)> vec(ima.domain().npoints());
+ std::vector<mln_psite(I)> vec(ima.domain().nsites());
// storing output data
mln_piter(I) p(ima.domain());
for_all(p)
Index: sandbox/duhamel/queue_p_priority.cc
--- sandbox/duhamel/queue_p_priority.cc (revision 2233)
+++ sandbox/duhamel/queue_p_priority.cc (working copy)
@@ -12,7 +12,7 @@
mln_assertion (q.empty ());
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
q.push_force (p3);
q.push_force (p1, 3);
@@ -25,7 +25,7 @@
mln_assertion (q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites () == 3);
mln_assertion (q.front () == p2);
q.pop ();
@@ -33,7 +33,7 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites () == 2);
mln_assertion (q.front () == p1);
q.pop ();
@@ -41,14 +41,14 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites () == 1);
mln_assertion (q.front () == p3);
q.pop ();
mln_assertion (!q.has (p1));
mln_assertion (!q.has (p2));
mln_assertion (!q.has (p3));
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
mln_assertion (q.empty ());
Index: sandbox/duhamel/mesh_p.hh
--- sandbox/duhamel/mesh_p.hh (revision 2233)
+++ sandbox/duhamel/mesh_p.hh (working copy)
@@ -28,7 +28,7 @@
/// Backward Site_Iterator associated type.
typedef mesh_p_piter_<P> bkd_piter;
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -128,7 +128,7 @@
template<typename P>
std::size_t
- mesh_p<P>::npoints() const
+ mesh_p<P>::nsites() const
{
return this->gr_.nb_node_;
}
Index: sandbox/duhamel/queue_p_fast.hh
--- sandbox/duhamel/queue_p_fast.hh (revision 2233)
+++ sandbox/duhamel/queue_p_fast.hh (working copy)
@@ -60,7 +60,7 @@
* (i.e., no-op if multiple or allow multiple insertions).
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints() when this container is multiple.
+ * a call to nsites() when this container is multiple.
*/
template <typename P>
class queue_p_fast : public internal::point_set_base_< P, queue_p_fast<P> >
@@ -83,7 +83,7 @@
bool empty() const;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -179,7 +179,7 @@
template <typename P>
std::size_t
- queue_p_fast<P>::npoints() const
+ queue_p_fast<P>::nsites() const
{
mln_precondition(this->end_ >= this->begin_);
return (this->end_ - this->begin_);
@@ -189,7 +189,7 @@
const box_<P>&
queue_p_fast<P>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
bb_update_();
return bb_.to_result();
@@ -263,7 +263,7 @@
const P&
queue_p_fast<P>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return q_[begin_ + i];
}
Index: sandbox/duhamel/queue_p_priority.hh
--- sandbox/duhamel/queue_p_priority.hh (revision 2233)
+++ sandbox/duhamel/queue_p_priority.hh (working copy)
@@ -61,7 +61,7 @@
* (i.e., no-op if multiple or allow multiple insertions).
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints() when this container is multiple.
+ * a call to nsites() when this container is multiple.
*/
template <typename P, typename T>
class queue_p_priority : public internal::point_set_base_< P, queue_p_priority<P, T> >
@@ -84,7 +84,7 @@
bool empty() const;
/// Give the number of points.
- unsigned npoints() const;
+ unsigned nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -142,7 +142,7 @@
queue_p_priority<P, T>::vect_update_() const
{
vect_.clear();
- vect_.reserve(npoints());
+ vect_.reserve(nsites());
typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
@@ -161,7 +161,7 @@
typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
- for (unsigned i = 0; i < (*it).second.npoints (); ++i)
+ for (unsigned i = 0; i < (*it).second.nsites (); ++i)
bb_.take((*it).second[i]);
}
@@ -192,7 +192,7 @@
template <typename P, typename T>
unsigned
- queue_p_priority<P, T>::npoints() const
+ queue_p_priority<P, T>::nsites() const
{
unsigned res = 0;
@@ -200,7 +200,7 @@
for (; it != q_.end (); ++it)
if (!(*it).second.empty ())
- res += (*it).second.npoints();
+ res += (*it).second.nsites();
return res;
}
@@ -208,7 +208,7 @@
const box_<P>&
queue_p_priority<P, T>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
bb_update_();
return bb_.to_result();
@@ -290,7 +290,7 @@
const P&
queue_p_priority<P, T>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
unsigned cpt = 0;
@@ -298,7 +298,7 @@
for (; it != q_.end (); ++it)
{
if (!(*it).second.empty ())
- for (cpt = 0; cpt < (*it).second.npoints (); ++cpt)
+ for (cpt = 0; cpt < (*it).second.nsites (); ++cpt)
{
if (i == 0)
return (*it).second[cpt];
Index: sandbox/duhamel/labeling_algo.hh
--- sandbox/duhamel/labeling_algo.hh (revision 2233)
+++ sandbox/duhamel/labeling_algo.hh (working copy)
@@ -250,7 +250,7 @@
q.push(p);
break;
}
- std::cout << "init => q has " << q.npoints() << " points"
+ std::cout << "init => q has " << q.nsites() << " points"
<< std::endl;
}
Index: sandbox/pellegrin/set/test/p_queue_fast.cc
--- sandbox/pellegrin/set/test/p_queue_fast.cc (revision 2233)
+++ sandbox/pellegrin/set/test/p_queue_fast.cc (working copy)
@@ -44,14 +44,14 @@
.push(make::point2d(6, 9))
.push(make::point2d(5, 1))
.push(make::point2d(4, 2));
- mln_assertion(q.npoints() == 3);
+ mln_assertion(q.nsites() == 3);
std::cout << q.bbox() << std::endl;
std::cout << q << std::endl;
q.pop();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
point2d p = q.front();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
mln_assertion(p == make::point2d(5, 1));
}
Index: sandbox/pellegrin/set/test/p_priority_queue_fast.cc
--- sandbox/pellegrin/set/test/p_priority_queue_fast.cc (revision 2233)
+++ sandbox/pellegrin/set/test/p_priority_queue_fast.cc (working copy)
@@ -44,7 +44,7 @@
mln_assertion (q.is_empty ());
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
q.push_force (p3);
q.push_force (p1, 3);
@@ -59,7 +59,7 @@
mln_assertion (q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites () == 3);
mln_assertion (q.front () == p2);
q.pop ();
@@ -67,7 +67,7 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites () == 2);
mln_assertion (q.front () == p1);
q.pop ();
@@ -75,14 +75,14 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites () == 1);
mln_assertion (q.front () == p3);
q.pop ();
mln_assertion (!q.has (p1));
mln_assertion (!q.has (p2));
mln_assertion (!q.has (p3));
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
mln_assertion (q.is_empty ());
Index: sandbox/pellegrin/set/test/p_queue.cc
--- sandbox/pellegrin/set/test/p_queue.cc (revision 2233)
+++ sandbox/pellegrin/set/test/p_queue.cc (working copy)
@@ -44,14 +44,14 @@
.push(make::point2d(6, 9))
.push(make::point2d(5, 1))
.push(make::point2d(4, 2));
- mln_assertion(q.npoints() == 3);
+ mln_assertion(q.nsites() == 3);
std::cout << q.bbox() << std::endl;
std::cout << q << std::endl;
q.pop();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
point2d p = q.front();
- mln_assertion(q.npoints() == 2);
+ mln_assertion(q.nsites() == 2);
mln_assertion(p == make::point2d(5, 1));
}
Index: sandbox/pellegrin/set/test/p_priority_queue.cc
--- sandbox/pellegrin/set/test/p_priority_queue.cc (revision 2233)
+++ sandbox/pellegrin/set/test/p_priority_queue.cc (working copy)
@@ -44,7 +44,7 @@
mln_assertion (q.is_empty ());
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
q.push_force (p3);
q.push_force (p1, 3);
@@ -59,7 +59,7 @@
mln_assertion (q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites () == 3);
mln_assertion (q.front () == p2);
q.pop ();
@@ -67,7 +67,7 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites () == 2);
mln_assertion (q.front () == p1);
q.pop ();
@@ -75,14 +75,14 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites () == 1);
mln_assertion (q.front () == p3);
q.pop ();
mln_assertion (!q.has (p1));
mln_assertion (!q.has (p2));
mln_assertion (!q.has (p3));
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
mln_assertion (q.is_empty ());
Index: sandbox/pellegrin/set/test/p_runs.cc
--- sandbox/pellegrin/set/test/p_runs.cc (revision 2233)
+++ sandbox/pellegrin/set/test/p_runs.cc (working copy)
@@ -61,10 +61,10 @@
p_runs_<point2d> ps2;
ps.insert(p_run<point2d>(p, 7));
- mln_assertion(ps.npoints() == 7);
+ mln_assertion(ps.nsites() == 7);
ps.insert(p_run<point2d>(q, 5));
- mln_assertion(ps.npoints() == 12);
+ mln_assertion(ps.nsites() == 12);
ps.insert(p_run<point2d>(r, 2));
Index: sandbox/pellegrin/set/test/pset_if.cc
--- sandbox/pellegrin/set/test/pset_if.cc (revision 2233)
+++ sandbox/pellegrin/set/test/pset_if.cc (working copy)
@@ -43,7 +43,7 @@
using namespace mln;
box2d box_8x8 = make::box2d(8, 8);
- mln_assertion((box_8x8 | fun::p2b::chess).npoints() == 32);
+ mln_assertion((box_8x8 | fun::p2b::chess).nsites() == 32);
{
p_set<point2d> s = convert::to_p_set(box_8x8 | fun::p2b::chess);
Index: sandbox/pellegrin/set/test/p_set.cc
--- sandbox/pellegrin/set/test/p_set.cc (revision 2233)
+++ sandbox/pellegrin/set/test/p_set.cc (working copy)
@@ -47,7 +47,7 @@
.insert(make::point2d(4, 2))
.insert(make::point2d(4, 2))
.insert(make::point2d(5, 1));
- mln_assertion(ps.npoints() == 3);
+ mln_assertion(ps.nsites() == 3);
std::cout << ps.bbox() << std::endl;
Index: sandbox/pellegrin/set/test/p_priority_queue_fast_with_array.cc
--- sandbox/pellegrin/set/test/p_priority_queue_fast_with_array.cc (revision 2233)
+++ sandbox/pellegrin/set/test/p_priority_queue_fast_with_array.cc (working copy)
@@ -43,19 +43,19 @@
point2d p3 (4, 2);
mln_assertion (q.is_empty ());
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
q.push_force (p3);
mln_assertion (!q.is_empty ());
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites () == 1);
q.push_force (p1, 3);
mln_assertion (!q.is_empty ());
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites () == 2);
q.push_force (p2, 5);
mln_assertion (!q.is_empty ());
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites () == 3);
std::cout << q.bbox () << std::endl;
std::cout << q << std::endl;
@@ -66,7 +66,7 @@
mln_assertion (q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 3);
+ mln_assertion (q.nsites () == 3);
mln_assertion (q.front () == p2);
q.pop ();
@@ -74,7 +74,7 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 2);
+ mln_assertion (q.nsites () == 2);
mln_assertion (q.front () == p1);
q.pop ();
@@ -82,14 +82,14 @@
mln_assertion (!q.has (p2));
mln_assertion (q.has (p3));
- mln_assertion (q.npoints () == 1);
+ mln_assertion (q.nsites () == 1);
mln_assertion (q.front () == p3);
q.pop ();
mln_assertion (!q.has (p1));
mln_assertion (!q.has (p2));
mln_assertion (!q.has (p3));
- mln_assertion (q.npoints () == 0);
+ mln_assertion (q.nsites () == 0);
mln_assertion (q.is_empty ());
Index: sandbox/pellegrin/set/core/p_priority_queue_fast.hh
--- sandbox/pellegrin/set/core/p_priority_queue_fast.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_priority_queue_fast.hh (working copy)
@@ -75,7 +75,7 @@
* \todo Make it work with P being a Point_Site.
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints() when this container is multiple.
+ * a call to nsites() when this container is multiple.
*/
template <typename P, typename T>
class p_priority_fast : public internal::point_set_base_< P, p_priority_fast<P, T> >
@@ -98,7 +98,7 @@
bool is_empty() const;
/// Give the number of points.
- size_t npoints() const;
+ size_t nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -163,7 +163,7 @@
p_priority_fast<P, T>::vect_update_() const
{
vect_.clear();
- vect_.reserve(npoints());
+ vect_.reserve(nsites());
typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
@@ -183,7 +183,7 @@
typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
- for (unsigned i = 0; i < (*it).second.npoints (); ++i)
+ for (unsigned i = 0; i < (*it).second.nsites (); ++i)
bb_.take((*it).second[i]);
bb_needs_update_ = false;
}
@@ -218,7 +218,7 @@
template <typename P, typename T>
inline
size_t
- p_priority_fast<P, T>::npoints() const
+ p_priority_fast<P, T>::nsites() const
{
unsigned res = 0;
@@ -226,7 +226,7 @@
for (; it != q_.end (); ++it)
if (!(*it).second.is_empty ())
- res += (*it).second.npoints();
+ res += (*it).second.nsites();
return res;
}
@@ -235,7 +235,7 @@
const box_<P>&
p_priority_fast<P, T>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
bb_update_();
return bb_.to_result();
@@ -339,7 +339,7 @@
const P&
p_priority_fast<P, T>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
typename std::map<T, p_queue_fast<P> >::const_reverse_iterator it = q_.rbegin ();
unsigned cpt = 0;
@@ -347,7 +347,7 @@
for (; it != q_.rend (); ++it)
{
if (!(*it).second.is_empty ())
- for (cpt = 0; cpt < (*it).second.npoints (); ++cpt)
+ for (cpt = 0; cpt < (*it).second.nsites (); ++cpt)
{
if (i == 0)
return (*it).second[cpt];
Index: sandbox/pellegrin/set/core/p_bgraph.hh
--- sandbox/pellegrin/set/core/p_bgraph.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_bgraph.hh (working copy)
@@ -92,7 +92,7 @@
p_bgraph (graph* gr);
/// Return The number of points (i.e., nodes) in the graph.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of lines (i.e., edges) in the graph.
std::size_t nlines() const;
@@ -145,7 +145,7 @@
template<typename P>
inline
std::size_t
- p_bgraph<P>::npoints() const
+ p_bgraph<P>::nsites() const
{
return boost::num_vertices(*gr_);
}
@@ -175,7 +175,7 @@
// Check whether P is compatible with this psite set.
(&p.pg() == this) &&
// Check that the node id of P belongs to the range of valid node ids.
- (p.id() < this->npoints());
+ (p.id() < this->nsites());
}
Index: sandbox/pellegrin/set/core/p_run.hh
--- sandbox/pellegrin/set/core/p_run.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_run.hh (working copy)
@@ -90,7 +90,7 @@
bool has(const P& p) const;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the length of the run.
std::size_t length() const;
@@ -110,7 +110,7 @@
protected:
accu::bbox<P> bb_;
- // FIXME: Add invariant bb_.is_valid() <=> npoints() != 0
+ // FIXME: Add invariant bb_.is_valid() <=> nsites() != 0
/// The first point of the run.
P p_;
@@ -186,7 +186,7 @@
template <typename P>
inline
std::size_t
- p_run<P>::npoints() const
+ p_run<P>::nsites() const
{
mln_precondition(is_valid_);
return len_;
@@ -207,7 +207,7 @@
p_run<P>::operator[](unsigned i) const
{
mln_precondition(is_valid_);
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
P p = p_;
p[P::dim - 1] += i;
return p;
@@ -227,7 +227,7 @@
p_run<P>::bbox() const
{
mln_precondition(is_valid_);
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
return bb_.to_result();
}
Index: sandbox/pellegrin/set/core/p_line_graph.hh
--- sandbox/pellegrin/set/core/p_line_graph.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_line_graph.hh (working copy)
@@ -93,7 +93,7 @@
typedef p_line_graph_piter_<P> bkd_piter;
/// Return The number of points (i.e., nodes) in the graph.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of lines (i.e., edges) in the graph.
std::size_t nlines() const;
@@ -137,7 +137,7 @@
template<typename P>
inline
std::size_t
- p_line_graph<P>::npoints() const
+ p_line_graph<P>::nsites() const
{
return this->gr_.nnodes();
}
Index: sandbox/pellegrin/set/core/pset_if.hh
--- sandbox/pellegrin/set/core/pset_if.hh (revision 2233)
+++ sandbox/pellegrin/set/core/pset_if.hh (working copy)
@@ -105,7 +105,7 @@
const box_<mln_point(S)>& bbox() const;
/// Give the number of points of the subset.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the primary overset.
const S& overset() const;
@@ -210,7 +210,7 @@
template <typename S, typename F>
std::size_t
- p_if<S,F>::npoints() const
+ p_if<S,F>::nsites() const
{
std::size_t n = 0;
fwd_piter p(*this);
Index: sandbox/pellegrin/set/core/p_array.hh
--- sandbox/pellegrin/set/core/p_array.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_array.hh (working copy)
@@ -65,7 +65,7 @@
* This is a multi-set of points.
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints(). FIXME: Explain!
+ * a call to nsites(). FIXME: Explain!
*
* \todo Make it work with P being a Point_Site.
*/
@@ -93,7 +93,7 @@
bool has(const P& p) const;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -120,7 +120,7 @@
mutable bool bb_needs_update_;
void update_bb_() const;
- // FIXME: Add invariant bb_.is_valid() <=> npoints() != 0
+ // FIXME: Add invariant bb_.is_valid() <=> nsites() != 0
};
@@ -183,7 +183,7 @@
template <typename P>
inline
std::size_t
- p_array<P>::npoints() const
+ p_array<P>::nsites() const
{
return vect_.size();
}
@@ -193,7 +193,7 @@
const box_<P>&
p_array<P>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
update_bb_();
return bb_.to_result();
@@ -232,7 +232,7 @@
const P&
p_array<P>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return vect_[i];
}
Index: sandbox/pellegrin/set/core/concept/point_set.hh
--- sandbox/pellegrin/set/core/concept/point_set.hh (revision 2233)
+++ sandbox/pellegrin/set/core/concept/point_set.hh (working copy)
@@ -77,7 +77,7 @@
bool has(const psite& p) const;
const box_<point>& bbox() const;
- std::size_t npoints() const;
+ std::size_t nsites() const;
*/
protected:
@@ -157,7 +157,7 @@
m1 = 0;
const box_<point>& (E::*m2)() const = & E::bbox;
m2 = 0;
- std::size_t (E::*m3)() const = & E::npoints;
+ std::size_t (E::*m3)() const = & E::nsites;
m3 = 0;
}
@@ -174,7 +174,7 @@
const Sr& rhs = exact(rhs_);
// easy test:
- if (lhs.npoints() != rhs.npoints())
+ if (lhs.nsites() != rhs.nsites())
return false;
// exhaustive test:
@@ -201,7 +201,7 @@
const Sr& rhs = exact(rhs_);
// easy test:
- if (lhs.npoints() > rhs.npoints())
+ if (lhs.nsites() > rhs.nsites())
return false;
// exhaustive test:
@@ -221,7 +221,7 @@
// FIXME: Same grid!
const Sl& lhs = exact(lhs_);
const Sr& rhs = exact(rhs_);
- return lhs <= rhs && lhs.npoints() != rhs.npoints();
+ return lhs <= rhs && lhs.nsites() != rhs.nsites();
}
Index: sandbox/pellegrin/set/core/p_queue.hh
--- sandbox/pellegrin/set/core/p_queue.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_queue.hh (working copy)
@@ -73,7 +73,7 @@
* (i.e., no-op if multiple or allow multiple insertions).
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints() when this container is multiple.
+ * a call to nsites() when this container is multiple.
*/
template <typename P>
class p_queue : public internal::point_set_base_< P, p_queue<P> >
@@ -96,7 +96,7 @@
bool is_empty() const;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -200,7 +200,7 @@
template <typename P>
inline
std::size_t
- p_queue<P>::npoints() const
+ p_queue<P>::nsites() const
{
return q_.size();
}
@@ -210,7 +210,7 @@
const box_<P>&
p_queue<P>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
bb_update_();
return bb_.to_result();
@@ -299,7 +299,7 @@
const P&
p_queue<P>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return q_[i];
}
Index: sandbox/pellegrin/set/core/p_priority_queue.hh
--- sandbox/pellegrin/set/core/p_priority_queue.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_priority_queue.hh (working copy)
@@ -75,7 +75,7 @@
* \todo Make it work with P being a Point_Site.
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints() when this container is multiple.
+ * a call to nsites() when this container is multiple.
*/
template <typename P, typename T>
class p_priority : public internal::point_set_base_< P, p_priority<P, T> >
@@ -98,7 +98,7 @@
bool is_empty() const;
/// Give the number of points.
- size_t npoints() const;
+ size_t nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -163,7 +163,7 @@
p_priority<P, T>::vect_update_() const
{
vect_.clear();
- vect_.reserve(npoints());
+ vect_.reserve(nsites());
typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
@@ -183,7 +183,7 @@
typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
- for (unsigned i = 0; i < (*it).second.npoints (); ++i)
+ for (unsigned i = 0; i < (*it).second.nsites (); ++i)
bb_.take((*it).second[i]);
bb_needs_update_ = false;
}
@@ -218,7 +218,7 @@
template <typename P, typename T>
inline
size_t
- p_priority<P, T>::npoints() const
+ p_priority<P, T>::nsites() const
{
unsigned res = 0;
@@ -226,7 +226,7 @@
for (; it != q_.end (); ++it)
if (!(*it).second.is_empty ())
- res += (*it).second.npoints();
+ res += (*it).second.nsites();
return res;
}
@@ -235,7 +235,7 @@
const box_<P>&
p_priority<P, T>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
bb_update_();
return bb_.to_result();
@@ -339,7 +339,7 @@
const P&
p_priority<P, T>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
typename std::map<T, p_queue<P> >::const_reverse_iterator it = q_.rbegin ();
unsigned cpt = 0;
@@ -347,7 +347,7 @@
for (; it != q_.rend (); ++it)
{
if (!(*it).second.is_empty ())
- for (cpt = 0; cpt < (*it).second.npoints (); ++cpt)
+ for (cpt = 0; cpt < (*it).second.nsites (); ++cpt)
{
if (i == 0)
return (*it).second[cpt];
Index: sandbox/pellegrin/set/core/p_runs.hh
--- sandbox/pellegrin/set/core/p_runs.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_runs.hh (working copy)
@@ -88,7 +88,7 @@
const box_<P>& bbox() const;
/// Give the number of points.
- typename std::size_t npoints() const;
+ typename std::size_t nsites() const;
/// Insert a range, start at point \p p wit len \p len.
void insert(const p_run<P>& pr);
@@ -114,7 +114,7 @@
protected:
/// Number of points.
- typename std::size_t npoints_;
+ typename std::size_t nsites_;
/// Points container
util::lazy_set_<p_run<P> > con_;
@@ -128,7 +128,7 @@
template <typename P>
inline
p_runs_<P>::p_runs_() :
- npoints_(0)
+ nsites_(0)
{
}
@@ -155,9 +155,9 @@
template <typename P>
inline
typename std::size_t
- p_runs_<P>::npoints() const
+ p_runs_<P>::nsites() const
{
- return npoints_;
+ return nsites_;
}
template <typename P>
@@ -198,7 +198,7 @@
fb_.take(pr.bbox().pmin());
fb_.take(pr.bbox().pmax());
// update size
- npoints_ += pr.npoints();
+ nsites_ += pr.nsites();
}
template <typename P>
Index: sandbox/pellegrin/set/core/p_priority_queue_fast_with_array.hh
--- sandbox/pellegrin/set/core/p_priority_queue_fast_with_array.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_priority_queue_fast_with_array.hh (working copy)
@@ -75,7 +75,7 @@
* \todo Make it work with P being a Point_Site.
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints() when this container is multiple.
+ * a call to nsites() when this container is multiple.
*/
template <typename P, typename T, unsigned S>
class p_priority_fast_with_array : public internal::point_set_base_< P, p_priority_fast_with_array<P, T, S> >
@@ -98,7 +98,7 @@
bool is_empty() const;
/// Give the number of points.
- unsigned npoints() const;
+ unsigned nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -168,7 +168,7 @@
p_priority_fast_with_array<P, T, S>::vect_update_() const
{
vect_.clear();
- vect_.reserve(npoints());
+ vect_.reserve(nsites());
for (unsigned i = 0; i < S; ++i)
std::copy(q_[i].vect().begin(), q_[i].vect().end(),
@@ -184,7 +184,7 @@
bb_.init();
for (unsigned i = 0; i < S; ++i)
- for (unsigned j = 0; j < q_[i].npoints (); ++j)
+ for (unsigned j = 0; j < q_[i].nsites (); ++j)
bb_.take(q_[i][j]);
bb_needs_update_ = false;
}
@@ -215,13 +215,13 @@
template <typename P, typename T, unsigned S>
inline
unsigned
- p_priority_fast_with_array<P, T, S>::npoints() const
+ p_priority_fast_with_array<P, T, S>::nsites() const
{
unsigned res = 0;
for (unsigned i = 0; i < S; ++i)
if (!q_[i].is_empty ())
- res += q_[i].npoints();
+ res += q_[i].nsites();
return res;
}
@@ -231,7 +231,7 @@
const box_<P>&
p_priority_fast_with_array<P, T, S>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
bb_update_();
return bb_.to_result();
@@ -330,13 +330,13 @@
const P&
p_priority_fast_with_array<P, T, S>::operator[](unsigned n) const
{
- mln_precondition(n < npoints());
+ mln_precondition(n < nsites());
unsigned i = S - 1;
unsigned cpt = 0;
for (; i != UINT_MAX; --i)
if (!q_[i].is_empty ())
- for (cpt = 0; cpt < q_[i].npoints (); ++cpt, --n)
+ for (cpt = 0; cpt < q_[i].nsites (); ++cpt, --n)
if (n == 0)
return q_[i][cpt];
mln_assertion (false);
Index: sandbox/pellegrin/set/core/p_set.hh
--- sandbox/pellegrin/set/core/p_set.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_set.hh (working copy)
@@ -89,7 +89,7 @@
using super_::vect;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Insert a point \p p.
p_set<P>& insert(const P& p);
@@ -110,7 +110,7 @@
protected:
accu::bbox<P> bb_;
- // FIXME: Add invariant bb_.is_valid() <=> npoints() != 0
+ // FIXME: Add invariant bb_.is_valid() <=> nsites() != 0
};
@@ -133,7 +133,7 @@
template <typename P>
inline
std::size_t
- p_set<P>::npoints() const
+ p_set<P>::nsites() const
{
return this->super_::nelements();
}
@@ -165,7 +165,7 @@
const P&
p_set<P>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return this->super_::element(i);
}
@@ -183,7 +183,7 @@
const box_<mln_point(P)>&
p_set<P>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
return bb_.to_result();
}
Index: sandbox/pellegrin/set/core/line2d.hh
--- sandbox/pellegrin/set/core/line2d.hh (revision 2233)
+++ sandbox/pellegrin/set/core/line2d.hh (working copy)
@@ -81,7 +81,7 @@
bool has(const point2d& p) const;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the exact bounding box.
const box_<point2d>& bbox() const;
@@ -177,7 +177,7 @@
inline
std::size_t
- line2d::npoints() const
+ line2d::nsites() const
{
return vect_.size();
}
@@ -200,7 +200,7 @@
const point2d&
line2d::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return vect_[i];
}
Index: sandbox/pellegrin/set/core/internal/multi_set.hh
--- sandbox/pellegrin/set/core/internal/multi_set.hh (revision 2233)
+++ sandbox/pellegrin/set/core/internal/multi_set.hh (working copy)
@@ -70,7 +70,7 @@
using super_::vect;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Insert a point \p p.
multi_set<P>& insert(const P& p);
@@ -91,7 +91,7 @@
protected:
accu::bbox<P> bb_;
- // FIXME: Add invariant bb_.is_valid() <=> npoints() != 0
+ // FIXME: Add invariant bb_.is_valid() <=> nsites() != 0
};
@@ -114,7 +114,7 @@
template <typename P>
inline
std::size_t
- multi_set<P>::npoints() const
+ multi_set<P>::nsites() const
{
return this->super_::nelements();
}
@@ -146,7 +146,7 @@
const P&
multi_set<P>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return this->super_::element(i);
}
@@ -164,7 +164,7 @@
const box_<mln_point(P)>&
multi_set<P>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
return bb_.to_result();
}
Index: sandbox/pellegrin/set/core/internal/uni_set.hh
--- sandbox/pellegrin/set/core/internal/uni_set.hh (revision 2233)
+++ sandbox/pellegrin/set/core/internal/uni_set.hh (working copy)
@@ -70,7 +70,7 @@
using super_::vect;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Insert a point \p p.
uni_set<P>& insert(const P& p);
@@ -91,7 +91,7 @@
protected:
accu::bbox<P> bb_;
- // FIXME: Add invariant bb_.is_valid() <=> npoints() != 0
+ // FIXME: Add invariant bb_.is_valid() <=> nsites() != 0
};
@@ -114,7 +114,7 @@
template <typename P>
inline
std::size_t
- uni_set<P>::npoints() const
+ uni_set<P>::nsites() const
{
return this->super_::nelements();
}
@@ -146,7 +146,7 @@
const P&
uni_set<P>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return this->super_::element(i);
}
@@ -164,7 +164,7 @@
const box_<mln_point(P)>&
uni_set<P>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
return bb_.to_result();
}
Index: sandbox/pellegrin/set/core/p_graph.hh
--- sandbox/pellegrin/set/core/p_graph.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_graph.hh (working copy)
@@ -78,7 +78,7 @@
typedef p_graph_piter_<P> bkd_piter;
/// Return The number of points (i.e., nodes) in the graph.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Return The number of lines (i.e., edges) in the graph.
std::size_t nlines() const;
@@ -131,7 +131,7 @@
// FIXME: Warning: if the underlying graph is updated later, this
// won't be taken into account by this p_graph!
accu::bbox<P> a;
- for (unsigned i = 0; i < npoints(); ++i)
+ for (unsigned i = 0; i < nsites(); ++i)
a.take(gr_.node_data(i));
bb_ = a.to_result();
}
@@ -141,7 +141,7 @@
template<typename P>
inline
std::size_t
- p_graph<P>::npoints() const
+ p_graph<P>::nsites() const
{
return this->gr_.nnodes();
}
@@ -221,8 +221,8 @@
{
// FIXME: Likewise, this is inefficient.
- assert (lhs < this->npoints());
- assert (rhs < this->npoints());
+ assert (lhs < this->nsites());
+ assert (rhs < this->nsites());
if (rhs == lhs)
return true;
Index: sandbox/pellegrin/set/core/p_queue_fast.hh
--- sandbox/pellegrin/set/core/p_queue_fast.hh (revision 2233)
+++ sandbox/pellegrin/set/core/p_queue_fast.hh (working copy)
@@ -72,7 +72,7 @@
* \todo Make it work with P being a Point_Site.
*
* \warning We have some troubles with point set comparison based on
- * a call to npoints() when this container is multiple.
+ * a call to nsites() when this container is multiple.
*/
template <typename P>
class p_queue_fast : public internal::point_set_base_< P, p_queue_fast<P> >
@@ -95,7 +95,7 @@
bool is_empty() const;
/// Give the number of points.
- std::size_t npoints() const;
+ std::size_t nsites() const;
/// Give the exact bounding box.
const box_<P>& bbox() const;
@@ -202,7 +202,7 @@
template <typename P>
inline
std::size_t
- p_queue_fast<P>::npoints() const
+ p_queue_fast<P>::nsites() const
{
mln_precondition(this->end_ >= this->begin_);
return (this->end_ - this->begin_);
@@ -213,7 +213,7 @@
const box_<P>&
p_queue_fast<P>::bbox() const
{
- mln_precondition(npoints() != 0);
+ mln_precondition(nsites() != 0);
if (bb_needs_update_)
bb_update_();
return bb_.to_result();
@@ -306,7 +306,7 @@
const P&
p_queue_fast<P>::operator[](unsigned i) const
{
- mln_precondition(i < npoints());
+ mln_precondition(i < nsites());
return q_[begin_ + i];
}
Index: sandbox/aroumougame/skeleton/test_image3d.cc
--- sandbox/aroumougame/skeleton/test_image3d.cc (revision 2233)
+++ sandbox/aroumougame/skeleton/test_image3d.cc (working copy)
@@ -71,12 +71,12 @@
X_complement.insert(mln::make::point3d(centre, centre, centre));
X_complement.insert(mln::make::point3d(centre+5, centre, centre));
- std::cout << "X "<< X.npoints() << std::endl;
- std::cout << "X_complement "<< X_complement.npoints() << std::endl;
+ std::cout << "X "<< X.nsites() << std::endl;
+ std::cout << "X_complement "<< X_complement.nsites() << std::endl;
X = thinning(X,c6(),X_complement,2000,false);
- for(uint i=0; i<X.npoints(); i++)
+ for(uint i=0; i<X.nsites(); i++)
{
std::cout << X[i] << std::endl;
}
Index: sandbox/aroumougame/skeleton/thinning.hh
--- sandbox/aroumougame/skeleton/thinning.hh (revision 2233)
+++ sandbox/aroumougame/skeleton/thinning.hh (working copy)
@@ -45,15 +45,15 @@
neighbors.insert(q);
}
}
-// std::cout << "nb_composant_connexe: neighbors " << neighbors.npoints() <<std::endl;
- if(neighbors.npoints()<=1)
+// std::cout << "nb_composant_connexe: neighbors " << neighbors.nsites() <<std::endl;
+ if(neighbors.nsites()<=1)
{
- return neighbors.npoints();
+ return neighbors.nsites();
}
else
T=0;
- while(neighbors.npoints()!=0)
+ while(neighbors.nsites()!=0)
{
T++;
done.insert(neighbors[0]);
@@ -67,13 +67,13 @@
}
}
- while(composant.npoints()!=0)
+ while(composant.nsites()!=0)
{
done.insert(composant[0]);
if(neighbors.has(composant[0]))
{
neighbors.remove(composant[0]);
- if(neighbors.npoints()==0)
+ if(neighbors.nsites()==0)
return T;
}
@@ -110,14 +110,14 @@
}
}
- if(neighbors.npoints()<=1)
+ if(neighbors.nsites()<=1)
{
- return neighbors.npoints();
+ return neighbors.nsites();
}
else
T=0;
- while(neighbors.npoints()!=0)
+ while(neighbors.nsites()!=0)
{
T++;
done.insert(neighbors[0]);
@@ -131,13 +131,13 @@
}
}
- while(composant.npoints()!=0)
+ while(composant.nsites()!=0)
{
done.insert(composant[0]);
if(neighbors.has(composant[0]))
{
neighbors.remove(composant[0]);
- if(neighbors.npoints()==0)
+ if(neighbors.nsites()==0)
return T;
}
@@ -262,19 +262,19 @@
p_set<mln_point(N)> Q;
p_set<mln_point(N)> K;
- for(uint i=0; i<X.npoints(); i++)
+ for(uint i=0; i<X.nsites(); i++)
{
if(simple_point(X,nbh,X_complement,X[i],local))
P.insert(X[i]);
}
- while(P.npoints()!=0 && L>0)
+ while(P.nsites()!=0 && L>0)
{
Q.clear();
// FIXME need a method to get the number of neighbor from the neighborhood instead of the 6
for(int t=0; t<6; t++)
{
- for(uint i=0; i <P.npoints(); i++)
+ for(uint i=0; i <P.nsites(); i++)
{
// isthmus1d => X and isthmus2d => X_complement
if(extremity(X,nbh,P[i]))
@@ -301,7 +301,7 @@
P.clear();
L--;
- for(uint i=0; i<Q.npoints(); i++)
+ for(uint i=0; i<Q.nsites(); i++)
{
if(simple_point(X,nbh,X_complement,Q[i],local))
{
@@ -329,11 +329,11 @@
N.insert(p_ref);
}
- while(N.npoints()!=0 && L>0)
+ while(N.nsites()!=0 && L>0)
{
Q.clear();
- for(uint i=0; i <N.npoints(); i++)
+ for(uint i=0; i <N.nsites(); i++)
{
// isthmus1d => type_isthmus = true and isthmus2d => type_isthmus = false
if(extremity(gi,N[i]))
@@ -360,7 +360,7 @@
N.clear();
L--;
- for(uint i=0; i<Q.npoints(); i++)
+ for(uint i=0; i<Q.nsites(); i++)
{
if(simple_point(gi,Q[i],false))
{
@@ -394,7 +394,7 @@
}
}
- for(int i=0; i < neighbors.npoints(); i++)
+ for(int i=0; i < neighbors.nsites(); i++)
{
mln_niter(graph_elt_neighborhood< P >) n(nbh, neighbors[i]);
@@ -408,7 +408,7 @@
}
}
- for(int i=0; i < composant.npoints(); i++)
+ for(int i=0; i < composant.nsites(); i++)
{
mln_niter(graph_elt_neighborhood< P >) n(nbh, composant[i]);
@@ -442,14 +442,14 @@
}
}
- if(neighbors.npoints()<=1)
+ if(neighbors.nsites()<=1)
{
- return neighbors.npoints();
+ return neighbors.nsites();
}
else
T=0;
- while(neighbors.npoints()!=0)
+ while(neighbors.nsites()!=0)
{
T++;
done.insert(neighbors[0]);
@@ -463,13 +463,13 @@
}
}
- while(composant.npoints()!=0)
+ while(composant.nsites()!=0)
{
done.insert(composant[0]);
if(neighbors.has(composant[0]))
{
neighbors.remove(composant[0]);
- if(neighbors.npoints()==0)
+ if(neighbors.nsites()==0)
return T;
}
@@ -518,17 +518,17 @@
p_set< graph_psite<N> > Q;
p_set< graph_psite<N> > K;
- for(uint i=0; i<X.npoints(); i++)
+ for(uint i=0; i<X.nsites(); i++)
{
if(simple_point(X,X_complement,X[i],local))
P.insert(X[i]);
}
- while(P.npoints()!=0 && L>0)
+ while(P.nsites()!=0 && L>0)
{
Q.clear();
- for(uint i=0; i <P.npoints(); i++)
+ for(uint i=0; i <P.nsites(); i++)
{
// isthmus1d => X and isthmus2d => X_complement
// if(isthmus(X,P[i],local))
@@ -556,7 +556,7 @@
P.clear();
L--;
- for(uint i=0; i<Q.npoints(); i++)
+ for(uint i=0; i<Q.nsites(); i++)
{
if(simple_point(X,X_complement,Q[i],local))
{
@@ -576,7 +576,7 @@
std::vector< std::pair< double, mln::point2d> > R;
// fill Q
- for(uint i = 0; i < X.npoints(); i++)
+ for(uint i = 0; i < X.nsites(); i++)
{
if (!Y.has(X[i]))
{
@@ -586,7 +586,7 @@
}
// fill R
- for(uint i = 0; i < X.npoints(); i++)
+ for(uint i = 0; i < X.nsites(); i++)
{
if (!Y.has(X[i]))
{
@@ -732,11 +732,11 @@
image2d<value::int_u8> bisector(h, w);
level::fill(bisector, 0);
- for(uint i=0; i<Y.npoints(); i++)
+ for(uint i=0; i<Y.nsites(); i++)
{
proj = EP(dt, Y[i], lut, nbh);
- int n=proj.npoints();
+ int n=proj.nsites();
if(n>1)
{
@@ -776,7 +776,7 @@
{
std::vector< std::pair< double, mln::point2d> > Q;
// fill Q
- for(uint i = 0; i < X.npoints(); i++)
+ for(uint i = 0; i < X.nsites(); i++)
{
if (!Y.has(X[i]))
{
@@ -891,7 +891,7 @@
mln::io::pgm::save(pic1, "bisector.pgm");
uint cpt=0;
- while(cpt!=Y.npoints())
+ while(cpt!=Y.nsites())
{
if(dt(Y[cpt])>=r && pic1(Y[cpt])>=alpha)
{
@@ -934,7 +934,7 @@
std::vector< std::pair< double, pt_t > > Q;
graph_elt_neighborhood<P> nbh;
// fill Q
- for(uint i = 0; i < X.npoints(); i++)
+ for(uint i = 0; i < X.nsites(); i++)
{
if (!Y.has(X[i]))
{
@@ -954,7 +954,7 @@
{
X.remove(tmp);
X_complement.insert(tmp);
-// std::cout << Y.npoints() << std::endl;
+// std::cout << Y.nsites() << std::endl;
mln_niter(graph_elt_neighborhood< P >) r(nbh, tmp);
for_all(r)
{
Index: sandbox/nivault/plugin-gimp/src/gimp-image.hh
--- sandbox/nivault/plugin-gimp/src/gimp-image.hh (revision 2233)
+++ sandbox/nivault/plugin-gimp/src/gimp-image.hh (working copy)
@@ -393,7 +393,7 @@
gimp_image<t>::nelements() const
{
mln_precondition(this->has_data());
- return this->data_->b_.npoints();
+ return this->data_->b_.nsites();
}
Index: sandbox/jardonnet/test/icp_ref.cc
--- sandbox/jardonnet/test/icp_ref.cc (revision 2233)
+++ sandbox/jardonnet/test/icp_ref.cc (working copy)
@@ -72,23 +72,23 @@
std::cout << "Pts processed = " << registration::pts << std::endl;
#endif
- qk.apply_on(c, c, c.npoints());
+ qk.apply_on(c, c, c.nsites());
image2d<value::rgb8> output(convert::to_box2d(working_box), 1);
level::fill(output, literal::white);
/* FIXME: remove or plot mu_Ck and mu_Xk
//plot mu_Ck
- point3df mu_Ck = registration::center(c, c.npoints());
+ point3df mu_Ck = registration::center(c, c.nsites());
draw::plot(output, point2d(mu_Ck[0], mu_Ck[1]), literal::green);
//plot mu_X
- point3df mu_X = registration::center(x, x.npoints());
+ point3df mu_X = registration::center(x, x.nsites());
draw::plot(output, point2d(mu_X[0], mu_X[1]), literal::black);
*/
//to 2d : projection (FIXME:if 3d)
- for (unsigned i = 0; i < c.npoints(); i++)
+ for (unsigned i = 0; i < c.nsites(); i++)
{
point2d p(c[i][0], c[i][1]);
if (output.has(p))
@@ -96,7 +96,7 @@
}
//ref image (black)
- for (unsigned i = 0; i < x.npoints(); i++)
+ for (unsigned i = 0; i < x.nsites(); i++)
{
point2d px(x[i][0], x[i][1]);
if (output.has(px))
Index: sandbox/jardonnet/test/icp.cc
--- sandbox/jardonnet/test/icp.cc (revision 2233)
+++ sandbox/jardonnet/test/icp.cc (working copy)
@@ -62,7 +62,7 @@
std::cout << "Pts processed = " << registration::pts << std::endl;
#endif
- qk.apply_on(c, c, c.npoints());
+ qk.apply_on(c, c, c.nsites());
float stddev, mean;
registration::mean_stddev(c, map, mean, stddev);
@@ -72,14 +72,14 @@
std::cout << "stddev : " << stddev << std::endl;
#endif
- std::vector<float> length(c.npoints());
- for (size_t i = 0; i < c.npoints(); i++)
+ std::vector<float> length(c.nsites());
+ for (size_t i = 0; i < c.nsites(); i++)
length[i] = norm::l2(algebra::vec<3,int> (c[i] - map(c[i])));
// final transform
quat7<3> fqk = registration::final_qk2(c, map, 2*stddev);
- fqk.apply_on(c, c, c.npoints());
+ fqk.apply_on(c, c, c.nsites());
//init output image
@@ -88,7 +88,7 @@
//print x
- for (size_t i = 0; i < x.npoints(); i++)
+ for (size_t i = 0; i < x.nsites(); i++)
{
//Xk points
point2d px(x[i][0], x[i][1]);
@@ -98,7 +98,7 @@
//to 2d : projection (FIXME:if 3d)
- for (size_t i = 0; i < c.npoints(); i++)
+ for (size_t i = 0; i < c.nsites(); i++)
{
//Ck points
point2d p(c[i][0], c[i][1]);
Index: sandbox/jardonnet/registration/final_qk.hh
--- sandbox/jardonnet/registration/final_qk.hh (revision 2233)
+++ sandbox/jardonnet/registration/final_qk.hh (working copy)
@@ -14,22 +14,22 @@
float& stddev)
{
//mean + length
- std::vector<float> length(c.npoints());
+ std::vector<float> length(c.nsites());
mean = 0;
- for (size_t i = 0; i < c.npoints(); i++)
+ for (size_t i = 0; i < c.nsites(); i++)
{
float f = norm::l2(algebra::vec<3,int> (c[i] - map(c[i])));
length[i] = f;
mean += f;
}
- mean /= c.npoints();
+ mean /= c.nsites();
//standar variation
stddev = 0;
- for (size_t i = 0; i < c.npoints(); i++)
+ for (size_t i = 0; i < c.nsites(); i++)
stddev += (length[i] - mean) * (length[i] - mean);
- stddev /= c.npoints();
+ stddev /= c.nsites();
stddev = math::sqrt(stddev);
}
@@ -44,7 +44,7 @@
p_array<P> newc;
algebra::vec<3,float> mu_newc(literal::zero);
- for (size_t i = 0; i < c.npoints(); ++i)
+ for (size_t i = 0; i < c.nsites(); ++i)
{
algebra::vec<3,float> ci = c[i];
algebra::vec<3,float> xki = map(c[i]);
@@ -55,11 +55,11 @@
mu_newc += ci;
}
}
- if (newc.npoints() == 0)
+ if (newc.nsites() == 0)
return quat7<P::dim>();
- mu_newc /= newc.npoints();
+ mu_newc /= newc.nsites();
- quat7<P::dim> qk = match(newc, mu_newc, newc, map, newc.npoints());
+ quat7<P::dim> qk = match(newc, mu_newc, newc, map, newc.nsites());
//qk._qT = - qk._qT; // FIXME : why?
@@ -78,7 +78,7 @@
algebra::vec<3,float> mu_C(literal::zero);
float nb_point = 0;
- for (size_t i = 0; i < c.npoints(); ++i)
+ for (size_t i = 0; i < c.nsites(); ++i)
{
algebra::vec<3,float> xki = map(c[i]);
algebra::vec<3,float> ci = c[i];
Index: sandbox/jardonnet/registration/cov.hh
--- sandbox/jardonnet/registration/cov.hh (revision 2233)
+++ sandbox/jardonnet/registration/cov.hh (working copy)
@@ -53,7 +53,7 @@
cov(const p_array<P>& a1,
const p_array<P>& a2)
{
- mln_precondition(a1.npoints() == a2.npoints());
+ mln_precondition(a1.nsites() == a2.nsites());
//centers of mass
algebra::vec<P::dim,float> mu_a1 = math::exp_value(a1);
@@ -61,7 +61,7 @@
//covariance matrix
algebra::mat<P::dim,P::dim,float> Mk(literal::zero);
- for (unsigned i = 0; i < a1.npoints(); ++i)
+ for (unsigned i = 0; i < a1.nsites(); ++i)
{
// FIXME: ugly cast.
algebra::vec<P::dim,float> a1i = a1[i];
@@ -69,7 +69,7 @@
Mk += make::mat(a1i - mu_a1) * trans(make::mat(a2i - mu_a2));
}
- return Mk / a1.npoints();
+ return Mk / a1.nsites();
}
# endif // ! MLN_INCLUDE_ONLY
Index: sandbox/jardonnet/registration/exp_val.hh
--- sandbox/jardonnet/registration/exp_val.hh (revision 2233)
+++ sandbox/jardonnet/registration/exp_val.hh (working copy)
@@ -53,18 +53,18 @@
algebra::vec<P::dim,float>
exp_value(const p_array<P>& a)
{
- if (a.npoints() == 0)
+ if (a.nsites() == 0)
return P();
algebra::vec<P::dim,float> c(literal::zero);
- for (unsigned i = 0; i < a.npoints(); ++i)
+ for (unsigned i = 0; i < a.nsites(); ++i)
{
// FIXME : Ugly.
algebra::vec<P::dim,float> ai = a[i];
c += ai;
}
- return c / a.npoints();
+ return c / a.nsites();
}
# endif // ! MLN_INCLUDE_ONLY
Index: sandbox/jardonnet/registration/save.hh
--- sandbox/jardonnet/registration/save.hh (revision 2233)
+++ sandbox/jardonnet/registration/save.hh (working copy)
@@ -53,7 +53,7 @@
//build ck: apply transform
p_array<P> ck(c);
- qk.apply_on(c, ck, c.npoints());
+ qk.apply_on(c, ck, c.nsites());
const box_<P> working_box = enlarge(bigger(ck.bbox(),x.bbox()),5);
image2d<value::rgb8> out(convert::to_box2d(working_box), 1);
@@ -72,7 +72,7 @@
//build xk : project ck
p_array<P> xk;
- for (unsigned i = 0; i < ck.npoints(); ++i)
+ for (unsigned i = 0; i < ck.nsites(); ++i)
xk.append(map(ck[i]));
//plot mu_Xk
@@ -87,7 +87,7 @@
literal::red);
//x in black
- for (unsigned i = 0; i < x.npoints(); i++)
+ for (unsigned i = 0; i < x.nsites(); i++)
{
point2d p(x[i][0], x[i][1]);
if (out.has(p))
@@ -95,7 +95,7 @@
}
//xk in red
- for (unsigned i = 0; i < xk.npoints(); i++)
+ for (unsigned i = 0; i < xk.nsites(); i++)
{
point2d p(xk[i][0], xk[i][1]);
if (out.has(p))
@@ -103,7 +103,7 @@
}
//ck in green
- for (unsigned i = 0; i < ck.npoints(); i++)
+ for (unsigned i = 0; i < ck.nsites(); i++)
{
point2d p(ck[i][0], ck[i][1]);
if (out.has(p))
Index: sandbox/jardonnet/registration/tools.hh
--- sandbox/jardonnet/registration/tools.hh (revision 2233)
+++ sandbox/jardonnet/registration/tools.hh (working copy)
@@ -23,9 +23,9 @@
template <typename P>
void shuffle(p_array<P>& a)
{
- for (unsigned int i = 0; i < a.npoints(); i++)
+ for (unsigned int i = 0; i < a.nsites(); i++)
{
- unsigned int r = rand() % a.npoints();
+ unsigned int r = rand() % a.nsites();
P tmp;
tmp = a[i];
a.hook_()[i] = a[r];
@@ -92,7 +92,7 @@
algebra::vec<P::dim,float> Cki = Ck;
algebra::vec<P::dim,float> best_x = X[0];
float best_d = norm::l2(Cki - best_x);
- for (size_t j = 1; j < X.npoints(); ++j)
+ for (size_t j = 1; j < X.nsites(); ++j)
{
algebra::vec<P::dim,float> Xj = X[j];
float d = norm::l2(Cki - Xj);
@@ -231,7 +231,7 @@
to_image2d(const p_array<P>& a)
{
image2d<bool> output (to_box2d(a.bbox()), 0);
- for (size_t i = 0; i < a.npoints(); i++)
+ for (size_t i = 0; i < a.nsites(); i++)
{
point2d p(a[i][0], a[i][1]);
if (output.has(p))
Index: sandbox/jardonnet/registration/quat7.hh
--- sandbox/jardonnet/registration/quat7.hh (revision 2233)
+++ sandbox/jardonnet/registration/quat7.hh (working copy)
@@ -64,8 +64,8 @@
p_array<P>& output,
const size_t c_length) const
{
- assert(c_length <= input.npoints());
- assert(c_length <= output.npoints());
+ assert(c_length <= input.nsites());
+ assert(c_length <= output.nsites());
assert(_qR.is_unit());
for (size_t i = 0; i < c_length; i++)
Index: sandbox/jardonnet/registration/cloud.hh
--- sandbox/jardonnet/registration/cloud.hh (revision 2233)
+++ sandbox/jardonnet/registration/cloud.hh (working copy)
@@ -21,18 +21,18 @@
template <typename P>
P center(const p_array<P>& a)
{
- if (a.npoints() == 0)
+ if (a.nsites() == 0)
return P();
algebra::vec<P::dim,float> c(literal::zero);
- for (unsigned i = 0; i < a.npoints(); ++i)
+ for (unsigned i = 0; i < a.nsites(); ++i)
{
// FIXME : Ugly.
algebra::vec<P::dim,float> ai = a[i];
c += ai;
}
- return algebra::to_point<P>(c / a.npoints());
+ return algebra::to_point<P>(c / a.nsites());
}
}
@@ -70,7 +70,7 @@
const M& map,
const size_t length)
{
- assert(length <= a1.npoints());
+ assert(length <= a1.nsites());
float f = 0.f;
for (size_t i = 0; i < length; ++i)
@@ -89,7 +89,7 @@
quat7<P::dim>& q1,
quat7<P::dim>& q2)
{
- assert(length <= a1.npoints());
+ assert(length <= a1.nsites());
float f = 0.f;
for (size_t i = 0; i < length; ++i)
Index: sandbox/jardonnet/registration/icp_ref.hh
--- sandbox/jardonnet/registration/icp_ref.hh (revision 2233)
+++ sandbox/jardonnet/registration/icp_ref.hh (working copy)
@@ -169,7 +169,7 @@
trace::entering("registration::icp");
mln_precondition(P::dim == 3);
- mln_precondition(cloud.npoints() != 0);
+ mln_precondition(cloud.nsites() != 0);
shuffle(cloud);
@@ -193,7 +193,7 @@
for (int e = nb_it-1; e >= 0; e--)
{
- size_t l = cloud.npoints() / std::pow(q, e);
+ size_t l = cloud.nsites() / std::pow(q, e);
l = (l<1) ? 1 : l;
impl::icp_(cloud, map, qk, l, x, 1e-3);
Index: sandbox/jardonnet/registration/icp.hh
--- sandbox/jardonnet/registration/icp.hh (revision 2233)
+++ sandbox/jardonnet/registration/icp.hh (working copy)
@@ -172,7 +172,7 @@
trace::entering("registration::icp");
mln_precondition(P::dim == 3);
- mln_precondition(cloud.npoints() != 0);
+ mln_precondition(cloud.nsites() != 0);
// Shuffle cloud
shuffle(cloud);
@@ -200,23 +200,23 @@
for (int e = nb_it-1; e >= 0; e--)
{
- size_t l = cloud.npoints() / std::pow(q, e);
+ size_t l = cloud.nsites() / std::pow(q, e);
l = (l<1) ? 1 : l;
impl::icp_(cloud, map, qk, l, 1e-3);
/*
//remove points
p_array<P> tmp;
- tmp.reserve(cloud.npoints());
- qk.apply_on(cloud,tmp, cloud.npoints());
+ tmp.reserve(cloud.nsites());
+ qk.apply_on(cloud,tmp, cloud.nsites());
float stddev, mean;
mean_stddev(tmp, map, mean, stddev);
- for (unsigned i = 0; i < cloud.npoints(); i++)
+ for (unsigned i = 0; i < cloud.nsites(); i++)
{
algebra::vec<3,float> qci = tmp[i];
algebra::vec<3,float> xi = x[i];
if (norm::l2(qci - xi) < 2 * stddev)
- cloud.hook_()[i] = cloud[(i+1) % cloud.npoints()];
+ cloud.hook_()[i] = cloud[(i+1) % cloud.nsites()];
}
*/
#ifndef NDEBUG
Index: sandbox/jardonnet/registration/projection.hh
--- sandbox/jardonnet/registration/projection.hh (revision 2233)
+++ sandbox/jardonnet/registration/projection.hh (working copy)
@@ -15,11 +15,11 @@
std::pair<T1,T2>& map,
p_array<P>& Xk)
{
- assert(Ck.npoints() == Xk.npoints());
+ assert(Ck.nsites() == Xk.nsites());
float err = 0.f;
- for (size_t i = 0; i < Ck.npoints(); ++i)
+ for (size_t i = 0; i < Ck.nsites(); ++i)
{
//FIXME: bof
if (map.second.has(Ck[i]))
@@ -30,7 +30,7 @@
err += map.first(Ck[i]);
}
}
- return err /= Ck.npoints();
+ return err /= Ck.nsites();
}
template <typename P>
@@ -41,16 +41,16 @@
p_array<P>& Xk,
float& err)
{
- assert(Ck.npoints() == Xk.npoints());
+ assert(Ck.nsites() == Xk.nsites());
err = 0.f;
- for (size_t i = 0; i < Ck.npoints(); ++i)
+ for (size_t i = 0; i < Ck.nsites(); ++i)
{
algebra::vec<P::dim,float> Cki = Ck[i];
algebra::vec<P::dim,float> best_x = X[0];
float best_d = norm::l2(Cki - best_x);
- for (size_t j = 1; j < X.npoints(); ++j)
+ for (size_t j = 1; j < X.nsites(); ++j)
{
algebra::vec<P::dim,float> Xj = X[j];
float d = norm::l2(Cki - Xj);
@@ -63,7 +63,7 @@
Xk.hook_()[i] = algebra::to_point<P>(best_x);
err += best_d;
}
- err /= Ck.npoints();
+ err /= Ck.nsites();
}
@@ -73,7 +73,7 @@
lazy_image<T>& map,
const size_t c_length) // first: closest points, second: is_computed
{
- //assert(Ck.npoints() == Xk.npoints()); //FIXME:
+ //assert(Ck.nsites() == Xk.nsites()); //FIXME:
for (size_t i = 0; i < c_length; ++i)
Xk.hook_()[i] = map(Ck[i]);
Index: sandbox/jardonnet/registration/center.hh
--- sandbox/jardonnet/registration/center.hh (revision 2233)
+++ sandbox/jardonnet/registration/center.hh (working copy)
@@ -49,18 +49,18 @@
inline
P exp_value(const p_array<P>& a)
{
- if (a.npoints() == 0)
+ if (a.nsites() == 0)
return P();
algebra::vec<P::dim,float> c(literal::zero);
- for (unsigned i = 0; i < a.npoints(); ++i)
+ for (unsigned i = 0; i < a.nsites(); ++i)
{
// FIXME : Ugly.
algebra::vec<P::dim,float> ai = a[i];
c += ai;
}
- return algebra::to_point<P>(c / a.npoints());
+ return algebra::to_point<P>(c / a.nsites());
}
# endif // ! MLN_INCLUDE_ONLY
Index: sandbox/geraud/fllt/fllt.hh
--- sandbox/geraud/fllt/fllt.hh (revision 2233)
+++ sandbox/geraud/fllt/fllt.hh (working copy)
@@ -93,7 +93,7 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
bool tagged;
bool set_id;
std::vector<p_array<P>*> N;
@@ -101,7 +101,7 @@
unsigned root_version;
unsigned deja_vu;
- fllt_node_elt(bool set_id) : npoints(0),
+ fllt_node_elt(bool set_id) : nsites(0),
tagged(false),
set_id(set_id),
root(0) {}
@@ -131,7 +131,7 @@
{
// gN is the min.
for (unsigned g = 0; g < 256; ++g)
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -146,7 +146,7 @@
// gN is the max.
for (int g = 255; g >= 0; --g)
{
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -162,7 +162,7 @@
{
for (unsigned i = 0; i < 257; ++i)
{
- if (N[i]->npoints() == 0)
+ if (N[i]->nsites() == 0)
continue;
std::cout << i << ": " << *N[i] << std::endl;
}
@@ -207,7 +207,7 @@
//std::cout << " Save in " << filename.str() << std::endl;
image2d<value::int_u8> out(is.domain());// = clone(cast_image<value::int_u8>(is));
level::fill(out, 0);
- mln_assertion(R_box.npoints() > 0);
+ mln_assertion(R_box.nsites() > 0);
mln_piter_(box2d) p(R_box);
for_all(p)
if (is(p) == in_R)
@@ -653,7 +653,7 @@
// deja_vu(x0) = in_R;
smallest_shapes(x0) = current_cc;
current_cc->elt().points.append(x0);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
}
@@ -669,7 +669,7 @@
// R <- R U A
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto the_end;
// N <- N U { x in nbh of A and not in R }
@@ -737,7 +737,7 @@
//save_u(u, deja_vu, N_box, in_R, in_N);
blob(Set(), deja_vu, N, in_N, N_box, current_cc);
- n_holes += current_cc->elt().holes.npoints();
+ n_holes += current_cc->elt().holes.nsites();
node_type* child = current_cc;
current_cc = new node_type(Set::id);
@@ -774,7 +774,7 @@
current_cc->elt().N.resize(257);
for (unsigned i = 0; i < 257; ++i)
{
- if (N[i]->npoints() > 0)
+ if (N[i]->nsites() > 0)
{
current_cc->elt().N[i] = N[i];
N[i] = new arr_t();
@@ -789,7 +789,7 @@
the_end:
std::cout << " n_step1=" << n_step_1 << " n_step3=" << n_step_3
<< " n_browsed=" << n_browsed
- << " n_browsed/npoints=" << n_browsed / input.domain().npoints()
+ << " n_browsed/nsites=" << n_browsed / input.domain().nsites()
<< " n_find_root=" << n_find_root
<< " n_neighb=" << n_neighb
<< " n_pass=" << n_pass
Index: sandbox/geraud/fllt/simple_tests.cc
--- sandbox/geraud/fllt/simple_tests.cc (revision 2233)
+++ sandbox/geraud/fllt/simple_tests.cc (working copy)
@@ -20,7 +20,7 @@
<< " from " << ((*p).elt().set_id == lower<V>::id ?
"lower" : "upper") << " level set."
<< std::endl
- << " npoints = " << (*p).elt().npoints << std::endl
+ << " nsites = " << (*p).elt().nsites << std::endl
<< " holes = " << (*p).elt().holes << std::endl;
std::cout << std::endl;
@@ -31,7 +31,7 @@
for_all(n)
tmp.append((*n).elt().points);
- if ((*p).elt().points.npoints() > 0)
+ if ((*p).elt().points.nsites() > 0)
debug::println(ima | tmp);
tmp.clear();
Index: sandbox/geraud/fllt/fllt.svg.1.cc
--- sandbox/geraud/fllt/fllt.svg.1.cc (revision 2233)
+++ sandbox/geraud/fllt/fllt.svg.1.cc (working copy)
@@ -59,7 +59,7 @@
unsigned compute_gN(const N_t& N)
{
for (unsigned i = 0; i < 256; ++i)
- if (N[i].npoints() != 0)
+ if (N[i].nsites() != 0)
return i;
mln_invariant(0);
return 0;
Index: sandbox/geraud/fllt/fllt.svg.7.hh
--- sandbox/geraud/fllt/fllt.svg.7.hh (revision 2233)
+++ sandbox/geraud/fllt/fllt.svg.7.hh (working copy)
@@ -94,11 +94,11 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
bool tagged;
bool set_id;
- fllt_node_elt(bool set_id) : npoints(0), tagged(false), set_id(set_id) {}
+ fllt_node_elt(bool set_id) : nsites(0), tagged(false), set_id(set_id) {}
};
@@ -124,7 +124,7 @@
void update_gN(const N_t& N, G& gN, lower<V>)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -138,7 +138,7 @@
{
for (int g = 255; g >= 0; --g)
{
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -154,7 +154,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i]->npoints() == 0)
+ if (N[i]->nsites() == 0)
continue;
std::cout << i << ": " << *N[i] << std::endl;
}
@@ -196,7 +196,7 @@
image2d<value::int_u8> out = clone(cast_image<value::int_u8>(is));
- mln_assertion(R_box.npoints() > 0);
+ mln_assertion(R_box.nsites() > 0);
mln_piter_(box2d) p(R_box);
for_all(p)
if (is(p) == in_R)
@@ -533,7 +533,7 @@
deja_vu(x0) = in_R;
smallest_shapes(x0) = current_cc;
current_cc->elt().points.append(x0);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
}
@@ -548,7 +548,7 @@
// R <- R U A
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto the_end;
// N <- N U { x in nbh of A and not in R }
@@ -588,7 +588,7 @@
else
blob(Set(), deja_vu, N, in_N, N_box, current_cc);
- n_holes += current_cc->elt().holes.npoints();
+ n_holes += current_cc->elt().holes.nsites();
node_type* child = current_cc;
current_cc = new node_type(Set::id);
Index: sandbox/geraud/fllt/fllt.svg.2.cc
--- sandbox/geraud/fllt/fllt.svg.2.cc (revision 2233)
+++ sandbox/geraud/fllt/fllt.svg.2.cc (working copy)
@@ -61,7 +61,7 @@
void update_gN(const N_t& N, G& gN)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g].npoints() != 0)
+ if (N[g].nsites() != 0)
{
gN = g;
return;
@@ -76,7 +76,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i].npoints() == 0)
+ if (N[i].nsites() == 0)
continue;
std::cout << i << ": " << N[i] << std::endl;
}
@@ -157,7 +157,7 @@
typedef p_array<mln_point(I)> arr_t;
arr_t A, R;
- R.reserve(input.npoints());
+ R.reserve(input.nsites());
arr_t N[256];
accu::bbox<mln_point(I)> R_box;
@@ -209,7 +209,7 @@
// R <- R U A
- if (A.npoints() == 0)
+ if (A.nsites() == 0)
goto the_end;
R.append(A);
@@ -218,7 +218,7 @@
mln_invariant(is(a) == in_A);
is(a) = in_R;
}
- mln_invariant(R.npoints() == (is | in_R).npoints());
+ mln_invariant(R.nsites() == (is | in_R).nsites());
R_box.take(A.bbox());
// N <- N U { x in nbh of A and not in R }
Index: sandbox/geraud/fllt/fllt.svg.3.cc
--- sandbox/geraud/fllt/fllt.svg.3.cc (revision 2233)
+++ sandbox/geraud/fllt/fllt.svg.3.cc (working copy)
@@ -62,7 +62,7 @@
void update_gN(const N_t& N, G& gN)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g].npoints() != 0)
+ if (N[g].nsites() != 0)
{
gN = g;
return;
@@ -77,7 +77,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i].npoints() == 0)
+ if (N[i].nsites() == 0)
continue;
std::cout << i << ": " << N[i] << std::endl;
}
@@ -212,7 +212,7 @@
// R <- R U A
- if (A.npoints() == 0)
+ if (A.nsites() == 0)
goto the_end;
for_all(a)
Index: sandbox/geraud/fllt/fllt.svg.4.cc
--- sandbox/geraud/fllt/fllt.svg.4.cc (revision 2233)
+++ sandbox/geraud/fllt/fllt.svg.4.cc (working copy)
@@ -64,7 +64,7 @@
void update_gN(const N_t& N, G& gN)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g].npoints() != 0)
+ if (N[g].nsites() != 0)
{
gN = g;
return;
@@ -79,7 +79,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i].npoints() == 0)
+ if (N[i].nsites() == 0)
continue;
std::cout << i << ": " << N[i] << std::endl;
}
@@ -221,7 +221,7 @@
// R <- R U A
- if (A.npoints() == 0)
+ if (A.nsites() == 0)
goto the_end;
// for_all(a)
@@ -292,10 +292,10 @@
// we only want R
// yet A is empty (cause included in R)
- // so this test is ok: mln_invariant((is | in_A).npoints() == 0);
+ // so this test is ok: mln_invariant((is | in_A).nsites() == 0);
for (unsigned i = 0; i < 256; ++i)
- if (N[i].npoints())
+ if (N[i].nsites())
level::fill(inplace(deja_vu | N[i]), false);
// {
// mln_piter(arr_t) p(N[i]);
Index: sandbox/geraud/fllt/fllt.svg.5.cc
--- sandbox/geraud/fllt/fllt.svg.5.cc (revision 2233)
+++ sandbox/geraud/fllt/fllt.svg.5.cc (working copy)
@@ -64,7 +64,7 @@
void update_gN(const N_t& N, G& gN)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -79,7 +79,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i]->npoints() == 0)
+ if (N[i]->nsites() == 0)
continue;
std::cout << i << ": " << *N[i] << std::endl;
}
@@ -223,7 +223,7 @@
// R <- R U A
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto the_end;
// for_all(a)
@@ -298,10 +298,10 @@
// we only want R
// yet A is empty (cause included in R)
- // so this test is ok: mln_invariant((is | in_A).npoints() == 0);
+ // so this test is ok: mln_invariant((is | in_A).nsites() == 0);
for (unsigned i = 0; i < 256; ++i)
- if (N[i]->npoints())
+ if (N[i]->nsites())
level::fill(inplace(deja_vu | *N[i]), false);
// mln_invariant(deja_vu == ((pw::value(is) == pw::cst(in_R)) | input.domain()));
Index: sandbox/geraud/fllt/fllt.svg.6.cc
--- sandbox/geraud/fllt/fllt.svg.6.cc (revision 2233)
+++ sandbox/geraud/fllt/fllt.svg.6.cc (working copy)
@@ -93,11 +93,11 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
bool tagged;
bool set_id;
- fllt_node_elt(bool set_id) : npoints(0), tagged(false), set_id(set_id) {}
+ fllt_node_elt(bool set_id) : nsites(0), tagged(false), set_id(set_id) {}
};
@@ -123,7 +123,7 @@
void update_gN(const N_t& N, G& gN, lower<V>)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -137,7 +137,7 @@
{
for (int g = 255; g >= 0; --g)
{
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -153,7 +153,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i]->npoints() == 0)
+ if (N[i]->nsites() == 0)
continue;
std::cout << i << ": " << *N[i] << std::endl;
}
@@ -195,7 +195,7 @@
image2d<value::int_u8> out = clone(cast_image<value::int_u8>(is));
- mln_assertion(R_box.npoints() > 0);
+ mln_assertion(R_box.nsites() > 0);
mln_piter_(box2d) p(R_box);
for_all(p)
if (is(p) == in_R)
@@ -451,7 +451,7 @@
mln_invariant(smallest_shapes(a) != current_cc);
deja_vu(a) = in_R;
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
if (!smallest_shapes(a))
{
smallest_shapes(a) = current_cc;
@@ -615,7 +615,7 @@
deja_vu(x0) = in_R;
smallest_shapes(x0) = current_cc;
current_cc->elt().points.append(x0);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
}
@@ -630,7 +630,7 @@
// R <- R U A
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto the_end;
// N <- N U { x in nbh of A and not in R }
@@ -670,7 +670,7 @@
else
blob(Set(), deja_vu, N, in_N, N_box, current_cc);
- n_holes += current_cc->elt().holes.npoints();
+ n_holes += current_cc->elt().holes.nsites();
node_type* child = current_cc;
current_cc = new node_type(Set::id);
@@ -938,7 +938,7 @@
std::cout << "region : " << &*p
<< " value = " << (*p).elt().value << std::endl
<< " from " << ((*p).elt().set_id == lower<V>::id ? "lower" : "upper") << " level set." << std::endl
- << " npoints = " << (*p).elt().npoints << std::endl
+ << " nsites = " << (*p).elt().nsites << std::endl
<< " holes = " << (*p).elt().holes << std::endl;
std::cout << std::endl;
@@ -949,7 +949,7 @@
for_all(n)
tmp.append((*n).elt().points);
- if ((*p).elt().points.npoints() > 0)
+ if ((*p).elt().points.nsites() > 0)
debug::println(ima | tmp);
tmp.clear();
@@ -979,7 +979,7 @@
ima(p) = true;
}
- node->elt().npoints = area;
+ node->elt().nsites = area;
return area;
}
@@ -1019,7 +1019,7 @@
fllt_tree(P, V) subtree(node);
fllt_branch_iter_ind(P, V) s(fllt_branch(P, V)(subtree, *node));
for_all(s)
- if ((*s).elt().npoints > min_area && (*s).elt().npoints < max_area)
+ if ((*s).elt().nsites > min_area && (*s).elt().nsites < max_area)
draw_shape(output, &*s);
}
@@ -1029,14 +1029,14 @@
value::int_u8 g,
unsigned accu)
{
-// if ((*node).elt().npoints >= min_area)
+// if ((*node).elt().nsites >= min_area)
if (accu > min_area)
{
accu = 0;
g = (*node).elt().value;
}
- accu += (*node).elt().npoints;
+ accu += (*node).elt().nsites;
level::fill(inplace(output | (*node).elt().points), g);
for (int i = 0; i < node->children().size();i++)
Index: sandbox/geraud/fllt/connected_filters/area_filter.hh
--- sandbox/geraud/fllt/connected_filters/area_filter.hh (revision 2233)
+++ sandbox/geraud/fllt/connected_filters/area_filter.hh (working copy)
@@ -27,7 +27,7 @@
ima(p) = true;
}
- node->elt().npoints = area;
+ node->elt().nsites = area;
return area;
}
@@ -46,7 +46,7 @@
unsigned min_area,
value::int_u8 g)
{
- unsigned area = (*node).elt().npoints;
+ unsigned area = (*node).elt().nsites;
if (area > min_area)
g = (*node).elt().value;
Index: sandbox/geraud/fllt/fllt_test.hh
--- sandbox/geraud/fllt/fllt_test.hh (revision 2233)
+++ sandbox/geraud/fllt/fllt_test.hh (working copy)
@@ -90,12 +90,12 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
bool tagged;
bool set_id;
char id;
- fllt_node_elt(bool set_id) : npoints(0), tagged(false), set_id(set_id)
+ fllt_node_elt(bool set_id) : nsites(0), tagged(false), set_id(set_id)
{
static char id_ = 'A';
@@ -127,7 +127,7 @@
void update_gN(const N_t& N, G& gN, lower<V>)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -141,7 +141,7 @@
{
for (int g = 255; g >= 0; --g)
{
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -157,7 +157,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i]->npoints() == 0)
+ if (N[i]->nsites() == 0)
continue;
std::cout << i << ": " << *N[i] << std::endl;
}
@@ -202,7 +202,7 @@
image2d<value::int_u8> out = clone(cast_image<value::int_u8>(is));
- mln_assertion(R_box.npoints() > 0);
+ mln_assertion(R_box.nsites() > 0);
mln_piter_(box2d) p(R_box);
for_all(p)
if (is(p) == in_R)
@@ -562,7 +562,7 @@
deja_vu(x0) = in_R;
smallest_shapes(x0) = current_cc;
current_cc->elt().points.append(x0);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
}
@@ -576,7 +576,7 @@
// R <- R U A
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto the_end;
// N <- N U { x in nbh of A and not in R }
@@ -617,7 +617,7 @@
else
blob(Set(), deja_vu, N, in_N, N_box, current_cc);
- n_holes += current_cc->elt().holes.npoints();
+ n_holes += current_cc->elt().holes.nsites();
node_type* child = current_cc;
current_cc = new node_type(Set::id);
Index: sandbox/geraud/fllt.svg.7.hh
--- sandbox/geraud/fllt.svg.7.hh (revision 2233)
+++ sandbox/geraud/fllt.svg.7.hh (working copy)
@@ -94,11 +94,11 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
bool tagged;
bool set_id;
- fllt_node_elt(bool set_id) : npoints(0), tagged(false), set_id(set_id) {}
+ fllt_node_elt(bool set_id) : nsites(0), tagged(false), set_id(set_id) {}
};
@@ -124,7 +124,7 @@
void update_gN(const N_t& N, G& gN, lower<V>)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -138,7 +138,7 @@
{
for (int g = 255; g >= 0; --g)
{
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -154,7 +154,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i]->npoints() == 0)
+ if (N[i]->nsites() == 0)
continue;
std::cout << i << ": " << *N[i] << std::endl;
}
@@ -196,7 +196,7 @@
image2d<value::int_u8> out = clone(cast_image<value::int_u8>(is));
- mln_assertion(R_box.npoints() > 0);
+ mln_assertion(R_box.nsites() > 0);
mln_piter_(box2d) p(R_box);
for_all(p)
if (is(p) == in_R)
@@ -526,7 +526,7 @@
deja_vu(x0) = in_R;
smallest_shapes(x0) = current_cc;
current_cc->elt().points.append(x0);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
}
@@ -541,7 +541,7 @@
// R <- R U A
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto the_end;
// N <- N U { x in nbh of A and not in R }
@@ -581,7 +581,7 @@
else
blob(Set(), deja_vu, N, in_N, N_box, current_cc);
- n_holes += current_cc->elt().holes.npoints();
+ n_holes += current_cc->elt().holes.nsites();
node_type* child = current_cc;
current_cc = new node_type(Set::id);
Index: sandbox/geraud/p_runs__with_dedicated_piter.hh
--- sandbox/geraud/p_runs__with_dedicated_piter.hh (revision 2233)
+++ sandbox/geraud/p_runs__with_dedicated_piter.hh (working copy)
@@ -418,7 +418,7 @@
// fb_.take(pr.bbox().pmin());
// fb_.take(pr.bbox().pmax());
// // update size
-// npoints_ += pr.npoints();
+// nsites_ += pr.nsites();
// }
Index: sandbox/geraud/fllt.svg.6.cc
--- sandbox/geraud/fllt.svg.6.cc (revision 2233)
+++ sandbox/geraud/fllt.svg.6.cc (working copy)
@@ -93,11 +93,11 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
bool tagged;
bool set_id;
- fllt_node_elt(bool set_id) : npoints(0), tagged(false), set_id(set_id) {}
+ fllt_node_elt(bool set_id) : nsites(0), tagged(false), set_id(set_id) {}
};
@@ -123,7 +123,7 @@
void update_gN(const N_t& N, G& gN, lower<V>)
{
for (unsigned g = 0; g < 256; ++g)
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -137,7 +137,7 @@
{
for (int g = 255; g >= 0; --g)
{
- if (N[g]->npoints() != 0)
+ if (N[g]->nsites() != 0)
{
gN = g;
return;
@@ -153,7 +153,7 @@
{
for (unsigned i = 0; i < 256; ++i)
{
- if (N[i]->npoints() == 0)
+ if (N[i]->nsites() == 0)
continue;
std::cout << i << ": " << *N[i] << std::endl;
}
@@ -195,7 +195,7 @@
image2d<value::int_u8> out = clone(cast_image<value::int_u8>(is));
- mln_assertion(R_box.npoints() > 0);
+ mln_assertion(R_box.nsites() > 0);
mln_piter_(box2d) p(R_box);
for_all(p)
if (is(p) == in_R)
@@ -451,7 +451,7 @@
mln_invariant(smallest_shapes(a) != current_cc);
deja_vu(a) = in_R;
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
if (!smallest_shapes(a))
{
smallest_shapes(a) = current_cc;
@@ -615,7 +615,7 @@
deja_vu(x0) = in_R;
smallest_shapes(x0) = current_cc;
current_cc->elt().points.append(x0);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
}
@@ -630,7 +630,7 @@
// R <- R U A
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto the_end;
// N <- N U { x in nbh of A and not in R }
@@ -670,7 +670,7 @@
else
blob(Set(), deja_vu, N, in_N, N_box, current_cc);
- n_holes += current_cc->elt().holes.npoints();
+ n_holes += current_cc->elt().holes.nsites();
node_type* child = current_cc;
current_cc = new node_type(Set::id);
@@ -938,7 +938,7 @@
std::cout << "region : " << &*p
<< " value = " << (*p).elt().value << std::endl
<< " from " << ((*p).elt().set_id == lower<V>::id ? "lower" : "upper") << " level set." << std::endl
- << " npoints = " << (*p).elt().npoints << std::endl
+ << " nsites = " << (*p).elt().nsites << std::endl
<< " holes = " << (*p).elt().holes << std::endl;
std::cout << std::endl;
@@ -949,7 +949,7 @@
for_all(n)
tmp.append((*n).elt().points);
- if ((*p).elt().points.npoints() > 0)
+ if ((*p).elt().points.nsites() > 0)
debug::println(ima | tmp);
tmp.clear();
@@ -979,7 +979,7 @@
ima(p) = true;
}
- node->elt().npoints = area;
+ node->elt().nsites = area;
return area;
}
@@ -1019,7 +1019,7 @@
fllt_tree(P, V) subtree(node);
fllt_branch_iter_ind(P, V) s(fllt_branch(P, V)(subtree, *node));
for_all(s)
- if ((*s).elt().npoints > min_area && (*s).elt().npoints < max_area)
+ if ((*s).elt().nsites > min_area && (*s).elt().nsites < max_area)
draw_shape(output, &*s);
}
@@ -1029,14 +1029,14 @@
value::int_u8 g,
unsigned accu)
{
-// if ((*node).elt().npoints >= min_area)
+// if ((*node).elt().nsites >= min_area)
if (accu > min_area)
{
accu = 0;
g = (*node).elt().value;
}
- accu += (*node).elt().npoints;
+ accu += (*node).elt().nsites;
level::fill(inplace(output | (*node).elt().points), g);
for (int i = 0; i < node->children().size();i++)
Index: sandbox/garrigues/level_set.hh
--- sandbox/garrigues/level_set.hh (revision 2233)
+++ sandbox/garrigues/level_set.hh (working copy)
@@ -159,7 +159,7 @@
// env.shape(n);
// }
// std::cout << "update cc lower : " << p << std::endl;
-// if (env.R.npoints())
+// if (env.R.nsites())
// debug::println(env.u | env.R);
// debug::println(d);
@@ -289,7 +289,7 @@
}
// gn <- min u(x) x belongs to N.
- if ((env.u | set::inter(env.N, env.u.domain())).npoints() > 0)
+ if ((env.u | set::inter(env.N, env.u.domain())).nsites() > 0)
env.gn = level::compute< typename F::accu_for_gn >(env.u | set::inter(env.N, env.u.domain()));
else
{
@@ -317,7 +317,7 @@
// Create a new conected component.
// FIXME : we can make it faster.
- if ((env.R.bbox() < env.u.domain()) || (env.R.npoints() == env.u.domain().npoints()))
+ if ((env.R.bbox() < env.u.domain()) || (env.R.nsites() == env.u.domain().nsites()))
{
mln_piter(p_set<P>) p(env.R);
env.current_region = new fllt_node(P, V)();
@@ -355,7 +355,7 @@
// std::cout << "labeling : " << n << std::endl;
// std::cout << "nous : " << env.n_cc << std::endl;
-// if (env.R.npoints())
+// if (env.R.nsites())
// debug::println(env.u | env.R);
if (n > 1)
Index: sandbox/garrigues/fllt/fllt_simple.svg.1.cc
--- sandbox/garrigues/fllt/fllt_simple.svg.1.cc (revision 2233)
+++ sandbox/garrigues/fllt/fllt_simple.svg.1.cc (working copy)
@@ -212,7 +212,7 @@
mln_niter(Nbh) x(nbh, a);
// Stop.
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto end;
// R <- R U A
@@ -233,9 +233,9 @@
#ifdef FLLTDEBUG
- std::cout << "points of A : " << A->npoints() << std::endl;
+ std::cout << "points of A : " << A->nsites() << std::endl;
#endif
- mln_assertion(A->npoints() > 0);
+ mln_assertion(A->nsites() > 0);
R_box.take(A->bbox());
mln_assertion(R_box.is_valid());
@@ -267,7 +267,7 @@
#endif
// Stop if N is empty.
- if (N->npoints() == 0)
+ if (N->nsites() == 0)
goto step_1;
else
{
Index: sandbox/garrigues/fllt/merge.hh
--- sandbox/garrigues/fllt/merge.hh (revision 2233)
+++ sandbox/garrigues/fllt/merge.hh (working copy)
@@ -94,10 +94,10 @@
const image2d<fllt_node(P, V)*>& hole_reg)
{
// std::cout << "[Start fill_a_shape] " << &node << " "
-// << node.elt().holes.npoints()
+// << node.elt().holes.nsites()
// << " holes." << std::endl;
- if (node.elt().holes.npoints() == 0)
+ if (node.elt().holes.nsites() == 0)
{
// std::cout << "[End fill_a_shape]" << std::endl;
return;
@@ -190,7 +190,7 @@
fllt_tree(P, V)* main_tree = &lower_tree;
fllt_tree(P, V)* other_tree = &upper_tree;
- if (lower_tree.root()->elt().points.npoints() >= ima.domain().npoints())
+ if (lower_tree.root()->elt().points.nsites() >= ima.domain().nsites())
{
main_tree = &upper_tree;
other_tree = &lower_tree;
Index: sandbox/garrigues/fllt/fllt_simple.svg.3.cc
--- sandbox/garrigues/fllt/fllt_simple.svg.3.cc (revision 2233)
+++ sandbox/garrigues/fllt/fllt_simple.svg.3.cc (working copy)
@@ -138,18 +138,18 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
};
template <typename P, typename V>
- void add_npoints_to(fllt_node(P, V)* node, unsigned npoints)
+ void add_nsites_to(fllt_node(P, V)* node, unsigned nsites)
{
mln_assertion(node);
- node->elt().npoints += npoints;
+ node->elt().nsites += nsites;
if (node->parent())
- add_npoints_to(node->parent(), npoints);
+ add_nsites_to(node->parent(), nsites);
}
@@ -187,10 +187,10 @@
std::cout << " |" << std::endl;
std::cout << "region : " << &*p
<< " value = " << (*p).elt().value << std::endl
- << " npoints = " << (*p).elt().npoints << std::endl
+ << " nsites = " << (*p).elt().nsites << std::endl
<< std::endl;
- if ((*p).elt().points.npoints() > 0)
+ if ((*p).elt().points.nsites() > 0)
debug::println(ima | (*p).elt().points);
std::cout << std::endl;
}
@@ -207,7 +207,7 @@
level::fill(output, 255);
for_all(p)
{
- if ((*p).elt().npoints > limit)
+ if ((*p).elt().nsites > limit)
{
mln_piter(p_array<point2d>) q((*p).elt().points);
for_all(q)
@@ -372,7 +372,7 @@
current_cc = new node_type();
++cc_cpt;
current_cc->elt().value = g;
- current_cc->elt().npoints = 0;
+ current_cc->elt().nsites = 0;
if (cc_cpt > 1)
current_parent = 0;
#ifdef FLLTDEBUG
@@ -414,7 +414,7 @@
mln_piter(arr_t) a(*A);
// Stop.
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto end;
// R <- R U A
@@ -426,7 +426,7 @@
mln_assertion(map(a).belongs_to == 0);
map(a).belongs_to = current_cc;
current_cc->elt().points.append(a);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
tagged(a) = true;
is(a) = in_R;
#ifdef FLLTDEBUG
@@ -439,9 +439,9 @@
#ifdef FLLTDEBUG
- std::cout << "points of A : " << A->npoints() << std::endl;
+ std::cout << "points of A : " << A->nsites() << std::endl;
#endif
- mln_assertion(A->npoints() > 0);
+ mln_assertion(A->nsites() > 0);
R_box.take(A->bbox());
mln_assertion(R_box.is_valid());
@@ -495,10 +495,10 @@
#endif
// Stop if N[g] is empty.
- if (N[g]->npoints() == 0)
+ if (N[g]->nsites() == 0)
{
- add_npoints_to(current_parent, current_cc->elt().npoints);
- // Was : current_parent->elt().npoints += current_cc->elt().npoints;
+ add_nsites_to(current_parent, current_cc->elt().nsites);
+ // Was : current_parent->elt().nsites += current_cc->elt().nsites;
current_cc->set_parent(current_parent);
erase_exterior_border(map, N_box, current_cc, neighb_c6);
goto step_1;
Index: sandbox/garrigues/fllt/fllt_simple.cc
--- sandbox/garrigues/fllt/fllt_simple.cc (revision 2233)
+++ sandbox/garrigues/fllt/fllt_simple.cc (working copy)
@@ -141,7 +141,7 @@
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
- unsigned npoints;
+ unsigned nsites;
};
@@ -286,13 +286,13 @@
};
template <typename P, typename V>
- void add_npoints_to(fllt_node(P, V)* node, unsigned npoints)
+ void add_nsites_to(fllt_node(P, V)* node, unsigned nsites)
{
mln_assertion(node);
- node->elt().npoints += npoints;
+ node->elt().nsites += nsites;
if (node->parent())
- add_npoints_to(node->parent(), npoints);
+ add_nsites_to(node->parent(), nsites);
}
template <typename R>
@@ -327,10 +327,10 @@
std::cout << " |" << std::endl;
std::cout << "region : " << &*p
<< " value = " << (*p).elt().value << std::endl
- << " npoints = " << (*p).elt().npoints << std::endl
+ << " nsites = " << (*p).elt().nsites << std::endl
<< std::endl;
- if ((*p).elt().points.npoints() > 0)
+ if ((*p).elt().points.nsites() > 0)
debug::println(ima | (*p).elt().points);
std::cout << std::endl;
}
@@ -346,7 +346,7 @@
level::fill(output, 255);
for_all(p)
{
- if ((*p).elt().npoints > limit)
+ if ((*p).elt().nsites > limit)
{
mln_piter(p_array<point2d>) q((*p).elt().points);
for_all(q)
@@ -490,7 +490,7 @@
current_cc = new node_type();
++cc_cpt;
current_cc->elt().value = g;
- current_cc->elt().npoints = 0;
+ current_cc->elt().nsites = 0;
if (cc_cpt > 1)
current_parent = 0;
#ifdef FLLTDEBUG
@@ -532,7 +532,7 @@
mln_piter(arr_t) a(*A);
// Stop.
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto end;
// R <- R U A
@@ -544,7 +544,7 @@
mln_assertion(map(a).belongs_to == 0);
map(a).belongs_to = current_cc;
current_cc->elt().points.append(a);
- current_cc->elt().npoints++;
+ current_cc->elt().nsites++;
tagged(a) = true;
is(a) = in_R;
#ifdef FLLTDEBUG
@@ -557,9 +557,9 @@
#ifdef FLLTDEBUG
- std::cout << "points of A : " << A->npoints() << std::endl;
+ std::cout << "points of A : " << A->nsites() << std::endl;
#endif
- mln_assertion(A->npoints() > 0);
+ mln_assertion(A->nsites() > 0);
R_box.take(A->bbox());
mln_assertion(R_box.is_valid());
@@ -613,10 +613,10 @@
#endif
// Stop if N[g] is empty.
- if (N[g]->npoints() == 0)
+ if (N[g]->nsites() == 0)
{
- add_npoints_to(current_parent, current_cc->elt().npoints);
- // Was : current_parent->elt().npoints += current_cc->elt().npoints;
+ add_nsites_to(current_parent, current_cc->elt().nsites);
+ // Was : current_parent->elt().nsites += current_cc->elt().nsites;
current_cc->set_parent(current_parent);
erase_exterior_border(map, N_box, current_cc);
goto step_1;
Index: sandbox/garrigues/fllt/types.hh
--- sandbox/garrigues/fllt/types.hh (revision 2233)
+++ sandbox/garrigues/fllt/types.hh (working copy)
@@ -96,14 +96,14 @@
const box2d& bbox() const;
/// Give the number of points.
- unsigned npoints() const;
+ unsigned nsites() const;
/// Hook to the image2d containing the points.
sub_image<image2d<value::int_u8>, box2d> image();
private:
image2d<value::int_u8> ima_;
- unsigned npoints_;
+ unsigned nsites_;
accu::bbox<point2d> bb_;
};
@@ -115,7 +115,7 @@
: ima_(b)
{
bb_.init();
- npoints_ = 0;
+ nsites_ = 0;
level::fill(ima_, false);
}
@@ -127,7 +127,7 @@
{
bb_.take(p);
ima_(p) = domain;
- npoints_++;
+ nsites_++;
return *this;
}
@@ -153,7 +153,7 @@
void
ran_domains::clear()
{
- if (npoints_ == 0)
+ if (nsites_ == 0)
return;
// unsigned bb_nrows = geom::nrows(bb_.to_result());
@@ -171,7 +171,7 @@
// else
level::fill(ima_, false);
- npoints_ = 0;
+ nsites_ = 0;
bb_.init();
}
@@ -180,22 +180,22 @@
const box2d&
ran_domains::bbox() const
{
- mln_precondition(npoints_ != 0);
+ mln_precondition(nsites_ != 0);
return bb_.to_result();
}
inline
unsigned
- ran_domains::npoints() const
+ ran_domains::nsites() const
{
- return npoints_;
+ return nsites_;
}
inline
sub_image<image2d<value::int_u8>, box2d>
ran_domains::image()
{
- mln_precondition(npoints_ > 0);
+ mln_precondition(nsites_ > 0);
mln_assertion(ima_.has_data());
return ima_ | bb_.to_result();
}
Index: sandbox/garrigues/fllt/fllt_theo.cc
--- sandbox/garrigues/fllt/fllt_theo.cc (revision 2233)
+++ sandbox/garrigues/fllt/fllt_theo.cc (working copy)
@@ -163,7 +163,7 @@
mln_niter(Nbh) x(nbh, a);
// Stop.
- if (A.npoints() == 0)
+ if (A.nsites() == 0)
goto end;
// R <- R U A
@@ -184,9 +184,9 @@
#ifdef FLLTDEBUG
- std::cout << "points of A : " << A.npoints() << std::endl;
+ std::cout << "points of A : " << A.nsites() << std::endl;
#endif
- mln_assertion(A.npoints() > 0);
+ mln_assertion(A.nsites() > 0);
R_box.take(A.bbox());
mln_assertion(R_box.is_valid());
@@ -214,7 +214,7 @@
// gN = min u(x) for all x in N
unsigned i;
for (i = 0; i < 256; ++i)
- if (N[i].npoints() != 0)
+ if (N[i].nsites() != 0)
{
gN = i;
break;
@@ -229,7 +229,7 @@
#endif
if (i == 256)
goto step_4c;
- mln_assertion(N[gN].npoints() > 0);
+ mln_assertion(N[gN].nsites() > 0);
// FIXME: update the number of CC of the border of R
}
@@ -249,8 +249,8 @@
A = N[gN];
N[gN].clear();
- mln_assertion(A.npoints() > 0);
- mln_assertion(N[gN].npoints() == 0);
+ mln_assertion(A.nsites() > 0);
+ mln_assertion(N[gN].nsites() == 0);
goto step_3;
}
// b)
@@ -261,8 +261,8 @@
#endif
A = N[gN];
N[gN].clear();
- mln_assertion(A.npoints() > 0);
- mln_assertion(N[gN].npoints() == 0);
+ mln_assertion(A.nsites() > 0);
+ mln_assertion(N[gN].nsites() == 0);
goto step_3;
}
// c)
Index: sandbox/garrigues/fllt/compute_level_set_fast2.hh
--- sandbox/garrigues/fllt/compute_level_set_fast2.hh (revision 2233)
+++ sandbox/garrigues/fllt/compute_level_set_fast2.hh (working copy)
@@ -130,7 +130,7 @@
// gn <- min u(x) x belongs to N.
image_sub_if_value tmp(r_a_n.image() | SET_N);
- finished = tmp.npoints() == 0;
+ finished = tmp.nsites() == 0;
if (!finished)
gn = level::compute< typename F::accu_for_gn >(u | tmp.domain());
@@ -175,7 +175,7 @@
// This is faster.
-// if (N.npoints() >= 0)
+// if (N.nsites() >= 0)
// {
image_sub_if_value tmp(r_a_n.image() | SET_N);
image_sub_if_value::fwd_piter qn(tmp.domain());
@@ -215,7 +215,7 @@
// FIXME : we can make it faster.
// FIXME : rewrite this test.
- // if ((R.bbox() < u.domain()) || (R.npoints() == u.domain().npoints()))
+ // if ((R.bbox() < u.domain()) || (R.nsites() == u.domain().nsites()))
// {
image_sub_if_value tmp(r_a_n.image() | SET_R);
image_sub_if_value::fwd_piter p(tmp.domain());
@@ -284,10 +284,10 @@
update_set(u, r_a_n, g);
// std::cout << "A :" << std::endl;
- // if (A.npoints())
+ // if (A.nsites())
// debug::println(u | A);
// std::cout << "N :" << std::endl;
- // if (N.npoints())
+ // if (N.nsites())
// debug::println(u | N);
// std::cout << "exiting step_fast 4_1" << std::endl;
@@ -307,10 +307,10 @@
update_set(u,r_a_n,g);
// std::cout << "A :" << std::endl;
- // if (A.npoints())
+ // if (A.nsites())
// debug::println(u | A);
// std::cout << "N :" << std::endl;
- // if (N.npoints())
+ // if (N.nsites())
// debug::println(u | N);
// std::cout << "exiting step_fast 4_2" << std::endl;
Index: sandbox/garrigues/fllt/fllt_merge.hh
--- sandbox/garrigues/fllt/fllt_merge.hh (revision 2233)
+++ sandbox/garrigues/fllt/fllt_merge.hh (working copy)
@@ -89,7 +89,7 @@
const image2d<fllt_node(P, V)*>& node_reg,
const image2d<fllt_node(P, V)*>& hole_reg)
{
- if (node.elt().holes.npoints() == 0)
+ if (node.elt().holes.nsites() == 0)
{
return;
}
@@ -177,7 +177,7 @@
fllt_tree(P, V)* main_tree = &lower_tree;
fllt_tree(P, V)* other_tree = &upper_tree;
- if (lower_tree.root()->elt().points.npoints() >= ima.domain().npoints())
+ if (lower_tree.root()->elt().points.nsites() >= ima.domain().nsites())
{
main_tree = &upper_tree;
other_tree = &lower_tree;
Index: sandbox/garrigues/fllt/fllt_optimized.hh
--- sandbox/garrigues/fllt/fllt_optimized.hh (revision 2233)
+++ sandbox/garrigues/fllt/fllt_optimized.hh (working copy)
@@ -83,7 +83,7 @@
level::fill(output, 255);
for_all(p)
{
- if ((*p).elt().points.npoints() > limit)
+ if ((*p).elt().points.nsites() > limit)
{
mln_piter(p_set<point2d>) q((*p).elt().points);
for_all(q)
@@ -114,7 +114,7 @@
std::cout << "region : " << &*p
<< " value = " << (*p).elt().value << std::endl
<< " holes : "
- << (*p).elt().holes.npoints()
+ << (*p).elt().holes.nsites()
<< (*p).elt().holes
<< std::endl;
Index: sandbox/garrigues/fllt/debug.hh
--- sandbox/garrigues/fllt/debug.hh (revision 2233)
+++ sandbox/garrigues/fllt/debug.hh (working copy)
@@ -79,7 +79,7 @@
level::fill(output, 255);
for_all(p)
{
- if ((*p).elt().points.npoints() > limit)
+ if ((*p).elt().points.nsites() > limit)
{
mln_piter(p_set<point2d>) q((*p).elt().points);
for_all(q)
@@ -110,7 +110,7 @@
std::cout << "region : " << &*p
<< " value = " << (*p).elt().value << std::endl
<< " holes : "
- << (*p).elt().holes.npoints()
+ << (*p).elt().holes.nsites()
<< (*p).elt().holes
<< std::endl;
@@ -186,11 +186,11 @@
level::fill(out, literal::white);
- if (R.npoints() != 0)
+ if (R.nsites() != 0)
level::fill(inplace(out | R), literal::green);
- if (A.npoints() != 0)
+ if (A.nsites() != 0)
level::fill(inplace(out | A), literal::blue);
- if (N.npoints() != 0)
+ if (N.nsites() != 0)
level::fill(inplace(out | N), literal::red);
io::ppm::save(out, filename.str());
Index: sandbox/garrigues/fllt/compute_level_set_fast.hh
--- sandbox/garrigues/fllt/compute_level_set_fast.hh (revision 2233)
+++ sandbox/garrigues/fllt/compute_level_set_fast.hh (working copy)
@@ -120,7 +120,7 @@
// gn <- min u(x) x belongs to N.
- finished = N.npoints() == 0;
+ finished = N.nsites() == 0;
if (!finished)
gn = level::compute< typename F::accu_for_gn >(u | N);
@@ -166,7 +166,7 @@
// This is faster.
-// if (N.npoints() >= 0)
+// if (N.nsites() >= 0)
// {
p_image2d_fwd_pixter<point2d> pxl(N);
for_all(pxl)
@@ -210,7 +210,7 @@
// Create a new conected component.
// FIXME : we can make it faster.
- if ((R.bbox() < u.domain()) || (R.npoints() == u.domain().npoints()))
+ if ((R.bbox() < u.domain()) || (R.nsites() == u.domain().nsites()))
{
mln_piter(p_image2d<P>) p(R);
current_region = new fllt_node(P, V)();
@@ -277,10 +277,10 @@
update_set(u,A,N,g);
// std::cout << "A :" << std::endl;
- // if (A.npoints())
+ // if (A.nsites())
// debug::println(u | A);
// std::cout << "N :" << std::endl;
- // if (N.npoints())
+ // if (N.nsites())
// debug::println(u | N);
// std::cout << "exiting step_fast 4_1" << std::endl;
@@ -316,10 +316,10 @@
update_set(u,A,N,g);
// std::cout << "A :" << std::endl;
- // if (A.npoints())
+ // if (A.nsites())
// debug::println(u | A);
// std::cout << "N :" << std::endl;
- // if (N.npoints())
+ // if (N.nsites())
// debug::println(u | N);
// std::cout << "exiting step_fast 4_2" << std::endl;
Index: sandbox/garrigues/fllt/fllt_simple.svg.2.cc
--- sandbox/garrigues/fllt/fllt_simple.svg.2.cc (revision 2233)
+++ sandbox/garrigues/fllt/fllt_simple.svg.2.cc (working copy)
@@ -228,7 +228,7 @@
mln_piter(arr_t) a(*A);
// Stop.
- if (A->npoints() == 0)
+ if (A->nsites() == 0)
goto end;
// R <- R U A
@@ -249,9 +249,9 @@
#ifdef FLLTDEBUG
- std::cout << "points of A : " << A->npoints() << std::endl;
+ std::cout << "points of A : " << A->nsites() << std::endl;
#endif
- mln_assertion(A->npoints() > 0);
+ mln_assertion(A->nsites() > 0);
R_box.take(A->bbox());
mln_assertion(R_box.is_valid());
@@ -291,7 +291,7 @@
#endif
// Stop if N is empty.
- if (N->npoints() == 0)
+ if (N->nsites() == 0)
goto step_1;
else
{
Index: sandbox/garrigues/fllt/compute_level_set.hh
--- sandbox/garrigues/fllt/compute_level_set.hh (revision 2233)
+++ sandbox/garrigues/fllt/compute_level_set.hh (working copy)
@@ -103,17 +103,17 @@
// debug::println(u);
// //std::cout << "A :" << std::endl;
- // if (A.npoints())
+ // if (A.nsites())
// //debug::println(u | A);
// //std::cout << "N :" << std::endl;
- // if (N.npoints())
+ // if (N.nsites())
// //debug::println(u | N);
// //std::cout << "R :" << std::endl;
- // if (R.npoints())
+ // if (R.nsites())
// //debug::println(u | R);
// gn <- min u(x) x belongs to N.
- if ((u | set::inter(N, u.domain())).npoints() > 0)
+ if ((u | set::inter(N, u.domain())).nsites() > 0)
gn = level::compute< typename F::accu_for_gn >(u | set::inter(N, u.domain()));
else
{
@@ -151,7 +151,7 @@
// Create a new conected component.
// FIXME : we can make it faster.
- if ((R.bbox() < u.domain()) || (R.npoints() == u.domain().npoints()))
+ if ((R.bbox() < u.domain()) || (R.nsites() == u.domain().nsites()))
{
mln_piter(p_set<P>) p(R);
current_region = new fllt_node(P, V)();
@@ -220,10 +220,10 @@
N = set::diff(N, set::inter(N, u.domain()) | pw::value(u) == pw::cst(g));
// std::cout << "A :" << std::endl;
- // if (A.npoints())
+ // if (A.nsites())
// debug::println(u | A);
// std::cout << "N :" << std::endl;
- // if (N.npoints())
+ // if (N.nsites())
// debug::println(u | N);
//std::cout << "exiting step 4_1" << std::endl;
@@ -248,10 +248,10 @@
N = set::diff(N, set::inter(N, u.domain()) | pw::value(u) == pw::cst(g));
// std::cout << "A :" << std::endl;
- // if (A.npoints())
+ // if (A.nsites())
// debug::println(u | A);
// std::cout << "N :" << std::endl;
- // if (N.npoints())
+ // if (N.nsites())
// debug::println(u | N);
//std::cout << "exiting step 4_2" << std::endl;
Index: sandbox/garrigues/tiled_image2d/tiled_image2d.hh
--- sandbox/garrigues/tiled_image2d/tiled_image2d.hh (revision 2233)
+++ sandbox/garrigues/tiled_image2d/tiled_image2d.hh (working copy)
@@ -323,7 +323,7 @@
tiled_image2d<T>::nelements() const
{
mln_precondition(this->has_data());
- return this->data_->b_.npoints();
+ return this->data_->b_.nsites();
}
template <typename T>
Index: sandbox/abraham/mln/morpho/basic_najman.hh
--- sandbox/abraham/mln/morpho/basic_najman.hh (revision 2233)
+++ sandbox/abraham/mln/morpho/basic_najman.hh (working copy)
@@ -546,7 +546,7 @@
// Clear the marker map
level::fill(isproc, false);
- for (int ip = 0; ip < int(S.npoints()); ++ip)
+ for (int ip = 0; ip < int(S.nsites()); ++ip)
{
psite p = S[ip];
MakeSet_node(p);
@@ -721,7 +721,7 @@
// We're on a leaf, the point has not been found
- if (nodes(cur).children.npoints() == 0)
+ if (nodes(cur).children.nsites() == 0)
return psite (-1, -1);
psite tmp, acc = psite(-1, -1);
@@ -762,7 +762,7 @@
psite min (p_set<psite>& components)
{
- if (components.npoints() == 0)
+ if (components.nsites() == 0)
return psite(-1, -1);
typename p_set<psite>::fwd_piter it(components);
@@ -777,7 +777,7 @@
psite max (p_set<psite>& components)
{
- if (components.npoints() == 0)
+ if (components.nsites() == 0)
return psite(-1, -1);
typename p_set<psite>::fwd_piter it(components);
@@ -793,13 +793,13 @@
psite highest_fork (p_set<psite>& components)
{
- if (components.npoints() == 0)
+ if (components.nsites() == 0)
{
std::cerr << "highest fork : empty set" << std::endl;
return psite(-1, -1);
}
- // if (components.npoints() == 1)
+ // if (components.nsites() == 1)
// return components[0];
psite
@@ -834,7 +834,7 @@
if (pima.has(q) && pima(q) < pima(p))
v.insert(Par_node(q));
- if (v.npoints() == 0)
+ if (v.nsites() == 0)
return psite(-1, -1);
psite hf = highest_fork(v);
@@ -857,10 +857,10 @@
if (pima.has(q) && pima(q) < pima(p))
v.insert(Par_node(q));
- if (v.npoints() == 0)
+ if (v.nsites() == 0)
return psite(-1, -1);
- if (nodes(min(v)).children.npoints() != 0)
+ if (nodes(min(v)).children.nsites() != 0)
return (psite(-1, -1));
//std::cout << "hf of " << p << ":" << v;
@@ -882,12 +882,12 @@
if (pima.has(q) && pima(q) > pima(p))
v.insert(Par_node(q));
- if (v.npoints() == 0)
+ if (v.nsites() == 0)
return psite(-1, -1);
- if (v.npoints() == 1)
+ if (v.nsites() == 1)
{
- if (nodes(v[0]).children.npoints() == 1)
+ if (nodes(v[0]).children.nsites() == 1)
std::cout << "SINGL QUI MERDE" << std::endl;
return v[0];
}
@@ -911,7 +911,7 @@
if (nodes(c).level <= pima(p))
return psite(-1, -1);
- if (nodes(c).children.npoints() == 1)
+ if (nodes(c).children.nsites() == 1)
std::cout << "LCA QUI MERDE" << std::endl;
return c;
@@ -927,10 +927,10 @@
if (pima.has(q) && pima(q) > pima(p))
v.insert(Par_node(q));
- if (v.npoints() == 0)
+ if (v.nsites() == 0)
return psite(-1, -1);
- if (v.npoints() == 1)
+ if (v.nsites() == 1)
return v[0];
psite
@@ -1173,7 +1173,7 @@
level::fill(cmax, false);
mln_piter(I) it(Par_node.domain());
for_all(it)
- if (nodes(Par_node(it.to_point())).children.npoints() == 0)
+ if (nodes(Par_node(it.to_point())).children.nsites() == 0)
cmax(it.to_point()) = true;
// Optimisation : enqueue minima's neighbours
@@ -1213,15 +1213,15 @@
Par_node(x) = c;
// isproc(x) = true;
- if (nodes(c).children.npoints() == 0)
+ if (nodes(c).children.nsites() == 0)
cmax(x) = true;
else
- if (nodes(c).children.npoints() > 1)
+ if (nodes(c).children.nsites() > 1)
{
}
else
{
- std::cerr << "ERREUR COMPOSANTE BRANCHE " << nodes(c).children.npoints() << std::endl;
+ std::cerr << "ERREUR COMPOSANTE BRANCHE " << nodes(c).children.nsites() << std::endl;
}
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Cleanup level fill.
* mln/level/fill.hh: Dispatch to explicit routines.
fill.hh | 180 +++++++++++++++++++---------------------------------------------
1 file changed, 55 insertions(+), 125 deletions(-)
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 2232)
+++ mln/level/fill.hh (working copy)
@@ -32,16 +32,15 @@
*
* \brief Fill an image, that is, set pixel values.
*
- * \todo Re-organize this file contents + Overload for fastest images.
+ * \todo Add a conversion "arr->fun" then get rid of the C array overload.
*/
# include <mln/core/concept/function.hh>
+# include <mln/pw/image.hh>
+# include <mln/convert/to_fun.hh>
-# include <mln/level/fill_with_value.hh>
# include <mln/level/fill_with_image.hh>
-
-// Specializations are in:
-// # include <mln/level/fill.spe.hh>
+# include <mln/level/fill_with_value.hh>
namespace mln
@@ -50,165 +49,96 @@
namespace level
{
- /*! Fill the whole image \p ima with the single value \p v.
- *
- * \param[in,out] ima The image to be filled.
- * \param[in] v The value to assign to all sites.
- *
- * \pre \p ima has to be initialized.
- *
- * \todo Optimize when \p ima is large and sizeof(mln_value(I)) > 1.
- */
- template <typename I>
- void fill(Image<I>& ima, const mln_value(I)& v);
-
-
- /*! Fill the whole image \p ima with the function \p f.
- *
- * \param[in,out] ima The image to be filled.
- * \param[in] f The function.
- *
- * \pre \p ima has to be initialized.
- *
- * \todo Take benefit from quantization when possible.
- */
- template <typename I, typename F>
- void fill(Image<I>& ima, const Function_p2v<F>& f);
-
-
- /*! Fill the image \p ima by applying the function \p f.
+ /*! Fill the whole image \p ima with the data provided by \p aux.
*
* \param[in,out] ima The image to be filled.
- * \param[in] f The function that defines the value of every pixel.
- *
- * The signature of \p f has to be:
- * " value f(const point& p) "
+ * \param[in] data The auxiliary data to fill the image \p ima.
*
* \pre \p ima has to be initialized.
- *
- * \todo Take benefit from quantization when possible.
*/
- template <typename I>
- void fill(Image<I>& ima, mln_value(I) (*(&f))(const mln_psite(I)& p));
-
- template <typename I>
- void fill_f(Image<I>& ima, mln_value(I) (*f)(const mln_psite(I)& p));
-
+ template <typename I, typename D>
+ void fill(Image<I>& ima, const D& data);
- /*! Fill the image \p ima with the values given by the array \p arr.
- *
- * \param[in,out] ima The image to be filled.
- * \param[in] arr The array of values.
- *
- * \warning The size of the array has to be larger than the number
- * of image points, otherwise the program crashes.
- *
- * \pre \p ima has to be initialized.
- * \pre N == \p ima.npoints
- */
- template <typename I, unsigned N>
- void fill(Image<I>& ima, mln_value(I) (&arr)[N]);
- /*! Fill the image \p ima with the values of the image \p data.
- *
- * \param[in,out] ima The image to be filled.
- * \param[in] data The image.
- *
- * \warning The definition domain of \p ima has to be included in
- * the one of \p data.
- *
- * \pre \p ima.domain <= \p data.domain.
- *
- * \todo Use memcpy when possible.
- */
- template <typename I, typename J>
- void fill(Image<I>& ima, const Image<J>& data);
+# ifndef MLN_INCLUDE_ONLY
+ namespace internal
+ {
+ // tests
+ template <typename I, typename D>
+ inline
+ void fill_tests(Image<I>& ima, const D&)
+ {
+ mlc_is(mln_trait_image_value_io(I), trait::image::value_io::read_write)::check();
+ mln_precondition(exact(ima).has_data());
+ // FIXME: check for ambiguities...
+ }
-# ifndef MLN_INCLUDE_ONLY
+ // dispatch
+ template <typename I, typename D>
+ void fill_dispatch(Image<I>& ima, const D& data)
+ {
+ fill_dispatch_overload(ima, exact(data));
+ }
- // With: value
+ // dispatch_overload
template <typename I>
- inline
- void fill(Image<I>& ima, const mln_value(I)& value)
+ void fill_dispatch_overload(Image<I>& ima, const mln_value(I)& v)
{
- trace::entering("level::fill");
- fill_with_value(ima, value);
- trace::exiting("level::fill");
+ mln::level::fill_with_value(ima, v);
}
-
- // with: Image<J>
-
template <typename I, typename J>
- inline
- void fill(Image<I>& ima, const Image<J>& data)
+ void fill_dispatch_overload(Image<I>& ima, const Image<J>& data)
{
- trace::entering("level::fill");
- fill_with_image(ima, data);
- trace::exiting("level::fill");
+ mln::level::fill_with_image(ima, data);
}
-
- // with: Function_p2v<F>
-
template <typename I, typename F>
- inline
- void fill(Image<I>& ima_, const Function_p2v<F>& f_)
+ void fill_dispatch_overload(Image<I>& ima, const Function<F>& f)
{
- trace::entering("level::fill");
-
- I& ima = exact(ima_);
- mln_precondition(ima.has_data());
- const F& f = exact(f_);
- mln_piter(I) p(ima.domain());
- for_all(p)
- ima(p) = f(p);
-
- trace::exiting("level::fill");
+ mlc_converts_to(mln_result(F), mln_value(I))::check();
+ mln::level::fill_with_image(ima, f | ima.domain());
}
-
- // with: value f(const point&)
-
- template <typename I>
- inline
- void fill_f(Image<I>& ima_,
- mln_value(I) (*f)(const mln_psite(I)& p))
+ template <typename I, typename R, typename A>
+ void fill_dispatch_overload(Image<I>& ima, R (*f)(A))
{
- trace::entering("level::fill_f");
+ mlc_converts_to(R, mln_value(I))::check();
+ mln::level::fill_with_image(ima,
+ convert::to_fun(f) | ima.domain());
+ }
- mln_precondition(f != 0);
+ template <typename I, typename V, unsigned N>
+ void fill_dispatch_overload(Image<I>& ima_, V (&arr)[N])
+ {
+ mlc_converts_to(V, mln_value(I))::check();
I& ima = exact(ima_);
- mln_precondition(ima.has_data());
- mln_piter(I) p(ima.domain());
+ mln_precondition(N == ima.nsites());
+ mln_fwd_piter(I) p(ima.domain());
+ unsigned i = 0;
for_all(p)
- ima(p) = f(p);
-
- trace::exiting("level::fill_f");
+ ima(p) = arr[i++];
}
+ } // end of namespace mln::level::internal
+
- // with: value arr[N]
+ // Facade.
- template <typename I, unsigned N>
+ template <typename I, typename D>
inline
- void fill(Image<I>& ima_, mln_value(I) (&arr)[N])
+ void fill(Image<I>& ima, const D& data)
{
trace::entering("level::fill");
- I& ima = exact(ima_);
- mln_precondition(ima.has_data());
- mln_precondition(N == ima.npoints());
- mln_piter(I) p(ima.domain());
- unsigned i = 0;
- for_all(p)
- ima(p) = arr[i++];
+ internal::fill_tests(ima, data);
+ internal::fill_dispatch(ima, data);
trace::exiting("level::fill");
}
1
0