Skip to content

Commit 57925ec

Browse files
committed
[Clang-tidy] fix warning for Tscal used as loop counter
Replace for loop by a while loop.
1 parent f467444 commit 57925ec

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/tests/shammath/sphkernelsTests.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,25 @@ inline void validate_kernel_3d(
8282
// is df = f' ?
8383
Tscal L2_sum = 0;
8484
Tscal step = 0.01;
85-
for (Tscal x = 0; x < Ker::Rkern; x += step) {
85+
86+
// for (Tscal x = 0; x < Ker::Rkern; x += step) {
87+
// Tscal diff = Ker::df(x) - shammath::derivative_upwind<Tscal>(x, dx, [](Tscal x) {
88+
// return Ker::f(x);
89+
// });
90+
// diff *= gen_norm3d;
91+
// L2_sum += diff * diff * step;
92+
// }
93+
94+
Tscal x = 0;
95+
while (x < Ker::Rkern) {
8696
Tscal diff = Ker::df(x) - shammath::derivative_upwind<Tscal>(x, dx, [](Tscal x) {
8797
return Ker::f(x);
8898
});
8999
diff *= gen_norm3d;
90100
L2_sum += diff * diff * step;
101+
x += step;
91102
}
103+
92104
REQUIRE_FLOAT_EQUAL(L2_sum, 0, tol);
93105
}
94106

0 commit comments

Comments
 (0)