27 #ifndef MLN_CORE_CONCEPT_GDPOINT_HH
28 # define MLN_CORE_CONCEPT_GDPOINT_HH
34 # include <mln/core/concept/object.hh>
35 # include <mln/core/grids.hh>
36 # include <mln/trait/all.hh>
37 # include <mln/value/scalar.hh>
38 # include <mln/debug/format.hh>
45 template <
typename E>
struct Gdpoint;
54 template <
typename L,
typename R >
55 struct set_binary_< op::
plus,
61 template <
typename L,
typename R >
62 struct set_binary_< op::
minus,
68 template <
typename D,
typename S >
69 struct set_binary_< op::
times,
100 template <
typename E>
119 template <
typename D>
121 operator<<(std::ostream& ostr, const Gdpoint<D>& dp);
124 template <
typename L,
typename R>
129 template <
typename L,
typename R>
133 template <
typename L,
typename R>
137 template <
typename D,
typename S>
146 template <
typename D>
151 # ifndef MLN_INCLUDE_ONLY
153 template <
typename E>
157 typedef mln_grid(E) grid;
158 typedef mln_vec(E) vec;
159 vec (E::*m)() const = & E::to_vec;
164 template <typename D>
166 std::ostream& operator<<(std::ostream& ostr, const
Gdpoint<D>& dp)
170 for (
unsigned i = 0; i < n; ++i)
176 template <
typename L,
typename R>
178 bool operator==(
const Gdpoint<L>& lhs,
const Gdpoint<R>&
rhs)
180 mlc_equal(mln_grid(L), mln_grid(R))::check();
181 return exact(lhs).to_vec() ==
exact(rhs).to_vec();
184 template <
typename L,
typename R>
187 operator+(
const Gdpoint<L>& lhs,
const Gdpoint<R>& rhs)
189 mlc_equal(mln_grid(L), mln_grid(R))::check();
190 L tmp =
exact(lhs).to_vec() +
exact(rhs).to_vec();
194 template <
typename L,
typename R>
197 operator-(
const Gdpoint<L>& lhs,
const Gdpoint<R>& rhs)
199 mlc_equal(mln_grid(L), mln_grid(R))::check();
200 L tmp =
exact(lhs).to_vec() -
exact(rhs).to_vec();
204 template <
typename D,
typename S>
206 operator*(
const Gdpoint<D>& lhs,
const value::Scalar<S>& rhs)
215 template <
typename D>
218 from_to_(
const Gdpoint<D>& dp_, mln_site(D)&
p)
221 const D& dp =
exact(dp_);
222 for (
unsigned i = 0; i < n; ++i)
226 # endif // ! MLN_INCLUDE_ONLY
231 #endif // ! MLN_CORE_CONCEPT_GDPOINT_HH