5#ifndef OPENFPM_PDATA_TESTHELPERS_HPP
6#define OPENFPM_PDATA_TESTHELPERS_HPP
10bool AlmostEqualRelativeAndAbs(T A, T B,
11 T maxDiff, T maxRelDiff = std::numeric_limits<T>::epsilon())
21 T largest = (B > A) ? B : A;
23 if (diff <= largest * maxRelDiff)
29template <
size_t Field,
typename gr
id_type_1,
typename gr
id_type_2, std::
string Field_type>
30bool are_equal_grid(grid_type_1 & grid_1, grid_type_2 & grid_2)
33 assert(grid_type_1::dims == grid_type_2::dims);
34 assert(grid_1.size() == grid_2.size());
36 for (
int d = 0; d < grid_dest_type::dims; ++d)
38 auto dom_1 = grid_1.getDomainIterator();
39 auto dom_2 = grid_2.getDomainIterator();
40 while (dom_sc.isNext())
42 auto key_1 = dom_1.get();
43 auto key_2 = dom_2.get();
45 auto v1 = grid_1.template get<attr_ds>(key_1)[d];
46 auto v2 = grid_2.template get<attr_sc>(key_2)[d];
48 if (!AlmostEqualRelativeAndAbs(v1, v2, std::numeric_limits<Field_type>::epsilon()))