* mln/core/site_set/p_complex.hh
(p_complex<D, P>): Replace parameter P, standing for a site type,
by...
(p_complex<D, G>): ...a parameter G, standing for a geometry
functor type.
Adjust.
Update documentation.
(mln::p_complex<D, G>::geom_): New attribute.
(mln::p_complex<D, G>::geom): New accessor.
(mln::p_complex::p_complex(const topo::complex<D>&)):
Add an extra parameter...
(mln::p_complex::p_complex(const topo::complex<D>&, const G&)):
...to initialize mln::p_complex<D, G>::geom_.
* mln/core/image/complex_higher_neighborhood.hh,
* mln/core/image/complex_higher_window_p.hh,
* mln/core/image/complex_lower_higher_neighborhood.hh,
* mln/core/image/complex_lower_higher_window_p.hh,
* mln/core/image/complex_lower_neighborhood.hh,
* mln/core/image/complex_lower_window_p.hh,
* mln/core/image/complex_neighborhood_piter.hh,
* mln/core/image/complex_window_piter.hh,
* mln/core/image/complex_image.hh,
* mln/core/site_set/complex_psite.hh,
* mln/core/site_set/p_complex_piter.hh:
Adjust: s/P/G/.
* mln/core/image/complex_image.hh
(mln::trait::image_< complex_image<D, G, V> >::dimension): Adjust.
(mln::complex_image<D, G, V>): More documentation.
* mln/core/site_set/complex_psite.hh: Use #if 0 / #endif to
disable code instead of comments.
(mln::complex_psite<D, G>::p_): Set type to mln_site(G).
(mln::complex_psite::complex_psite): Don't update unconditionally,
ensure the iterator is valid first.
(mln::complex_psite::complex_psite<D, G>::subj_())
(mln::complex_psite::complex_psite<D, G>::update_()):
Provide actual implementations.
* mln/core/site_set/p_complex_piter.hh
(mln::p_complex_fwd_piter_<D, G>)
(mln::p_complex_bkd_piter_<D, G>):
Adjust site type passed as parameter as super class.
(mln::p_complex_fwd_piter_<D, G>::super_)
(mln::p_complex_bkd_piter_<D, G>::super_):
Likewise.
---
milena/ChangeLog | 48 ++++++
.../mln/core/image/complex_higher_neighborhood.hh | 22 ++--
milena/mln/core/image/complex_higher_window_p.hh | 30 ++--
milena/mln/core/image/complex_image.hh | 107 +++++++-------
.../image/complex_lower_higher_neighborhood.hh | 22 ++--
.../core/image/complex_lower_higher_window_p.hh | 30 ++--
.../mln/core/image/complex_lower_neighborhood.hh | 22 ++--
milena/mln/core/image/complex_lower_window_p.hh | 30 ++--
.../mln/core/image/complex_neighborhood_piter.hh | 100 +++++++-------
milena/mln/core/image/complex_window_piter.hh | 100 +++++++-------
milena/mln/core/site_set/complex_psite.hh | 156 +++++++++++---------
milena/mln/core/site_set/p_complex.hh | 110 ++++++++------
milena/mln/core/site_set/p_complex_piter.hh | 62 ++++----
13 files changed, 464 insertions(+), 375 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index afe3d11..fa3e596 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,53 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Have complex-based site set use geometry functor for site location.
+
+ * mln/core/site_set/p_complex.hh
+ (p_complex<D, P>): Replace parameter P, standing for a site type,
+ by...
+ (p_complex<D, G>): ...a parameter G, standing for a geometry
+ functor type.
+ Adjust.
+ Update documentation.
+ (mln::p_complex<D, G>::geom_): New attribute.
+ (mln::p_complex<D, G>::geom): New accessor.
+ (mln::p_complex::p_complex(const topo::complex<D>&)):
+ Add an extra parameter...
+ (mln::p_complex::p_complex(const topo::complex<D>&, const G&)):
+ ...to initialize mln::p_complex<D, G>::geom_.
+ * mln/core/image/complex_higher_neighborhood.hh,
+ * mln/core/image/complex_higher_window_p.hh,
+ * mln/core/image/complex_lower_higher_neighborhood.hh,
+ * mln/core/image/complex_lower_higher_window_p.hh,
+ * mln/core/image/complex_lower_neighborhood.hh,
+ * mln/core/image/complex_lower_window_p.hh,
+ * mln/core/image/complex_neighborhood_piter.hh,
+ * mln/core/image/complex_window_piter.hh,
+ * mln/core/image/complex_image.hh,
+ * mln/core/site_set/complex_psite.hh,
+ * mln/core/site_set/p_complex_piter.hh:
+ Adjust: s/P/G/.
+ * mln/core/image/complex_image.hh
+ (mln::trait::image_< complex_image<D, G, V> >::dimension): Adjust.
+ (mln::complex_image<D, G, V>): More documentation.
+ * mln/core/site_set/complex_psite.hh: Use #if 0 / #endif to
+ disable code instead of comments.
+ (mln::complex_psite<D, G>::p_): Set type to mln_site(G).
+ (mln::complex_psite::complex_psite): Don't update unconditionally,
+ ensure the iterator is valid first.
+ (mln::complex_psite::complex_psite<D, G>::subj_())
+ (mln::complex_psite::complex_psite<D, G>::update_()):
+ Provide actual implementations.
+ * mln/core/site_set/p_complex_piter.hh
+ (mln::p_complex_fwd_piter_<D, G>)
+ (mln::p_complex_bkd_piter_<D, G>):
+ Adjust site type passed as parameter as super class.
+ (mln::p_complex_fwd_piter_<D, G>::super_)
+ (mln::p_complex_bkd_piter_<D, G>::super_):
+ Likewise.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Add a functor encoding the geometry of a complex using its 0-faces.
* mln/geom/complex_geometry.hh: New.
diff --git a/milena/mln/core/image/complex_higher_neighborhood.hh
b/milena/mln/core/image/complex_higher_neighborhood.hh
index b3fc4b9..4dce482 100644
--- a/milena/mln/core/image/complex_higher_neighborhood.hh
+++ b/milena/mln/core/image/complex_higher_neighborhood.hh
@@ -44,19 +44,19 @@
namespace mln
{
// Forward declarations.
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_fwd_piter;
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_bkd_piter;
/// \brief Neighborhood centered on a n-face of complex returning its
/// adjacent (n-1)-faces.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
class complex_higher_neighborhood
- : public Neighborhood< complex_higher_neighborhood<D, P> >
+ : public Neighborhood< complex_higher_neighborhood<D, G> >
{
- typedef complex_higher_neighborhood<D, P> self_;
+ typedef complex_higher_neighborhood<D, G> self_;
public:
/// The associated complex iterators.
@@ -69,19 +69,19 @@ namespace mln
/// Associated types.
/// \{
/// The type of psite corresponding to the neighborhood.
- typedef complex_psite<D, P> psite;
+ typedef complex_psite<D, G> psite;
/// The type of site corresponding to the neighborhood.
typedef mln_site(psite) site;
/// \brief Site_Iterator type to browse the psites of the neighborhood
/// w.r.t. the ordering of vertices.
typedef
- complex_neighborhood_fwd_piter<complex_fwd_iter, P, self_> fwd_niter;
+ complex_neighborhood_fwd_piter<complex_fwd_iter, G, self_> fwd_niter;
/// \brief Site_Iterator type to browse the psites of the neighborhood
/// w.r.t. the reverse ordering of vertices.
typedef
- complex_neighborhood_bkd_piter<complex_bkd_iter, P, self_> bkd_niter;
+ complex_neighborhood_bkd_piter<complex_bkd_iter, G, self_> bkd_niter;
/// The default niter type.
typedef fwd_niter niter;
@@ -102,11 +102,11 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
// FIXME: Dummy.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
// FIXME: Change (dummy) type.
- const typename complex_higher_neighborhood<D, P>::window&
- complex_higher_neighborhood<D, P>::win() const
+ const typename complex_higher_neighborhood<D, G>::window&
+ complex_higher_neighborhood<D, G>::win() const
{
// FIXME: Dummy.
return *this;
diff --git a/milena/mln/core/image/complex_higher_window_p.hh
b/milena/mln/core/image/complex_higher_window_p.hh
index 39108c4..b043ce9 100644
--- a/milena/mln/core/image/complex_higher_window_p.hh
+++ b/milena/mln/core/image/complex_higher_window_p.hh
@@ -43,16 +43,16 @@
namespace mln
{
// Forward declarations.
- template <unsigned D, typename P> class complex_higher_window_p;
- template <typename I, typename P, typename W> class complex_window_fwd_piter;
- template <typename I, typename P, typename W> class complex_window_bkd_piter;
+ template <unsigned D, typename G> class complex_higher_window_p;
+ template <typename I, typename G, typename W> class complex_window_fwd_piter;
+ template <typename I, typename G, typename W> class complex_window_bkd_piter;
namespace trait
{
- template <unsigned D, typename P>
- struct window_< mln::complex_higher_window_p<D,P> >
+ template <unsigned D, typename G>
+ struct window_< mln::complex_higher_window_p<D,G> >
{
typedef trait::window::size::unknown size;
typedef trait::window::support::irregular support;
@@ -64,11 +64,11 @@ namespace mln
/// \brief Window centered on a n-face of complex returning its
/// adjacent (n+1)-faces as well as the center n-face.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
class complex_higher_window_p
- : public Window< complex_higher_window_p<D, P> >
+ : public Window< complex_higher_window_p<D, G> >
{
- typedef complex_higher_window_p<D, P> self_;
+ typedef complex_higher_window_p<D, G> self_;
/// The complex iterators on the <em>adjacent</em> faces only
/// (without the center point).
/// \{
@@ -87,7 +87,7 @@ namespace mln
/// Associated types.
/// \{
/// The type of psite corresponding to the window.
- typedef complex_psite<D, P> psite;
+ typedef complex_psite<D, G> psite;
/// The type of site corresponding to the window.
typedef mln_site(psite) site;
@@ -97,12 +97,12 @@ namespace mln
/// \brief Site_Iterator type to browse the psites of the window
/// w.r.t. the ordering of vertices.
typedef
- complex_window_fwd_piter<complex_fwd_iter, P, self_> fwd_qiter;
+ complex_window_fwd_piter<complex_fwd_iter, G, self_> fwd_qiter;
/// \brief Site_Iterator type to browse the psites of the window
/// w.r.t. the reverse ordering of vertices.
typedef
- complex_window_bkd_piter<complex_bkd_iter, P, self_> bkd_qiter;
+ complex_window_bkd_piter<complex_bkd_iter, G, self_> bkd_qiter;
/// The default qiter type.
typedef fwd_qiter qiter;
@@ -125,16 +125,16 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- complex_higher_window_p<D, P>::is_empty() const
+ complex_higher_window_p<D, G>::is_empty() const
{
return false;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- complex_higher_window_p<D, P>::is_centered() const
+ complex_higher_window_p<D, G>::is_centered() const
{
return true;
}
diff --git a/milena/mln/core/image/complex_image.hh
b/milena/mln/core/image/complex_image.hh
index 1cc5fe6..966f95d 100644
--- a/milena/mln/core/image/complex_image.hh
+++ b/milena/mln/core/image/complex_image.hh
@@ -51,20 +51,20 @@ namespace mln
{
// Forward declaration.
- template <unsigned D, typename P, typename V> class complex_image;
+ template <unsigned D, typename G, typename V> class complex_image;
namespace internal
{
- /// Data structure for \c mln::complex_image<P,V>.
- template <unsigned D, typename P, typename V>
- struct data< complex_image<D, P, V> >
+ /// Data structure for \c mln::complex_image.
+ template <unsigned D, typename G, typename V>
+ struct data< complex_image<D, G, V> >
{
- data(const p_complex<D, P>& pc,
+ data(const p_complex<D, G>& pc,
const metal::vec< D + 1, std::vector<V> >& values);
metal::vec< D + 1, std::vector<V> > values_;
- const p_complex<D, P> pc_;
+ const p_complex<D, G> pc_;
};
} // end of namespace mln::internal
@@ -73,9 +73,9 @@ namespace mln
namespace trait
{
- template <unsigned D, typename P, typename V>
- struct image_< complex_image<D, P, V> >
- : default_image_< V, complex_image<D, P, V> >
+ template <unsigned D, typename G, typename V>
+ struct image_< complex_image<D, G, V> >
+ : default_image_< V, complex_image<D, G, V> >
{
typedef trait::image::category::primary category;
@@ -92,8 +92,11 @@ namespace mln
// Site / domain.
typedef trait::image::localization::space localization;
- // FIXME: Likewise.
- typedef typename trait::image::space_from_point<P>::ret dimension;
+ /* FIXME: Depends on G. We could use
+ `trait::image::space_from_point<mln_site(G)>::ret' in most
+ cases (i.e., when G's site is a Point), but would not be
+ generic. */
+ typedef typename trait::image::dimension::none dimension;
// Extended domain.
typedef trait::image::ext_domain::none ext_domain;
@@ -106,11 +109,15 @@ namespace mln
/// \brief Image based on a complex.
///
- /// Values are stored on the vertices of the graph.
- template <unsigned D, typename P, typename V>
+ /// Values attached to each face of the complex.
+ ///
+ /// \arg p D The dimension of the complex.
+ /// \arg p G The geometry of the complex.
+ /// \arg p V The value type of the image.
+ template <unsigned D, typename G, typename V>
class complex_image
- : public internal::image_primary< V, p_complex<D, P>,
- complex_image<D, P, V> >
+ : public internal::image_primary< V, p_complex<D, G>,
+ complex_image<D, G, V> >
{
public:
/// Value associated type.
@@ -128,30 +135,30 @@ namespace mln
typedef typename std::vector<V>::const_reference rvalue;
/// Skeleton.
- typedef complex_image< D, tag::psite_<P>, tag::value_<V> >
skeleton;
+ typedef complex_image< D, tag::psite_<G>, tag::value_<V> >
skeleton;
public:
/// Constructors.
/// \{
complex_image();
- complex_image(const p_complex<D, P>& pc);
- complex_image(const p_complex<D, P>& pc,
+ complex_image(const p_complex<D, G>& pc);
+ complex_image(const p_complex<D, G>& pc,
const metal::vec< D + 1, std::vector<V> >& values);
/// \}
/// Initialize an empty image.
- void init_(const p_complex<D, P>& pc,
+ void init_(const p_complex<D, G>& pc,
const metal::vec< D + 1, std::vector<V> >& values);
/// Read-only access of face value at point site \p p.
- rvalue operator()(const complex_psite<D, P>& p) const;
+ rvalue operator()(const complex_psite<D, G>& p) const;
/// Read-write access of face value at point site \p p.
- lvalue operator()(const complex_psite<D, P>& p);
+ lvalue operator()(const complex_psite<D, G>& p);
/// Accessors.
/// \{
/// Return the domain of psites od the image.
- const p_complex<D, P>& domain() const;
+ const p_complex<D, G>& domain() const;
/// Return the array of values associated to the faces.
const metal::vec<D + 1, std::vector<V> >& values() const;
@@ -159,10 +166,10 @@ namespace mln
};
// Fwd decl.
- template <unsigned D, typename P, typename V, typename W>
+ template <unsigned D, typename G, typename V, typename W>
void init_(tag::image_t,
- complex_image<D, P, V>& target,
- const complex_image<D, P, W>& model);
+ complex_image<D, G, V>& target,
+ const complex_image<D, G, W>& model);
# ifndef MLN_INCLUDE_ONLY
@@ -171,11 +178,11 @@ namespace mln
| Initialization. |
`-----------------*/
- template <unsigned D, typename P, typename V, typename W>
+ template <unsigned D, typename G, typename V, typename W>
inline
void init_(tag::image_t,
- complex_image<D, P, V>& target,
- const complex_image<D, P, W>& model)
+ complex_image<D, G, V>& target,
+ const complex_image<D, G, W>& model)
{
metal::vec<D + 1, std::vector<V> > values;
for (unsigned i = 0; i <= D; ++i)
@@ -189,9 +196,9 @@ namespace mln
namespace internal
{
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
- data< complex_image<D, P, V> >::data(const p_complex<D, P>&
pc,
+ data< complex_image<D, G, V> >::data(const p_complex<D, G>&
pc,
const metal::vec< D + 1, std::vector<V> >& values)
: values_(values),
pc_(pc)
@@ -211,15 +218,15 @@ namespace mln
| Construction. |
`---------------*/
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
- complex_image<D, P, V>::complex_image()
+ complex_image<D, G, V>::complex_image()
{
}
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
- complex_image<D, P, V>::complex_image(const p_complex<D, P>& pc)
+ complex_image<D, G, V>::complex_image(const p_complex<D, G>& pc)
{
metal::vec<D + 1, std::vector<V> > values;
for (unsigned i = 0; i <= D; ++i)
@@ -227,60 +234,60 @@ namespace mln
init_(pc, values);
}
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
- complex_image<D, P, V>::complex_image(const p_complex<D, P>& pc,
+ complex_image<D, G, V>::complex_image(const p_complex<D, G>& pc,
const metal::vec< D + 1,
std::vector<V> >&
values)
{
init_(pc, values);
}
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
void
- complex_image<D, P, V>::init_(const p_complex<D, P>& pc,
+ complex_image<D, G, V>::init_(const p_complex<D, G>& pc,
const metal::vec< D + 1, std::vector<V> >& values)
{
mln_precondition(! this->has_data());
this->data_ =
- new internal::data< complex_image<D, P, V> >(pc, values);
+ new internal::data< complex_image<D, G, V> >(pc, values);
}
/*---------------.
| Manipulation. |
`---------------*/
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
- typename complex_image<D, P, V>::rvalue
- complex_image<D, P, V>::operator()(const complex_psite<D, P>& p) const
+ typename complex_image<D, G, V>::rvalue
+ complex_image<D, G, V>::operator()(const complex_psite<D, G>& p) const
{
mln_precondition(this->data_->pc_.has(p));
return this->data_->values_[p.n()][p.face_id()];
}
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
- typename complex_image<D, P, V>::lvalue
- complex_image<D, P, V>::operator()(const complex_psite<D, P>& p)
+ typename complex_image<D, G, V>::lvalue
+ complex_image<D, G, V>::operator()(const complex_psite<D, G>& p)
{
mln_precondition(this->data_->pc_.has(p));
return this->data_->values_[p.n()][p.face_id()];
}
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
const metal::vec< D + 1, std::vector<V> >&
- complex_image<D, P, V>::values() const
+ complex_image<D, G, V>::values() const
{
return this->data_->values_;
}
- template <unsigned D, typename P, typename V>
+ template <unsigned D, typename G, typename V>
inline
- const p_complex<D, P>&
- complex_image<D, P, V>::domain() const
+ const p_complex<D, G>&
+ complex_image<D, G, V>::domain() const
{
mln_precondition(this->has_data());
return this->data_->pc_;
diff --git a/milena/mln/core/image/complex_lower_higher_neighborhood.hh
b/milena/mln/core/image/complex_lower_higher_neighborhood.hh
index bb99e0e..459913a 100644
--- a/milena/mln/core/image/complex_lower_higher_neighborhood.hh
+++ b/milena/mln/core/image/complex_lower_higher_neighborhood.hh
@@ -46,19 +46,19 @@
namespace mln
{
// Forward declarations.
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_fwd_piter;
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_bkd_piter;
/// \brief Neighborhood centered on a n-face of complex returning its
/// adjacent (n-1)-faces.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
class complex_lower_higher_neighborhood
- : public Neighborhood< complex_lower_higher_neighborhood<D, P> >
+ : public Neighborhood< complex_lower_higher_neighborhood<D, G> >
{
- typedef complex_lower_higher_neighborhood<D, P> self_;
+ typedef complex_lower_higher_neighborhood<D, G> self_;
public:
/// The associated complex iterators.
@@ -71,19 +71,19 @@ namespace mln
/// Associated types.
/// \{
/// The type of psite corresponding to the neighborhood.
- typedef complex_psite<D, P> psite;
+ typedef complex_psite<D, G> psite;
/// The type of site corresponding to the neighborhood.
typedef mln_site(psite) site;
/// \brief Site_Iterator type to browse the psites of the neighborhood
/// w.r.t. the ordering of vertices.
typedef
- complex_neighborhood_fwd_piter<complex_fwd_iter, P, self_> fwd_niter;
+ complex_neighborhood_fwd_piter<complex_fwd_iter, G, self_> fwd_niter;
/// \brief Site_Iterator type to browse the psites of the neighborhood
/// w.r.t. the reverse ordering of vertices.
typedef
- complex_neighborhood_bkd_piter<complex_bkd_iter, P, self_> bkd_niter;
+ complex_neighborhood_bkd_piter<complex_bkd_iter, G, self_> bkd_niter;
/// The default niter type.
typedef fwd_niter niter;
@@ -104,11 +104,11 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
// FIXME: Dummy.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
// FIXME: Change (dummy) type.
- const typename complex_lower_higher_neighborhood<D, P>::window&
- complex_lower_higher_neighborhood<D, P>::win() const
+ const typename complex_lower_higher_neighborhood<D, G>::window&
+ complex_lower_higher_neighborhood<D, G>::win() const
{
// FIXME: Dummy.
return *this;
diff --git a/milena/mln/core/image/complex_lower_higher_window_p.hh
b/milena/mln/core/image/complex_lower_higher_window_p.hh
index 9b0d79d..f44a7c7 100644
--- a/milena/mln/core/image/complex_lower_higher_window_p.hh
+++ b/milena/mln/core/image/complex_lower_higher_window_p.hh
@@ -44,16 +44,16 @@
namespace mln
{
// Forward declarations.
- template <unsigned D, typename P> class complex_lower_higher_window_p;
- template <typename I, typename P, typename W> class complex_window_fwd_piter;
- template <typename I, typename P, typename W> class complex_window_bkd_piter;
+ template <unsigned D, typename G> class complex_lower_higher_window_p;
+ template <typename I, typename G, typename W> class complex_window_fwd_piter;
+ template <typename I, typename G, typename W> class complex_window_bkd_piter;
namespace trait
{
- template <unsigned D, typename P>
- struct window_< mln::complex_lower_higher_window_p<D,P> >
+ template <unsigned D, typename G>
+ struct window_< mln::complex_lower_higher_window_p<D,G> >
{
typedef trait::window::size::unknown size;
typedef trait::window::support::irregular support;
@@ -65,11 +65,11 @@ namespace mln
/// \brief Window centered on a n-face of complex returning its
/// adjacent (n-1)-faces as well as the center n-face.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
class complex_lower_higher_window_p
- : public Window< complex_lower_higher_window_p<D, P> >
+ : public Window< complex_lower_higher_window_p<D, G> >
{
- typedef complex_lower_higher_window_p<D, P> self_;
+ typedef complex_lower_higher_window_p<D, G> self_;
/// The complex iterators on the <em>adjacent</em> faces only
/// (without the center point).
/// \{
@@ -88,7 +88,7 @@ namespace mln
/// Associated types.
/// \{
/// The type of psite corresponding to the window.
- typedef complex_psite<D, P> psite;
+ typedef complex_psite<D, G> psite;
/// The type of site corresponding to the window.
typedef mln_site(psite) site;
@@ -98,12 +98,12 @@ namespace mln
/// \brief Site_Iterator type to browse the psites of the window
/// w.r.t. the ordering of vertices.
typedef
- complex_window_fwd_piter<complex_fwd_iter, P, self_> fwd_qiter;
+ complex_window_fwd_piter<complex_fwd_iter, G, self_> fwd_qiter;
/// \brief Site_Iterator type to browse the psites of the window
/// w.r.t. the reverse ordering of vertices.
typedef
- complex_window_bkd_piter<complex_bkd_iter, P, self_> bkd_qiter;
+ complex_window_bkd_piter<complex_bkd_iter, G, self_> bkd_qiter;
/// The default qiter type.
typedef fwd_qiter qiter;
@@ -126,16 +126,16 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- complex_lower_higher_window_p<D, P>::is_empty() const
+ complex_lower_higher_window_p<D, G>::is_empty() const
{
return false;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- complex_lower_higher_window_p<D, P>::is_centered() const
+ complex_lower_higher_window_p<D, G>::is_centered() const
{
return true;
}
diff --git a/milena/mln/core/image/complex_lower_neighborhood.hh
b/milena/mln/core/image/complex_lower_neighborhood.hh
index 0c17bf5..a93298b 100644
--- a/milena/mln/core/image/complex_lower_neighborhood.hh
+++ b/milena/mln/core/image/complex_lower_neighborhood.hh
@@ -44,19 +44,19 @@
namespace mln
{
// Forward declarations.
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_fwd_piter;
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_bkd_piter;
/// \brief Neighborhood centered on a n-face of complex returning its
/// adjacent (n-1)-faces.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
class complex_lower_neighborhood
- : public Neighborhood< complex_lower_neighborhood<D, P> >
+ : public Neighborhood< complex_lower_neighborhood<D, G> >
{
- typedef complex_lower_neighborhood<D, P> self_;
+ typedef complex_lower_neighborhood<D, G> self_;
public:
/// The associated complex iterators.
@@ -69,19 +69,19 @@ namespace mln
/// Associated types.
/// \{
/// The type of psite corresponding to the neighborhood.
- typedef complex_psite<D, P> psite;
+ typedef complex_psite<D, G> psite;
/// The type of site corresponding to the neighborhood.
typedef mln_site(psite) site;
/// \brief Site_Iterator type to browse the psites of the neighborhood
/// w.r.t. the ordering of vertices.
typedef
- complex_neighborhood_fwd_piter<complex_fwd_iter, P, self_> fwd_niter;
+ complex_neighborhood_fwd_piter<complex_fwd_iter, G, self_> fwd_niter;
/// \brief Site_Iterator type to browse the psites of the neighborhood
/// w.r.t. the reverse ordering of vertices.
typedef
- complex_neighborhood_bkd_piter<complex_bkd_iter, P, self_> bkd_niter;
+ complex_neighborhood_bkd_piter<complex_bkd_iter, G, self_> bkd_niter;
/// The default niter type.
typedef fwd_niter niter;
@@ -102,11 +102,11 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
// FIXME: Dummy.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
// FIXME: Change (dummy) type.
- const typename complex_lower_neighborhood<D, P>::window&
- complex_lower_neighborhood<D, P>::win() const
+ const typename complex_lower_neighborhood<D, G>::window&
+ complex_lower_neighborhood<D, G>::win() const
{
// FIXME: Dummy.
return *this;
diff --git a/milena/mln/core/image/complex_lower_window_p.hh
b/milena/mln/core/image/complex_lower_window_p.hh
index aaa1e1e..1a50d8f 100644
--- a/milena/mln/core/image/complex_lower_window_p.hh
+++ b/milena/mln/core/image/complex_lower_window_p.hh
@@ -43,16 +43,16 @@
namespace mln
{
// Forward declarations.
- template <unsigned D, typename P> class complex_lower_window_p;
- template <typename I, typename P, typename W> class complex_window_fwd_piter;
- template <typename I, typename P, typename W> class complex_window_bkd_piter;
+ template <unsigned D, typename G> class complex_lower_window_p;
+ template <typename I, typename G, typename W> class complex_window_fwd_piter;
+ template <typename I, typename G, typename W> class complex_window_bkd_piter;
namespace trait
{
- template <unsigned D, typename P>
- struct window_< mln::complex_lower_window_p<D,P> >
+ template <unsigned D, typename G>
+ struct window_< mln::complex_lower_window_p<D,G> >
{
typedef trait::window::size::unknown size;
typedef trait::window::support::irregular support;
@@ -64,11 +64,11 @@ namespace mln
/// \brief Window centered on a n-face of complex returning its
/// adjacent (n-1)-faces as well as the center n-face.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
class complex_lower_window_p
- : public Window< complex_lower_window_p<D, P> >
+ : public Window< complex_lower_window_p<D, G> >
{
- typedef complex_lower_window_p<D, P> self_;
+ typedef complex_lower_window_p<D, G> self_;
/// The complex iterators on the <em>adjacent</em> faces only
/// (without the center point).
/// \{
@@ -87,7 +87,7 @@ namespace mln
/// Associated types.
/// \{
/// The type of psite corresponding to the window.
- typedef complex_psite<D, P> psite;
+ typedef complex_psite<D, G> psite;
/// The type of site corresponding to the window.
typedef mln_site(psite) site;
@@ -97,12 +97,12 @@ namespace mln
/// \brief Site_Iterator type to browse the psites of the window
/// w.r.t. the ordering of vertices.
typedef
- complex_window_fwd_piter<complex_fwd_iter, P, self_> fwd_qiter;
+ complex_window_fwd_piter<complex_fwd_iter, G, self_> fwd_qiter;
/// \brief Site_Iterator type to browse the psites of the window
/// w.r.t. the reverse ordering of vertices.
typedef
- complex_window_bkd_piter<complex_bkd_iter, P, self_> bkd_qiter;
+ complex_window_bkd_piter<complex_bkd_iter, G, self_> bkd_qiter;
/// The default qiter type.
typedef fwd_qiter qiter;
@@ -125,16 +125,16 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- complex_lower_window_p<D, P>::is_empty() const
+ complex_lower_window_p<D, G>::is_empty() const
{
return false;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- complex_lower_window_p<D, P>::is_centered() const
+ complex_lower_window_p<D, G>::is_centered() const
{
return true;
}
diff --git a/milena/mln/core/image/complex_neighborhood_piter.hh
b/milena/mln/core/image/complex_neighborhood_piter.hh
index ed9474d..f155794 100644
--- a/milena/mln/core/image/complex_neighborhood_piter.hh
+++ b/milena/mln/core/image/complex_neighborhood_piter.hh
@@ -48,16 +48,16 @@ namespace mln
{
/*------------------------------------------.
- | complex_neighborhood_fwd_piter<I, P, N>. |
+ | complex_neighborhood_fwd_piter<I, G, N>. |
`------------------------------------------*/
/// \brief Forward iterator on complex neighborhood.
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_fwd_piter
: public internal::site_relative_iterator_base< N,
- complex_neighborhood_fwd_piter<I, P, N> >
+ complex_neighborhood_fwd_piter<I, G, N> >
{
- typedef complex_neighborhood_fwd_piter<I, P, N> self_;
+ typedef complex_neighborhood_fwd_piter<I, G, N> self_;
typedef internal::site_relative_iterator_base< N, self_ > super_;
public:
@@ -104,23 +104,23 @@ namespace mln
/// Print an mln::complex_neighborhood_fwd_piter.
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
std::ostream&
operator<<(std::ostream& ostr,
- const complex_neighborhood_fwd_piter<I, P, N>& p);
+ const complex_neighborhood_fwd_piter<I, G, N>& p);
/*------------------------------------------.
- | complex_neighborhood_bkd_piter<I, P, N>. |
+ | complex_neighborhood_bkd_piter<I, G, N>. |
`------------------------------------------*/
/// \brief Backward iterator on complex neighborhood.
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
class complex_neighborhood_bkd_piter
: public internal::site_relative_iterator_base< N,
- complex_neighborhood_bkd_piter<I, P, N> >
+ complex_neighborhood_bkd_piter<I, G, N> >
{
- typedef complex_neighborhood_bkd_piter<I, P, N> self_;
+ typedef complex_neighborhood_bkd_piter<I, G, N> self_;
typedef internal::site_relative_iterator_base< N, self_ > super_;
public:
@@ -167,29 +167,29 @@ namespace mln
/// Print an mln::complex_neighborhood_bkd_piter.
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
std::ostream&
operator<<(std::ostream& ostr,
- const complex_neighborhood_bkd_piter<I, P, N>& p);
+ const complex_neighborhood_bkd_piter<I, G, N>& p);
# ifndef MLN_INCLUDE_ONLY
/*------------------------------------------.
- | complex_neighborhood_fwd_piter<I, P, N>. |
+ | complex_neighborhood_fwd_piter<I, G, N>. |
`------------------------------------------*/
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
- complex_neighborhood_fwd_piter<I, P, N>::complex_neighborhood_fwd_piter()
+ complex_neighborhood_fwd_piter<I, G, N>::complex_neighborhood_fwd_piter()
{
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
template <typename Pref>
inline
- complex_neighborhood_fwd_piter<I, P, N>::complex_neighborhood_fwd_piter(const
Neighborhood<N>& nbh,
+ complex_neighborhood_fwd_piter<I, G, N>::complex_neighborhood_fwd_piter(const
Neighborhood<N>& nbh,
const Pref& p_ref)
{
this->change_target(exact(nbh));
@@ -197,81 +197,81 @@ namespace mln
mln_postcondition(!this->is_valid());
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
bool
- complex_neighborhood_fwd_piter<I, P, N>::is_valid_() const
+ complex_neighborhood_fwd_piter<I, G, N>::is_valid_() const
{
return iter_.is_valid();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
void
- complex_neighborhood_fwd_piter<I, P, N>::invalidate_()
+ complex_neighborhood_fwd_piter<I, G, N>::invalidate_()
{
iter_.invalidate();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
void
- complex_neighborhood_fwd_piter<I, P, N>::do_start_()
+ complex_neighborhood_fwd_piter<I, G, N>::do_start_()
{
iter_.start();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
void
- complex_neighborhood_fwd_piter<I, P, N>::do_next_()
+ complex_neighborhood_fwd_piter<I, G, N>::do_next_()
{
iter_.next();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
template <typename Pref>
inline
void
- complex_neighborhood_fwd_piter<I, P, N>::center_at(const Pref& c)
+ complex_neighborhood_fwd_piter<I, G, N>::center_at(const Pref& c)
{
super_::center_at(c);
iter_.center_at(this->center().face());
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
mln_psite(N)
- complex_neighborhood_fwd_piter<I, P, N>::compute_p_() const
+ complex_neighborhood_fwd_piter<I, G, N>::compute_p_() const
{
return psite(this->center().site_set(), iter_);
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
std::ostream&
operator<<(std::ostream& ostr,
- const complex_neighborhood_fwd_piter<I, P, N>& p)
+ const complex_neighborhood_fwd_piter<I, G, N>& p)
{
return ostr << p.unproxy_();
}
/*------------------------------------------.
- | complex_neighborhood_bkd_piter<I, P, N>. |
+ | complex_neighborhood_bkd_piter<I, G, N>. |
`------------------------------------------*/
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
- complex_neighborhood_bkd_piter<I, P, N>::complex_neighborhood_bkd_piter()
+ complex_neighborhood_bkd_piter<I, G, N>::complex_neighborhood_bkd_piter()
{
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
template <typename Pref>
inline
- complex_neighborhood_bkd_piter<I, P, N>::complex_neighborhood_bkd_piter(const
Neighborhood<N>& nbh,
+ complex_neighborhood_bkd_piter<I, G, N>::complex_neighborhood_bkd_piter(const
Neighborhood<N>& nbh,
const Pref& p_ref)
{
this->change_target(exact(nbh));
@@ -279,62 +279,62 @@ namespace mln
mln_postcondition(!this->is_valid());
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
bool
- complex_neighborhood_bkd_piter<I, P, N>::is_valid_() const
+ complex_neighborhood_bkd_piter<I, G, N>::is_valid_() const
{
return iter_.is_valid();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
void
- complex_neighborhood_bkd_piter<I, P, N>::invalidate_()
+ complex_neighborhood_bkd_piter<I, G, N>::invalidate_()
{
iter_.invalidate();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
void
- complex_neighborhood_bkd_piter<I, P, N>::do_start_()
+ complex_neighborhood_bkd_piter<I, G, N>::do_start_()
{
iter_.start();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
void
- complex_neighborhood_bkd_piter<I, P, N>::do_next_()
+ complex_neighborhood_bkd_piter<I, G, N>::do_next_()
{
iter_.next();
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
template <typename Pref>
inline
void
- complex_neighborhood_bkd_piter<I, P, N>::center_at(const Pref& c)
+ complex_neighborhood_bkd_piter<I, G, N>::center_at(const Pref& c)
{
super_::center_at(c);
iter_.center_at(this->center().face());
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
mln_psite(N)
- complex_neighborhood_bkd_piter<I, P, N>::compute_p_() const
+ complex_neighborhood_bkd_piter<I, G, N>::compute_p_() const
{
return psite(this->center().site_set(), iter_);
}
- template <typename I, typename P, typename N>
+ template <typename I, typename G, typename N>
inline
std::ostream&
operator<<(std::ostream& ostr,
- const complex_neighborhood_bkd_piter<I, P, N>& p)
+ const complex_neighborhood_bkd_piter<I, G, N>& p)
{
return ostr << p.unproxy_();
}
diff --git a/milena/mln/core/image/complex_window_piter.hh
b/milena/mln/core/image/complex_window_piter.hh
index 62c6f86..085c18a 100644
--- a/milena/mln/core/image/complex_window_piter.hh
+++ b/milena/mln/core/image/complex_window_piter.hh
@@ -49,16 +49,16 @@ namespace mln
{
/*------------------------------------.
- | complex_window_fwd_piter<I, P, W>. |
+ | complex_window_fwd_piter<I, G, W>. |
`------------------------------------*/
/// \brief Forward iterator on complex window.
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
class complex_window_fwd_piter
: public internal::site_relative_iterator_base< W,
- complex_window_fwd_piter<I, P, W> >
+ complex_window_fwd_piter<I, G, W> >
{
- typedef complex_window_fwd_piter<I, P, W> self_;
+ typedef complex_window_fwd_piter<I, G, W> self_;
typedef internal::site_relative_iterator_base< W, self_ > super_;
public:
@@ -104,23 +104,23 @@ namespace mln
/// Print an mln::complex_window_fwd_piter.
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
std::ostream&
operator<<(std::ostream& ostr,
- const complex_window_fwd_piter<I, P, W>& p);
+ const complex_window_fwd_piter<I, G, W>& p);
/*------------------------------------.
- | complex_window_bkd_piter<I, P, W>. |
+ | complex_window_bkd_piter<I, G, W>. |
`------------------------------------*/
/// \brief Backward iterator on complex window.
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
class complex_window_bkd_piter
: public internal::site_relative_iterator_base< W,
- complex_window_bkd_piter<I, P, W> >
+ complex_window_bkd_piter<I, G, W> >
{
- typedef complex_window_bkd_piter<I, P, W> self_;
+ typedef complex_window_bkd_piter<I, G, W> self_;
typedef internal::site_relative_iterator_base< W, self_ > super_;
public:
@@ -166,29 +166,29 @@ namespace mln
/// Print an mln::complex_window_bkd_piter.
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
std::ostream&
operator<<(std::ostream& ostr,
- const complex_window_bkd_piter<I, P, W>& p);
+ const complex_window_bkd_piter<I, G, W>& p);
# ifndef MLN_INCLUDE_ONLY
/*------------------------------------.
- | complex_window_fwd_piter<I, P, W>. |
+ | complex_window_fwd_piter<I, G, W>. |
`------------------------------------*/
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
- complex_window_fwd_piter<I, P, W>::complex_window_fwd_piter()
+ complex_window_fwd_piter<I, G, W>::complex_window_fwd_piter()
{
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
template <typename Pref>
inline
- complex_window_fwd_piter<I, P, W>::complex_window_fwd_piter(const
Window<W>& win,
+ complex_window_fwd_piter<I, G, W>::complex_window_fwd_piter(const
Window<W>& win,
const Pref& p_ref)
{
this->change_target(exact(win));
@@ -196,81 +196,81 @@ namespace mln
mln_postcondition(!this->is_valid());
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
bool
- complex_window_fwd_piter<I, P, W>::is_valid_() const
+ complex_window_fwd_piter<I, G, W>::is_valid_() const
{
return iter_.is_valid();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
void
- complex_window_fwd_piter<I, P, W>::invalidate_()
+ complex_window_fwd_piter<I, G, W>::invalidate_()
{
iter_.invalidate();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
void
- complex_window_fwd_piter<I, P, W>::do_start_()
+ complex_window_fwd_piter<I, G, W>::do_start_()
{
iter_.start();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
void
- complex_window_fwd_piter<I, P, W>::do_next_()
+ complex_window_fwd_piter<I, G, W>::do_next_()
{
iter_.next();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
template <typename Pref>
inline
void
- complex_window_fwd_piter<I, P, W>::center_at(const Pref& c)
+ complex_window_fwd_piter<I, G, W>::center_at(const Pref& c)
{
super_::center_at(c);
iter_.center_at(this->center().face());
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
mln_psite(W)
- complex_window_fwd_piter<I, P, W>::compute_p_() const
+ complex_window_fwd_piter<I, G, W>::compute_p_() const
{
return psite(this->center().site_set(), iter_);
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
std::ostream&
operator<<(std::ostream& ostr,
- const complex_window_fwd_piter<I, P, W>& p)
+ const complex_window_fwd_piter<I, G, W>& p)
{
return ostr << p.unproxy_();
}
/*------------------------------------.
- | complex_window_bkd_piter<I, P, W>. |
+ | complex_window_bkd_piter<I, G, W>. |
`------------------------------------*/
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
- complex_window_bkd_piter<I, P, W>::complex_window_bkd_piter()
+ complex_window_bkd_piter<I, G, W>::complex_window_bkd_piter()
{
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
template <typename Pref>
inline
- complex_window_bkd_piter<I, P, W>::complex_window_bkd_piter(const
Window<W>& win,
+ complex_window_bkd_piter<I, G, W>::complex_window_bkd_piter(const
Window<W>& win,
const Pref& p_ref)
{
this->change_target(exact(win));
@@ -278,62 +278,62 @@ namespace mln
mln_postcondition(!this->is_valid());
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
bool
- complex_window_bkd_piter<I, P, W>::is_valid_() const
+ complex_window_bkd_piter<I, G, W>::is_valid_() const
{
return iter_.is_valid();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
void
- complex_window_bkd_piter<I, P, W>::invalidate_()
+ complex_window_bkd_piter<I, G, W>::invalidate_()
{
iter_.invalidate();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
void
- complex_window_bkd_piter<I, P, W>::do_start_()
+ complex_window_bkd_piter<I, G, W>::do_start_()
{
iter_.start();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
void
- complex_window_bkd_piter<I, P, W>::do_next_()
+ complex_window_bkd_piter<I, G, W>::do_next_()
{
iter_.next();
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
template <typename Pref>
inline
void
- complex_window_bkd_piter<I, P, W>::center_at(const Pref& c)
+ complex_window_bkd_piter<I, G, W>::center_at(const Pref& c)
{
super_::center_at(c);
iter_.center_at(this->center().face());
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
mln_psite(W)
- complex_window_bkd_piter<I, P, W>::compute_p_() const
+ complex_window_bkd_piter<I, G, W>::compute_p_() const
{
return psite(this->center().site_set(), iter_);
}
- template <typename I, typename P, typename W>
+ template <typename I, typename G, typename W>
inline
std::ostream&
operator<<(std::ostream& ostr,
- const complex_window_bkd_piter<I, P, W>& p)
+ const complex_window_bkd_piter<I, G, W>& p)
{
return ostr << p.unproxy_();
}
diff --git a/milena/mln/core/site_set/complex_psite.hh
b/milena/mln/core/site_set/complex_psite.hh
index 5dd476b..87aa5ce 100644
--- a/milena/mln/core/site_set/complex_psite.hh
+++ b/milena/mln/core/site_set/complex_psite.hh
@@ -50,31 +50,30 @@
namespace mln
{
// Forward declaration.
- template <unsigned D, typename P> class p_complex;
+ template <unsigned D, typename G> class p_complex;
/// \brief Point site associated to a mln::p_complex.
///
/// \arg \p D The dimension of the complex this psite belongs to.
- /// \arg \p P The type of point associated to this psite.
- template <unsigned D, typename P>
+ /// \arg \p G The geometry of the complex.
+ template <unsigned D, typename G>
class complex_psite
- : public internal::pseudo_site_base_< const P&,
- complex_psite<D, P> >
+ : public internal::pseudo_site_base_< const mln_site(G)&, complex_psite<D,
G> >
{
public:
// This associated type is important to know that this particular
// pseudo site knows the site set it refers to.
- typedef p_complex<D, P> target;
+ typedef p_complex<D, G> target;
// FIXME: Document.
/// Construction and assignment.
/// \{
complex_psite();
/// \pre pc.cplx() == face.cplx().
- complex_psite(const p_complex<D, P>& pc,
+ complex_psite(const p_complex<D, G>& pc,
const topo::face<D>& face);
- complex_psite(const p_complex<D, P>& pc, unsigned n, unsigned face_id);
+ complex_psite(const p_complex<D, G>& pc, unsigned n, unsigned face_id);
/// \}
/// Psite manipulators.
@@ -101,7 +100,7 @@ namespace mln
/// Proxy manipulators.
/// \{
/// Return the site corresponding to this psite.
- const P& subj_();
+ const mln_site(G)& subj_();
/// \}
/// Face handle manipulators.
@@ -121,7 +120,7 @@ namespace mln
/// Update the site corresponding to this psite.
void update_();
// The site corresponding to this psite.
- P p_;
+ mln_site(G) p_;
/// \}
/* FIXME: Attributes pc_ and face_ share a common information: the
@@ -158,10 +157,10 @@ namespace mln
/// mln::p_complex.
/* FIXME: We probably want to relax this precondition: p_complex
equality is too strong; prefer complex equality. */
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator==(const complex_psite<D, P>& lhs,
- const complex_psite<D, P>& rhs);
+ operator==(const complex_psite<D, G>& lhs,
+ const complex_psite<D, G>& rhs);
/// \brief Is \a lhs not equal to \a rhs?
///
@@ -169,10 +168,10 @@ namespace mln
/// mln::p_complex.
/* FIXME: We probably want to relax this precondition: p_complex
equality is too strong; prefer complex equality. */
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator!=(const complex_psite<D, P>& lhs,
- const complex_psite<D, P>& rhs);
+ operator!=(const complex_psite<D, G>& lhs,
+ const complex_psite<D, G>& rhs);
/// \brief Is \a lhs ``less'' than \a rhs?
///
@@ -182,91 +181,102 @@ namespace mln
/// mln::p_complex.
/* FIXME: We probably want to relax this precondition: p_complex
equality is too strong; prefer complex equality. */
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator< (const complex_psite<D, P>& lhs,
- const complex_psite<D, P>& rhs);
+ operator< (const complex_psite<D, G>& lhs,
+ const complex_psite<D, G>& rhs);
/// \}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
std::ostream&
- operator<<(std::ostream& ostr, const complex_psite<D, P>& p);
+ operator<<(std::ostream& ostr, const complex_psite<D, G>& p);
# ifndef MLN_INCLUDE_ONLY
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- complex_psite<D, P>::complex_psite()
+ complex_psite<D, G>::complex_psite()
: pc_(0)
{
invalidate();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- complex_psite<D, P>::complex_psite(const p_complex<D, P>& pc,
+ complex_psite<D, G>::complex_psite(const p_complex<D, G>& pc,
const topo::face<D>& face)
: pc_(&pc),
face_(face)
{
// Check arguments consistency.
-// mln_precondition(pc.cplx() == face.cplx());
- update_();
+ // FIXME: Re-enable when the cyclic dependencies are fixed.
+#if 0
+ mln_precondition(pc.cplx() == face.cplx());
+#endif
+ if (is_valid())
+ update_();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- complex_psite<D, P>::complex_psite(const p_complex<D, P>& pc,
+ complex_psite<D, G>::complex_psite(const p_complex<D, G>& pc,
unsigned n, unsigned face_id)
: pc_(&pc),
face_(pc.cplx(), n, face_id)
{
- update_();
+ if (is_valid())
+ update_();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
bool
- complex_psite<D, P>::is_valid() const
+ complex_psite<D, G>::is_valid() const
{
-// mln_invariant(!pc_ || pc_.cplx() == face_.cplx());
+ // FIXME: Re-enable when the cyclic dependencies are fixed.
+#if 0
+ mln_invariant(!pc_ || pc_.cplx() == face_.cplx());
+#endif
return face_.is_valid();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
void
- complex_psite<D, P>::invalidate()
+ complex_psite<D, G>::invalidate()
{
return face_.invalidate();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- const p_complex<D, P>&
- complex_psite<D, P>::site_set() const
+ const p_complex<D, G>&
+ complex_psite<D, G>::site_set() const
{
mln_precondition(target_());
return *target_();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- const p_complex<D, P>*
- complex_psite<D, P>::target_() const
+ const p_complex<D, G>*
+ complex_psite<D, G>::target_() const
{
-// mln_invariant(!pc_ || pc_.cplx() == face_.cplx());
+ // FIXME: Re-enable when the cyclic dependencies are fixed.
+#if 0
+ mln_invariant(!pc_ || pc_.cplx() == face_.cplx());
+#endif
return pc_;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
void
- complex_psite<D, P>::change_target(const target& new_target)
+ complex_psite<D, G>::change_target(const target& new_target)
{
// Update both pc_ and face_.
pc_ = &new_target;
@@ -275,50 +285,52 @@ namespace mln
}
// FIXME: Write or extend a test to exercise this method (when the
- // handling of P is done, i.e., when update_ is complete).
- template <unsigned D, typename P>
+ // handling of G is done, i.e., when update_ is complete).
+ template <unsigned D, typename G>
inline
- const P&
- complex_psite<D, P>::subj_()
+ const mln_site(G)&
+ complex_psite<D, G>::subj_()
{
- // FIXME: Member p_ is not updated correctly yet; do not use this
- // method for now.
- abort();
return p_;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
const topo::face<D>&
- complex_psite<D, P>::face() const
+ complex_psite<D, G>::face() const
{
return face_;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
unsigned
- complex_psite<D, P>::n() const
+ complex_psite<D, G>::n() const
{
return face_.n();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
unsigned
- complex_psite<D, P>::face_id() const
+ complex_psite<D, G>::face_id() const
{
return face_.face_id();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
void
- complex_psite<D, P>::update_()
+ complex_psite<D, G>::update_()
{
mln_precondition(is_valid());
-// mln_invariant(!pc_ || pc_.cplx() == face_.cplx());
- // FIXME: Implement (update p_).
+ // FIXME: Re-enable when the cyclic dependencies are fixed.
+#if 0
+ mln_invariant(!pc_ || pc_.cplx() == face_.cplx());
+#endif
+ // FIXME: Simplify? (I.e., add accessors to shorten the following
+ // line?)
+ p_ = site_set().geom()(face_);
}
@@ -326,28 +338,28 @@ namespace mln
| Comparisons. |
`--------------*/
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator==(const complex_psite<D, P>& lhs,
- const complex_psite<D, P>& rhs)
+ operator==(const complex_psite<D, G>& lhs,
+ const complex_psite<D, G>& rhs)
{
mln_precondition(&lhs.site_set() == &rhs.site_set());
return lhs.face() == rhs.face();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator!=(const complex_psite<D, P>& lhs,
- const complex_psite<D, P>& rhs)
+ operator!=(const complex_psite<D, G>& lhs,
+ const complex_psite<D, G>& rhs)
{
mln_precondition(&lhs.site_set() == &rhs.site_set());
return lhs.face() != rhs.face();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator< (const complex_psite<D, P>& lhs,
- const complex_psite<D, P>& rhs)
+ operator< (const complex_psite<D, G>& lhs,
+ const complex_psite<D, G>& rhs)
{
mln_precondition(&lhs.site_set() == &rhs.site_set());
return lhs.face() < rhs.face();
@@ -358,10 +370,10 @@ namespace mln
| Pretty-printing. |
`------------------*/
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
std::ostream&
- operator<<(std::ostream& ostr, const complex_psite<D, P>& p)
+ operator<<(std::ostream& ostr, const complex_psite<D, G>& p)
{
return ostr << p.face();
}
diff --git a/milena/mln/core/site_set/p_complex.hh
b/milena/mln/core/site_set/p_complex.hh
index 9613bd6..8f79961 100644
--- a/milena/mln/core/site_set/p_complex.hh
+++ b/milena/mln/core/site_set/p_complex.hh
@@ -43,31 +43,36 @@
# include <mln/core/site_set/p_complex_faces_piter.hh>
# endif
+# include <mln/geom/complex_geometry.hh>
+
+// FIXME: Have G default to mln::geom::complex_geom<D, P>? But we
+// don't know P...
+
namespace mln
{
// Forward declarations.
- template <unsigned D, typename P> class p_complex;
+ template <unsigned D, typename G> class p_complex;
- template <unsigned D, typename P> class p_complex_fwd_piter_;
- template <unsigned D, typename P> class p_complex_bkd_piter_;
+ template <unsigned D, typename G> class p_complex_fwd_piter_;
+ template <unsigned D, typename G> class p_complex_bkd_piter_;
// FIXME: Disabled (moved to the attic).
# if 0
- template <unsigned N, unsigned D, typename P>
+ template <unsigned N, unsigned D, typename G>
class p_complex_faces_fwd_piter_;
- template <unsigned N, unsigned D, typename P>
+ template <unsigned N, unsigned D, typename G>
class p_complex_faces_bkd_piter_;
# endif
namespace trait
{
- template <unsigned D, typename P>
- struct site_set_< p_complex<D, P> >
+ template <unsigned D, typename G>
+ struct site_set_< p_complex<D, G> >
{
typedef trait::site_set::nsites::known nsites;
- // FIXME: Depends on P!
+ // FIXME: Depends on G!
typedef trait::site_set::bbox::unknown bbox;
typedef trait::site_set::contents::fixed contents;
typedef trait::site_set::arity::unique arity;
@@ -75,7 +80,7 @@ namespace mln
} // end of namespace mln::trait
- /* FIXME: We should decide was P represents:
+ /* FIXME: We should decide was G represents:
- a unique site type for all faces of all dimensions?
(Acceptable for a first implementation -- the one currently
@@ -98,20 +103,25 @@ namespace mln
/* FIXME: Aggregate site data (location). */
- /// A complex psite set based on a the N-faces of a complex of
- /// dimension \tparam D (a \p D-complex).
- template <unsigned D, typename P>
+ /** \brief A complex psite set based on a the \N-faces of a complex
+ of dimension \tparam D (a \p D-complex).
+
+ \arg \p D The dimension of the complex.
+ \arg \p G A function object type, associating localization
+ information (geometry) to each face of the complex.
+ \see mln::geom::complex_geometry. */
+ template <unsigned D, typename G>
class p_complex
- : public internal::site_set_base_< complex_psite<D, P>, p_complex<D,
P> >
+ : public internal::site_set_base_< complex_psite<D, G>, p_complex<D,
G> >
{
- typedef p_complex<D, P> self_;
- typedef internal::site_set_base_< complex_psite<D, P>, self_ > super_;
+ typedef p_complex<D, G> self_;
+ typedef internal::site_set_base_< complex_psite<D, G>, self_ > super_;
public:
/// \brief Construct a complex psite set from a complex.
///
/// \param cplx The complex upon which the complex psite set is built.
- p_complex (const topo::complex<D>& cplx);
+ p_complex(const topo::complex<D>& cplx, const G& geom);
/// Associated types.
/// \{
@@ -119,13 +129,13 @@ namespace mln
typedef mln_site(super_) element;
/// Point_Site associated type.
- typedef complex_psite<D, P> psite;
+ typedef complex_psite<D, G> psite;
/// Forward Site_Iterator associated type.
- typedef p_complex_fwd_piter_<D, P> fwd_piter;
+ typedef p_complex_fwd_piter_<D, G> fwd_piter;
/// Backward Site_Iterator associated type.
- typedef p_complex_bkd_piter_<D, P> bkd_piter;
+ typedef p_complex_bkd_piter_<D, G> bkd_piter;
/// Site_Iterator associated type.
typedef fwd_piter piter;
@@ -168,6 +178,9 @@ namespace mln
/// Return the complex associated to the p_complex domain (mutable
/// version).
topo::complex<D>& cplx();
+
+ /// Return the geometry of the complex.
+ const G& geom() const;
/// \}
private:
@@ -185,6 +198,8 @@ namespace mln
where vertex and edge handles (named `id's) are not tied to a
specific graph. */
mutable topo::complex<D> cplx_;
+ /// Geometry of the complex.
+ G geom_;
};
@@ -192,9 +207,9 @@ namespace mln
///
/// Two mln::p_complex's are considered equal if they share the
/// same complex.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator==(const p_complex<D, P>& lhs, const p_complex<D, P>&
rhs);
+ operator==(const p_complex<D, G>& lhs, const p_complex<D, G>&
rhs);
/// \brief Inclusion of a mln::p_complex in another one.
///
@@ -204,49 +219,49 @@ namespace mln
///
/// \todo Refine this later, when we are able to express subcomplex
/// relations.
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator<=(const p_complex<D, P>& lhs, const p_complex<D, P>&
rhs);
+ operator<=(const p_complex<D, G>& lhs, const p_complex<D, G>&
rhs);
# ifndef MLN_INCLUDE_ONLY
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- p_complex<D, P>::p_complex(const topo::complex<D>& cplx)
- : cplx_(cplx)
+ p_complex<D, G>::p_complex(const topo::complex<D>& cplx, const G&
geom)
+ : cplx_(cplx), geom_(geom)
{
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
unsigned
- p_complex<D, P>::nsites() const
+ p_complex<D, G>::nsites() const
{
return nfaces();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
std::size_t
- p_complex<D, P>::nfaces() const
+ p_complex<D, G>::nfaces() const
{
return cplx_.nfaces();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
bool
- p_complex<D, P>::is_valid() const
+ p_complex<D, G>::is_valid() const
{
return true;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
bool
- p_complex<D, P>::has(const psite& p) const
+ p_complex<D, G>::has(const psite& p) const
{
mln_precondition(is_valid());
return
@@ -256,49 +271,56 @@ namespace mln
(p.is_valid());
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
std::size_t
- p_complex<D, P>::memory_size() const
+ p_complex<D, G>::memory_size() const
{
// FIXME: Dummy; implement (see other site sets).
abort();
return 0;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
topo::complex<D>&
- p_complex<D, P>::cplx() const
+ p_complex<D, G>::cplx() const
{
mln_precondition(is_valid());
return cplx_;
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
topo::complex<D>&
- p_complex<D, P>::cplx()
+ p_complex<D, G>::cplx()
{
mln_precondition(is_valid());
return cplx_;
}
+ template <unsigned D, typename G>
+ const G&
+ p_complex<D, G>::geom() const
+ {
+ return geom_;
+ }
+
/*--------------.
| Comparisons. |
`--------------*/
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator==(const p_complex<D, P>& lhs, const p_complex<D, P>& rhs)
+ operator==(const p_complex<D, G>& lhs, const p_complex<D, G>& rhs)
{
/* FIXME: When actual location data is attached to a p_complex,
check also the equlity w.r.t. to these data. */
return lhs.cplx() == rhs.cplx();
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
bool
- operator<=(const p_complex<D, P>& lhs, const p_complex<D, P>&
rhs)
+ operator<=(const p_complex<D, G>& lhs, const p_complex<D, G>&
rhs)
{
/* FIXME: When actual location data is attached to a p_complex,
check also the equality w.r.t. to these data. */
diff --git a/milena/mln/core/site_set/p_complex_piter.hh
b/milena/mln/core/site_set/p_complex_piter.hh
index b9ec30e..f2304a2 100644
--- a/milena/mln/core/site_set/p_complex_piter.hh
+++ b/milena/mln/core/site_set/p_complex_piter.hh
@@ -42,62 +42,62 @@ namespace mln
{
// Forward declarations.
- template <unsigned D, typename P> class p_complex;
+ template <unsigned D, typename G> class p_complex;
template <unsigned D> class complex_fwd_iter_;
template <unsigned D> class complex_bkd_iter_;
/*-----------------------------.
- | p_complex_fwd_piter_<D, P>. |
+ | p_complex_fwd_piter_<D, G>. |
`-----------------------------*/
- /// \brief Forward iterator on (all) the faces of an mln::p_complex<D, P>.
- template <unsigned D, typename P>
+ /// \brief Forward iterator on (all) the faces of an mln::p_complex<D, G>.
+ template <unsigned D, typename G>
class p_complex_fwd_piter_
: public internal::p_complex_piter_base_< topo::face_fwd_iter<D>,
- p_complex<D, P>,
- P,
- p_complex_fwd_piter_<D, P> >
+ p_complex<D, G>,
+ mln_site(G),
+ p_complex_fwd_piter_<D, G> >
{
- typedef p_complex_fwd_piter_<D, P> self_;
+ typedef p_complex_fwd_piter_<D, G> self_;
typedef internal::p_complex_piter_base_< topo::face_fwd_iter<D>,
- p_complex<D, P>,
- P,
+ p_complex<D, G>,
+ mln_site(G),
self_ > super_;
public:
/// Construction and assignment.
/// \{
p_complex_fwd_piter_();
- p_complex_fwd_piter_(const p_complex<D, P>& pc);
+ p_complex_fwd_piter_(const p_complex<D, G>& pc);
/// \}
};
/*-----------------------------.
- | p_complex_bkd_piter_<D, P>. |
+ | p_complex_bkd_piter_<D, G>. |
`-----------------------------*/
- /// \brief Backward iterator on (all) the faces of an mln::p_complex<D, P>.
- template <unsigned D, typename P>
+ /// \brief Backward iterator on (all) the faces of an mln::p_complex<D, G>.
+ template <unsigned D, typename G>
class p_complex_bkd_piter_
: public internal::p_complex_piter_base_< topo::face_bkd_iter<D>,
- p_complex<D, P>,
- P,
- p_complex_bkd_piter_<D, P> >
+ p_complex<D, G>,
+ mln_site(G),
+ p_complex_bkd_piter_<D, G> >
{
- typedef p_complex_bkd_piter_<D, P> self_;
+ typedef p_complex_bkd_piter_<D, G> self_;
typedef internal::p_complex_piter_base_< topo::face_bkd_iter<D>,
- p_complex<D, P>,
- P,
+ p_complex<D, G>,
+ mln_site(G),
self_ > super_;
public:
/// Construction and assignment.
/// \{
p_complex_bkd_piter_();
- p_complex_bkd_piter_(const p_complex<D, P>& pc);
+ p_complex_bkd_piter_(const p_complex<D, G>& pc);
/// \}
};
@@ -106,36 +106,36 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
/*-----------------------------.
- | p_complex_fwd_piter_<D, P>. |
+ | p_complex_fwd_piter_<D, G>. |
`-----------------------------*/
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- p_complex_fwd_piter_<D, P>::p_complex_fwd_piter_()
+ p_complex_fwd_piter_<D, G>::p_complex_fwd_piter_()
{
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- p_complex_fwd_piter_<D, P>::p_complex_fwd_piter_(const p_complex<D, P>&
pc)
+ p_complex_fwd_piter_<D, G>::p_complex_fwd_piter_(const p_complex<D, G>&
pc)
: super_(pc)
{
}
/*-----------------------------.
- | p_complex_bkd_piter_<D, P>. |
+ | p_complex_bkd_piter_<D, G>. |
`-----------------------------*/
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- p_complex_bkd_piter_<D, P>::p_complex_bkd_piter_()
+ p_complex_bkd_piter_<D, G>::p_complex_bkd_piter_()
{
}
- template <unsigned D, typename P>
+ template <unsigned D, typename G>
inline
- p_complex_bkd_piter_<D, P>::p_complex_bkd_piter_(const p_complex<D, P>&
pc)
+ p_complex_bkd_piter_<D, G>::p_complex_bkd_piter_(const p_complex<D, G>&
pc)
: super_(pc)
{
}
--
1.6.0.1