11 #include "quadrature.hpp"
24 template <
class... Tags>
25 KOKKOS_FUNCTION
double norm_inf(ddc::Coordinate<Tags...> coord)
28 ((result = Kokkos::max(result, Kokkos::fabs(coord.template get<Tags>()))), ...);
44 KOKKOS_INLINE_FUNCTION
double norm_inf(
double const coord)
53 template <
class ExecSpace,
class FuncType>
54 double norm_inf(ExecSpace exec_space, FuncType
function)
57 Kokkos::SpaceAccessibility<ExecSpace, typename FuncType::memory_space>::accessible);
58 using IdxRangeFunc =
typename FuncType::discrete_domain_type;
59 using IdxFunc =
typename IdxRangeFunc::discrete_element_type;
60 IdxRangeFunc idx_range = get_idx_range(
function);
61 return ddc::parallel_transform_reduce(
65 ddc::reducer::max<double>(),
71 template <
class ExecSpace,
class FuncType>
72 double error_norm_inf(ExecSpace exec_space, FuncType
function, FuncType exact_function)
75 Kokkos::SpaceAccessibility<ExecSpace, typename FuncType::memory_space>::accessible);
76 using IdxRangeFunc =
typename FuncType::discrete_domain_type;
77 using IdxFunc =
typename IdxRangeFunc::discrete_element_type;
78 IdxRangeFunc idx_range = get_idx_range(
function);
79 return ddc::parallel_transform_reduce(
83 ddc::reducer::max<double>(),
84 KOKKOS_LAMBDA(IdxFunc
const idx) {
97 template <
class ExecSpace,
class ElementType,
class IdxRange>
100 ConstField<ElementType, IdxRange, typename ExecSpace::memory_space>
function)
111 template <
class ExecSpace,
class ElementType,
class IdxRange,
class NDTag>
113 ExecSpace exec_space,
126 template <
class ExecSpace,
class ElementType,
class IdxRange>
128 ExecSpace exec_space,
129 ConstField<ElementType, IdxRange, typename ExecSpace::memory_space>
function,
130 ConstField<ElementType, IdxRange, typename ExecSpace::memory_space> exact_function)
142 template <
class ExecSpace,
class ElementType,
class IdxRange,
class NDTag>
144 ExecSpace exec_space,
166 template <
class IdxRangeQuad,
class ExecSpace>
168 ExecSpace exec_space,
170 DField<IdxRangeQuad, typename ExecSpace::memory_space>
function)
172 using IdxQuad =
typename IdxRangeQuad::discrete_element_type;
175 KOKKOS_LAMBDA(IdxQuad
const idx) {
return Kokkos::fabs(
function(idx)); });
186 template <
class IdxRangeQuad,
class ExecSpace>
188 ExecSpace exec_space,
190 DField<IdxRangeQuad, typename ExecSpace::memory_space>
function,
191 DField<IdxRangeQuad, typename ExecSpace::memory_space> exact_function)
193 using IdxQuad =
typename IdxRangeQuad::discrete_element_type;
196 KOKKOS_LAMBDA(IdxQuad
const idx) {
197 return Kokkos::fabs(
function(idx) - exact_function(idx));
216 template <
class IdxRangeQuad,
class ExecSpace>
218 ExecSpace exec_space,
220 DField<IdxRangeQuad, typename ExecSpace::memory_space>
function)
222 using IdxQuad =
typename IdxRangeQuad::discrete_element_type;
223 return std::sqrt(quadrature(
225 KOKKOS_LAMBDA(IdxQuad
const idx) {
return function(idx) *
function(idx); }));
236 template <
class IdxRangeQuad,
class ExecSpace>
238 ExecSpace exec_space,
240 DField<IdxRangeQuad, typename ExecSpace::memory_space>
function,
241 DField<IdxRangeQuad, typename ExecSpace::memory_space> exact_function)
243 using IdxQuad =
typename IdxRangeQuad::discrete_element_type;
244 return std::sqrt(quadrature(
246 KOKKOS_LAMBDA(IdxQuad
const idx) {
247 double err =
function(idx) - exact_function(idx);
A class providing an operator for integrating functions defined on a discrete index range.
Definition: quadrature.hpp:29
A class which holds multiple (scalar) fields in order to represent a vector field.
Definition: vector_field.hpp:64