diff --git a/CHANGELOG.md b/CHANGELOG.md index 397d277b6d4..b0c8463243d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - [[PR575]](https://github.com/lanl/singularity-eos/pull/575) Pin variant submodule to the same commit as the spackage ### Infrastructure (changes irrelevant to downstream codes) +- [[PR576]](https://github.com/lanl/singularity-eos/pull/576) Clean up some header includes to use the C++ versions - [[PR559]](https://github.com/lanl/singularity-eos/pull/559) Document the intent of the virtual keyword in solvers - [[PR558]](https://github.com/lanl/singularity-eos/pull/558) Make EOSPAC CMake options depend on SINGULARITY_USE_EOSPAC option - [[PR573]](https://github.com/lanl/singularity-eos/pull/573) Add CMake option for address sanitizing diff --git a/singularity-eos/base/root-finding-1d/root_finding.hpp b/singularity-eos/base/root-finding-1d/root_finding.hpp index fce40b91886..741013d681b 100644 --- a/singularity-eos/base/root-finding-1d/root_finding.hpp +++ b/singularity-eos/base/root-finding-1d/root_finding.hpp @@ -24,10 +24,10 @@ // #include // debug // #include -#include -#include +#include +#include #include -#include +#include #include #define SINGULARITY_ROOT_DEBUG (0) @@ -84,7 +84,7 @@ class RootCounts { counts_[i] = 0; } PORTABLE_INLINE_FUNCTION void increment(std::size_t i) const { - assert(i < nbins_ && i >= 0); + PORTABLE_REQUIRE(i < nbins_ && i >= 0, "Index in bounds"); #ifdef PORTABILITY_STRATEGY_NONE counts_[i] += 1; #endif // PORTABILITY_STRATEGY_NONE @@ -96,11 +96,11 @@ class RootCounts { return tot; } PORTABLE_INLINE_FUNCTION const Real &operator[](const std::size_t i) const { - assert(i < nbins_ && i >= 0); + PORTABLE_REQUIRE(i < nbins_ && i >= 0, "Index in bounds"); return counts_[i]; } PORTABLE_INLINE_FUNCTION Real &operator[](const std::size_t i) { - assert(i < nbins_ && i >= 0); + PORTABLE_REQUIRE(i < nbins_ && i >= 0, "Index in bounds"); return counts_[i]; } PORTABLE_INLINE_FUNCTION void print_counts() const { @@ -362,7 +362,7 @@ PORTABLE_INLINE_FUNCTION Status findRoot(const T &f, const Real ytarget, Real xg status = bisect(f, ytarget, xguess, xmin, xmax, xtol, ytol, xroot, counts); // Check for something horrible happening - if (isnan(xroot) || isinf(xroot)) { + if (std::isnan(xroot) || std::isinf(xroot)) { #if SINGULARITY_ROOT_DEBUG fprintf(stderr, "xroot is nan after bisection\n"); #endif @@ -396,7 +396,7 @@ PORTABLE_INLINE_FUNCTION Status secant(const T &f, const Real ytarget, const Rea x -= y / dy; if (x < xmin) x = xmin; if (x > xmax) x = xmax; - if (isnan(x) || isinf(x)) { + if (std::isnan(x) || std::isinf(x)) { // can't recover from this #if SINGULARITY_ROOT_DEBUG fprintf(stderr, @@ -472,8 +472,8 @@ PORTABLE_INLINE_FUNCTION Status secant(const T &f, const Real ytarget, const Rea } #endif - const int secant_failed = - (fabs(x - x_last) > xtol || fabs(frac_error) > ytol || isnan(x) || isinf(x)); + const int secant_failed = (std::abs(x - x_last) > xtol || std::abs(frac_error) > ytol || + std::isnan(x) || std::isinf(x)); return secant_failed ? Status::FAIL : Status::SUCCESS; } @@ -577,7 +577,7 @@ PORTABLE_INLINE_FUNCTION Status bisect(const T &f, const Real ytarget, const Rea xroot = 0.5 * (xl + xr); - if (isnan(xroot)) { + if (std::isnan(xroot)) { #if SINGULARITY_ROOT_DEBUG Real il = f(xl); Real ir = f(xr); diff --git a/singularity-eos/eos/modifiers/eos_unitsystem.hpp b/singularity-eos/eos/modifiers/eos_unitsystem.hpp index 601d8191d0b..0417104ccd1 100644 --- a/singularity-eos/eos/modifiers/eos_unitsystem.hpp +++ b/singularity-eos/eos/modifiers/eos_unitsystem.hpp @@ -15,9 +15,9 @@ #ifndef _SINGULARITY_EOS_EOS_EOS_UNITSYSTEM_HPP_ #define _SINGULARITY_EOS_EOS_EOS_UNITSYSTEM_HPP_ -#include "stdio.h" #include #include +#include #include #include #include diff --git a/singularity-eos/eos/modifiers/floored_energy.hpp b/singularity-eos/eos/modifiers/floored_energy.hpp index bcf2dbdebc0..b3b926df57c 100644 --- a/singularity-eos/eos/modifiers/floored_energy.hpp +++ b/singularity-eos/eos/modifiers/floored_energy.hpp @@ -15,7 +15,7 @@ #ifndef _SINGULARITY_EOS_EOS_FLOORED_ENERGY_ #define _SINGULARITY_EOS_EOS_FLOORED_ENERGY_ -#include "stdio.h" +#include #include #include diff --git a/singularity-eos/eos/modifiers/ramps_eos.hpp b/singularity-eos/eos/modifiers/ramps_eos.hpp index fe8bc279ea9..1891b1d81ca 100644 --- a/singularity-eos/eos/modifiers/ramps_eos.hpp +++ b/singularity-eos/eos/modifiers/ramps_eos.hpp @@ -15,9 +15,9 @@ #ifndef _SINGULARITY_EOS_EOS_RAMPS_EOS_ #define _SINGULARITY_EOS_EOS_RAMPS_EOS_ -#include "stdio.h" #include #include +#include #include #include #include diff --git a/singularity-eos/eos/modifiers/relativistic_eos.hpp b/singularity-eos/eos/modifiers/relativistic_eos.hpp index 50e9e774c31..fafa2f95a62 100644 --- a/singularity-eos/eos/modifiers/relativistic_eos.hpp +++ b/singularity-eos/eos/modifiers/relativistic_eos.hpp @@ -15,9 +15,9 @@ #ifndef _SINGULARITY_EOS_EOS_RELATIVISTIC_EOS_ #define _SINGULARITY_EOS_EOS_RELATIVISTIC_EOS_ -#include "stdio.h" #include #include +#include #include #include #include diff --git a/singularity-eos/eos/modifiers/scaled_eos.hpp b/singularity-eos/eos/modifiers/scaled_eos.hpp index ad231c0c787..c7c2292a3e9 100644 --- a/singularity-eos/eos/modifiers/scaled_eos.hpp +++ b/singularity-eos/eos/modifiers/scaled_eos.hpp @@ -15,9 +15,9 @@ #ifndef _SINGULARITY_EOS_EOS_SCALED_EOS_ #define _SINGULARITY_EOS_EOS_SCALED_EOS_ -#include "stdio.h" #include #include +#include #include #include #include diff --git a/singularity-eos/eos/modifiers/shifted_eos.hpp b/singularity-eos/eos/modifiers/shifted_eos.hpp index 9fb3adf5308..ff52b2eac26 100644 --- a/singularity-eos/eos/modifiers/shifted_eos.hpp +++ b/singularity-eos/eos/modifiers/shifted_eos.hpp @@ -15,9 +15,9 @@ #ifndef _SINGULARITY_EOS_EOS_SHIFTED_EOS_ #define _SINGULARITY_EOS_EOS_SHIFTED_EOS_ -#include "stdio.h" #include #include +#include #include #include #include