Skip to content

Commit e0be3e0

Browse files
committed
fix capture of IIFE
1 parent fbb32ef commit e0be3e0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/MeshField_Shape.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ namespace {
99
template <typename Array>
1010
KOKKOS_INLINE_FUNCTION bool
1111
sumsToOne(Array &xi, double tol = 10 * MeshField::MachinePrecision) {
12-
const bool sums_to_one = []() {
12+
// IIFE, capture by reference is preferred
13+
const bool sums_to_one = [&]() {
1314
auto sum = 0.0;
1415
for (size_t i = 0; i < xi.size(); i++) {
1516
sum += xi[i];
@@ -21,7 +22,6 @@ sumsToOne(Array &xi, double tol = 10 * MeshField::MachinePrecision) {
2122
printf("%e ", xi[i]);
2223
}
2324
printf("\n");
24-
printf("sum: %e tol: %e \n", std::fabs(sum - 1), tol);
2525
}
2626
return sums_to_one;
2727
}
@@ -31,7 +31,6 @@ KOKKOS_INLINE_FUNCTION bool greaterThanOrEqualZero(Array &xi,
3131
double tol = 1E-12) {
3232
for (size_t i = 0; i < xi.size(); i++) {
3333
if (xi[i] < -tol) {
34-
printf("failure %d, %e, %e\n", i, xi[i], tol);
3534
return false;
3635
}
3736
}

0 commit comments

Comments
 (0)