Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Jun 20, 2023
1 parent 97553d7 commit 779be96
Show file tree
Hide file tree
Showing 21 changed files with 189 additions and 213 deletions.
2 changes: 2 additions & 0 deletions Src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ foreach(D IN LISTS AMReX_SPACEDIM)
Parser/amrex_iparser.tab.cpp
Parser/amrex_iparser.tab.nolint.H
Parser/amrex_iparser.tab.h
# AMReX Hydro -----------------------------------------------------
AMReX_Slopes_K.H
# Forward declaration -----------------------------------------------------
AMReX_BaseFwd.H
)
Expand Down
6 changes: 3 additions & 3 deletions Src/EB/AMReX_EBFluxRegister.H
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ public:

// If we are not doing re-redistribution we don't need dm
void FineAdd (const MFIter& mfi,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& flux,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& a_flux,
const Real* dx, Real dt,
const FArrayBox& volfrac,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& areafrac,
RunOn runon);

// If we are doing re-redistribution we add dm to the solution
void FineAdd (const MFIter& mfi,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& flux,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& a_flux,
const Real* dx, Real dt,
const FArrayBox& volfrac,
const FArrayBox& vfrac,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& areafrac,
const FArrayBox& dm,
RunOn runon);
Expand Down
57 changes: 20 additions & 37 deletions Src/EB/AMReX_EB_Redistribution.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,28 @@
#include <AMReX_MultiCutFab.H>
#include <AMReX_EB2.H>

namespace amrex {

#ifdef AMREX_USE_FLOAT
constexpr amrex::Real eb_covered_val = amrex::Real(1.e20);
static constexpr amrex::Real eb_covered_val = amrex::Real(1.e20);
#else
constexpr amrex::Real eb_covered_val = amrex::Real(1.e40);
static constexpr amrex::Real eb_covered_val = amrex::Real(1.e40);
#endif

namespace amrex {
#if (AMREX_SPACEDIM > 1)

void single_level_redistribute (amrex::MultiFab& div_tmp_in, amrex::MultiFab& div_out,
int div_comp, int ncomp, const amrex::Geometry& geom);

void single_level_weighted_redistribute (amrex::MultiFab& div_tmp_in, amrex::MultiFab& div_out,
const amrex::MultiFab& weights,
int div_comp, int ncomp, const amrex::Geometry& geom);

#if (__cplusplus >= 201402L)
[[deprecated]]
#endif
inline void single_level_redistribute (int lev, amrex::MultiFab& div_tmp_in, amrex::MultiFab& div_out,
int div_comp, int ncomp, const amrex::Vector<amrex::Geometry>& geom)
{ single_level_redistribute(div_tmp_in, div_out, div_comp, ncomp, geom[lev]); }

#if (__cplusplus >= 201402L)
[[deprecated]]
#endif
inline void single_level_weighted_redistribute (int lev, amrex::MultiFab& div_tmp_in, amrex::MultiFab& div_out,
const amrex::MultiFab& weights, int div_comp, int ncomp,
const amrex::Vector<amrex::Geometry>& geom)
{ single_level_weighted_redistribute(div_tmp_in, div_out, weights, div_comp, ncomp, geom[lev]); }

// Flux redistribution scheme for case where C/F interface does *not* cross EB
void apply_flux_redistribution ( const amrex::Box& bx,
amrex::Array4<amrex::Real > const& div,
amrex::Array4<amrex::Real const> const& divc,
amrex::Array4<amrex::Real const> const& wt,
int icomp, int ncomp,
amrex::Array4<amrex::EBCellFlag const> const& flags,
amrex::Array4<amrex::EBCellFlag const> const& flag_arr,
amrex::Array4<amrex::Real const> const& vfrac,
const amrex::Geometry & geom);

Expand All @@ -66,7 +50,6 @@ namespace amrex {
bool use_wts_in_divnc,
int level_mask_not_covered,
int icomp, int ncomp, amrex::Real dt);
}

// Interface to redistribution schemes that only calls single-level routines
void ApplyRedistribution ( amrex::Box const& bx, int ncomp,
Expand All @@ -82,11 +65,11 @@ namespace amrex {
AMREX_D_DECL(amrex::Array4<amrex::Real const> const& fcx,
amrex::Array4<amrex::Real const> const& fcy,
amrex::Array4<amrex::Real const> const& fcz),
amrex::Array4<amrex::Real const> const& ccent,
amrex::Array4<amrex::Real const> const& ccc,
amrex::BCRec const* d_bcrec_ptr,
amrex::Geometry const& geom,
amrex::Real dt, std::string redistribution_type,
const int srd_max_order = 2,
amrex::Geometry const& lev_geom,
amrex::Real dt, std::string const& redistribution_type,
int srd_max_order = 2,
amrex::Real target_volfrac = 0.5,
amrex::Array4<amrex::Real const> const& update_scale={});

Expand All @@ -108,7 +91,7 @@ namespace amrex {
amrex::Array4<amrex::Real const> const& ccc,
amrex::BCRec const* d_bcrec_ptr,
amrex::Geometry const& lev_geom, amrex::Real dt,
std::string redistribution_type,
std::string const& redistribution_type,
int as_crse,
amrex::Array4<amrex::Real > const& rr_drho_crse,
amrex::Array4<int const> const& rr_flag_crse,
Expand All @@ -118,7 +101,7 @@ namespace amrex {
int level_mask_not_covered,
bool use_wts_in_divnc = false,
int icomp = 0,
const int srd_max_order = 2,
int srd_max_order = 2,
amrex::Real target_volfrac = 0.5,
amrex::Array4<amrex::Real const> const& update_scale={});

Expand All @@ -134,15 +117,15 @@ namespace amrex {
AMREX_D_DECL(amrex::Array4<amrex::Real const> const& fcx,
amrex::Array4<amrex::Real const> const& fcy,
amrex::Array4<amrex::Real const> const& fcz),
amrex::Array4<amrex::Real const> const& ccent,
amrex::Array4<amrex::Real const> const& ccc,
amrex::BCRec const* d_bcrec_ptr,
amrex::Geometry& geom, std::string redistribution_type,
const int srd_max_order = 2,
amrex::Geometry const& geom, std::string const& redistribution_type,
int srd_max_order = 2,
amrex::Real target_volfrac = 0.5);

void StateRedistribute ( amrex::Box const& bx, int ncomp,
amrex::Array4<amrex::Real> const& dUdt_out,
amrex::Array4<amrex::Real> const& dUdt_in,
amrex::Array4<amrex::Real> const& U_out,
amrex::Array4<amrex::Real> const& U_in,
amrex::Array4<amrex::EBCellFlag const> const& flag,
amrex::Array4<amrex::Real const> const& vfrac,
AMREX_D_DECL(amrex::Array4<amrex::Real const> const& fcx,
Expand All @@ -156,7 +139,7 @@ namespace amrex {
amrex::Array4<amrex::Real const> const& nbhd_vol,
amrex::Array4<amrex::Real const> const& cent_hat,
amrex::Geometry const& geom,
const int max_order = 2);
int max_order = 2);

void MakeITracker ( amrex::Box const& bx,
AMREX_D_DECL(amrex::Array4<amrex::Real const> const& apx,
Expand All @@ -173,12 +156,12 @@ namespace amrex {
amrex::Array4<amrex::Real const> const& ccent,
amrex::Array4< int const> const& itracker,
amrex::Array4<amrex::Real> const& nrs,
amrex::Array4<amrex::Real> const& nbhd_vol,
amrex::Array4<amrex::Real> const& alpha,
amrex::Array4<amrex::Real> const& nbhd_vol,
amrex::Array4<amrex::Real> const& cent_hat,
amrex::Geometry const& geom,
amrex::Real target_volfrac);

#endif
/** @} */
}

#endif
17 changes: 9 additions & 8 deletions Src/EB/AMReX_EB_RedistributionApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <AMReX_EB_Redistribution.H>
#include <AMReX_EB_utils.H>

using namespace amrex;
namespace amrex {

void ApplyRedistribution ( Box const& bx, int ncomp,
Array4<Real > const& dUdt_out,
Expand All @@ -25,8 +25,8 @@ void ApplyRedistribution ( Box const& bx, int ncomp,
Array4<Real const> const& ccc,
amrex::BCRec const* d_bcrec_ptr,
Geometry const& lev_geom, Real dt,
std::string redistribution_type,
const int srd_max_order,
std::string const& redistribution_type,
int srd_max_order,
amrex::Real target_volfrac,
Array4<Real const> const& srd_update_scale)
{
Expand Down Expand Up @@ -179,7 +179,7 @@ ApplyMLRedistribution ( Box const& bx, int ncomp,
Array4<Real const> const& ccc,
amrex::BCRec const* d_bcrec_ptr,
Geometry const& lev_geom, Real dt,
std::string redistribution_type,
std::string const& redistribution_type,
int as_crse,
Array4<Real > const& rr_drho_crse,
Array4<int const> const& rr_flag_crse,
Expand All @@ -189,7 +189,7 @@ ApplyMLRedistribution ( Box const& bx, int ncomp,
int level_mask_not_covered,
bool use_wts_in_divnc,
int icomp,
const int srd_max_order,
int srd_max_order,
amrex::Real target_volfrac,
Array4<Real const> const& srd_update_scale)
{
Expand Down Expand Up @@ -253,8 +253,8 @@ ApplyInitialRedistribution ( Box const& bx, int ncomp,
amrex::Array4<amrex::Real const> const& fcz),
amrex::Array4<amrex::Real const> const& ccc,
amrex::BCRec const* d_bcrec_ptr,
Geometry& lev_geom, std::string redistribution_type,
const int srd_max_order,
Geometry const& lev_geom, std::string const& redistribution_type,
int srd_max_order,
amrex::Real target_volfrac)
{
if (redistribution_type != "StateRedist") {
Expand Down Expand Up @@ -317,4 +317,5 @@ ApplyInitialRedistribution ( Box const& bx, int ncomp,
itr_const, nrs_const, alpha_const, nbhd_vol_const,
cent_hat_const, lev_geom, srd_max_order);
}
/** @} */

}
19 changes: 6 additions & 13 deletions Src/EB/AMReX_EB_Slopes_2D_K.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef HYDRO_EB_SLOPES_K_H_
#define HYDRO_EB_SLOPES_K_H_
#ifndef AMREX_HYDRO_EB_SLOPES_2D_K_H_
#define AMREX_HYDRO_EB_SLOPES_2D_K_H_

#include <AMReX_Config.H>
#include <AMReX_Slopes_K.H>
Expand All @@ -11,14 +11,8 @@
#include <AMReX_FArrayBox.H>
#endif


using namespace amrex::literals;

namespace {

#if (AMREX_SPACEDIM == 2)
#ifdef AMREX_USE_EB

// amrex_calc_slopes_eb calculates the slope in each coordinate direction using a
// least squares linear fit to the 8 nearest neighbors, with the function
// going through the centroid of cell(i,j,k). This does not assume that the cell centroids,
Expand Down Expand Up @@ -679,8 +673,10 @@ amrex::Real
amrex_calc_alpha_stencil(amrex::Real q_hat, amrex::Real q_max,
amrex::Real q_min, amrex::Real state, amrex::Real alpha) noexcept
{
amrex::Real alpha_temp = 0.0;
amrex::Real small = 1.0e-13;
using namespace amrex::literals;

auto alpha_temp = 0.0_rt;
auto small = 1.0e-13_rt;

if ((q_hat-state) > small) {
alpha_temp = amrex::min(1.0_rt,(q_max-state)/(q_hat-state));
Expand Down Expand Up @@ -890,8 +886,5 @@ amrex_lim_slopes_extdir_eb (int i, int j, int k, int n,
return {alpha_lim[0]*slopes[0],alpha_lim[1]*slopes[1]};
}

#endif
#endif

}
#endif
28 changes: 11 additions & 17 deletions Src/EB/AMReX_EB_Slopes_3D_K.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef HYDRO_EB_SLOPES_K_H_
#define HYDRO_EB_SLOPES_K_H_
#ifndef AMREX_HYDRO_EB_SLOPES_3D_K_H_
#define AMREX_HYDRO_EB_SLOPES_3D_K_H_

#include <AMReX_Config.H>
#include <AMReX_Slopes_K.H>
Expand All @@ -11,13 +11,8 @@
#include <AMReX_FArrayBox.H>
#endif

using namespace amrex::literals;

namespace {

#if (AMREX_SPACEDIM == 3)
#ifdef AMREX_USE_EB

// amrex_calc_slopes_eb calculates the slope in each coordinate direction using a
// least squares linear fit to the 26 nearest neighbors, with the function
// going through the centroid of cell(i,j,k). This does not assume that the cell centroids,
Expand Down Expand Up @@ -56,8 +51,8 @@ amrex_calc_slopes_eb_given_A (int i, int j, int k, int n,
amrex::Real Atb[AMREX_SPACEDIM];

for(int jj(0); jj<AMREX_SPACEDIM; ++jj){
for(int ii(0); ii<AMREX_SPACEDIM; ++ii){
AtA[ii][jj] = 0.0;
for(int ii(0); ii<AMREX_SPACEDIM; ++ii){ // NOLINT(modernize-loop-convert)
AtA[jj][ii] = 0.0;
}
Atb[jj] = 0.0;
}
Expand Down Expand Up @@ -135,8 +130,8 @@ amrex_calc_slopes_eb_given_A_grown (int i, int j, int k, int n, int nx, int ny,
amrex::Real Atb[AMREX_SPACEDIM];

for(int jj(0); jj<AMREX_SPACEDIM; ++jj){
for(int ii(0); ii<AMREX_SPACEDIM; ++ii){
AtA[ii][jj] = 0.0;
for(int ii(0); ii<AMREX_SPACEDIM; ++ii){ // NOLINT(modernize-loop-convert)
AtA[jj][ii] = 0.0;
}
Atb[jj] = 0.0;
}
Expand Down Expand Up @@ -824,8 +819,10 @@ amrex::Real
amrex_calc_alpha_stencil(amrex::Real q_hat, amrex::Real q_max,
amrex::Real q_min, amrex::Real state, amrex::Real alpha) noexcept
{
amrex::Real alpha_temp = amrex::Real(0.0);
amrex::Real small = amrex::Real(1.0e-13);
using namespace amrex::literals;

auto alpha_temp = amrex::Real(0.0);
auto small = amrex::Real(1.0e-13);

if ((q_hat-state) > small) {
alpha_temp = amrex::min(1.0_rt,(q_max-state)/(q_hat-state));
Expand All @@ -848,7 +845,7 @@ amrex_calc_alpha_limiter(int i, int j, int k, int n,
amrex::Array4<amrex::Real const> const& fcz,
amrex::Array4<amrex::Real const> const& ccent) noexcept
{
amrex::Real alpha = amrex::Real(2.0);
auto alpha = amrex::Real(2.0);

int cuts_x = 0; int cuts_y = 0; int cuts_z = 0;

Expand Down Expand Up @@ -1128,8 +1125,5 @@ amrex_lim_slopes_extdir_eb (int i, int j, int k, int n,
return {alpha_lim[0]*slopes[0],alpha_lim[1]*slopes[1],alpha_lim[2]*slopes[2]};
}

#endif
#endif

}
#endif
7 changes: 5 additions & 2 deletions Src/EB/AMReX_EB_StateRedistItracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <AMReX_EB_Redistribution.H>

using namespace amrex;
namespace amrex {

#if (AMREX_SPACEDIM == 2)

Expand Down Expand Up @@ -216,6 +216,7 @@ MakeITracker ( Box const& bx,
}
});
}

#elif (AMREX_SPACEDIM == 3)

void
Expand Down Expand Up @@ -704,5 +705,7 @@ MakeITracker ( Box const& bx,
}
});
}

#endif
/** @} */

}
Loading

0 comments on commit 779be96

Please sign in to comment.