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
2581: Have complex-based site set use geometry functor for site location.
by Roland Levillain 16 Oct '08
by Roland Levillain 16 Oct '08
16 Oct '08
* 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
1
0
2580: Add a functor encoding the geometry of a complex using its 0-faces.
by Roland Levillain 16 Oct '08
by Roland Levillain 16 Oct '08
16 Oct '08
* mln/geom/complex_geometry.hh: New.
---
milena/ChangeLog | 6 +
milena/mln/geom/complex_geometry.hh | 217 +++++++++++++++++++++++++++++++++++
2 files changed, 223 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/geom/complex_geometry.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 36dd95d..afe3d11 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,11 @@
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.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Add a multiple-site type.
* mln/util/multi_site.hh: New.
diff --git a/milena/mln/geom/complex_geometry.hh b/milena/mln/geom/complex_geometry.hh
new file mode 100644
index 0000000..2e44ad4
--- /dev/null
+++ b/milena/mln/geom/complex_geometry.hh
@@ -0,0 +1,217 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_GEOM_COMPLEX_GEOMETRY_HH
+# define MLN_GEOM_COMPLEX_GEOMETRY_HH
+
+/// \file mln/geom/complex_geometry.hh
+/// \brief A functor associating geometry (location) data to the faces
+/// of a complex.
+///
+/// \see mln::topo::complex.
+
+# include <vector>
+# include <set>
+
+# include <mln/topo/face.hh>
+
+# include <mln/util/multi_site.hh>
+# include <mln/util/tracked_ptr.hh>
+
+
+/* FIXME: Also provide functors where the locations are computed using
+ a function (useful for a complex on a regular grid/support. */
+
+/* FIXME: This class could probably be turned into something more
+ generic, usable for other other purpose, e.g. attaching sites to
+ graphs. */
+
+/* FIXME: Also provide another geometry type where everything is
+ stored even for n-face with n > 0. */
+
+
+namespace mln
+{
+
+ namespace geom
+ {
+
+ // Forward declaration.
+ namespace internal
+ {
+ template <typename P> struct complex_geometry_data;
+ }
+
+
+ /** \brief A functor returning the sites of the faces of a complex
+ where the locations of each 0-face is stored. Faces of higher
+ dimensions are computed.
+
+ \arg \p D The dimension of the complex.
+ \arg \p P The type of the location of a 0-face.
+
+ Locations of 0-face are usually points (hence the \p P above),
+ but can possibly be any (default-constructible) values.
+
+ The functor returns a std::vector of locations: 0-faces are
+ singletons, 1-faces are (usually) pairs, faces of higher
+ dimensions are arrays of locations.
+
+ Note that for consistency reasons w.r.t. the return type of
+ operator(), returned sites are always <em>arrays</em> of
+ locations attached to 0-faces; hence the returned singletons
+ (of locations) for 0-faces. */
+ template <unsigned D, typename P>
+ class complex_geometry
+ {
+ public:
+ typedef P location;
+ typedef util::multi_site<P> site;
+
+ public:
+ /// \brief Build a complex geometry object.
+ complex_geometry();
+
+ public:
+ /// \brief Populate the set of locations.
+ ///
+ /// Append a new location \a p. Return the index of the newly
+ /// created location (which should semantically match the id of
+ /// the corresonding 0-face in the complex).
+ unsigned add_location(const P& p);
+
+ /// \brief Retrieve the site associated to \a f.
+ site operator()(const mln::topo::face<D>& f) const;
+
+ private:
+ mln::util::tracked_ptr< internal::complex_geometry_data<P> > data_;
+ };
+
+
+ namespace internal
+ {
+ /// \brief The data stored in a complex_geometry object.
+ ///
+ /// \arg \p P The type of the location of a 0-face.
+ template <typename P>
+ struct complex_geometry_data
+ {
+ util::multi_site<P> zero_faces;
+ };
+ }
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned D, typename P>
+ inline
+ complex_geometry<D, P>::complex_geometry()
+ : data_(new internal::complex_geometry_data<P>())
+ {
+ }
+
+ template <unsigned D, typename P>
+ inline
+ unsigned
+ complex_geometry<D, P>::add_location(const P& p)
+ {
+ mln_precondition(data_);
+ // FIXME: These two lines are not thread safe.
+ data_->zero_faces.push_back(p);
+ return data_->zero_faces.size();
+ }
+
+ template <unsigned D, typename P>
+ inline
+ util::multi_site<P>
+ complex_geometry<D, P>::operator()(const mln::topo::face<D>& f) const
+ {
+ mln_precondition(data_);
+ site s;
+ s.reserve(1);
+ if (f.n() == 0)
+ {
+ // F is a 0-face.
+ mln_assertion(f.face_id() < data_->zero_faces.size());
+ s.push_back(data_->zero_faces[f.face_id()]);
+ }
+ else
+ {
+ // F is an n-face, with n > 0.
+ typedef std::vector < topo::face<D> > faces_t;
+ typedef std::set < topo::face<D> > faces_set_t;
+
+ // The adjacent m-faces.
+ faces_t m_faces = f.lower_dim_adj_faces();
+ // The set of (m-1)-face being built.
+ /* FIXME: This pattern is recurring in Milena---using an
+ std::set (or any fast associative container) to improve
+ the lookup speed of an std::vector; we should create a
+ class for this, a bit like mln::util::set, but with a
+ garantee on the order of insertion. */
+ faces_t work_faces;
+ faces_set_t work_faces_set;
+
+ // Iteratively compute the set of locations.
+ for (unsigned m = f.n() - 1; m > 0; --m)
+ {
+ for (typename faces_t::const_iterator g = m_faces.begin();
+ g != m_faces.end(); ++g)
+ {
+ faces_t m_minus_one_faces = g->lower_dim_adj_faces();
+ // Don't insert a face twice.
+ for (typename faces_t::const_iterator h =
+ m_minus_one_faces.begin();
+ h != m_minus_one_faces.end(); ++h)
+ if (work_faces_set.find(*h) == work_faces_set.end())
+ {
+ work_faces.push_back(*h);
+ work_faces_set.insert(*h);
+ }
+ }
+ work_faces.swap(m_faces);
+ work_faces.clear();
+ work_faces_set.clear();
+ }
+ for (typename faces_t::const_iterator g = m_faces.begin();
+ g != m_faces.end(); ++g)
+ {
+ mln_assertion(g->face_id() < data_->zero_faces.size());
+ s.push_back(data_->zero_faces[g->face_id()]);
+ }
+ }
+ return s;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of mln::geom
+
+ } // end of mln
+
+#endif // MLN_GEOM_COMPLEX_GEOMETRY_HH
--
1.6.0.1
1
0
* mln/util/multi_site.hh: New.
---
milena/ChangeLog | 6 ++
milena/mln/util/multi_site.hh | 117 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/util/multi_site.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4cd9a13..36dd95d 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,11 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Add a multiple-site type.
+
+ * mln/util/multi_site.hh: New.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Add more services to mln::topo::n_faces_set.
* mln/topo/n_faces_set.hh
diff --git a/milena/mln/util/multi_site.hh b/milena/mln/util/multi_site.hh
new file mode 100644
index 0000000..b7bedae
--- /dev/null
+++ b/milena/mln/util/multi_site.hh
@@ -0,0 +1,117 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_UTIL_MULTI_SITE_HH
+# define MLN_UTIL_MULTI_SITE_HH
+
+/// \file mln/util/multi_site.hh
+/// \brief Definition of a multiple-site type.
+
+# include <cstddef>
+
+# include <vector>
+
+
+namespace mln
+{
+
+ namespace util
+ {
+
+ template <typename P>
+ struct multi_site : public mln::Object< multi_site<P> >
+ {
+ // The type of a single site, called a location.
+ typedef P location;
+ /* FIXME: We should not need to define this typedef
+ (see. mln::internal::image_base's site `coord' typedef). */
+ typedef mln_coord(P) coord;
+
+ typedef std::vector<P> container;
+ typedef typename container::size_type size_type;
+ typedef typename container::reference reference;
+ typedef typename container::const_reference const_reference;
+
+ /// Interface similar to std::vector.
+ /// \{
+ void push_back(const P& p);
+ void reserve(size_type n);
+ size_type size() const;
+ reference operator[](size_type n);
+ const_reference operator[](size_type n) const;
+ /// \}
+
+ container sites;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ void
+ multi_site<P>::push_back(const P& p)
+ {
+ sites.push_back(p);
+ }
+
+ template <typename P>
+ void
+ multi_site<P>::reserve(size_type n)
+ {
+ sites.reserve(n);
+ }
+
+ template <typename P>
+ typename multi_site<P>::size_type
+ multi_site<P>::size() const
+ {
+ return sites.size();
+ }
+
+ template <typename P>
+ typename multi_site<P>::reference
+ multi_site<P>::operator[](size_type n)
+ {
+ return sites[n];
+ }
+
+ template <typename P>
+ typename multi_site<P>::const_reference
+ multi_site<P>::operator[](size_type n) const
+ {
+ return sites[n];
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of mln::util
+
+} // end of mln
+
+
+#endif // ! MLN_UTIL_MULTI_SITE_HH
--
1.6.0.1
1
0
* mln/topo/n_faces_set.hh
(mln::topo::n_faces_set<N, D>::reserve)
(operator+=(n_faces_set<N, D>&, const n_face<N, D>&)):
New.
---
milena/ChangeLog | 9 +++++++++
milena/mln/topo/n_faces_set.hh | 28 ++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 83ba017..4cd9a13 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Add more services to mln::topo::n_faces_set.
+
+ * mln/topo/n_faces_set.hh
+ (mln::topo::n_faces_set<N, D>::reserve)
+ (operator+=(n_faces_set<N, D>&, const n_face<N, D>&)):
+ New.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Add more services to mln::topo::n_face.
* mln/topo/n_face.hh
diff --git a/milena/mln/topo/n_faces_set.hh b/milena/mln/topo/n_faces_set.hh
index 9b853ba..cf11eef 100644
--- a/milena/mln/topo/n_faces_set.hh
+++ b/milena/mln/topo/n_faces_set.hh
@@ -56,8 +56,16 @@ namespace mln
class n_faces_set
{
public:
+ /// \brief Append face \a f to the set.
void add(const n_face<N, D>& f);
+ /// \brief Reserve \a n cells in the set.
+ ///
+ /// This methods does not change the content of \a faces_; it
+ /// only pre-allocate memory. Method reserve is provided for
+ /// efficiency purpose, and its use is completely optional.
+ void reserve(size_t n);
+
/// \brief Accessors.
///
/// Return the set of handles.
@@ -82,6 +90,10 @@ namespace mln
template <unsigned N, unsigned D>
n_faces_set<N, D>
operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f);
+
+ template <unsigned N, unsigned D>
+ n_faces_set<N, D>&
+ operator+=(n_faces_set<N, D>& fs, const n_face<N, D>& f);
/// \}
@@ -101,6 +113,14 @@ namespace mln
template <unsigned N, unsigned D>
inline
+ void
+ n_faces_set<N, D>::reserve(size_t n)
+ {
+ faces_.reserve(n);
+ }
+
+ template <unsigned N, unsigned D>
+ inline
const std::vector< n_face<N, D> >&
n_faces_set<N, D>::faces() const
{
@@ -129,6 +149,14 @@ namespace mln
return fs2;
}
+ template <unsigned N, unsigned D>
+ n_faces_set<N, D>&
+ operator+=(n_faces_set<N, D>& fs, const n_face<N, D>& f)
+ {
+ fs.add(f);
+ return fs;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::topo
--
1.6.0.1
1
0
* mln/topo/n_face.hh
(mln::topo::n_face<N, D>::lower_dim_adj_faces)
(mln::topo::n_face<N, D>::higher_dim_adj_faces):
New methods.
(mln::topo::edge(const n_face<0, D>&, const n_face<0, D>&)):
New function.
* mln/topo/face_data.hh
(mln::topo::internal::lower_dim_faces_data_mixin): Make
mln::topo::n_face<N, D>::lower_dim_adj_faces a friend of this
class.
(mln::topo::internal::higher_dim_faces_data_mixin): Make
mln::topo::n_face<N, D>::higher_dim_adj_faces a friend of this
class.
---
milena/ChangeLog | 18 +++++++++
milena/mln/topo/face_data.hh | 10 ++++-
milena/mln/topo/n_face.hh | 79 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 105 insertions(+), 2 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7bda463..83ba017 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,23 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Add more services to mln::topo::n_face.
+
+ * mln/topo/n_face.hh
+ (mln::topo::n_face<N, D>::lower_dim_adj_faces)
+ (mln::topo::n_face<N, D>::higher_dim_adj_faces):
+ New methods.
+ (mln::topo::edge(const n_face<0, D>&, const n_face<0, D>&)):
+ New function.
+ * mln/topo/face_data.hh
+ (mln::topo::internal::lower_dim_faces_data_mixin): Make
+ mln::topo::n_face<N, D>::lower_dim_adj_faces a friend of this
+ class.
+ (mln::topo::internal::higher_dim_faces_data_mixin): Make
+ mln::topo::n_face<N, D>::higher_dim_adj_faces a friend of this
+ class.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Manipulate complexes as plain objects (instead of pointers) in
face handles.
diff --git a/milena/mln/topo/face_data.hh b/milena/mln/topo/face_data.hh
index 28d425e..27e78cd 100644
--- a/milena/mln/topo/face_data.hh
+++ b/milena/mln/topo/face_data.hh
@@ -115,7 +115,10 @@ namespace mln
private:
friend class mln::topo::internal::lower_dim_faces_set_mixin<N, D>;
friend class mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>;
- // FIXME: Rename as lower_dim_adj_faces_?
+ friend std::vector< n_face<N - 1, D> >
+ mln::topo::n_face<N, D>::lower_dim_adj_faces() const;
+
+ // FIXME: Rename as lower_dim_adj_faces_ (as well as related members).
std::vector< n_face<N - 1, D> > lower_dim_faces_;
};
@@ -127,7 +130,10 @@ namespace mln
private:
friend class mln::topo::internal::higher_dim_faces_set_mixin<N, D>;
friend class mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>;
- // FIXME: Rename as higher_dim_adj_faces_?
+ friend std::vector< n_face<N + 1, D> >
+ mln::topo::n_face<N, D>::higher_dim_adj_faces() const;
+
+ // FIXME: Rename as higher_dim_adj_faces_ (as well as related members).
std::vector< n_face<N + 1, D> > higher_dim_faces_;
};
/// \}
diff --git a/milena/mln/topo/n_face.hh b/milena/mln/topo/n_face.hh
index 534df69..68a9512 100644
--- a/milena/mln/topo/n_face.hh
+++ b/milena/mln/topo/n_face.hh
@@ -32,6 +32,7 @@
/// \brief n-face of a complex.
#include <limits>
+#include <vector>
#include <mln/core/contract.hh>
@@ -93,6 +94,13 @@ namespace mln
/// Return the mln::topo::face_data pointed by this handle.
face_data<N, D>& data() const;
+
+ /* FIXME: We should not provide lower_dim_adj_faces() when N ==
+ 0 nor higher_dim_adj_faces() when N == D. */
+ /// \Return an array of face handles pointing to adjacent (n-1)-faces.
+ std::vector< n_face<N - 1, D> > lower_dim_adj_faces() const;
+ /// Return an array of face handles pointing to adjacent (n+1)-faces.
+ std::vector< n_face<N + 1, D> > higher_dim_adj_faces() const;
/// \}
private:
@@ -147,6 +155,31 @@ namespace mln
operator<<(std::ostream& ostr, const n_face<N, D>& f);
+ /// \brief Helpers
+ /// \{
+
+ /** \brief Return the 1-face (edge) linking the 0-faces (vertices)
+ \a f1 and \a f2. If there is no 1-face between \a f1 and \a
+ f2, return an invalid 1-face.
+
+ \pre \a f1 and \a f2 must belong to the same complex.
+
+ Note: this routine assumes the complex is not degenerated, i.e,
+ \li it does not check that \a f1 and \a f2 are the only
+ 0-faces adjacent to an hypothetical 1-face; it just checks
+ that \a f1 and \a f2 <em>share</em> a common 1-face;
+
+ \li if there are several ajacent 1-faces shared by \a f1 and
+ \a f2 (if the complex is ill-formed), there is no
+ guarantee on the returned 1-face (the current
+ implementation return the first 1-face found, but client
+ code should not rely on this implementation-defined
+ behavior). */
+ template <unsigned D>
+ n_face<1, D> edge(const n_face<0, D>& f1, const n_face<0, D>& f2);
+ /// \}
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -250,6 +283,26 @@ namespace mln
return cplx_.template face_data_<N>(face_id_);
}
+ template <unsigned N, unsigned D>
+ inline
+ std::vector< n_face<N - 1, D> >
+ n_face<N, D>::lower_dim_adj_faces() const
+ {
+ mln_precondition(N > 0);
+ mln_precondition(is_valid());
+ return cplx_.template face_data_<N>(face_id_).lower_dim_faces_;
+ }
+
+ template <unsigned N, unsigned D>
+ inline
+ std::vector< n_face<N + 1, D> >
+ n_face<N, D>::higher_dim_adj_faces() const
+ {
+ mln_precondition(N <= D);
+ mln_precondition(is_valid());
+ return cplx_.template face_data_<N>(face_id_).higher_dim_faces_;
+ }
+
template <unsigned N, unsigned D>
inline
@@ -300,6 +353,32 @@ namespace mln
<< ", id = " << f.face_id() << ')';
}
+ /*----------.
+ | Helpers. |
+ `----------*/
+
+ template <unsigned D>
+ n_face<1, D> edge(const n_face<0, D>& f1, const n_face<0, D>& f2)
+ {
+ typedef std::vector< n_face<0, D> > n0_faces_t;
+ typedef std::vector< n_face<1, D> > n1_faces_t;
+
+ n1_faces_t f1_adj_edges = f1.higher_dim_adj_faces();
+ for (typename n1_faces_t::const_iterator e = f1_adj_edges.begin();
+ e != f1_adj_edges.end(); ++e)
+ {
+ n0_faces_t e_adj_vertices = e->lower_dim_adj_faces();
+ for (typename n0_faces_t::const_iterator w = e_adj_vertices.begin();
+ w != e_adj_vertices.end(); ++w)
+ if (*w == f2)
+ // E is the edge linking F1 and F2.
+ return *e;
+ }
+
+ // If no shared edge was found, retun an empty (invalid) 1-face.
+ return n_face<1, D>();
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::topo
--
1.6.0.1
1
0
2576: Manipulate complexes as plain objects (instead of pointers) in face handles.
by Roland Levillain 16 Oct '08
by Roland Levillain 16 Oct '08
16 Oct '08
* mln/topo/face.hh, mln/topo/n_face.hh
(mln::face<D>::cplx_, mln::n_face<N, D>::cplx_):
Change type from mutable complex<D>* to mutable complex<D>.
(mln::face<D>::face, mln::n_face<N, D>::n_face): Adjust ctors.
(mln::face<D>::is_valid, mln::face<D>::data)
(mln::n_face<N, D>::is_valid, mln::n_face<N, D>::data):
Adjust.
(mln::complex<D>::cplx, mln::complex<D>::set_cplx): Don't
manipulate complexes by pointers, use plain objects instead.
(operator<<(std::ostream&, const face<D>&)): Adjust.
* mln/topo/n_faces_set.hh
(mln::topo::n_faces_set<N, D>::add(const n_face<N, D>&)): Adjust.
---
milena/ChangeLog | 18 ++++++++++++++++++
milena/mln/topo/face.hh | 30 +++++++++++++++---------------
milena/mln/topo/n_face.hh | 26 +++++++++++++-------------
milena/mln/topo/n_faces_set.hh | 2 +-
4 files changed, 47 insertions(+), 29 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 43214ce..7bda463 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,23 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Manipulate complexes as plain objects (instead of pointers) in
+ face handles.
+
+ * mln/topo/face.hh, mln/topo/n_face.hh
+ (mln::face<D>::cplx_, mln::n_face<N, D>::cplx_):
+ Change type from mutable complex<D>* to mutable complex<D>.
+ (mln::face<D>::face, mln::n_face<N, D>::n_face): Adjust ctors.
+ (mln::face<D>::is_valid, mln::face<D>::data)
+ (mln::n_face<N, D>::is_valid, mln::n_face<N, D>::data):
+ Adjust.
+ (mln::complex<D>::cplx, mln::complex<D>::set_cplx): Don't
+ manipulate complexes by pointers, use plain objects instead.
+ (operator<<(std::ostream&, const face<D>&)): Adjust.
+ * mln/topo/n_faces_set.hh
+ (mln::topo::n_faces_set<N, D>::add(const n_face<N, D>&)): Adjust.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Fix a precondition in complex construction (add_face).
* mln/topo/complex.hh
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index bd2c3cd..371cf21 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -32,9 +32,11 @@
/// \brief Face of a complex.
#include <limits>
+#include <vector>
#include <mln/core/contract.hh>
+
namespace mln
{
@@ -78,7 +80,7 @@ namespace mln
/// Accessors.
/// \{
/// Return the complex the face belongs to.
- complex<D>& cplx() const;
+ complex<D> cplx() const;
/// Return the dimension of the face.
// FIXME: Rename as `dim'?
unsigned n() const;
@@ -87,7 +89,7 @@ namespace mln
unsigned face_id() const;
/// Set the complex the face belongs to.
- void set_cplx(complex<D>& cplx);
+ void set_cplx(const complex<D>& cplx);
/// Set the dimension of the face.
void set_n(unsigned n);
@@ -108,7 +110,6 @@ namespace mln
face_data<N, D>& data() const;
// FIXME: To be overhauled.
- // FIXME: Why no `const' here?
/// Return an array of face handles pointing to adjacent (n-1)-faces.
std::vector< face<D> > lower_dim_adj_faces() const;
/// Return an array of face handles pointing to adjacent (n+1)-faces.
@@ -119,7 +120,7 @@ namespace mln
/// \brief The complex the face belongs to.
///
/// A const face can be used to modify a complex.
- mutable complex<D>* cplx_;
+ mutable complex<D> cplx_;
/// The dimension of the face.
// FIXME: Rename as `dim_'?
unsigned n_;
@@ -171,7 +172,7 @@ namespace mln
template <unsigned D>
inline
face<D>::face()
- : cplx_(0),
+ : cplx_(),
n_(std::numeric_limits<unsigned>::max()),
face_id_(std::numeric_limits<unsigned>::max())
{
@@ -180,7 +181,7 @@ namespace mln
template <unsigned D>
inline
face<D>::face(complex<D>& c, unsigned n, unsigned face_id)
- : cplx_(&c), n_(n), face_id_(face_id)
+ : cplx_(c), n_(n), face_id_(face_id)
{
// Ensure N is compatible with D.
mln_precondition(n <= D);
@@ -190,7 +191,7 @@ namespace mln
template <unsigned N>
inline
face<D>::face(const n_face<N, D>& f)
- : cplx_(&f.cplx()), n_(N), face_id_(f.face_id())
+ : cplx_(f.cplx()), n_(N), face_id_(f.face_id())
{
// Ensure N is compatible with D.
metal::bool_< N <= D >::check();
@@ -202,7 +203,7 @@ namespace mln
bool
face<D>::is_valid() const
{
- return cplx_ != 0 && n_ <= D && face_id_ < cplx_->nfaces(n_);
+ return n_ <= D && face_id_ < cplx_.nfaces(n_);
}
template <unsigned D>
@@ -216,11 +217,10 @@ namespace mln
template <unsigned D>
inline
- complex<D>&
+ complex<D>
face<D>::cplx() const
{
- mln_precondition(cplx_);
- return *cplx_;
+ return cplx_;
}
template <unsigned D>
@@ -242,9 +242,9 @@ namespace mln
template <unsigned D>
inline
void
- face<D>::set_cplx(complex<D>& cplx)
+ face<D>::set_cplx(const complex<D>& cplx)
{
- cplx_ = &cplx;
+ cplx_ = cplx;
}
template <unsigned D>
@@ -303,7 +303,7 @@ namespace mln
{
mln_precondition(n_ == N);
mln_precondition(is_valid());
- return cplx_->template face_data_<N>(face_id_);
+ return cplx_.template face_data_<N>(face_id_);
}
@@ -461,7 +461,7 @@ namespace mln
std::ostream&
operator<<(std::ostream& ostr, const face<D>& f)
{
- return ostr << "(cplx = " << &f.cplx() << ", dim = " << f.n()
+ return ostr << "(cplx = " << f.cplx().addr() << ", dim = " << f.n()
<< ", id = " << f.face_id() << ')';
}
diff --git a/milena/mln/topo/n_face.hh b/milena/mln/topo/n_face.hh
index f0a7277..534df69 100644
--- a/milena/mln/topo/n_face.hh
+++ b/milena/mln/topo/n_face.hh
@@ -74,13 +74,13 @@ namespace mln
/// Accessors.
/// \{
/// Return the complex the face belongs to.
- complex<D>& cplx() const;
+ complex<D> cplx() const;
/// Return the id of the face.
// FIXME: Rename as `id'?
unsigned face_id() const;
/// Set the complex the face belongs to.
- void set_cplx(complex<D>& cplx);
+ void set_cplx(const complex<D>& cplx);
/// Return the dimension of the face.
// FIXME: Rename as `dim'?
unsigned n() const;
@@ -99,7 +99,7 @@ namespace mln
/// \brief The complex the face belongs to.
///
/// A const mln::topo::n_face can be used to modify a complex.
- mutable complex<D>* cplx_;
+ mutable complex<D> cplx_;
/// \brief The id of the face.
// FIXME: Rename as `id_'?
unsigned face_id_;
@@ -153,16 +153,17 @@ namespace mln
template <unsigned N, unsigned D>
inline
n_face<N, D>::n_face()
- : cplx_(0), face_id_(std::numeric_limits<unsigned>::max())
+ : cplx_(), face_id_(std::numeric_limits<unsigned>::max())
{
// Ensure N is compatible with D.
metal::bool_< N <= D >::check();
+ mln_postcondition(!is_valid());
}
template <unsigned N, unsigned D>
inline
n_face<N, D>::n_face(complex<D>& c, unsigned face_id)
- : cplx_(&c), face_id_(face_id)
+ : cplx_(c), face_id_(face_id)
{
// Ensure N is compatible with D.
metal::bool_< N <= D >::check();
@@ -173,7 +174,7 @@ namespace mln
bool
n_face<N, D>::is_valid() const
{
- return cplx_ != 0 && face_id_ < cplx_->template nfaces<N>();
+ return face_id_ < cplx_.template nfaces<N>();
}
template <unsigned N, unsigned D>
@@ -186,11 +187,10 @@ namespace mln
template <unsigned N, unsigned D>
inline
- complex<D>&
+ complex<D>
n_face<N, D>::cplx() const
{
- mln_precondition(cplx_);
- return *cplx_;
+ return cplx_;
}
template <unsigned N, unsigned D>
@@ -212,9 +212,9 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- n_face<N, D>::set_cplx(complex<D>& cplx)
+ n_face<N, D>::set_cplx(const complex<D>& cplx)
{
- cplx_ = &cplx;
+ cplx_ = cplx;
}
template <unsigned N, unsigned D>
@@ -247,7 +247,7 @@ namespace mln
n_face<N, D>::data() const
{
mln_precondition(is_valid());
- return cplx_->template face_data_<N>(face_id_);
+ return cplx_.template face_data_<N>(face_id_);
}
@@ -296,7 +296,7 @@ namespace mln
std::ostream&
operator<<(std::ostream& ostr, const n_face<N, D>& f)
{
- return ostr << "(cplx = " << &f.cplx() << ", dim = " << f.n()
+ return ostr << "(cplx = " << f.cplx().addr() << ", dim = " << f.n()
<< ", id = " << f.face_id() << ')';
}
diff --git a/milena/mln/topo/n_faces_set.hh b/milena/mln/topo/n_faces_set.hh
index f0b3615..9b853ba 100644
--- a/milena/mln/topo/n_faces_set.hh
+++ b/milena/mln/topo/n_faces_set.hh
@@ -95,7 +95,7 @@ namespace mln
{
// Check consistency.
if (!faces_.empty())
- mln_precondition(&faces_.front().cplx() == &f.cplx());
+ mln_precondition(faces_.front().cplx() == f.cplx());
faces_.push_back(f);
}
--
1.6.0.1
1
0
16 Oct '08
* mln/topo/complex.hh
(mln::complex<D>::add_face(const n_faces_set<N, D>&)):
Don't compare pointers-on-complex in precondition, compare the
complexes themselves.
Aesthetic changes.
---
milena/ChangeLog | 10 ++++++++++
milena/mln/topo/complex.hh | 8 +++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index f67a0d3..43214ce 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,15 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Fix a precondition in complex construction (add_face).
+
+ * mln/topo/complex.hh
+ (mln::complex<D>::add_face(const n_faces_set<N, D>&)):
+ Don't compare pointers-on-complex in precondition, compare the
+ complexes themselves.
+ Aesthetic changes.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
* mln/topo/complex.hh (mln::complex<D>::addr): New accessor.
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index f4e1499..e6330e2 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -211,8 +211,7 @@ namespace mln
///
/// \pre \p N must be lower or equal to \p D.
template <unsigned N>
- void connect_(const n_face<N, D>& f1,
- const n_face<N + 1, D>& f2);
+ void connect_(const n_face<N, D>& f1, const n_face<N + 1, D>& f2);
};
@@ -502,7 +501,7 @@ namespace mln
for (iter_t a = adjacent_faces.faces().begin();
a != adjacent_faces.faces().end(); ++a)
{
- mln_precondition(&a->cplx() == this);
+ mln_precondition(a->cplx() == *this);
mln_precondition(a->is_valid());
}
@@ -630,8 +629,7 @@ namespace mln
template <unsigned N>
inline
void
- complex<D>::connect_(const n_face<N, D>& f1,
- const n_face<N + 1, D>& f2)
+ complex<D>::connect_(const n_face<N, D>& f1, const n_face<N + 1, D>& f2)
{
// Ensure N is compatible with D.
metal::bool_< N <= D >::check();
--
1.6.0.1
1
0
16 Oct '08
---
milena/ChangeLog | 4 ++++
milena/mln/topo/complex.hh | 14 ++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 948ad38..f67a0d3 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ * mln/topo/complex.hh (mln::complex<D>::addr): New accessor.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Have mln::point be more generic.
* mln/core/point.hh: Fix a name in documentation.
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index f186f4f..f4e1499 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -153,6 +153,12 @@ namespace mln
void print_faces(std::ostream& ostr) const;
/// \}
+ /// \brief Get the address of the data of this complex.
+ ///
+ /// This address is a concise and useful information to print
+ /// and track the actual content of this complex.
+ const void* addr() const;
+
private:
/// The actual data of the complex.
util::tracked_ptr< internal::complex_data<D> > data_;
@@ -681,6 +687,14 @@ namespace mln
data_->internal::faces_set_mixin<N, D>::print(ostr);
}
+ template <unsigned D>
+ inline
+ const void*
+ complex<D>::addr() const
+ {
+ return data_.ptr_;
+ }
+
namespace internal
{
--
1.6.0.1
1
0
* mln/core/point.hh: Fix a name in documentation.
(mln::point::operator algebra::vec<G::dim, float>): Disable.
---
milena/ChangeLog | 7 +++++++
milena/mln/core/point.hh | 20 +++++++++++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 860f449..948ad38 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Have mln::point be more generic.
+
+ * mln/core/point.hh: Fix a name in documentation.
+ (mln::point::operator algebra::vec<G::dim, float>): Disable.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Add a floating-point 3-dimensional point type.
* mln/core/alias/point3df.hh: New.
diff --git a/milena/mln/core/point.hh b/milena/mln/core/point.hh
index 8497985..25b7bc9 100644
--- a/milena/mln/core/point.hh
+++ b/milena/mln/core/point.hh
@@ -30,7 +30,7 @@
/*! \file mln/core/point.hh
*
- * \brief Definition of the generic point class mln::point_.
+ * \brief Definition of the generic point class mln::point.
*/
# include <mln/core/def/coord.hh>
@@ -173,7 +173,18 @@ namespace mln
/// Hook to coordinates.
operator typename internal::point_to_<G, C>::metal_vec () const;
+ /* FIXME: Seems highly non-generic! Moreover, causes
+ overloading/duplicate errors with the previous operator when
+ C == float. Disable it for the moment.
+
+ This (non documented change, even in ChangeLog) change was
+ introduce by revision 1224, see
+ https://trac.lrde.org/olena/changeset/1224#file2
+ https://www.lrde.epita.fr/pipermail/olena-patches/2007-October/001592.html
+ */
+#if 0
operator algebra::vec<G::dim, float> () const;
+#endif
/// Explicit conversion towards mln::algebra::vec.
const algebra::vec<G::dim, C>& to_vec() const;
@@ -376,9 +387,11 @@ namespace mln
inline
point<G,C>::operator typename internal::point_to_<G, C>::metal_vec () const
{
- return coord_; // FIXME: Is-it OK?
+ return coord_; // FIXME: Is it OK?
}
-
+
+ // FIXME: See declaration of this member above.
+#if 0
template <typename G, typename C>
inline
point<G,C>::operator algebra::vec<G::dim, float> () const
@@ -388,6 +401,7 @@ namespace mln
tmp[i] = coord_[i];
return tmp;
}
+#endif
template <typename G, typename C>
inline
--
1.6.0.1
1
0
* mln/core/alias/point3df.hh: New.
---
milena/ChangeLog | 6 +
milena/mln/core/alias/point3df.hh | 215 +++++++++++++++++++++++++++++++++++++
2 files changed, 221 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/core/alias/point3df.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 3f4208e..860f449 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,11 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Add a floating-point 3-dimensional point type.
+
+ * mln/core/alias/point3df.hh: New.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Add a floating-point coordinate type.
* mln/core/def/coordf.hh: New.
diff --git a/milena/mln/core/alias/point3df.hh b/milena/mln/core/alias/point3df.hh
new file mode 100644
index 0000000..444db8e
--- /dev/null
+++ b/milena/mln/core/alias/point3df.hh
@@ -0,0 +1,215 @@
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// 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_CORE_ALIAS_POINT3DF_HH
+# define MLN_CORE_ALIAS_POINT3DF_HH
+
+/*! \file mln/core/alias/point3df.hh
+ *
+ * \brief Definition of the mln::point3df alias and of its construction
+ * routine.
+ */
+
+/* FIXME: Factor with mln/core/alias/point3d.hh (these two files are
+ almost identical). */
+
+# include <mln/core/point.hh>
+# include <mln/core/def/coordf.hh>
+// For site_const_impl and site_mutable_impl:
+# include <mln/core/concept/site_proxy.hh>
+# include <mln/core/internal/force_exact.hh>
+
+namespace mln
+{
+
+ /*! \brief Type alias for a point defined on the 3D square grid with
+ * floating-point coordinates.
+ */
+ typedef point<grid::cube, def::coordf> point3df;
+
+ namespace internal
+ {
+
+ // Specialization.
+
+ template <typename C, typename E>
+ struct subject_impl< const point<grid::cube, C>, E >
+ {
+ typedef C coordf;
+ enum { dim = 3 };
+
+ typedef const C& row_t;
+ const C& row() const;
+
+ typedef const C& col_t;
+ const C& col() const;
+
+ typedef const C& sli_t;
+ const C& sli() const;
+
+ const C& operator[](unsigned i) const;
+ const C& last_coord() const;
+ private:
+ const E& exact_() const;
+ };
+
+
+ // Specialization for point<M,C>.
+
+ template <typename C, typename E>
+ struct subject_impl< point<grid::cube, C>, E > :
+ subject_impl< const point<grid::cube, C>, E >
+ {
+ private:
+ typedef subject_impl< const point<grid::cube, C>, E > super_;
+ E& exact_();
+ public:
+
+ using super_::row;
+ C& row();
+
+ using super_::col;
+ C& col();
+
+ using super_::sli;
+ C& sli();
+
+ using super_::operator[];
+ C& operator[](unsigned i);
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // subject_impl
+
+ template <typename C, typename E>
+ inline
+ const C&
+ subject_impl< const point<grid::cube, C>, E >::row() const
+ {
+ return exact_().get_subject().row();
+ }
+
+ template <typename C, typename E>
+ inline
+ const C&
+ subject_impl< const point<grid::cube, C>, E >::col() const
+ {
+ return exact_().get_subject().col();
+ }
+
+ template <typename C, typename E>
+ inline
+ const C&
+ subject_impl< const point<grid::cube, C>, E >::sli() const
+ {
+ return exact_().get_subject().sli();
+ }
+
+ template <typename C, typename E>
+ inline
+ const C&
+ subject_impl< const point<grid::cube, C>, E >::operator[](unsigned i) const
+ {
+ mln_precondition(i < 3);
+ return exact_().get_subject()[i];
+ }
+
+ template <typename C, typename E>
+ inline
+ const C&
+ subject_impl< const point<grid::cube, C>, E >::last_coord() const
+ {
+ return this->col();
+ }
+
+ template <typename C, typename E>
+ inline
+ const E&
+ subject_impl< const point<grid::cube, C>, E >::exact_() const
+ {
+ return internal::force_exact<const E>(*this);
+ }
+
+ // subject_impl
+
+ template <typename C, typename E>
+ inline
+ C&
+ subject_impl< point<grid::cube, C>, E >::row()
+ {
+ return exact_().get_subject().row();
+ }
+
+ template <typename C, typename E>
+ inline
+ C&
+ subject_impl< point<grid::cube, C>, E >::col()
+ {
+ return exact_().get_subject().col();
+ }
+
+ template <typename C, typename E>
+ inline
+ C&
+ subject_impl< point<grid::cube, C>, E >::sli()
+ {
+ return exact_().get_subject().sli();
+ }
+
+ template <typename C, typename E>
+ inline
+ C&
+ subject_impl< point<grid::cube, C>, E >::operator[](unsigned i)
+ {
+ mln_precondition(i < 3);
+ return exact_().get_subject()[i];
+ }
+
+ template <typename C, typename E>
+ inline
+ E&
+ subject_impl< point<grid::cube, C>, E >::exact_()
+ {
+ return internal::force_exact<E>(*this);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+
+} // end of namespace mln
+
+// FIXME: File mln/core/alias/dpoint3df does not exist yet.
+# if 0
+# include <mln/core/alias/dpoint3df.hh>
+# endif
+
+#endif // ! MLN_CORE_ALIAS_POINT3DF_HH
--
1.6.0.1
1
0