Very low two compile.
- I didn't find mlc_is_not_const :( -
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Fix union_find.
* oln/morpho/union_find.hh: .
* oln/canvas/two_pass.hh: .
canvas/two_pass.hh | 4 ++--
morpho/union_find.hh | 25 ++++++++++++++-----------
2 files changed, 16 insertions(+), 13 deletions(-)
Index: oln/morpho/union_find.hh
--- oln/morpho/union_find.hh (revision 937)
+++ oln/morpho/union_find.hh (working copy)
@@ -31,6 +31,7 @@
# include <oln/core/concept/image.hh>
# include <oln/canvas/two_pass.hh>
+# include <oln/level/fill.hh>
namespace oln
{
@@ -40,7 +41,7 @@
template <typename I>
oln_plain_value(I, unsigned)
- union_find(const Binary_Image<I>& input);
+ union_find(const Image_with_Nbh<I>& input);
# ifndef OLN_INCLUDE_ONLY
@@ -50,7 +51,7 @@
struct union_find_
{
const I& input;
- oln_plain(I) output;
+ oln_plain_value(I, unsigned) output;
oln_plain(I) is_processed;
oln_plain_value(I, oln_point(I)) parent;
@@ -58,12 +59,13 @@
union_find_(const I& in)
: input(in)
{
- prepare(is_processed, oln::with, input);
- prepare(output, oln::with, input);
- prepare(parent, oln::with, input);
+ prepare(is_processed, with, in);
+ prepare(output, with, in);
+ prepare(parent, with, in);
}
- oln_point(I) find_root(I& ima,
+ oln_point(I)
+ find_root(const I& ima,
const oln_point(I)& x,
oln_plain_value(I, oln_point(I))& parent)
{
@@ -75,7 +77,8 @@
return x;
}
- void do_union(I& ima,
+ void
+ do_union(const I& ima,
const oln_point(I)& n,
const oln_point(I)& p,
oln_plain_value(I, oln_point(I))& parent)
@@ -87,7 +90,7 @@
void init()
{
- oln::level::fill(is_processed, false);
+ level::fill(is_processed, false);
}
void first_pass_body(const oln_point(I)& p)
@@ -127,10 +130,10 @@
template <typename I>
oln_plain_value(I, unsigned)
- union_find(const Binary_Image<I>& input)
+ union_find(const Image_with_Nbh<I>& input)
{
- union_find_<I> f(input);
- canvas::two_pass(f);
+ impl::union_find_<I> f(exact(input));
+ canvas::two_pass(f, input);
return f.output;
}
Index: oln/canvas/two_pass.hh
--- oln/canvas/two_pass.hh (revision 937)
+++ oln/canvas/two_pass.hh (working copy)
@@ -36,11 +36,11 @@
{
f.init();
- oln_piter(I) p1(f.input.points());
+ oln_piter(I) p1(input.points());
for_all(p1)
f.first_pass_body(p1);
- oln_bkd_piter(I) p2(f.input.points());
+ oln_bkd_piter(I) p2(input.points());
for_all(p2)
f.second_pass_body(p2);