Skip to content

Commit

Permalink
Merge pull request #482 from mahf708/fix-warning-in-math
Browse files Browse the repository at this point in the history
reuse already defined max instead of std numerx
  • Loading branch information
singhbalwinder authored Jul 21, 2024
2 parents 8e4c96d + 6b7bda1 commit 0dff12a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions haero/root_finders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ template <typename ScalarFunction> struct NewtonSolver {
KOKKOS_INLINE_FUNCTION
NewtonSolver(const value_type x0, const value_type a0, const value_type b0,
const Real &tol, const ScalarFunction &fn)
: xroot(x0), conv_tol(tol), counter(0),
iter_diff(std::numeric_limits<Real>::max()), f(fn), fail(false) {}
: xroot(x0), conv_tol(tol), counter(0), iter_diff(max()), f(fn),
fail(false) {}

/// Solves for the root. Prints a warning message if the convergence
/// tolerance is not met before the maximum number of iterations is achieved.
Expand Down Expand Up @@ -132,8 +132,8 @@ template <typename ScalarFunction> struct BracketedNewtonSolver {
const value_type b0, const Real tol,
const ScalarFunction &fn)
: xroot(x0), a(a0), b(b0), conv_tol(tol), fa(fn(value_type(a0))),
fx(fn(x0)), fb(fn(value_type(b0))), f(fn), counter(0),
iter_diff(std::numeric_limits<Real>::max()), fail(false) {
fx(fn(x0)), fb(fn(value_type(b0))), f(fn), counter(0), iter_diff(max()),
fail(false) {
EKAT_KERNEL_ASSERT(b - a > 0.0);
EKAT_KERNEL_ASSERT(fa * fb < 0.0);
}
Expand Down

0 comments on commit 0dff12a

Please sign in to comment.