URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-28 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update mesh_image.
* main_mesh_image.cc,
* mesh_image.hh,
* mesh_p.hh,
* mesh_psite.hh: Update.
---
main_mesh_image.cc | 7 ++-----
mesh_image.hh | 4 ++++
mesh_p.hh | 39 ++++++++++++++++++++++++++++++++++++++-
mesh_psite.hh | 11 ++++++-----
4 files changed, 50 insertions(+), 11 deletions(-)
Index: trunk/milena/sandbox/duhamel/main_mesh_image.cc
===================================================================
--- trunk/milena/sandbox/duhamel/main_mesh_image.cc (revision 1190)
+++ trunk/milena/sandbox/duhamel/main_mesh_image.cc (revision 1191)
@@ -45,8 +45,6 @@
mesh_p<point2d> m(g, v);
- draw::mesh (ima, m, 7, 1);
-
std::vector<int> val;
val.push_back (2);
@@ -56,9 +54,8 @@
val.push_back (6);
val.push_back (7);
- mesh_image<point2d, int> im (m, val);
-
- draw::mesh (ima, im);
+ mesh_image<point2d, int> m_ima (m, val);
+ draw::mesh (ima, m_ima);
debug::println (ima);
}
Index: trunk/milena/sandbox/duhamel/mesh_image.hh
===================================================================
--- trunk/milena/sandbox/duhamel/mesh_image.hh (revision 1190)
+++ trunk/milena/sandbox/duhamel/mesh_image.hh (revision 1191)
@@ -197,6 +197,10 @@
{
// FIXME
unsigned i = 0;
+// for (i = 0; i < this->data_->val_.size(); ++i)
+// if (this->data_->mesh_.loc_[i] == v)
+// break;
+// mln_invariant(i == this->data_->val_.size());
return this->data_->val_[i];
}
Index: trunk/milena/sandbox/duhamel/mesh_psite.hh
===================================================================
--- trunk/milena/sandbox/duhamel/mesh_psite.hh (revision 1190)
+++ trunk/milena/sandbox/duhamel/mesh_psite.hh (revision 1191)
@@ -10,15 +10,16 @@
{
public:
mesh_psite () {}
- mesh_psite (unsigned i, mesh_p<P>* m_ptr) :
- i_ (i),
- m_ptr_ (m_ptr)
+ mesh_psite (unsigned i// , mesh_p<P> * m_ptr
+ ) :
+ i_ (i)// ,
+// m_ptr_ (m_ptr)
{}
~mesh_psite() {}
- P to_point () {return m_ptr_->loc_[i_];}
+ // P to_point () {return m_ptr_->loc_[i_];}
private:
unsigned i_;
- mesh_p<P>* m_ptr_;
+ // mesh_p<P>* m_ptr_;
};
} // end of mln
#endif // MLN_MESH_PSITE_HH
Index: trunk/milena/sandbox/duhamel/mesh_p.hh
===================================================================
--- trunk/milena/sandbox/duhamel/mesh_p.hh (revision 1190)
+++ trunk/milena/sandbox/duhamel/mesh_p.hh (revision 1191)
@@ -1,13 +1,15 @@
#ifndef MLN_MESH_P_HH
# define MLN_MESH_P_HH
+# include <mln/core/concept/point.hh>
#include "graph.hh"
+# include "mesh_psite.hh"
namespace mln
{
template<typename P>
- class mesh_p
+ class mesh_p// : public Point_Set<mesh_p<P> >
{
public:
mesh_p () {}
@@ -21,6 +23,41 @@
~mesh_p () {}
+ /// Mesh associated type.
+ typedef mln_mesh(P) mesh;
+
+ /// Point_Site associated type.
+ typedef mesh_psite<P> psite;
+
+ /// Point associated type.
+ typedef P point;
+
+ /// Dpoint associated type.
+ typedef mln_dpoint(P) dpoint;
+
+ //FIXME
+ /// Forward Point_Iterator associated type.
+ typedef P fwd_piter;
+
+ /// Backward Point_Iterator associated type.
+ typedef P bkd_piter;
+ //END FIXME
+
+ std::size_t npoints() const
+ {
+ return this->gr_.nb_node_;
+ }
+
+// bool has(const P& p) const
+// {
+// typename std::vector<P>::const_iterator it = this->loc_.begin ();
+
+// for (; it != this->loc_.begin () ; ++it)
+// if (*it == p)
+// return true;
+// return false;
+// }
+
util::graph<void> gr_;
std::vector<P> loc_;
};