Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining clang-tidy warnings #1288

Merged
merged 12 commits into from
Jul 22, 2023
18 changes: 9 additions & 9 deletions EOS/helmholtz/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -1341,10 +1341,10 @@ void actual_eos_init ()
// buffer, broadcast that, and then copy that into the managed
// memory.

amrex::Vector<Real> f_local(jmax * imax * 9);
amrex::Vector<Real> dpdf_local(jmax * imax * 4);
amrex::Vector<Real> ef_local(jmax * imax * 4);
amrex::Vector<Real> xf_local(jmax * imax * 4);
amrex::Vector<Real> f_local(static_cast<size_t>(9) * imax * jmax);
amrex::Vector<Real> dpdf_local(static_cast<size_t>(4) * imax * jmax);
amrex::Vector<Real> ef_local(static_cast<size_t>(4) * imax * jmax);
amrex::Vector<Real> xf_local(static_cast<size_t>(4) * imax * jmax);

if (amrex::ParallelDescriptor::IOProcessor()) {

Expand Down Expand Up @@ -1412,14 +1412,14 @@ void actual_eos_init ()

}

amrex::ParallelDescriptor::Bcast(f_local.data(), static_cast<size_t>(9 * imax * jmax));
amrex::ParallelDescriptor::Bcast(dpdf_local.data(), static_cast<size_t>(4 * imax * jmax));
amrex::ParallelDescriptor::Bcast(ef_local.data(), static_cast<size_t>(4 * imax * jmax));
amrex::ParallelDescriptor::Bcast(xf_local.data(), static_cast<size_t>(4 * imax * jmax));
amrex::ParallelDescriptor::Bcast(f_local.data(), static_cast<size_t>(9) * imax * jmax);
amrex::ParallelDescriptor::Bcast(dpdf_local.data(), static_cast<size_t>(4) * imax * jmax);
amrex::ParallelDescriptor::Bcast(ef_local.data(), static_cast<size_t>(4) * imax * jmax);
amrex::ParallelDescriptor::Bcast(xf_local.data(), static_cast<size_t>(4) * imax * jmax);

// now copy into managed memory
int idx = 0;
for (int j = 0; j < jmax; ++j) {
for (int j = 0; j < jmax; ++j) { // NOLINT(modernize-loop-convert)
for (int i = 0; i < imax; ++i) {
for (int m = 0; m < 9; ++m) {
f[j][i][m] = f_local[idx];
Expand Down
10 changes: 5 additions & 5 deletions integration/VODE/actual_integrator.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void actual_integrator (BurnT& state, Real dt)
vode_state.rtol_enuc = rtol_enuc; // energy generated

// set the Jacobian type
vode_state.jacobian_type = jacobian;
vode_state.jacobian_type = static_cast<short>(jacobian);

// Start off by assuming a successful burn.

Expand Down Expand Up @@ -172,15 +172,15 @@ void actual_integrator (BurnT& state, Real dt)
std::cout << "dt = " << std::setprecision(16) << dt << std::endl;
std::cout << "temp start = " << std::setprecision(16) << T_in << std::endl;
std::cout << "xn start = ";
for (int n = 0; n < NumSpec; ++n) {
std::cout << std::setprecision(16) << xn_in[n] << " ";
for (double x : xn_in) {
std::cout << std::setprecision(16) << x << " ";
}
std::cout << std::endl;
std::cout << "dens current = " << std::setprecision(16) << state.rho << std::endl;
std::cout << "temp current = " << std::setprecision(16) << state.T << std::endl;
std::cout << "xn current = ";
for (int n = 0; n < NumSpec; ++n) {
std::cout << std::setprecision(16) << state.xn[n] << " ";
for (double x : state.xn) {
std::cout << std::setprecision(16) << x << " ";
}
std::cout << std::endl;
std::cout << "energy generated = " << state.e << std::endl;
Expand Down
14 changes: 0 additions & 14 deletions interfaces/ArrayUtilities.H
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ namespace ArrayUtil
}
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void operator= (const MathArray1D<XLO, XHI>& other) noexcept {
for (int i = 0; i < (XHI-XLO+1); ++i) {
arr[i] = other.arr[i];
}
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
const Real& operator() (int i) const noexcept {
AMREX_ASSERT(i >= XLO && i <= XHI);
Expand Down Expand Up @@ -90,13 +83,6 @@ namespace ArrayUtil
}
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void operator= (const MathArray2D<XLO, XHI, YLO, YHI>& other) noexcept {
for (int i = 0; i < (YHI-YLO+1)*(XHI-XLO+1); ++i) {
arr[i] = other.arr[i];
}
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
const Real& operator() (int i, int j) const noexcept {
AMREX_ASSERT(i >= XLO && i <= XHI && j >= YLO && j <= YHI);
Expand Down
10 changes: 5 additions & 5 deletions interfaces/burn_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ void normalize_abundances_burn (BurnT& state)
{

Real sum = 0.0_rt;
for (int n = 0; n < NumSpec; ++n) {
state.xn[n] = amrex::max(small_x, amrex::min(1.0_rt, state.xn[n]));
sum += state.xn[n];
for (double &x : state.xn) {
x = amrex::max(small_x, amrex::min(1.0_rt, x));
sum += x;
}
for (int n = 0; n < NumSpec; ++n) {
state.xn[n] /= sum;
for (double &x : state.xn) {
x /= sum;
}

}
Expand Down
28 changes: 14 additions & 14 deletions interfaces/eos_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -161,111 +161,111 @@ struct has_energy
: std::false_type {};

template <typename T>
struct has_energy<T, typename std::enable_if<(sizeof(((T*)0)->e) > 0)>::type>
struct has_energy<T, decltype((void)T::e, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_enthalpy
: std::false_type {};

template <typename T>
struct has_enthalpy<T, typename std::enable_if<(sizeof(((T*)0)->h) > 0)>::type>
struct has_enthalpy<T, decltype((void)T::h, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_entropy
: std::false_type {};

template <typename T>
struct has_entropy<T, typename std::enable_if<(sizeof(((T*)0)->s) > 0)>::type>
struct has_entropy<T, decltype((void)T::s, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_pressure
: std::false_type {};

template <typename T>
struct has_pressure<T, typename std::enable_if<(sizeof(((T*)0)->p) > 0)>::type>
struct has_pressure<T, decltype((void)T::p, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_dpdA
: std::false_type {};

template <typename T>
struct has_dpdA<T, typename std::enable_if<(sizeof(((T*)0)->dpdA) > 0)>::type>
struct has_dpdA<T, decltype((void)T::dpdA, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_dpdZ
: std::false_type {};

template <typename T>
struct has_dpdZ<T, typename std::enable_if<(sizeof(((T*)0)->dpdZ) > 0)>::type>
struct has_dpdZ<T, decltype((void)T::dpdZ, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_dedA
: std::false_type {};

template <typename T>
struct has_dedA<T, typename std::enable_if<(sizeof(((T*)0)->dedA) > 0)>::type>
struct has_dedA<T, decltype((void)T::dedA, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_dedZ
: std::false_type {};

template <typename T>
struct has_dedZ<T, typename std::enable_if<(sizeof(((T*)0)->dedZ) > 0)>::type>
struct has_dedZ<T, decltype((void)T::dedZ, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_pele_ppos
: std::false_type {};

template <typename T>
struct has_pele_ppos<T, typename std::enable_if<(sizeof(((T*)0)->pele) > 0)>::type>
struct has_pele_ppos<T, decltype((void)T::pele, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_xne_xnp
: std::false_type {};

template <typename T>
struct has_xne_xnp<T, typename std::enable_if<(sizeof(((T*)0)->xne) > 0)>::type>
struct has_xne_xnp<T, decltype((void)T::xne, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_eta
: std::false_type {};

template <typename T>
struct has_eta<T, typename std::enable_if<(sizeof(((T*)0)->eta) > 0)>::type>
struct has_eta<T, decltype((void)T::eta, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_conductivity
: std::false_type {};

template <typename T>
struct has_conductivity<T, typename std::enable_if<(sizeof(((T*)0)->conductivity) > 0)>::type>
struct has_conductivity<T, decltype((void)T::conductivity, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_xn
: std::false_type {};

template <typename T>
struct has_xn<T, typename std::enable_if<(sizeof(((T*)0)->xn) > 0)>::type>
struct has_xn<T, decltype((void)T::xn, void())>
: std::true_type {};

template <typename T, typename Enable = void>
struct has_base_variables
: std::false_type {};

template <typename T>
struct has_base_variables<T, typename std::enable_if<(sizeof(((T*)0)->rho) > 0)>::type>
struct has_base_variables<T, decltype((void)T::rho, void())>
: std::true_type {};

template <typename T>
Expand Down
98 changes: 34 additions & 64 deletions interfaces/rhs_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -38,70 +38,40 @@ namespace RHS
{

struct rhs_t {
int species_A;
int species_B;
int species_C;
int species_D;
int species_E;
int species_F;

int number_A;
int number_B;
int number_C;
int number_D;
int number_E;
int number_F;

int exponent_A;
int exponent_B;
int exponent_C;
int exponent_D;
int exponent_E;
int exponent_F;

amrex::Real forward_branching_ratio;
amrex::Real reverse_branching_ratio;

int apply_identical_particle_factor;

int rate_can_be_tabulated;

int screen_forward_reaction;
int screen_reverse_reaction;

int additional_reaction_1;
int additional_reaction_2;
int additional_reaction_3;

constexpr rhs_t ()
: species_A(-1),
species_B(-1),
species_C(-1),
species_D(-1),
species_E(-1),
species_F(-1),
number_A(0),
number_B(0),
number_C(0),
number_D(0),
number_E(0),
number_F(0),
exponent_A(0),
exponent_B(0),
exponent_C(0),
exponent_D(0),
exponent_E(0),
exponent_F(0),
forward_branching_ratio(1.0_rt),
reverse_branching_ratio(1.0_rt),
apply_identical_particle_factor(1),
rate_can_be_tabulated(1),
screen_forward_reaction(1),
screen_reverse_reaction(1),
additional_reaction_1(-1),
additional_reaction_2(-1),
additional_reaction_3(-1)
{}
int species_A{-1};
int species_B{-1};
int species_C{-1};
int species_D{-1};
int species_E{-1};
int species_F{-1};

int number_A{0};
int number_B{0};
int number_C{0};
int number_D{0};
int number_E{0};
int number_F{0};

int exponent_A{0};
int exponent_B{0};
int exponent_C{0};
int exponent_D{0};
int exponent_E{0};
int exponent_F{0};

amrex::Real forward_branching_ratio{1.0_rt};
amrex::Real reverse_branching_ratio{1.0_rt};

int apply_identical_particle_factor{1};

int rate_can_be_tabulated{1};

int screen_forward_reaction{1};
int screen_reverse_reaction{1};

int additional_reaction_1{-1};
int additional_reaction_2{-1};
int additional_reaction_3{-1};
};

constexpr amrex::Real tab_tlo = 6.0e0_rt;
Expand Down
13 changes: 2 additions & 11 deletions networks/aprox13/actual_network.H
Original file line number Diff line number Diff line change
Expand Up @@ -798,19 +798,10 @@ namespace RHS {
else if constexpr (rate == C12_C12_to_Ne20_He4) {
rate_c12c12(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == C12_O16_to_Mg24_He4) {
else if constexpr (rate == C12_O16_to_Mg24_He4 || rate == C12_O16_to_Si28) {
rate_c12o16(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == C12_O16_to_Si28) {
rate_c12o16(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == O16_O16_to_Si28_He4) {
rate_o16o16(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == O16_O16_to_P31_P) {
rate_o16o16(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == O16_O16_to_S32) {
else if constexpr (rate == O16_O16_to_Si28_He4 || rate == O16_O16_to_P31_P || rate == O16_O16_to_S32) {
rate_o16o16(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == O16_He4_to_Ne20) {
Expand Down
8 changes: 1 addition & 7 deletions networks/aprox21/actual_network.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace network
static_assert(spec >= 1 && spec <= NumSpec);

// Set the binding energy of the element
if constexpr (spec == H1) {
if constexpr (spec == H1 || spec == N || spec == P) {
return 0.0_rt;
}
else if constexpr (spec == He3) {
Expand Down Expand Up @@ -90,12 +90,6 @@ namespace network
else if constexpr (spec == Ni56) {
return 484.00300e0_rt;
}
else if constexpr (spec == N) {
return 0.0_rt;
}
else if constexpr (spec == P) {
return 0.0_rt;
}

// Return zero if we don't recognize the species.
return 0.0_rt;
Expand Down
5 changes: 1 addition & 4 deletions networks/iso7/actual_network.H
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,7 @@ namespace RHS {
else if constexpr (rate == C12_C12_to_Ne20_He4) {
rate_c12c12(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == C12_O16_to_Mg24_He4) {
rate_c12o16(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == C12_O16_to_Si28) {
else if constexpr (rate == C12_O16_to_Mg24_He4 || rate == C12_O16_to_Si28) {
rate_c12o16(state.tf, 1.0_rt, rates.fr, rates.frdt, rates.rr, rates.rrdt);
}
else if constexpr (rate == O16_O16_to_Si28_He4) {
Expand Down
Loading