* mln/topo/face.hh (mln::topo::face<N, D>): Rename as...
(mln::topo::face_data<N, D>): ...this.
(mln::topo::internal::lower_dim_faces_mixin<N, D>)
(mln::topo::internal::higher_dim_faces_mixin<N, D>):
Rename as...
(mln::topo::internal::lower_dim_faces_data_mixin<N, D>)
(mln::topo::internal::higher_dim_faces_data_mixin<N, D>):
...these.
(mln::topo::face_handle<N, D>::to_face)
(mln::topo::any_face_handle<D>::to_face):
Rename accessors as...
(mln::topo::face_handle<N, D>::face_data)
(mln::topo::any_face_handle<D>::face_data):
...these.
Adjust.
* mln/topo/complex.hh: Adjust.
* tests/topo/complex.cc: Likewise.
---
milena/ChangeLog | 22 +++++++++++++
milena/mln/topo/complex.hh | 36 ++++++++++----------
milena/mln/topo/face.hh | 72 ++++++++++++++++++++++-------------------
milena/tests/topo/complex.cc | 4 +-
4 files changed, 81 insertions(+), 53 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index ce8c7c6..fb69e22 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,27 @@
2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+ Rename mln::topo::face as mln::topo::face_data.
+
+ * mln/topo/face.hh (mln::topo::face<N, D>): Rename as...
+ (mln::topo::face_data<N, D>): ...this.
+ (mln::topo::internal::lower_dim_faces_mixin<N, D>)
+ (mln::topo::internal::higher_dim_faces_mixin<N, D>):
+ Rename as...
+ (mln::topo::internal::lower_dim_faces_data_mixin<N, D>)
+ (mln::topo::internal::higher_dim_faces_data_mixin<N, D>):
+ ...these.
+ (mln::topo::face_handle<N, D>::to_face)
+ (mln::topo::any_face_handle<D>::to_face):
+ Rename accessors as...
+ (mln::topo::face_handle<N, D>::face_data)
+ (mln::topo::any_face_handle<D>::face_data):
+ ...these.
+ Adjust.
+ * mln/topo/complex.hh: Adjust.
+ * tests/topo/complex.cc: Likewise.
+
+2008-09-26 Roland Levillain <roland(a)lrde.epita.fr>
+
* tests/topo/complex.cc: Add more to-do and proto-documentation.
2008-09-26 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh
index ae69dee..52c43a9 100644
--- a/milena/mln/topo/complex.hh
+++ b/milena/mln/topo/complex.hh
@@ -156,10 +156,10 @@ namespace mln
template <unsigned D_> friend class any_face_handle;
template <unsigned N>
- face<N, D>& face_(unsigned face_id);
+ face_data<N, D>& face_data_(unsigned face_id);
template <unsigned N>
- const face<N, D>& face_(unsigned face_id) const;
+ const face_data<N, D>& face_data_(unsigned face_id) const;
/// \}
/// Functional meta-manipulators.
@@ -258,7 +258,7 @@ namespace mln
struct faces_set_mixin<D, D> : public faces_set_mixin<D - 1, D>,
public lower_dim_faces_set_mixin<D, D>
{
- std::vector< face<D, D> > faces_;
+ std::vector< face_data<D, D> > faces_;
/// Pretty-printing.
/// \{
@@ -287,7 +287,7 @@ namespace mln
public lower_dim_faces_set_mixin<N, D>,
public higher_dim_faces_set_mixin<N, D>
{
- std::vector< face<N, D> > faces_;
+ std::vector< face_data<N, D> > faces_;
/// Pretty-printing.
/// \{
@@ -316,7 +316,7 @@ namespace mln
template <unsigned D>
struct faces_set_mixin<0u, D> : public higher_dim_faces_set_mixin<0u,
D>
{
- std::vector< face<0u, D> > faces_;
+ std::vector< face_data<0u, D> > faces_;
/// Pretty-printing.
/// \{
@@ -343,7 +343,7 @@ namespace mln
template <>
struct faces_set_mixin<0u, 0u>
{
- std::vector< face<0u, 0u> > faces_;
+ std::vector< face_data<0u, 0u> > faces_;
/// Pretty-printing.
/// \{
@@ -378,13 +378,13 @@ namespace mln
template <unsigned N, unsigned D>
struct lower_dim_faces_set_mixin
{
- void print(std::ostream& ostr, const face<N, D>& f) const;
+ void print(std::ostream& ostr, const face_data<N, D>& f) const;
};
template <unsigned N, unsigned D>
struct higher_dim_faces_set_mixin
{
- void print(std::ostream& ostr, const face<N, D>& f) const;
+ void print(std::ostream& ostr, const face_data<N, D>& f) const;
};
/// \}
@@ -411,7 +411,7 @@ namespace mln
{
/* FIXME: This is not thread-proof (these two lines should
form an atomic section). */
- data_->internal::faces_set_mixin<0u, D>::faces_.push_back(face<0u,
D>());
+ data_->internal::faces_set_mixin<0u, D>::faces_.push_back(face_data<0u,
D>());
unsigned id = nfaces<0u>() - 1;
return face_handle<0u, D>(*this, id);
@@ -433,7 +433,7 @@ namespace mln
mln_precondition(a->is_valid());
}
- face<N + 1, D> f;
+ face_data<N + 1, D> f;
/* FIXME: This is not thread-proof (these two lines should
form an atomic section). */
data_->internal::faces_set_mixin<N + 1, D>::faces_.push_back(f);
@@ -534,16 +534,16 @@ namespace mln
template <unsigned D>
template <unsigned N>
- face<N, D>&
- complex<D>::face_(unsigned face_id)
+ face_data<N, D>&
+ complex<D>::face_data_(unsigned face_id)
{
return data_->internal::faces_set_mixin<N, D>::faces_[face_id];
}
template <unsigned D>
template <unsigned N>
- const face<N, D>&
- complex<D>::face_(unsigned face_id) const
+ const face_data<N, D>&
+ complex<D>::face_data_(unsigned face_id) const
{
return data_->internal::faces_set_mixin<N, D>::faces_[face_id];
}
@@ -557,8 +557,8 @@ namespace mln
// Ensure N is compatible with D.
metal::bool_< N <= D >::check();
- f1.to_face().connect_higher_dim_face(f2);
- f2.to_face().connect_lower_dim_face(f1);
+ f1.face_data().connect_higher_dim_face(f2);
+ f2.face_data().connect_lower_dim_face(f1);
}
@@ -701,7 +701,7 @@ namespace mln
template <unsigned N, unsigned D>
void
lower_dim_faces_set_mixin<N, D>::print(std::ostream& ostr,
- const face<N, D>& f) const
+ const face_data<N, D>& f) const
{
for (typename std::vector< face_handle<N - 1, D> >::const_iterator l =
f.lower_dim_faces_.begin(); l != f.lower_dim_faces_.end(); ++l)
@@ -711,7 +711,7 @@ namespace mln
template <unsigned N, unsigned D>
void
higher_dim_faces_set_mixin<N, D>::print(std::ostream& ostr,
- const face<N, D>& f) const
+ const face_data<N, D>& f) const
{
for (typename std::vector< face_handle<N + 1, D> >::const_iterator h =
f.higher_dim_faces_.begin(); h != f.higher_dim_faces_.end(); ++h)
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 11f22b2..689f7e6 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -47,6 +47,10 @@
Anyway, whatever the decision, splitting `face', `face_handle' and
`any_face_handle' seems to be sound.
+ `face_data' is somehow an implementation detail: it should be
+ hidden, either by moving it to mln/topo/complex.cc or into its own
+ file in mln/topo/internal.
+
(And what about `faces_set'? Should we move it to its own file as
well?) */
@@ -68,42 +72,42 @@ namespace mln
template <unsigned N, unsigned D> class face_handle;
namespace internal
{
- template <unsigned N, unsigned D> class lower_dim_faces_mixin;
- template <unsigned N, unsigned D> class higher_dim_faces_mixin;
+ template <unsigned N, unsigned D> class lower_dim_faces_data_mixin;
+ template <unsigned N, unsigned D> class higher_dim_faces_data_mixin;
}
- /*-------.
- | Face. |
- `-------*/
+ /*------------.
+ | Face data. |
+ `------------*/
- /// \p N-face of a \p D-complex.
- template <unsigned N, unsigned D> class face;
+ /// Data (adjacent faces) associated to a \p N-face of a \p D-complex.
+ template <unsigned N, unsigned D> class face_data;
// Specialization for the faces of highest dimension (\p D).
template <unsigned D>
- class face<D, D> : public internal::lower_dim_faces_mixin<D, D>
+ class face_data<D, D> : public internal::lower_dim_faces_data_mixin<D,
D>
{
};
// Specialization for the faces of intermediate dimension (greater
// than 0, lower than \p D).
template <unsigned N, unsigned D>
- class face : public internal::lower_dim_faces_mixin<N, D>,
- public internal::higher_dim_faces_mixin<N, D>
+ class face_data : public internal::lower_dim_faces_data_mixin<N, D>,
+ public internal::higher_dim_faces_data_mixin<N, D>
{
};
// Specialization for the faces of lowest dimension (0).
template <unsigned D>
- class face<0u, D> : public internal::higher_dim_faces_mixin<0u, D>
+ class face_data<0u, D> : public internal::higher_dim_faces_data_mixin<0u,
D>
{
};
// Specialization for the case of a 0-complex.
template <>
- class face<0u, 0u>
+ class face_data<0u, 0u>
{
};
@@ -114,7 +118,7 @@ namespace mln
/// Factored implementation of faces.
/// \{
template <unsigned N, unsigned D>
- class lower_dim_faces_mixin
+ class lower_dim_faces_data_mixin
{
public:
void connect_lower_dim_face (const face_handle<N - 1, D>& f);
@@ -124,7 +128,7 @@ namespace mln
};
template <unsigned N, unsigned D>
- class higher_dim_faces_mixin
+ class higher_dim_faces_data_mixin
{
public:
void connect_higher_dim_face(const face_handle<N + 1, D>& f);
@@ -181,8 +185,8 @@ namespace mln
/// Set the id of the face.
void set_face_id(unsigned face_id);
- /// Return the mln::face pointed by this handle.
- face<N, D>& to_face() const;
+ /// Return the mln::topo::face_data pointed by this handle.
+ face_data<N, D>& face_data() const;
/// \}
private:
@@ -202,12 +206,12 @@ namespace mln
make_face_handle(const complex<D>& c, unsigned face_id);
- /// Comparison of two instances of mln::face_handle.
+ /// Comparison of two instances of mln::topo::face_handle.
/// \{
/// \brief Is \a lhs equal to \a rhs?
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
template <unsigned N, unsigned D>
bool
operator==(const face_handle<N, D>& lhs, const face_handle<N, D>&
rhs);
@@ -217,7 +221,7 @@ namespace mln
/// This comparison is required by algorithms sorting face handles.
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
template <unsigned N, unsigned D>
bool
operator< (const face_handle<N, D>& lhs, const face_handle<N,
D>& rhs);
@@ -250,7 +254,7 @@ namespace mln
};
- /// Construction helpers for mln::faces_set.
+ /// Construction helpers for mln::topo::faces_set.
/// \{
template <unsigned N, unsigned D>
faces_set<N, D>
@@ -311,9 +315,9 @@ namespace mln
/// Set the id of the face.
void set_face_id(unsigned face_id);
- /// Return the mln::face pointed by this handle.
+ /// Return the mln::topo::face_data pointed by this handle.
template <unsigned N>
- face<N, D>& to_face() const;
+ face_data<N, D>& face_data() const;
/// \}
private:
@@ -330,12 +334,12 @@ namespace mln
};
- /// Comparison of two instances of mln::any_face_handle.
+ /// Comparison of two instances of mln::topo::any_face_handle.
/// \{
/// \brief Is \a lhs equal to \a rhs?
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
template <unsigned D>
bool
operator==(const any_face_handle<D>& lhs, const
any_face_handle<D>& rhs);
@@ -345,7 +349,7 @@ namespace mln
/// This comparison is required by algorithms sorting face handles.
///
/// \pre Arguments \a lhs and \a rhs must belong to the same
- /// mln::complex.
+ /// mln::topo::complex.
/// \pre Arguments \a lhs and \a rhs must have the same dimension.
template <unsigned D>
bool
@@ -365,7 +369,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- lower_dim_faces_mixin<N, D>::connect_lower_dim_face(const face_handle<N -
1, D>& f)
+ lower_dim_faces_data_mixin<N, D>::connect_lower_dim_face(const
face_handle<N - 1, D>& f)
{
lower_dim_faces_.push_back(f);
}
@@ -373,7 +377,7 @@ namespace mln
template <unsigned N, unsigned D>
inline
void
- higher_dim_faces_mixin<N, D>::connect_higher_dim_face(const face_handle<N
+ 1, D>& f)
+ higher_dim_faces_data_mixin<N, D>::connect_higher_dim_face(const
face_handle<N + 1, D>& f)
{
higher_dim_faces_.push_back(f);
}
@@ -484,11 +488,11 @@ namespace mln
template <unsigned N, unsigned D>
inline
- face<N, D>&
- face_handle<N, D>::to_face() const
+ face_data<N, D>&
+ face_handle<N, D>::face_data() const
{
mln_precondition(is_valid());
- return cplx_->template face_<N>(face_id_);
+ return cplx_->template face_data_<N>(face_id_);
}
@@ -500,6 +504,7 @@ namespace mln
return face_handle<N, D>(&c, face_id);
}
+
template <unsigned N, unsigned D>
inline
bool
@@ -691,12 +696,12 @@ namespace mln
template <unsigned D>
template <unsigned N>
inline
- face<N, D>&
- any_face_handle<D>::to_face() const
+ face_data<N, D>&
+ any_face_handle<D>::face_data() const
{
mln_precondition(n_ == N);
mln_precondition(is_valid());
- return cplx_->template face_<N>(face_id_);
+ return cplx_->template face_data_<N>(face_id_);
}
@@ -712,6 +717,7 @@ namespace mln
lhs.face().id() == rhs.face().id();
}
+
template <unsigned D>
inline
bool
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index b9051dc..43143c5 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -107,12 +107,12 @@ int main()
`-------------------*/
// Get the face data from (``static'') face handle E0.
- const topo::face<1, D>& face1 = e0.to_face();
+ const topo::face_data<1, D>& face1 = e0.face_data();
// Any-face handle.
topo::any_face_handle<D> af(e0);
// Get the face data from (``dynamic'') face handle AF.
- const topo::face<1, D>& face2 = af.to_face<1>();
+ const topo::face_data<1, D>& face2 = af.face_data<1>();
mln_assertion(&face1 == &face2);
--
1.6.0.1