Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions singularity-eos/base/root-finding-1d/root_finding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

// #include <iostream> // debug
// #include <iomanip>
#include <assert.h>
#include <math.h>
#include <cmath>
#include <cstdio>
#include <ports-of-call/portability.hpp>
#include <stdio.h>
#include <ports-of-call/portable_errors.hpp>
#include <tuple>

#define SINGULARITY_ROOT_DEBUG (0)
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/modifiers/eos_unitsystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef _SINGULARITY_EOS_EOS_EOS_UNITSYSTEM_HPP_
#define _SINGULARITY_EOS_EOS_EOS_UNITSYSTEM_HPP_

#include "stdio.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <limits>
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/modifiers/floored_energy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef _SINGULARITY_EOS_EOS_FLOORED_ENERGY_
#define _SINGULARITY_EOS_EOS_FLOORED_ENERGY_

#include "stdio.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/modifiers/ramps_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef _SINGULARITY_EOS_EOS_RAMPS_EOS_
#define _SINGULARITY_EOS_EOS_RAMPS_EOS_

#include "stdio.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <limits>
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/modifiers/relativistic_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef _SINGULARITY_EOS_EOS_RELATIVISTIC_EOS_
#define _SINGULARITY_EOS_EOS_RELATIVISTIC_EOS_

#include "stdio.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <limits>
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/modifiers/scaled_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef _SINGULARITY_EOS_EOS_SCALED_EOS_
#define _SINGULARITY_EOS_EOS_SCALED_EOS_

#include "stdio.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <limits>
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/modifiers/shifted_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef _SINGULARITY_EOS_EOS_SHIFTED_EOS_
#define _SINGULARITY_EOS_EOS_SHIFTED_EOS_

#include "stdio.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <limits>
Expand Down