From 6e52378cb3ef03ec619214a8f63a67719f409a5e Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 24 Jun 2024 12:42:53 -0400 Subject: [PATCH] some cppcheck fixes (#2852) --- Source/driver/Castro.H | 4 ++-- Source/driver/Castro.cpp | 8 ++++---- Source/driver/Castro_util.H | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/driver/Castro.H b/Source/driver/Castro.H index 8f0f59a88a..30976c248d 100644 --- a/Source/driver/Castro.H +++ b/Source/driver/Castro.H @@ -522,7 +522,7 @@ public: /// @param state MultiFab to check /// @param check_ghost do we check the ghost cells? /// - static void check_for_nan(amrex::MultiFab& state, int check_ghost=0); + static void check_for_nan(const amrex::MultiFab& state, int check_ghost=0); #include @@ -1138,7 +1138,7 @@ public: /// @param S Current state /// @param time current time /// - void define_new_center (amrex::MultiFab& S, amrex::Real time); + void define_new_center (const amrex::MultiFab& S, amrex::Real time); void write_center (); /// diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index b458f477f2..d79f4d4935 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -2782,8 +2782,8 @@ Castro::reflux (int crse_level, int fine_level, bool in_post_timestep) // Update the flux register now that we may have modified some of the flux corrections. for (OrientationIter fi; fi.isValid(); ++fi) { - FabSet& fs = (*reg)[fi()]; if (fi().coordDir() == idir) { + FabSet& fs = (*reg)[fi()]; fs.copyFrom(temp_fluxes[idir], 0, 0, 0, temp_fluxes[idir].nComp()); } } @@ -3551,7 +3551,7 @@ Castro::apply_tagging_restrictions(TagBoxArray& tags, [[maybe_unused]] Real time { bool outer_boundary_test[3] = {false}; - int idx[3] = {i, j, k}; + const int idx[3] = {i, j, k}; for (int dim = 0; dim < AMREX_SPACEDIM; ++dim) { @@ -4239,7 +4239,7 @@ Castro::get_numpts () } void -Castro::define_new_center(MultiFab& S, Real time) +Castro::define_new_center(const MultiFab& S, Real time) { BL_PROFILE("Castro::define_new_center()"); @@ -4428,7 +4428,7 @@ Castro::expand_state(MultiFab& S, Real time, int ng) void -Castro::check_for_nan(MultiFab& state_in, int check_ghost) +Castro::check_for_nan(const MultiFab& state_in, int check_ghost) { BL_PROFILE("Castro::check_for_nan()"); diff --git a/Source/driver/Castro_util.H b/Source/driver/Castro_util.H index 032278edeb..4202132493 100644 --- a/Source/driver/Castro_util.H +++ b/Source/driver/Castro_util.H @@ -97,9 +97,9 @@ void position(int i, int j, int k, // Given 3D indices (i,j,k), return the cell-centered spatial position. // Optionally we can also be edge-centered in any of the directions. - int idx[3] = {i, j, k}; + const int idx[3] = {i, j, k}; - bool cc[3] = {ccx, ccy, ccz}; + const bool cc[3] = {ccx, ccy, ccz}; Real offset[AMREX_SPACEDIM];