4#include "ddc_aliases.hpp"
14 template <
class Eval1,
class Eval2>
28 template <
class IdxRange>
30 : eval_func1(ddc::select<typename Eval1::Dim>(idx_range))
31 , eval_func2(ddc::select<typename Eval2::Dim>(idx_range))
41 double operator()(
double const x,
double const y)
const noexcept
43 return eval_func1(x) * eval_func2(y);
51 template <
class Gr
id1,
class Gr
id2>
52 double operator()(ddc::Coordinate<Grid1, Grid2>
const x)
const noexcept
54 return eval_func1(ddc::get<Grid1>(x)) * eval_func2(ddc::get<Grid2>(x));
61 template <
class Gr
id1,
class Gr
id2>
62 void operator()(ddc::ChunkSpan<
double, ddc::DiscreteDomain<Grid1, Grid2>> chunk)
const
64 auto const& idx_range = chunk.idx_range();
66 ddc::for_each(idx_range, [=](ddc::DiscreteElement<Grid1, Grid2>
const i) {
67 chunk(i) = eval_func1(ddc::coordinate(ddc::select<Grid1>(i)))
68 * eval_func2(ddc::coordinate(ddc::select<Grid2>(i)));
80 double deriv(
double const x,
double const y,
int const derivative_x,
int const derivative_y)
83 return eval_func1.deriv(x, derivative_x) * eval_func2.deriv(y, derivative_y);
93 template <
class Gr
id1,
class Gr
id2>
95 ddc::Coordinate<Grid1, Grid2>
const x,
96 int const derivative_x,
97 int const derivative_y)
const noexcept
99 return eval_func1.deriv(ddc::get<Grid1>(x), derivative_x)
100 * eval_func2.deriv(ddc::get<Grid2>(x), derivative_y);
109 template <
class Gr
id1,
class Gr
id2>
111 ddc::ChunkSpan<
double, ddc::DiscreteDomain<Grid1, Grid2>> chunk,
112 int const derivative_x,
113 int const derivative_y)
const
115 auto const& idx_range = chunk.idx_range();
117 ddc::for_each(idx_range, [=](ddc::DiscreteElement<Grid1, Grid2>
const i) {
118 chunk(i) = eval_func1.deriv(ddc::coordinate(ddc::select<Grid1>(i)), derivative_x)
119 * eval_func2.deriv(ddc::coordinate(ddc::select<Grid2>(i)), derivative_y);
129 double max_norm(
int diff1 = 0,
int diff2 = 0)
const
131 return eval_func1.max_norm(diff1) * eval_func2.max_norm(diff2);
An analytical 2D evaluator combining 2 1D evaluators, to be used for exact comparisons in tests.
Definition evaluator_2d.hpp:16
double max_norm(int diff1=0, int diff2=0) const
The maximum norm of this equation.
Definition evaluator_2d.hpp:129
Evaluator(IdxRange idx_range)
A constructor taking the range over which the evaluator will be applied.
Definition evaluator_2d.hpp:29
double operator()(double const x, double const y) const noexcept
Evaluate the equation at (x,y)
Definition evaluator_2d.hpp:41
double operator()(ddc::Coordinate< Grid1, Grid2 > const x) const noexcept
Evaluate the equation at .
Definition evaluator_2d.hpp:52
void operator()(ddc::ChunkSpan< double, ddc::DiscreteDomain< Grid1, Grid2 > > chunk) const
Evaluate the equation at the positions on which chunk is defined.
Definition evaluator_2d.hpp:62
double deriv(ddc::Coordinate< Grid1, Grid2 > const x, int const derivative_x, int const derivative_y) const noexcept
Evaluate the derivative of the equation at .
Definition evaluator_2d.hpp:94
double deriv(double const x, double const y, int const derivative_x, int const derivative_y) const noexcept
Evaluate the derivative of the equation at (x,y)
Definition evaluator_2d.hpp:80
void deriv(ddc::ChunkSpan< double, ddc::DiscreteDomain< Grid1, Grid2 > > chunk, int const derivative_x, int const derivative_y) const
Evaluate the derivative of the equation at the positions on which chunk is defined.
Definition evaluator_2d.hpp:110
A wrapper around a 2D Evaluator that can be used in tests.
Definition evaluator_2d.hpp:10