@@ -60,7 +60,11 @@ TEST_P(test_restriction, test_bilinear_restriction)
6060 * These values are the eight fine nodes' value in the vicinity that are to be accumulated in the coarse node.
6161 *
6262 * We treat values in r as the x-axis. values in theta as the y-axis. Hence the vector 'adjacent' stores the values in the order:
63- * bottom_left, left, top_left, bottom, top, bottom_right, right, top_right.
63+ * bottom_left, left, top_left, bottom, top, bottom_right, right, top_right, i.e.
64+ * ^ --- 2 --- 4 --- 7
65+ * | --- 1 --- x --- 6
66+ * theta --- 0 --- 3 --- 5
67+ * | ------- r ------>
6468 */
6569
6670 for (int j = 0 ; j < cr_int + 1 ; j++) {
@@ -78,6 +82,7 @@ TEST_P(test_restriction, test_bilinear_restriction)
7882 }
7983
8084 int k = 0 ;
85+ // Store h_j,h_j-1 and k_i, k_i-1 for all adjacent nodes in the order as given above
8186 std::vector<std::tuple<double , double >> h_p (8 , {-1 , -1 }); // (h_p, h_{p-1}) relative grid sizes
8287 std::vector<std::tuple<double , double >> k_q (8 , {-1 , -1 }); // (k_q, k_{q-1})
8388 // z and y represent relative positions to the coarse node. e.g. if (z,y)=(-1,1) then we consider the fine node to the top-left
@@ -127,7 +132,7 @@ TEST_P(test_restriction, test_bilinear_restriction)
127132 }
128133 /* values given by the operator. We multiply this with the grid-function value of the corresponding adjacent node*/
129134
130- std::vector<double > vals {
135+ std::vector<double > coeffs_hk {
131136 std::get<1 >(h_p[0 ]) * std::get<1 >(k_q[0 ]) /
132137 ((std::get<0 >(h_p[0 ]) + std::get<1 >(h_p[0 ])) * (std::get<0 >(k_q[0 ]) + std::get<1 >(k_q[0 ]))),
133138 std::get<1 >(h_p[1 ]) / (std::get<0 >(h_p[1 ]) + std::get<1 >(h_p[1 ])),
@@ -143,7 +148,7 @@ TEST_P(test_restriction, test_bilinear_restriction)
143148
144149 double finval = u_test[(2 * j) * p_level.ntheta_int + (2 * i)];
145150 for (int z = 0 ; z < 8 ; z++) {
146- finval += vals [z] * adjacent[z]; // accumulate all values in the coarse node
151+ finval += coeffs_hk [z] * adjacent[z]; // accumulate all values in the coarse node
147152 }
148153 EXPECT_NEAR (finval, sol[j * ctheta_int + i], 1e-10 )
149154 << " The test fails at Index for (r,theta): (" + std::to_string (j) + " ," + std::to_string (i) + " )" ;
@@ -223,8 +228,8 @@ TEST_P(test_restriction, test_extrapolation_restriction)
223228 int ctheta_int = test_p.v_level [1 ]->ntheta_int ;
224229 int cr_int = test_p.v_level [1 ]->nr_int ;
225230
226- p_level.m = test_p.v_level [0 ]->nr * test_p.v_level [0 ]->ntheta ;
227- p_level.mc = test_p.v_level [1 ]->nr * test_p.v_level [1 ]->ntheta ;
231+ p_level.m = test_p.v_level [0 ]->nr * test_p.v_level [0 ]->ntheta ; // number of nodes on fine level
232+ p_level.mc = test_p.v_level [1 ]->nr * test_p.v_level [1 ]->ntheta ; // number of nodes on coarse level
228233
229234 std::vector<double > u_test (p_level.m );
230235 for (int z = 0 ; z < p_level.mc ; z++) {
@@ -270,7 +275,7 @@ TEST_P(test_restriction, test_extrapolation_restriction)
270275 for (int z = 0 ; z < 6 ; z++) {
271276 finval +=
272277 0.5 *
273- adjacent[z]; // accumulate the values. the vector "vals " reduces to 1/2 for every adjacent fine node
278+ adjacent[z]; // accumulate the values. the vector "coeffs_hk " reduces to 1/2 for every adjacent fine node
274279 }
275280
276281 EXPECT_NEAR (finval, sol[j * ctheta_int + i], 1e-12 )
0 commit comments