Skip to content

Commit 0c733e4

Browse files
authored
Merge pull request #3063 from boutproject/next-use-isfinite
Use isfinite, fix pvode linking
2 parents 8959dce + 5a2e624 commit 0c733e4

8 files changed

Lines changed: 32 additions & 32 deletions

File tree

externalpackages/PVODE/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ target_include_directories(pvpre PUBLIC
5858
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
5959
$<INSTALL_INTERFACE:include>
6060
)
61-
target_link_libraries(pvpre PUBLIC MPI::MPI_CXX)
61+
target_link_libraries(pvpre PUBLIC pvode MPI::MPI_CXX)
6262

6363

6464
set_target_properties(pvpre PROPERTIES

src/field/field2d.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Class for 2D X-Y profiles
55
*
66
**************************************************************************
7-
* Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
7+
* Copyright 2010 - 2025 BOUT++ developers
88
*
9-
* Contact: Ben Dudson, bd512@york.ac.uk
9+
* Contact: Ben Dudson, dudson2@llnl.gov
1010
*
1111
* This file is part of BOUT++.
1212
*
@@ -355,7 +355,7 @@ namespace {
355355
void checkDataIsFiniteOnRegion(const Field2D& f, const std::string& region) {
356356
// Do full checks
357357
BOUT_FOR_SERIAL(i, f.getRegion(region)) {
358-
if (!::finite(f[i])) {
358+
if (!std::isfinite(f[i])) {
359359
throw BoutException("Field2D: Operation on non-finite data at [{:d}][{:d}]\n",
360360
i.x(), i.y());
361361
}

src/field/field3d.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Class for 3D X-Y-Z scalar fields
55
*
66
**************************************************************************
7-
* Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
7+
* Copyright 2010 - 2025 BOUT++ developers
88
*
9-
* Contact: Ben Dudson, bd512@york.ac.uk
9+
* Contact: Ben Dudson, dudson2@llnl.gov
1010
*
1111
* This file is part of BOUT++.
1212
*
@@ -751,7 +751,7 @@ namespace {
751751
void checkDataIsFiniteOnRegion(const Field3D& f, const std::string& region) {
752752
// Do full checks
753753
BOUT_FOR_SERIAL(i, f.getValidRegionWithDefault(region)) {
754-
if (!finite(f[i])) {
754+
if (!std::isfinite(f[i])) {
755755
throw BoutException("Field3D: Operation on non-finite data at [{:d}][{:d}][{:d}]\n",
756756
i.x(), i.y(), i.z());
757757
}

src/field/fieldperp.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* Class for 2D X-Z slices
33
*
44
**************************************************************************
5-
* Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
5+
* Copyright 2010 - 2025 BOUT++ developers
66
*
7-
* Contact: Ben Dudson, bd512@york.ac.uk
7+
* Contact: Ben Dudson, dudson2@llnl.gov
88
*
99
* This file is part of BOUT++.
1010
*
@@ -175,7 +175,7 @@ const FieldPerp sliceXZ(const Field3D& f, int y) {
175175
void checkDataIsFiniteOnRegion(const FieldPerp& f, const std::string& region) {
176176
// Do full checks
177177
BOUT_FOR_SERIAL(i, f.getRegion(region)) {
178-
if (!::finite(f[i])) {
178+
if (!std::isfinite(f[i])) {
179179
throw BoutException("FieldPerp: Operation on non-finite data at [{:d}][{:d}]\n",
180180
i.x(), i.z());
181181
}

src/invert/laplace/impls/iterative_parallel_tri/iterative_parallel_tri.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**************************************************************************
66
* Copyright 2020 Joseph Parker
77
*
8-
* Contact: Ben Dudson, bd512@york.ac.uk
8+
* Contact: Ben Dudson, dudson2@llnl.gov
99
*
1010
* This file is part of BOUT++.
1111
*
@@ -575,8 +575,8 @@ FieldPerp LaplaceIPT::solve(const FieldPerp& b, const FieldPerp& x0) {
575575
#if CHECK > 2
576576
for (int ix = 0; ix < 4; ix++) {
577577
for (int kz = 0; kz < nmode; kz++) {
578-
if (!finite(levels[0].xloc(ix, kz).real())
579-
or !finite(levels[0].xloc(ix, kz).imag())) {
578+
if (!std::isfinite(levels[0].xloc(ix, kz).real())
579+
or !std::isfinite(levels[0].xloc(ix, kz).imag())) {
580580
throw BoutException("Non-finite xloc at {:d}, {:d}, {:d}", ix, jy, kz);
581581
}
582582
}
@@ -595,7 +595,7 @@ FieldPerp LaplaceIPT::solve(const FieldPerp& b, const FieldPerp& x0) {
595595
#if CHECK > 2
596596
for (int ix = 0; ix < ncx; ix++) {
597597
for (int kz = 0; kz < nmode; kz++) {
598-
if (!finite(xk1d(kz, ix).real()) or !finite(xk1d(kz, ix).imag())) {
598+
if (!std::isfinite(xk1d(kz, ix).real()) or !std::isfinite(xk1d(kz, ix).imag())) {
599599
throw BoutException("Non-finite xloc at {:d}, {:d}, {:d}", ix, jy, kz);
600600
}
601601
}
@@ -636,7 +636,7 @@ FieldPerp LaplaceIPT::solve(const FieldPerp& b, const FieldPerp& x0) {
636636

637637
#if CHECK > 2
638638
for (int kz = 0; kz < ncz; kz++) {
639-
if (!finite(x(ix, kz))) {
639+
if (!std::isfinite(x(ix, kz))) {
640640
throw BoutException("Non-finite at {:d}, {:d}, {:d}", ix, jy, kz);
641641
}
642642
}

src/invert/laplace/impls/petsc/petsc_laplace.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Using PETSc Solvers
44
*
55
**************************************************************************
6-
* Copyright 2013 J. Buchanan, J.Omotani
6+
* Copyright 2013 - 2025 BOUT++ developers
77
*
8-
* Contact: Ben Dudson, bd512@york.ac.uk
8+
* Contact: Ben Dudson, dudson2@llnl.gov
99
*
1010
* This file is part of BOUT++.
1111
*
@@ -466,7 +466,7 @@ FieldPerp LaplacePetsc::solve(const FieldPerp& b, const FieldPerp& x0) {
466466
BoutReal A0, A1, A2, A3, A4, A5;
467467
A0 = A(x, y, z);
468468

469-
ASSERT3(finite(A0));
469+
ASSERT3(std::isfinite(A0));
470470

471471
// Set the matrix coefficients
472472
Coeffs(x, y, z, A1, A2, A3, A4, A5);
@@ -477,11 +477,11 @@ FieldPerp LaplacePetsc::solve(const FieldPerp& b, const FieldPerp& x0) {
477477
BoutReal dz2 = SQ(dz);
478478
BoutReal dxdz = dx * dz;
479479

480-
ASSERT3(finite(A1));
481-
ASSERT3(finite(A2));
482-
ASSERT3(finite(A3));
483-
ASSERT3(finite(A4));
484-
ASSERT3(finite(A5));
480+
ASSERT3(std::isfinite(A1));
481+
ASSERT3(std::isfinite(A2));
482+
ASSERT3(std::isfinite(A3));
483+
ASSERT3(std::isfinite(A4));
484+
ASSERT3(std::isfinite(A5));
485485

486486
// Set Matrix Elements
487487
PetscScalar val = 0.;
@@ -913,7 +913,7 @@ void LaplacePetsc::Element(int i, int x, int z, int xshift, int zshift, PetscSca
913913
int index = (row_new * meshz) + col_new;
914914

915915
#if CHECK > 2
916-
if (!finite(ele)) {
916+
if (!std::isfinite(ele)) {
917917
throw BoutException("Non-finite element at x={:d}, z={:d}, row={:d}, col={:d}\n", x,
918918
z, i, index);
919919
}
@@ -978,8 +978,8 @@ void LaplacePetsc::Coeffs(int x, int y, int z, BoutReal& coef1, BoutReal& coef2,
978978
coef4 = coords->G1(x, y, z); // X 1st derivative
979979
coef5 = coords->G3(x, y, z); // Z 1st derivative
980980

981-
ASSERT3(finite(coef4));
982-
ASSERT3(finite(coef5));
981+
ASSERT3(std::isfinite(coef4));
982+
ASSERT3(std::isfinite(coef5));
983983
}
984984

985985
if (nonuniform) {

src/invert/laplace/impls/serial_tri/serial_tri.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* and tridiagonal solver.
44
*
55
**************************************************************************
6-
* Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
6+
* Copyright 2010 - 2025 BOUT++ developers
77
*
8-
* Contact: Ben Dudson, bd512@york.ac.uk
8+
* Contact: Ben Dudson, dudson2@llnl.gov
99
*
1010
* This file is part of BOUT++.
1111
*
@@ -235,7 +235,7 @@ FieldPerp LaplaceSerialTri::solve(const FieldPerp& b, const FieldPerp& x0) {
235235

236236
#if CHECK > 2
237237
for (int kz = 0; kz < ncz; kz++) {
238-
if (!finite(x(ix, kz))) {
238+
if (!std::isfinite(x(ix, kz))) {
239239
throw BoutException("Non-finite at {:d}, {:d}, {:d}", ix, jy, kz);
240240
}
241241
}

src/mesh/parallel/fci.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* possible to just swap in the FCI approach for the standard BOUT++
1616
* Grad_par operator.
1717
**************************************************************************
18-
* Copyright 2014 B.D.Dudson, P. Hill
18+
* Copyright 2014 - 2025 BOUT++ developers
1919
*
20-
* Contact: Ben Dudson, bd512@york.ac.uk
20+
* Contact: Ben Dudson, dudson2@llnl.gov
2121
*
2222
* This file is part of BOUT++.
2323
*
@@ -292,7 +292,7 @@ Field3D FCIMap::integrate(Field3D& f) const {
292292
// which would include cell edges and corners
293293
result[inext] = 0.5 * (f_c + 0.25 * (f_pp + f_mp + f_pm + f_mm));
294294
}
295-
ASSERT2(finite(result[inext]));
295+
ASSERT2(std::isfinite(result[inext]));
296296
}
297297
return result;
298298
}

0 commit comments

Comments
 (0)