26 #ifndef MLN_CORE_IMAGE_VERTEX_IMAGE_HH
27 # define MLN_CORE_IMAGE_VERTEX_IMAGE_HH
33 # include <mln/core/concept/graph.hh>
34 # include <mln/core/image/graph_elt_window.hh>
35 # include <mln/core/image/graph_elt_neighborhood.hh>
36 # include <mln/core/image/graph_elt_mixed_neighborhood.hh>
37 # include <mln/core/site_set/p_vertices.hh>
38 # include <mln/pw/internal/image_base.hh>
39 # include <mln/fun/i2v/array.hh>
41 # include <mln/util/internal/id2element.hh>
48 template <
typename P,
typename V,
typename G>
class vertex_image;
49 namespace util {
class graph; }
57 template <
typename P,
typename V,
typename G>
59 : pw_image_<fun::i2v::array<V>,
60 p_vertices<util::graph, fun::i2v::array<P> >,
73 template <
typename P,
typename V,
typename G>
76 typedef typename vertex_image<P,V,G>::site_function_t site_function_t;
79 data(
const fun::i2v::array<V>& vertex_values,
80 const p_vertices<G,F>& pv);
82 fun::i2v::array<V> f_;
83 p_vertices<G,site_function_t> domain_;
92 template <
typename V,
typename G,
typename P>
94 operator | (
const fun::i2v::array<V>& vertex_values,
95 const p_vertices<G,fun::i2v::array<P> >& pv);
103 template <
typename P,
typename G>
104 struct vfsite_selector
106 typedef fun::i2v::array<P> site_function_t;
111 template <
typename G>
112 struct vfsite_selector<void,G>
114 typedef util::internal::id2element< G,util::vertex<G> > site_function_t;
125 template <
typename P,
typename V,
typename G = util::graph>
127 :
public pw::internal::image_base<fun::i2v::array<V>,
128 p_vertices<G, typename internal::vfsite_selector<P,G>::site_function_t >,
129 vertex_image<P,V,G> >
131 typedef pw::internal::image_base<fun::i2v::array<V>,
136 typedef typename super_::psite psite;
137 typedef typename super_::rvalue rvalue;
138 typedef typename super_::lvalue lvalue;
144 typedef typename internal::vfsite_selector<P,G>::site_function_t
174 const
Function_v2v< fun::i2v::array<V> >& vertex_values);
175 template <typename FV>
182 rvalue operator()(
unsigned v_id) const;
183 lvalue operator()(
unsigned v_id);
188 rvalue operator()(const psite& p) const;
189 lvalue operator()(const psite& p);
194 template <typename P, typename V, typename G, typename J>
198 # ifndef MLN_INCLUDE_ONLY
200 template <
typename P,
typename V,
typename G,
typename J>
203 fun::i2v::array<V> f;
204 init_(tag::function, f, exact(model));
206 init_(tag::domain, s, exact(model));
212 template <
typename V,
typename G,
typename P>
215 operator | (
const fun::i2v::array<V>& vertex_values,
229 template <
typename P,
typename V,
typename G>
230 template <
typename F>
233 const p_vertices<G,F>& ps)
245 template <
typename P,
typename V,
typename G>
251 template <
typename P,
typename V,
typename G>
254 : super_(fun::i2v::array<V>(pv.nsites()), pv)
258 template <
typename P,
typename V,
typename G>
261 const Function_v2v< fun::i2v::array<V> >& vertex_values)
262 : super_(exact(vertex_values), pv)
266 template <
typename P,
typename V,
typename G>
267 template <
typename FV>
270 const Function_v2v<FV>& vertex_values)
271 : super_(
convert::
to<fun::i2v::array<V> >(exact(vertex_values)), pv)
273 mlc_equal(mln_result(FV),V)::check();
290 template <
typename P,
typename V,
typename G>
291 typename vertex_image<P,V,G>::rvalue
294 return this->data_->f_(v_id);
297 template <
typename P,
typename V,
typename G>
298 typename vertex_image<P,V,G>::lvalue
301 return this->data_->f_(v_id);
304 template <
typename P,
typename V,
typename G>
305 typename vertex_image<P,V,G>::rvalue
308 return this->super_::operator()(p);
311 template <
typename P,
typename V,
typename G>
312 typename vertex_image<P,V,G>::lvalue
315 return this->super_::operator()(p);
318 # endif // ! MLN_INCLUDE_ONLY
323 #endif // ! MLN_CORE_IMAGE_VERTEX_IMAGE_HH