From e0f06fdf074e3b07d2b7f260d19645fc6d0dee31 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 28 Jan 2024 14:58:48 -0500 Subject: [PATCH] more fabs --- Diagnostics/DustCollapse/main.cpp | 20 ++++++++++---------- Diagnostics/Radiation/Radiation_utils.H | 2 +- Diagnostics/Radiation/lgt_frnt1d.cpp | 2 +- Diagnostics/Sedov/main.cpp | 10 +++++----- Source/driver/Castro.cpp | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Diagnostics/DustCollapse/main.cpp b/Diagnostics/DustCollapse/main.cpp index 3540c01579..9ac8619009 100644 --- a/Diagnostics/DustCollapse/main.cpp +++ b/Diagnostics/DustCollapse/main.cpp @@ -102,8 +102,8 @@ int main(int argc, char* argv[]) #if (AMREX_SPACEDIM == 1) int nbins = domain.length(0); #elif (AMREX_SPACEDIM == 2) - auto x_maxdist = fmax(fabs(problo[0]), fabs(probhi[0])); - auto y_maxdist = fmax(fabs(problo[1] - yctr), fabs(probhi[1] - yctr)); + auto x_maxdist = std::max(std::abs(problo[0]), std::abs(probhi[0])); + auto y_maxdist = std::max(std::abs(problo[1] - yctr), std::abs(probhi[1] - yctr)); auto max_dist = std::sqrt(x_maxdist*x_maxdist + y_maxdist*y_maxdist); @@ -210,21 +210,21 @@ int main(int argc, char* argv[]) // analytic expression for the radius as a function of time t = 0.00 Real max_dens = 1.e9; - if (fabs(data.Time()) <= 1.e-8) + if (std::abs(data.Time()) <= 1.e-8) max_dens = 1.e9; - else if (fabs(data.Time() - 0.01) <= 1.e-8) + else if (std::abs(data.Time() - 0.01) <= 1.e-8) max_dens = 1.043345e9; - else if (fabs(data.Time() - 0.02) <= 1.e-8) + else if (std::abs(data.Time() - 0.02) <= 1.e-8) max_dens = 1.192524e9; - else if (fabs(data.Time() - 0.03) <= 1.e-8) + else if (std::abs(data.Time() - 0.03) <= 1.e-8) max_dens = 1.527201e9; - else if (fabs(data.Time() - 0.04) <= 1.e-8) + else if (std::abs(data.Time() - 0.04) <= 1.e-8) max_dens = 2.312884e9; - else if (fabs(data.Time() - 0.05) <= 1.e-8) + else if (std::abs(data.Time() - 0.05) <= 1.e-8) max_dens = 4.779133e9; - else if (fabs(data.Time() - 0.06) <= 1.e-8) + else if (std::abs(data.Time() - 0.06) <= 1.e-8) max_dens = 24.472425e9; - else if (fabs(data.Time() - 0.065) <= 1.e-8) + else if (std::abs(data.Time() - 0.065) <= 1.e-8) max_dens = 423.447291e9; else { Print() << "Dont know the maximum density at this time: " << data.Time() < r, slicefile << std::setw(w) << r[i]; for (auto it=vars.begin(); it!=vars.end(); ++it) { - if(fabs((*it)[i]) < SMALL) (*it)[i] = 0.0; + if(std::abs((*it)[i]) < SMALL) (*it)[i] = 0.0; slicefile << std::setw(w) << (*it)[i]; } diff --git a/Diagnostics/Radiation/lgt_frnt1d.cpp b/Diagnostics/Radiation/lgt_frnt1d.cpp index bb941c793b..9b1743b3b4 100644 --- a/Diagnostics/Radiation/lgt_frnt1d.cpp +++ b/Diagnostics/Radiation/lgt_frnt1d.cpp @@ -53,7 +53,7 @@ int main(int argc, char* argv[]) // compute the size of the radially-binned array -- we'll do it to // the furtherest corner of the domain - double maxdist = fabs(probhi[0] - problo[0]); + double maxdist = std::abs(probhi[0] - problo[0]); double dx_fine = *(std::min_element(dx.begin(), dx.end())); int nbins = int(maxdist / dx_fine); diff --git a/Diagnostics/Sedov/main.cpp b/Diagnostics/Sedov/main.cpp index f6153d6bc0..4a32f24b6b 100644 --- a/Diagnostics/Sedov/main.cpp +++ b/Diagnostics/Sedov/main.cpp @@ -148,7 +148,7 @@ int main(int argc, char* argv[]) #else double x_maxdist = amrex::max(std::abs(probhi[0] - xctr), - std::fabs(problo[0] - xctr)); + std::abs(problo[0] - xctr)); double y_maxdist = amrex::max(std::abs(probhi[1] - yctr), std::abs(problo[1] - yctr)); double z_maxdist = amrex::max(std::abs(probhi[2] - zctr), @@ -342,10 +342,10 @@ int main(int argc, char* argv[]) // write the data in columns const auto SMALL = 1.e-20; for (auto i = 0; i < nbins; i++) { - if (fabs(dens_bin[i]) < SMALL) dens_bin[i] = 0.0; - if (fabs( vel_bin[i]) < SMALL) vel_bin[i] = 0.0; - if (fabs(pres_bin[i]) < SMALL) pres_bin[i] = 0.0; - if (fabs( e_bin[i]) < SMALL) e_bin[i] = 0.0; + if (std::abs(dens_bin[i]) < SMALL) dens_bin[i] = 0.0; + if (std::abs( vel_bin[i]) < SMALL) vel_bin[i] = 0.0; + if (std::abs(pres_bin[i]) < SMALL) pres_bin[i] = 0.0; + if (std::abs( e_bin[i]) < SMALL) e_bin[i] = 0.0; slicefile << std::setw(w) << r[i] << std::setw(w) << dens_bin[i] << std::setw(w) << vel_bin[i] << std::setw(w) << pres_bin[i] << std::setw(w) << e_bin[i] << std::endl; } diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index 729dbc1ecd..155cd3cf5b 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -984,13 +984,13 @@ Castro::initData () // make sure dx = dy = dz -- that's all we guarantee to support #if (AMREX_SPACEDIM == 2) const Real SMALL = 1.e-13; - if (fabs(dx[0] - dx[1]) > SMALL*dx[0]) + if (std::abs(dx[0] - dx[1]) > SMALL*dx[0]) { amrex::Abort("We don't support dx != dy"); } #elif (AMREX_SPACEDIM == 3) const Real SMALL = 1.e-13; - if ( (fabs(dx[0] - dx[1]) > SMALL*dx[0]) || (fabs(dx[0] - dx[2]) > SMALL*dx[0]) ) + if ( (std::abs(dx[0] - dx[1]) > SMALL*dx[0]) || (std::abs(dx[0] - dx[2]) > SMALL*dx[0]) ) { amrex::Abort("We don't support dx != dy != dz"); }