27 #ifndef MLN_CORE_IMAGE_VERTEX_IMAGE_HH
28 # define MLN_CORE_IMAGE_VERTEX_IMAGE_HH
34 # include <mln/core/concept/graph.hh>
35 # include <mln/core/image/graph_elt_window.hh>
36 # include <mln/core/image/graph_elt_neighborhood.hh>
37 # include <mln/core/image/graph_elt_mixed_neighborhood.hh>
38 # include <mln/core/site_set/p_vertices.hh>
39 # include <mln/pw/internal/image_base.hh>
40 # include <mln/fun/i2v/array.hh>
42 # include <mln/util/internal/id2element.hh>
49 template <
typename P,
typename V,
typename G>
class vertex_image;
50 namespace util {
class graph; }
58 template <
typename P,
typename V,
typename G>
60 : pw_image_<fun::i2v::array<V>,
61 p_vertices<util::graph, fun::i2v::array<P> >,
77 template <
typename P,
typename V,
typename G>
80 typedef typename vertex_image<P,V,G>::site_function_t site_function_t;
83 data(
const fun::i2v::array<V>& vertex_values,
84 const p_vertices<G,F>& pv);
86 fun::i2v::array<V> f_;
87 p_vertices<G,site_function_t> domain_;
96 template <
typename V,
typename G,
typename P>
98 operator | (
const fun::i2v::array<V>& vertex_values,
99 const p_vertices<G,fun::i2v::array<P> >& pv);
107 template <
typename P,
typename G>
115 template <
typename G>
129 template <
typename P,
typename V,
typename G = util::graph>
132 p_vertices<G, typename internal::vfsite_selector<P,G>::site_function_t >,
133 vertex_image<P,V,G> >
178 const
Function_v2v< fun::i2v::array<V> >& vertex_values);
179 template <typename FV>
186 rvalue operator()(
unsigned v_id) const;
187 lvalue operator()(
unsigned v_id);
200 template <typename P, typename V, typename G, typename J>
205 # ifndef MLN_INCLUDE_ONLY
207 template <
typename P,
typename V,
typename G,
typename J>
219 template <
typename V,
typename G,
typename P>
236 template <
typename P,
typename V,
typename G>
237 template <
typename F>
240 const p_vertices<G,F>& ps)
252 template <
typename P,
typename V,
typename G>
254 vertex_image<P,V,G>::vertex_image()
258 template <
typename P,
typename V,
typename G>
260 vertex_image<P,V,G>::vertex_image(
const p_vertices<G,site_function_t>& pv)
261 : super_(fun::i2v::array<V>(pv.
nsites()), pv)
265 template <
typename P,
typename V,
typename G>
268 const Function_v2v< fun::i2v::array<V> >& vertex_values)
269 : super_(
exact(vertex_values), pv)
273 template <
typename P,
typename V,
typename G>
274 template <
typename FV>
277 const Function_v2v<FV>& vertex_values)
278 : super_(
convert::
to<fun::i2v::array<V> >(
exact(vertex_values)), pv)
280 mlc_equal(mln_result(FV),V)::check();
297 template <
typename P,
typename V,
typename G>
298 typename vertex_image<P,V,G>::rvalue
301 return this->data_->f_(v_id);
304 template <
typename P,
typename V,
typename G>
305 typename vertex_image<P,V,G>::lvalue
308 return this->data_->f_(v_id);
311 template <
typename P,
typename V,
typename G>
312 typename vertex_image<P,V,G>::rvalue
315 return this->super_::operator()(p);
318 template <
typename P,
typename V,
typename G>
319 typename vertex_image<P,V,G>::lvalue
322 return this->super_::operator()(p);
325 # endif // ! MLN_INCLUDE_ONLY
330 #endif // ! MLN_CORE_IMAGE_VERTEX_IMAGE_HH