2 #include "catch2/catch_all.hpp"
7 TEST_CASE(
"re-group visibilities in order of processes") {
11 params.
u = Vector<t_real>::Random(N);
12 params.
v = Vector<t_real>::Random(N);
13 params.
w = Vector<t_real>::Random(N);
14 params.
vis = Vector<t_complex>::Random(N);
15 params.
weights = Vector<t_complex>::Random(N);
17 std::vector<t_int> order(N);
19 SECTION(
"Single item out of order") {
21 std::fill(order.begin() + 1, order.end(), 0);
25 CHECK(params.
u(0) == Approx(actual.u(N - 1)));
26 CHECK(params.
u(N - 1) == Approx(actual.u(0)));
27 CHECK(params.
u.segment(1, N - 2).isApprox(actual.u.segment(1, N - 2)));
30 SECTION(
"Two items out of order") {
34 std::fill(order.begin() + 3, order.end(), 0);
38 CHECK(params.
u(0) == Approx(actual.u(0)));
39 CHECK(params.
u(1) == Approx(actual.u(N - 2)));
40 CHECK(params.
u(2) == Approx(actual.u(N - 1)));
41 CHECK(params.
u(3) == Approx(actual.u(1)));
42 CHECK(params.
u(4) == Approx(actual.u(2)));
45 SECTION(
"Three procs") {
46 order = {1, 0, 2, 2, 0};
49 CHECK(actual.u(0) == Approx(params.
u(N - 1)));
50 CHECK(actual.u(1) == Approx(params.
u(1)));
51 CHECK(actual.u(2) == Approx(params.
u(0)));
52 CHECK(actual.u(3) == Approx(params.
u(3)));
53 CHECK(actual.u(4) == Approx(params.
u(2)));
#define CHECK(CONDITION, ERROR)
void regroup(vis_params &uv_params, std::vector< t_int > const &groups_, const t_int max_groups)
Vector< t_complex > weights
TEST_CASE("re-group visibilities in order of processes")