* mln/topo/is_simple_cell.hh
(mln::topo::is_simple_cell<I, N, NL, NH>::operator()): Here.
---
milena/ChangeLog | 7 +++++++
milena/mln/make/attachment.hh | 2 ++
milena/mln/make/detachment.hh | 2 ++
milena/mln/topo/detach_cell.hh | 2 ++
milena/mln/topo/is_facet.hh | 2 ++
milena/mln/topo/is_simple_cell.hh | 26 +++++++++++++++++++++++++-
6 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 279f0a6..d4d9a23 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-24 Roland Levillain <roland(a)lrde.epita.fr>
+
+ State a cell is not simple if it does not correspond to a facet.
+
+ * mln/topo/is_simple_cell.hh
+ (mln::topo::is_simple_cell<I, N, NL, NH>::operator()): Here.
+
2010-09-09 Roland Levillain <roland(a)lrde.epita.fr>
Use mln::data::paste to simplify mesh skeleton applications.
diff --git a/milena/mln/make/attachment.hh b/milena/mln/make/attachment.hh
index 3af5332..63eca65 100644
--- a/milena/mln/make/attachment.hh
+++ b/milena/mln/make/attachment.hh
@@ -74,6 +74,8 @@ namespace mln
attachment(const Image<I>& ima_, const mln_psite(I)& f,
const Neighborhood<N>& nbh_)
{
+ // FIXME: The current implementation of topo::is_facet is too
+ // naive: it does not take the values of the image into account.
mln_precondition(topo::is_facet(f));
mlc_equal(mln_value(I), bool)::check();
diff --git a/milena/mln/make/detachment.hh b/milena/mln/make/detachment.hh
index 6cd01ba..88b70a0 100644
--- a/milena/mln/make/detachment.hh
+++ b/milena/mln/make/detachment.hh
@@ -81,6 +81,8 @@ namespace mln
detachment(const Image<I>& ima_, const mln_psite(I)& f,
const Neighborhood<N>& nbh_)
{
+ // FIXME: The current implementation of topo::is_facet is too
+ // naive: it does not take the values of the image into account.
mln_precondition(topo::is_facet(f));
mlc_equal(mln_value(I), bool)::check();
diff --git a/milena/mln/topo/detach_cell.hh b/milena/mln/topo/detach_cell.hh
index 9e2a489..250babf 100644
--- a/milena/mln/topo/detach_cell.hh
+++ b/milena/mln/topo/detach_cell.hh
@@ -131,6 +131,8 @@ namespace mln
detach_cell<I, N>::operator()(const mln_psite(I)& f)
{
mln_precondition(ima_);
+ // FIXME: The current implementation of topo::is_facet is too
+ // naive: it does not take the values of the image into account.
mln_precondition(topo::is_facet(f));
typedef p_set<mln_psite(I)> faces_t;
diff --git a/milena/mln/topo/is_facet.hh b/milena/mln/topo/is_facet.hh
index 0b10040..675126c 100644
--- a/milena/mln/topo/is_facet.hh
+++ b/milena/mln/topo/is_facet.hh
@@ -52,6 +52,8 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+ // FIXME: Too naive: this code does not take the values of the
+ // image into account.
template <unsigned D, typename G>
inline
bool
diff --git a/milena/mln/topo/is_simple_cell.hh b/milena/mln/topo/is_simple_cell.hh
index bf60c3d..0cf50fb 100644
--- a/milena/mln/topo/is_simple_cell.hh
+++ b/milena/mln/topo/is_simple_cell.hh
@@ -81,7 +81,12 @@ namespace mln
/// Set the underlying image.
void set_image(const mln::Image<I>& ima);
- /// Based on the algorithm A2 from couprie.08.pami.
+ /** \brief Test whether a face (expected to be facet) is a
+ simple cell.
+
+ If \a p is not a facet, return false.
+
+ Based on the algorithm A2 from couprie.08.pami. */
/* FIXME: We probably broke the compatiblity with g++ 3.3, as it
seems this compiler does not like an indirect type like the
one of the following operator's argument. Check and possibly
@@ -124,6 +129,25 @@ namespace mln
is_simple_cell<I, N, NL, NH>::operator()(const mln_psite(I)& p) const
{
mln_precondition(ima_);
+ // FIXME: Introduce `const I& ima = *ima_;' and use it instead of
+ // `ima_'. Or introduce an `ima()' accessor?
+
+ // FIXME: We should be using topo::is_facet, but this routine is
+ // too naive, and does not take the values of the image into
+ // account.
+ {
+ // This (part of) ``algorithm'' considers that looking for
+ // faces of dimension n+1 is enough (which is the case
+ // if the image is a complex).
+ NH higher_adj_nbh;
+ mln_niter(NH) n(higher_adj_nbh, p);
+ for_all(n)
+ // If the higher-dim-faces neighborhood is not empty, then P
+ // is included in a face of higher dimension.
+ if (ima_->has(n) && (*ima_)(n))
+ return false;
+ // Otherwise, F is a facet; continue.
+ }
typedef p_set<mln_psite(I)> faces_t;
--
1.5.6.5
Show replies by date