Skip to content

Commit

Permalink
move some constant names to enums instead of static member data (#356)
Browse files Browse the repository at this point in the history
also some more clang tidy disabling
  • Loading branch information
zingale committed Feb 24, 2023
1 parent c2b9b3c commit 565abb0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-linter.yml
Expand Up @@ -30,7 +30,7 @@ jobs:
make_options: '-j 2 USE_OMP=FALSE USE_MPI=FALSE USE_CUDA=FALSE DIM=3 DEBUG=TRUE'
ignore_files: 'amrex|Microphysics'
header_filter: 'MAESTROeX'
checks: 'bugprone-*,performance-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*,readability-*,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index,-clang-diagnostic-unknown-warning-option,-clang-diagnostic-unknown-pragmas,-readability-avoid-const-params-in-decls,-cppcoreguidelines-owning-memory,-cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-cppcoreguidelines-avoid-non-const-global-variables'
checks: 'bugprone-*,performance-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*,readability-*,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index,-clang-diagnostic-unknown-warning-option,-clang-diagnostic-unknown-pragmas,-readability-avoid-const-params-in-decls,-cppcoreguidelines-owning-memory,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-avoid-non-const-global-variables'

- name: Archive clang tidy report
uses: actions/upload-artifact@v1
Expand Down
35 changes: 22 additions & 13 deletions Source/Maestro.H
Expand Up @@ -38,6 +38,28 @@ using RealVector = amrex::Vector<amrex::Real>;
using IntVector = amrex::Vector<int>;
#endif


// helpful enums for different options in the algorithm

// these represent the four types of nodal projections
enum projection_type {initial_projection_comp = 1,
divu_iters_comp,
pressure_iters_comp,
regular_timestep_comp};

enum species_pred {predict_rhoprime_and_X = 1,
predict_rhoX,
predict_rho_and_X};

enum enthalpy_pred {predict_rhoh = 0,
predict_rhohprime,
predict_h,
predict_T_then_rhohprime,
predict_T_then_h,
predict_hprime,
predict_Tprime_then_h};


// function called on GPU only
AMREX_GPU_DEVICE
amrex::Real QuadInterp(const amrex::Real x, const amrex::Real x0,
Expand Down Expand Up @@ -1878,19 +1900,6 @@ class Maestro : public amrex::AmrCore {
// these are defined in `VariableSetup()`
static int ng_s; //< number of ghost cells for `sold/new` and `uold/new`

// these are defined in `Maestro.cpp`
// these represent the four types of nodal projections
static int initial_projection_comp;
static int divu_iters_comp;
static int pressure_iters_comp;
static int regular_timestep_comp;

// these are defined in `Maestro.cpp`
// density and enthalpy edge state prediction
static int predict_rhoprime_and_X, predict_rhoX, predict_rho_and_X;
static int predict_rhoh, predict_rhohprime, predict_h;
static int predict_T_then_rhohprime, predict_T_then_h;
static int predict_hprime, predict_Tprime_then_h;

// these are defined in `Maestro.cpp`
static amrex::IntVect nodal_flag;
Expand Down
18 changes: 0 additions & 18 deletions Source/Maestro.cpp
Expand Up @@ -8,24 +8,6 @@ using namespace amrex;
// overwritten in VariableSetup()
int Maestro::ng_s = -1;

int Maestro::initial_projection_comp = 1;
int Maestro::divu_iters_comp = 2;
int Maestro::pressure_iters_comp = 3;
int Maestro::regular_timestep_comp = 4;

// species prediction
int Maestro::predict_rhoprime_and_X = 1;
int Maestro::predict_rhoX = 2;
int Maestro::predict_rho_and_X = 3;
// enthalpy prediction
int Maestro::predict_rhoh = 0;
int Maestro::predict_rhohprime = 1;
int Maestro::predict_h = 2;
int Maestro::predict_T_then_rhohprime = 3;
int Maestro::predict_T_then_h = 4;
int Maestro::predict_hprime = 5;
int Maestro::predict_Tprime_then_h = 6;

// helper IntVects used to define face/nodal MultiFabs
#if (AMREX_SPACEDIM == 2)
IntVect Maestro::nodal_flag(1, 1);
Expand Down

0 comments on commit 565abb0

Please sign in to comment.