Skip to content

Commit

Permalink
some namespace and clang-tidy cleanings
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Feb 8, 2025
1 parent 99e5c03 commit ca3156b
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 81 deletions.
2 changes: 1 addition & 1 deletion EOS/ztwd/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE
bool is_input_valid (I input)
{
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");

amrex::ignore_unused(input);
bool valid = true;

return valid;
Expand Down
4 changes: 1 addition & 3 deletions conductivity/stellar/actual_conductivity.H
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ actual_conductivity (T& state)
amrex::Real xkaz = 50.0_rt*xz*xka1 * std::exp(-0.5206_rt*amrex::Math::powi<2>((std::log(state.rho)-d0log)/xkw));
amrex::Real dbar2log = -(4.283_rt + 0.7196_rt*xh) + 3.86_rt*std::log(t6);
amrex::Real dbar1log = -5.296_rt + 4.833_rt*std::log(t6);
if (dbar2log < dbar1log) {
dbar1log = dbar2log;
}
dbar1log = std::min(dbar1log, dbar2log);
oiben2 = std::pow(state.rho/std::exp(dbar1log), 0.67_rt) * std::exp(xkaz);
}

Expand Down
2 changes: 0 additions & 2 deletions integration/nse_update_sdc.H
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef NSE_UPDATE_H
#define NSE_UPDATE_H

#include <AMReX_Algorithm.H>

#include <iostream>
#include <fstream>
#include <actual_network.H>
Expand Down
2 changes: 1 addition & 1 deletion networks/aprox21/actual_network.H
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ namespace RHS {

rhs_t data;

switch (rate) {
switch (rate) { // NOLINT(bugprone-switch-missing-default-case)

case P_to_N:
// irpen and irnep in the original aprox21
Expand Down
2 changes: 0 additions & 2 deletions unit_test/burn_cell/burn_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <iomanip>
#include <react_util.H>

using namespace unit_test_rp;

AMREX_INLINE
void burn_cell_c()
{
Expand Down
84 changes: 41 additions & 43 deletions unit_test/burn_cell_sdc/burn_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <iostream>
#include <react_util.H>

using namespace unit_test_rp;

AMREX_INLINE
void burn_cell_c()
{
Expand Down Expand Up @@ -60,109 +58,109 @@ void burn_cell_c()
switch (n) {

case 1:
adv_species[n-1] = Adv_X1;
adv_species[n-1] = unit_test_rp::Adv_X1;
break;
case 2:
adv_species[n-1] = Adv_X2;
adv_species[n-1] = unit_test_rp::Adv_X2;
break;
case 3:
adv_species[n-1] = Adv_X3;
adv_species[n-1] = unit_test_rp::Adv_X3;
break;
case 4:
adv_species[n-1] = Adv_X4;
adv_species[n-1] = unit_test_rp::Adv_X4;
break;
case 5:
adv_species[n-1] = Adv_X5;
adv_species[n-1] = unit_test_rp::Adv_X5;
break;
case 6:
adv_species[n-1] = Adv_X6;
adv_species[n-1] = unit_test_rp::Adv_X6;
break;
case 7:
adv_species[n-1] = Adv_X7;
adv_species[n-1] = unit_test_rp::Adv_X7;
break;
case 8:
adv_species[n-1] = Adv_X8;
adv_species[n-1] = unit_test_rp::Adv_X8;
break;
case 9:
adv_species[n-1] = Adv_X9;
adv_species[n-1] = unit_test_rp::Adv_X9;
break;
case 10:
adv_species[n-1] = Adv_X10;
adv_species[n-1] = unit_test_rp::Adv_X10;
break;
case 11:
adv_species[n-1] = Adv_X11;
adv_species[n-1] = unit_test_rp::Adv_X11;
break;
case 12:
adv_species[n-1] = Adv_X12;
adv_species[n-1] = unit_test_rp::Adv_X12;
break;
case 13:
adv_species[n-1] = Adv_X13;
adv_species[n-1] = unit_test_rp::Adv_X13;
break;
case 14:
adv_species[n-1] = Adv_X14;
adv_species[n-1] = unit_test_rp::Adv_X14;
break;
case 15:
adv_species[n-1] = Adv_X15;
adv_species[n-1] = unit_test_rp::Adv_X15;
break;
case 16:
adv_species[n-1] = Adv_X16;
adv_species[n-1] = unit_test_rp::Adv_X16;
break;
case 17:
adv_species[n-1] = Adv_X17;
adv_species[n-1] = unit_test_rp::Adv_X17;
break;
case 18:
adv_species[n-1] = Adv_X18;
adv_species[n-1] = unit_test_rp::Adv_X18;
break;
case 19:
adv_species[n-1] = Adv_X19;
adv_species[n-1] = unit_test_rp::Adv_X19;
break;
case 20:
adv_species[n-1] = Adv_X20;
adv_species[n-1] = unit_test_rp::Adv_X20;
break;
case 21:
adv_species[n-1] = Adv_X21;
adv_species[n-1] = unit_test_rp::Adv_X21;
break;
case 22:
adv_species[n-1] = Adv_X22;
adv_species[n-1] = unit_test_rp::Adv_X22;
break;
case 23:
adv_species[n-1] = Adv_X23;
adv_species[n-1] = unit_test_rp::Adv_X23;
break;
case 24:
adv_species[n-1] = Adv_X24;
adv_species[n-1] = unit_test_rp::Adv_X24;
break;
case 25:
adv_species[n-1] = Adv_X25;
adv_species[n-1] = unit_test_rp::Adv_X25;
break;
case 26:
adv_species[n-1] = Adv_X26;
adv_species[n-1] = unit_test_rp::Adv_X26;
break;
case 27:
adv_species[n-1] = Adv_X27;
adv_species[n-1] = unit_test_rp::Adv_X27;
break;
case 28:
adv_species[n-1] = Adv_X28;
adv_species[n-1] = unit_test_rp::Adv_X28;
break;
case 29:
adv_species[n-1] = Adv_X29;
adv_species[n-1] = unit_test_rp::Adv_X29;
break;
case 30:
adv_species[n-1] = Adv_X30;
adv_species[n-1] = unit_test_rp::Adv_X30;
break;
case 31:
adv_species[n-1] = Adv_X31;
adv_species[n-1] = unit_test_rp::Adv_X31;
break;
case 32:
adv_species[n-1] = Adv_X32;
adv_species[n-1] = unit_test_rp::Adv_X32;
break;
case 33:
adv_species[n-1] = Adv_X33;
adv_species[n-1] = unit_test_rp::Adv_X33;
break;
case 34:
adv_species[n-1] = Adv_X34;
adv_species[n-1] = unit_test_rp::Adv_X34;
break;
case 35:
adv_species[n-1] = Adv_X35;
adv_species[n-1] = unit_test_rp::Adv_X35;
break;
default:
amrex::Error("invalid species");
Expand All @@ -179,13 +177,13 @@ void burn_cell_c()
switch (n) {

case 1:
adv_aux[n-1] = Adv_Aux1;
adv_aux[n-1] = unit_test_rp::Adv_Aux1;
break;
case 2:
adv_aux[n-1] = Adv_Aux2;
adv_aux[n-1] = unit_test_rp::Adv_Aux2;
break;
case 3:
adv_aux[n-1] = Adv_Aux3;
adv_aux[n-1] = unit_test_rp::Adv_Aux3;
break;
default:
amrex::Error("invalid aux component");
Expand All @@ -198,9 +196,9 @@ void burn_cell_c()
// Echo initial conditions at burn and fill burn state input

std::cout << "Maximum Time (s): " << tmax << std::endl;
std::cout << "State Density (g/cm^3): " << density << std::endl;
std::cout << "State Temperature (K): " << temperature << std::endl;
std::cout << "State rhoe (erg/cm^3): " << rhoe << std::endl;
std::cout << "State Density (g/cm^3): " << unit_test_rp::density << std::endl;
std::cout << "State Temperature (K): " << unit_test_rp::temperature << std::endl;
std::cout << "State rhoe (erg/cm^3): " << unit_test_rp::rhoe << std::endl;

for (int n = 0; n < NumSpec; ++n) {
std::cout << "Mass Fraction (" << short_spec_names_cxx[n] << "): " << massfractions[n] << std::endl;
Expand Down
6 changes: 2 additions & 4 deletions unit_test/eos_cell/eos_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <iostream>
#include <react_util.H>

using namespace unit_test_rp;

AMREX_INLINE
void eos_cell_c()
{
Expand All @@ -17,8 +15,8 @@ void eos_cell_c()

// Set mass fractions to sanitize inputs for them
amrex::Real massfractions[NumSpec];
for (int n = 0; n < NumSpec; ++n) {
massfractions[n] = -1.0e0_rt;
for (double &X : massfractions) {
X = -1.0e0_rt;
}

// Make sure user set all the mass fractions to values in the interval [0, 1]
Expand Down
12 changes: 5 additions & 7 deletions unit_test/test_conductivity/conductivity_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
#include <network.H>
#include <eos.H>
#include <conductivity.H>
#include <extern_parameters.H>

#include <cmath>

using namespace amrex::literals;
using namespace unit_test_rp;

void cond_test_C(const amrex::Box& bx,
const amrex::Real dlogrho, const amrex::Real dlogT, const amrex::Real dmetal,
const plot_t& vars,
Expand All @@ -32,16 +30,16 @@ void cond_test_C(const amrex::Box& bx,

eos_extra_t eos_state;

for (int n = 0; n < NumSpec; n++) {
eos_state.xn[n] = metalicity/(NumSpec - 2);
for (double& X : eos_state.xn) {
X = metalicity / static_cast<amrex::Real>(NumSpec - 2);
}
eos_state.xn[ih1] = 0.75 - 0.5*metalicity;
eos_state.xn[ihe4] = 0.25 - 0.5*metalicity;

amrex::Real temp_zone = std::pow(10.0, std::log10(temp_min) + static_cast<amrex::Real>(j)*dlogT);
amrex::Real temp_zone = std::pow(10.0, std::log10(unit_test_rp::temp_min) + static_cast<amrex::Real>(j)*dlogT);
eos_state.T = temp_zone;

amrex::Real dens_zone = std::pow(10.0, std::log10(dens_min) + static_cast<amrex::Real>(i)*dlogrho);
amrex::Real dens_zone = std::pow(10.0, std::log10(unit_test_rp::dens_min) + static_cast<amrex::Real>(i)*dlogrho);
eos_state.rho = dens_zone;

// store default state
Expand Down
10 changes: 4 additions & 6 deletions unit_test/test_conductivity/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ using namespace amrex;

#include <unit_test.H>

using namespace unit_test_rp;

int main (int argc, char* argv[])
{
amrex::Initialize(argc, argv);
Expand Down Expand Up @@ -95,7 +93,7 @@ void main_main ()

init_unit_test();

eos_init(small_temp, small_dens);
eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens);
network_init();
conductivity_init();

Expand Down Expand Up @@ -130,9 +128,9 @@ void main_main ()
Real dmetal = 0.0e0_rt;

if (n_cell > 1) {
dlogrho = (std::log10(dens_max) - std::log10(dens_min))/(n_cell - 1);
dlogT = (std::log10(temp_max) - std::log10(temp_min))/(n_cell - 1);
dmetal = (metalicity_max - 0.0)/(n_cell - 1);
dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min))/(n_cell - 1);
dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min))/(n_cell - 1);
dmetal = (unit_test_rp::metalicity_max - 0.0)/(n_cell - 1);
}

// Initialize the state and compute the different thermodynamics
Expand Down
1 change: 0 additions & 1 deletion unit_test/test_jac/jac_zones.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <burner.H>
#include <extern_parameters.H>
#include <ArrayUtilities.H>
#include <variables.H>
#include <numerical_jacobian.H>

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
Expand Down
10 changes: 4 additions & 6 deletions unit_test/test_neutrino_cooling/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ using namespace amrex;
#include <cmath>
#include <unit_test.H>

using namespace unit_test_rp;

int main (int argc, char* argv[])
{
amrex::Initialize(argc, argv);
Expand Down Expand Up @@ -96,7 +94,7 @@ void main_main ()

init_unit_test();

eos_init(small_temp, small_dens);
eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens);

network_init();

Expand Down Expand Up @@ -129,9 +127,9 @@ void main_main ()
Real dmetal = 0.0e0_rt;

if (n_cell > 1) {
dlogrho = (std::log10(dens_max) - std::log10(dens_min)) / static_cast<Real>(n_cell - 1);
dlogT = (std::log10(temp_max) - std::log10(temp_min))/ static_cast<Real>(n_cell - 1);
dmetal = (metalicity_max - 0.0_rt)/ static_cast<Real>(n_cell - 1);
dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min)) / static_cast<Real>(n_cell - 1);
dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min))/ static_cast<Real>(n_cell - 1);
dmetal = (unit_test_rp::metalicity_max - 0.0_rt)/ static_cast<Real>(n_cell - 1);
}

// Initialize the state and compute the different thermodynamics
Expand Down
10 changes: 5 additions & 5 deletions unit_test/test_neutrino_cooling/neutrino_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#include <variables.H>
#include <network.H>
#include <eos.H>
#include <extern_parameters.H>

#include <sneut5.H>

#include <cmath>

using namespace amrex;
using namespace unit_test_rp;

void neut_test_C(const Box& bx,
const Real dlogrho, const Real dlogT, const Real dmetal,
Expand Down Expand Up @@ -43,15 +43,15 @@ void neut_test_C(const Box& bx,
// for now... the screening using 1-based indexing
Array1D<Real, 1, NumSpec> ymass;

for (int n = 0; n < NumSpec; n++) {
xn[n] = metalicity / static_cast<Real>(NumSpec - 2);
for (double& X : xn) {
X = metalicity / static_cast<Real>(NumSpec - 2);
}
xn[ih1] = 0.75_rt - 0.5_rt * metalicity;
xn[ihe4] = 0.25_rt - 0.5_rt * metalicity;

Real temp_zone = std::pow(10.0, std::log10(temp_min) + static_cast<Real>(j)*dlogT);
Real temp_zone = std::pow(10.0, std::log10(unit_test_rp::temp_min) + static_cast<Real>(j)*dlogT);

Real dens_zone = std::pow(10.0, std::log10(dens_min) + static_cast<Real>(i)*dlogrho);
Real dens_zone = std::pow(10.0, std::log10(unit_test_rp::dens_min) + static_cast<Real>(i)*dlogrho);

// store default state
sp(i, j, k, vars.irho) = dens_zone;
Expand Down

0 comments on commit ca3156b

Please sign in to comment.