diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..2ab8a4f --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,43 @@ +Checks: > + -*, + bugprone-*, + -bugprone-easily-swappable-parameters, + clang-analyzer-*, + clang-diagnostic-*, + cppcoreguidelines-*, + -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-init-variables, + -cppcoreguidelines-interfaces-global-init, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-pro-*, + misc-*, + -misc-const-correctness, + -misc-include-cleaner, + -misc-non-private-member-variables-in-classes, + -misc-use-anonymous-namespace, + modernize-*, + -modernize-avoid-c-arrays, + -modernize-use-trailing-return-type, + performance-*, + -performance-avoid-endl, + portability-*, + readability-*, + -readability-avoid-const-params-in-decls, + -readability-braces-around-statements, + -readability-else-after-return, + -readability-function-cognitive-complexity, + -readability-function-size, + -readability-identifier-length, + -readability-implicit-bool-conversion, + -readability-isolate-declaration, + -readability-magic-numbers, + -readability-named-parameter, + -readability-simplify-boolean-expr, + mpi-*, + openmp-* + +HeaderFilterRegex: '(/source/*/|^\./|^./tmp_build_dir/microphysics_sources/*/).*\.H$' \ No newline at end of file diff --git a/.codespell-ignore-words b/.codespell-ignore-words new file mode 100644 index 0000000..25908b2 --- /dev/null +++ b/.codespell-ignore-words @@ -0,0 +1,15 @@ +blocs +bloc +inout +pres +bion +tye +delt +thi +daa +numer +clen +coul +dum +crate +vie diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..ec1149d --- /dev/null +++ b/.codespellrc @@ -0,0 +1,5 @@ +[codespell] +skip = .git,*.ipynb,*.bib,*.ps,*~ +ignore-words = .codespell-ignore-words + + diff --git a/.github/workflows/check_powi.py b/.github/workflows/check_powi.py new file mode 100644 index 0000000..686a826 --- /dev/null +++ b/.github/workflows/check_powi.py @@ -0,0 +1,78 @@ +import subprocess +import sys +import os +import re + + +def pow_to_powi(text): + # Finds all possible std::pow(x, n) or gcem::pow(x, n) + # where n is a potential integer to amrex::Math::powi(x) + + # Check for all positive and negative integer, whole float numbers + # with and without _rt + match_pattern = r"([^,]+),\s*(-?(?:\d+\.0*_rt?|\d))" + + # Match fails when there is a nested pow, so only inner most pow is matched + negate_pattern = r"(?![\s\S]*(?:std|gcem)::pow\((?:[^,]+),\s*(?:-?(?:\d+\.0*_rt?|\d))\))" + + # Final pattern + pattern = rf"(?:std|gcem)::pow\({negate_pattern}{match_pattern}\)" + # pattern = rf"(?:std|gcem)::pow\((?![\s\S]*(?:std|gcem)::pow\((?:[^,]+),\s*(?:-?(?:\d+\.0*_rt?|\d))\))([^,]+),\s*(-?(?:\d+\.0*_rt?|\d))\)" + + def replacement(match): + x = match.group(1) + n = match.group(2) + + # Only extracts out the integer part before decimal point + n = n.split('.')[0] if '.' in n else n + return f"amrex::Math::powi<{n}>({x})" + + text = re.sub(pattern, replacement, text) + return text + +def process_content(dir_path): + # This function processes all text in the given directory + for root, dirs, filenames in os.walk(dir_path): + for filename in filenames: + if filename.endswith(".H") or filename.endswith(".cpp"): + filepath = os.path.join(root, filename) + + with open(filepath, 'r') as file: + old_content = file.read() + + # Iterate over content until content is the same + # This is used to get rid of potential nested pow + new_content = pow_to_powi(old_content) + while new_content != old_content: + old_content = new_content + new_content = pow_to_powi(old_content) + + with open(filepath, 'w') as file: + file.write(new_content) + +def git_diff(): + # Run git diff to see if there are any changes made + + git_diff_output = subprocess.run(['git', 'diff', '--color=always'], + capture_output=True, text=True) + + # Print out suggested change and raise error after detecting modification + if git_diff_output.stdout: + print("Detected potential usage to replace std::pow" + + "with integer powers via amrex::Math::powi\n") + print("Below are the suggested change:\n") + print(git_diff_output.stdout) + + raise RuntimeError("Changes detected after modification") + +if __name__ == '__main__': + + # Get directory paths + directory_paths = sys.argv[1:] + + # Modify the std::pow -> amrex::Math::powi if needed + for dir_path in directory_paths: + process_content(dir_path) + + # Give suggested change if there are any modifications made + git_diff() diff --git a/.github/workflows/check_powi.yml b/.github/workflows/check_powi.yml new file mode 100644 index 0000000..e185037 --- /dev/null +++ b/.github/workflows/check_powi.yml @@ -0,0 +1,26 @@ +name: check powi + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + check-ifdefs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: "pip" + + - name: Run check_powi + run: | + python .github/workflows/check_powi.py . diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 0000000..c3c4ae7 --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,61 @@ +name: "clang-tidy" + +on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + clang_tidy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Get AMReX + run: | + mkdir external + cd external + git clone https://github.com/AMReX-Codes/amrex.git + cd amrex + git checkout development + echo 'AMREX_HOME=$(GITHUB_WORKSPACE)/external/amrex' >> $GITHUB_ENV + echo $AMREX_HOME + if [[ -n "${AMREX_HOME}" ]]; then exit 1; fi + cd ../.. + + - name: Get Microphysics + run: | + cd external + git clone https://github.com/AMReX-Astro/Microphysics.git + cd Microphysics + git checkout development + echo 'MICROPHYSICS_HOME=$(GITHUB_WORKSPACE)/external/Microphysics' >> $GITHUB_ENV + echo $MICROPHYSICS_HOME + if [[ -n "${MICROPHYSICS_HOME}" ]]; then exit 1; fi + cd ../.. + + - name: Install dependencies + run: | + .github/workflows/dependencies_clang-tidy-apt-llvm.sh 17 + + - name: Compile convective_grad + run: | + cd source/convective_grad + make USE_MPI=FALSE USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-17 CLANG_TIDY_WARN_ERROR=TRUE -j 4 + + - name: Compile eos_demo + run: | + cd source/eos_demo + make USE_MPI=FALSE USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-17 CLANG_TIDY_WARN_ERROR=TRUE -j 4 + + - name: Compile fluxes + run: | + cd source/fluxes + make USE_MPI=FALSE USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-17 CLANG_TIDY_WARN_ERROR=TRUE -j 4 + + - name: Compile max_enuc + run: | + cd source/max_enuc + make USE_MPI=FALSE USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-17 CLANG_TIDY_WARN_ERROR=TRUE -j 4 + diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..f8d4f26 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,30 @@ +name: codespell + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + codespell: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: "pip" + + - name: Install dependencies + run: pip install codespell + + - name: Run codespell + run: | + codespell + diff --git a/.github/workflows/dependencies_clang-tidy-apt-llvm.sh b/.github/workflows/dependencies_clang-tidy-apt-llvm.sh new file mode 100755 index 0000000..b64cd61 --- /dev/null +++ b/.github/workflows/dependencies_clang-tidy-apt-llvm.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -eu -o pipefail + +# `man apt.conf`: +# Number of retries to perform. If this is non-zero APT will retry +# failed files the given number of times. +echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries + +if [[ ! -f /etc/apt/trusted.gpg.d/apt.llvm.org.asc ]]; then + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc +fi + +source /etc/os-release # set UBUNTU_CODENAME + +sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME} main" +sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-$1 main" + +sudo apt-get update + +sudo apt-get install -y --no-install-recommends \ + clang-tidy-$1 libomp-$1-dev diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 0000000..5b5af5e --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,22 @@ +name: Style + +on: [push, pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-style + cancel-in-progress: true + +jobs: + tabs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Tabs + run: .github/workflows/style/check_tabs.sh + + trailing_whitespaces: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Trailing Whitespaces + run: .github/workflows/style/check_trailing_whitespaces.sh diff --git a/.github/workflows/style/check_tabs.sh b/.github/workflows/style/check_tabs.sh new file mode 100755 index 0000000..f441864 --- /dev/null +++ b/.github/workflows/style/check_tabs.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -eu -o pipefail + +find . -type d \( -name .git \ + -o -path ./paper \ + -o -name build -o -name install \ + -o -name tmp_build_dir -o -name tmp_install_dir \ + \) -prune -o \ + -type f \( \( -name "*.H" -o -name "*.h" -o -name "*.hh" -o -name "*.hpp" \ + -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.cxx" \ + -o -name "*.f" -o -name "*.F" -o -name "*.f90" -o -name "*.F90" \ + -o -name "*.py" \ + -o -name "*.md" -o -name "*.rst" \ + -o -name "*.sh" \ + -o -name "*.tex" \ + -o -name "*.txt" \ + -o -name "*.yml" \) \ + -a \( ! -name "*.tab.h" -a ! -name "*.tab.nolint.H" \ + -a ! -name "*.lex.h" -a ! -name "*.lex.nolint.H" \) \ + \) \ + -exec grep -Iq . {} \; \ + -exec sed -i 's/\t/\ \ \ \ /g' {} + + +gitdiff=`git diff` + +if [ -z "$gitdiff" ] +then + exit 0 +else + echo -e "\nTabs are not allowed. Changes suggested by" + echo -e " ${0}\n" + git --no-pager diff + echo "" + exit 1 +fi diff --git a/.github/workflows/style/check_trailing_whitespaces.sh b/.github/workflows/style/check_trailing_whitespaces.sh new file mode 100755 index 0000000..b33b62c --- /dev/null +++ b/.github/workflows/style/check_trailing_whitespaces.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -eu -o pipefail + +find . -type d \( -name .git \ + -o -path ./paper \ + -o -name build -o -name install \ + -o -name tmp_build_dir -o -name tmp_install_dir \ + -o -path ./util/gcem \ + \) -prune -o \ + -type f \( \( -name "*.H" -o -name "*.h" -o -name "*.hh" -o -name "*.hpp" \ + -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.cxx" \ + -o -name "*.f" -o -name "*.F" -o -name "*.f90" -o -name "*.F90" \ + -o -name "*.py" \ + -o -name "*.rst" \ + -o -name "*.sh" \ + -o -name "*.tex" \ + -o -name "*.txt" \ + -o -name "*.yml" \) \ + -a \( ! -name "*.tab.h" -a ! -name "*.tab.nolint.H" \ + -a ! -name "*.lex.h" -a ! -name "*.lex.nolint.H" \ + -a ! -path "./networks/*/reaclib_rates.H" \) \ + \) \ + -exec grep -Iq . {} \; \ + -exec sed -i 's/[[:blank:]]\+$//g' {} + + +gitdiff=`git diff` + +if [ -z "$gitdiff" ] +then + exit 0 +else + echo -e "\nTrailing whitespaces at the end of a line are not allowed. Changes suggested by" + echo -e " ${0}\n" + git --no-pager diff + echo "" + exit 1 +fi diff --git a/license.txt b/license.txt index c2ed7ea..588e92b 100644 --- a/license.txt +++ b/license.txt @@ -1,7 +1,7 @@ SOURCE CODE LICENSE AGREEMENT -Castro, Copyright (c) 2015, -The Regents of the University of California, -through Lawrence Berkeley National Laboratory +Castro, Copyright (c) 2015, +The Regents of the University of California, +through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved." diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/source/convective_grad/main.cpp b/source/convective_grad/main.cpp index ea128ed..a0bfcef 100644 --- a/source/convective_grad/main.cpp +++ b/source/convective_grad/main.cpp @@ -23,7 +23,6 @@ using namespace amrex; void main_main() { - const int narg = amrex::command_argument_count(); std::string pltfile(diag_rp::plotfile); @@ -110,7 +109,7 @@ void main_main() // output MultiFab - gmf[ilev].define(pf.boxArray(ilev), pf.DistributionMap(ilev), gvarnames.size(), 0); + gmf[ilev].define(pf.boxArray(ilev), pf.DistributionMap(ilev), static_cast(gvarnames.size()), 0); Vector bcr{bcr_default}; auto is_per = is_periodic; @@ -275,7 +274,7 @@ void main_main() } } else if (ndims == 2) { - // r is from x and y + // r is from x and y Real dp = (xpos / dx[0]) * (P(i+1,j,k) - P(i-1,j,k)) + (ypos / dx[1]) * (P(i,j+1,k) - P(i,j-1,k)); @@ -292,12 +291,12 @@ void main_main() // r is from x, y, and z Real dp = (xpos / dx[0]) * (P(i+1,j,k) - P(i-1,j,k)) + (ypos / dx[1]) * (P(i,j+1,k) - P(i,j-1,k)) - + (zpos / dx[2]) * (P(i,j,k+1) - P(i,j,k-1)); + + (zpos / dx[2]) * (P(i,j,k+1) - P(i,j,k-1)); if (dp != 0.0) { Real dT = (xpos / dx[0]) * (T(i+1,j,k) - T(i-1,j,k)) + (ypos / dx[1]) * (T(i,j+1,k) - T(i,j-1,k)) - + (zpos / dx[2]) * (T(i,j,k+1) - T(i,j,k-1)); + + (zpos / dx[2]) * (T(i,j,k+1) - T(i,j,k-1)); ga(i,j,k,0) = (dT / dp) * (P(i,j,k) / T(i,j,k)); @@ -408,9 +407,9 @@ void main_main() lnPalt_minus = std::log(eos_state.p); } else if (ndims ==2 ) { - // r is made of x and y + // r is made of x and y - // actual + // actual lnP_plus = (xpos / dx[0]) * std::log(P(i+1,j,k)) + (ypos / dx[1]) * std::log(P(i,j+1,k)); @@ -418,7 +417,7 @@ void main_main() + (ypos / dx[1]) * std::log(P(i,j-1,k)); //alternate - //plus - x + //plus - x for (int n = 0; n < NumSpec; ++n) { eos_state.xn[n] = X(i+1,j,k,n); } @@ -432,7 +431,7 @@ void main_main() eos(eos_input_rt, eos_state); lnPalt_plus += (ypos / dx[1]) * std::log(eos_state.p); - //minus - x + //minus - x for (int n = 0; n < NumSpec; ++n) { eos_state.xn[n] = X(i-1,j,k,n); } @@ -447,9 +446,9 @@ void main_main() lnPalt_minus += (ypos / dx[1]) * std::log(eos_state.p); } else { - // r is made of x, y and z + // r is made of x, y and z - // actual + // actual lnP_plus = (xpos / dx[0]) * std::log(P(i+1,j,k)) + (ypos / dx[1]) * std::log(P(i,j+1,k)) + (zpos / dx[2]) * std::log(P(i,j,k+1)); @@ -459,7 +458,7 @@ void main_main() + (zpos / dx[2]) * std::log(P(i,j,k-1)); //alternate - //plus - x + //plus - x for (int n = 0; n < NumSpec; ++n) { eos_state.xn[n] = X(i+1,j,k,n); } @@ -480,7 +479,7 @@ void main_main() eos(eos_input_rt, eos_state); lnPalt_plus += (zpos / dx[2]) * std::log(eos_state.p); - //minus - x + //minus - x for (int n = 0; n < NumSpec; ++n) { eos_state.xn[n] = X(i-1,j,k,n); } diff --git a/source/eos_demo/main.cpp b/source/eos_demo/main.cpp index 5787bdc..5866abc 100644 --- a/source/eos_demo/main.cpp +++ b/source/eos_demo/main.cpp @@ -45,17 +45,6 @@ int main(int argc, char* argv[]) int fine_level = pf.finestLevel(); const int dim = pf.spaceDim(); - // get the index bounds and dx. - - Box domain = pf.probDomain(fine_level); - int coord = pf.coordSys(); - - auto dx = pf.cellSize(fine_level); - - auto problo = pf.probLo(); - auto probhi = pf.probHi(); - - // find variable indices -- we want density, temperature, and species. // we will assume here that the species are contiguous, so we will find // the index of the first species @@ -74,8 +63,6 @@ int main(int argc, char* argv[]) for (int ilev = 0; ilev <= fine_level; ++ilev) { - Array dx_level = pf.cellSize(ilev); - if (ilev < fine_level) { IntVect ratio{pf.refRatio(ilev)}; for (int idim = dim; idim < AMREX_SPACEDIM; ++idim) { @@ -106,11 +93,6 @@ int main(int argc, char* argv[]) // compute the coordinate of the current zone - Array p - = {AMREX_D_DECL(problo[0]+static_cast(i+0.5)*dx_level[0], - problo[1]+static_cast(j+0.5)*dx_level[1], - problo[2]+static_cast(k+0.5)*dx_level[2])}; - eos_t eos_state; eos_state.rho = fab(i,j,k,dens_comp); @@ -147,11 +129,6 @@ int main(int argc, char* argv[]) for (int j = lo.y; j <= hi.y; ++j) { for (int i = lo.x; i <= hi.x; ++i) { - Array p - = {AMREX_D_DECL(problo[0]+static_cast(i+0.5)*dx_level[0], - problo[1]+static_cast(j+0.5)*dx_level[1], - problo[2]+static_cast(k+0.5)*dx_level[2])}; - eos_t eos_state; eos_state.rho = fab(i,j,k,dens_comp); diff --git a/source/fluxes/GNUmakefile b/source/fluxes/GNUmakefile index 984547f..5e64c9b 100644 --- a/source/fluxes/GNUmakefile +++ b/source/fluxes/GNUmakefile @@ -39,3 +39,6 @@ EXTERN_SEARCH += . .. USE_AMR_CORE = TRUE include $(MICROPHYSICS_HOME)/Make.Microphysics + +CLANG_TIDY_IGNORE_SOURCES += $(MICROPHYSICS_HOME) +CLANG_TIDY_CONFIG_FILE = ../../.clang-tidy diff --git a/source/fluxes/main.cpp b/source/fluxes/main.cpp index a478b7a..1e82846 100644 --- a/source/fluxes/main.cpp +++ b/source/fluxes/main.cpp @@ -31,7 +31,7 @@ get_vy_index(const std::vector& var_names_pf) { if (idx == var_names_pf.cend()) { amrex::Error("Error: could not find vely component"); } - return std::distance(var_names_pf.cbegin(), idx); + return static_cast(std::distance(var_names_pf.cbegin(), idx)); } inline int @@ -41,7 +41,7 @@ get_vz_index(const std::vector& var_names_pf) { if (idx == var_names_pf.cend()) { amrex::Error("Error: could not find velz component"); } - return std::distance(var_names_pf.cbegin(), idx); + return static_cast(std::distance(var_names_pf.cbegin(), idx)); } inline int @@ -51,12 +51,11 @@ get_dT_index(const std::vector& var_names_pf) { if (idx == var_names_pf.cend()) { amrex::Error("Error: could not find tpert component"); } - return std::distance(var_names_pf.cbegin(), idx); + return static_cast(std::distance(var_names_pf.cbegin(), idx)); } void main_main() { - const int narg = amrex::command_argument_count(); std::string pltfile(diag_rp::plotfile); @@ -84,7 +83,7 @@ void main_main() varnames = pf.varNames(); // find variable indices - // We want: + // We want: // density, temperature, pressure, species // vertical velocity, temperature perturbation // we will assume here that the species are contiguous, so we will find @@ -98,10 +97,12 @@ void main_main() int spec_comp = get_spec_index(var_names_pf); int dT_comp = get_dT_index(var_names_pf); - int v_comp = get_vy_index(var_names_pf); - if (ndims == 3) { + int v_comp{-1}; + if (ndims == 2) { + v_comp = get_vy_index(var_names_pf); + } else if (ndims == 3) { // z is the vertical - int v_comp = get_vz_index(var_names_pf); + v_comp = get_vz_index(var_names_pf); } // create the variable names we will derive and store in the output @@ -140,7 +141,7 @@ void main_main() // output MultiFab - gmf[ilev].define(pf.boxArray(ilev), pf.DistributionMap(ilev), gvarnames.size(), 0); + gmf[ilev].define(pf.boxArray(ilev), pf.DistributionMap(ilev), static_cast(gvarnames.size()), 0); Vector bcr{bcr_default}; auto is_per = is_periodic; @@ -325,17 +326,17 @@ void main_main() //Real Hp = -pres/(rho*g) // g is negative // Convective heat flux - ga(i,j,k,0) = rho * cp * vel * delT; + ga(i,j,k,0) = rho * cp * vel * delT; // Mixing-length heat flux // ga(i,j,k,1) = rho * cp * temp * pow(vel, 3) / (Q * g * Hp); - //ga(i,j,k,1) = pow(rho,2) * cp * temp * pow(vel,3) / (Q * pres); // doesnt require g + //ga(i,j,k,1) = pow(rho,2) * cp * temp * pow(vel,3) / (Q * pres); // doesn't require g ga(i,j,k,1) = pow(rho,2) * cp * temp * pow(std::abs(vel), 3) / (Q * pres); // using absolute value of velocity // Kinetic flux ga(i,j,k,2) = rho * pow(vel,3); - // Radiative flux + // Radiative flux // conductivity is k = 4*a*c*T^3/(kap*rho) // see Microphysics/conductivity/stellar/actual_conductivity.H ga(i,j,k,3) = -eos_state.conductivity * dT_dr; diff --git a/source/max_enuc/main.cpp b/source/max_enuc/main.cpp index 727ff43..6ddf627 100644 --- a/source/max_enuc/main.cpp +++ b/source/max_enuc/main.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -38,8 +37,6 @@ void main_main() return; } - int ntime = narg; - const std::string& filename = amrex::get_command_argument(farg); PlotFileData pf(filename); @@ -48,7 +45,7 @@ void main_main() // we need rho, T, X, and enuc - auto ienuc = std::distance(var_names_pf.cbegin(), std::find(var_names_pf.cbegin(), var_names_pf.cend(), "enuc")); + auto ienuc = static_cast(std::distance(var_names_pf.cbegin(), std::find(var_names_pf.cbegin(), var_names_pf.cend(), "enuc"))); int fine_level = pf.finestLevel();