Skip to content

Commit

Permalink
Style consistency (#1495)
Browse files Browse the repository at this point in the history
* take advantage of amrex namespace for style consistency

* fix oops

* fix another oops
  • Loading branch information
asalmgren authored Mar 13, 2024
1 parent 2e777a2 commit 9aa8d65
Show file tree
Hide file tree
Showing 56 changed files with 855 additions and 823 deletions.
6 changes: 3 additions & 3 deletions Source/BoundaryConditions/BoundaryConditions_bndryreg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ ERF::fill_from_bndryregs (const Vector<MultiFab*>& mfs, const Real time)
int lev = 0;
const Box& domain = geom[lev].Domain();

const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

amrex::Vector<std::unique_ptr<PlaneVector>>& bndry_data = m_r2d->interp_in_time(time);
Vector<std::unique_ptr<PlaneVector>>& bndry_data = m_r2d->interp_in_time(time);

// xlo: ori = 0
// ylo: ori = 1
Expand Down
26 changes: 13 additions & 13 deletions Source/BoundaryConditions/BoundaryConditions_cons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ void ERFPhysBCFunct::impose_lateral_cons_bcs (const Array4<Real>& dest_arr, cons
int icomp, int ncomp, int bccomp)
{
BL_PROFILE_VAR("impose_lateral_cons_bcs()",impose_lateral_cons_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

// xlo: ori = 0
// ylo: ori = 1
Expand All @@ -33,15 +33,15 @@ void ERFPhysBCFunct::impose_lateral_cons_bcs (const Array4<Real>& dest_arr, cons
// bccomp is used as starting index for m_domain_bcs_type
// 0 is used as starting index for bcrs
Vector<BCRec> bcrs(icomp+ncomp);
amrex::setBC(bx, domain, bccomp, 0, icomp+ncomp, m_domain_bcs_type, bcrs);
setBC(bx, domain, bccomp, 0, icomp+ncomp, m_domain_bcs_type, bcrs);

amrex::Gpu::DeviceVector<BCRec> bcrs_d(icomp+ncomp);
Gpu::DeviceVector<BCRec> bcrs_d(icomp+ncomp);
#ifdef AMREX_USE_GPU
Gpu::htod_memcpy_async(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*(icomp+ncomp));
#else
std::memcpy(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*(icomp+ncomp));
#endif
const amrex::BCRec* bc_ptr = bcrs_d.data();
const BCRec* bc_ptr = bcrs_d.data();

GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,AMREX_SPACEDIM+NVAR_max> l_bc_extdir_vals_d;
for (int i = 0; i < icomp+ncomp; i++)
Expand Down Expand Up @@ -176,8 +176,8 @@ void ERFPhysBCFunct::impose_vertical_cons_bcs (const Array4<Real>& dest_arr, con
int icomp, int ncomp, int bccomp)
{
BL_PROFILE_VAR("impose_lateral_cons_bcs()",impose_lateral_cons_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

GeometryData const& geomdata = m_geom.data();

Expand All @@ -192,15 +192,15 @@ void ERFPhysBCFunct::impose_vertical_cons_bcs (const Array4<Real>& dest_arr, con
// bccomp is used as starting index for m_domain_bcs_type
// 0 is used as starting index for bcrs
Vector<BCRec> bcrs(icomp+ncomp);
amrex::setBC(bx, domain, bccomp, 0, icomp+ncomp, m_domain_bcs_type, bcrs);
setBC(bx, domain, bccomp, 0, icomp+ncomp, m_domain_bcs_type, bcrs);

amrex::Gpu::DeviceVector<BCRec> bcrs_d(icomp+ncomp);
Gpu::DeviceVector<BCRec> bcrs_d(icomp+ncomp);
#ifdef AMREX_USE_GPU
Gpu::htod_memcpy_async(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*(icomp+ncomp));
#else
std::memcpy(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*(icomp+ncomp));
#endif
const amrex::BCRec* bc_ptr = bcrs_d.data();
const BCRec* bc_ptr = bcrs_d.data();

GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,AMREX_SPACEDIM+NVAR_max> l_bc_extdir_vals_d;
for (int i = 0; i < icomp+ncomp; i++)
Expand Down Expand Up @@ -273,8 +273,8 @@ void ERFPhysBCFunct::impose_vertical_cons_bcs (const Array4<Real>& dest_arr, con
}

if (m_z_phys_nd) {
const auto& bx_lo = amrex::lbound(bx);
const auto& bx_hi = amrex::ubound(bx);
const auto& bx_lo = lbound(bx);
const auto& bx_hi = ubound(bx);

// Neumann conditions (d<var>/dn = 0) must be aware of the surface normal with terrain.
// An additional source term arises from d<var>/dx & d<var>/dy & met_h_xi/eta/zeta.
Expand All @@ -285,7 +285,7 @@ void ERFPhysBCFunct::impose_vertical_cons_bcs (const Array4<Real>& dest_arr, con
// Hit for Neumann condition at kmin
if( bcrs[n].lo(2) == ERFBCType::foextrap) {
// Loop over ghost cells in bottom XY-plane (valid box)
amrex::Box xybx = bx;
Box xybx = bx;
xybx.setBig(2,dom_lo.z-1);
xybx.setSmall(2,bx.smallEnd()[2]);
int k0 = 0;
Expand Down
26 changes: 13 additions & 13 deletions Source/BoundaryConditions/BoundaryConditions_xvel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ void ERFPhysBCFunct::impose_lateral_xvel_bcs (const Array4<Real>& dest_arr,
int bccomp)
{
BL_PROFILE_VAR("impose_lateral_xvel_bcs()",impose_lateral_xvel_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

// xlo: ori = 0
// ylo: ori = 1
Expand All @@ -34,15 +34,15 @@ void ERFPhysBCFunct::impose_lateral_xvel_bcs (const Array4<Real>& dest_arr,
// 0 is used as starting index for bcrs
int ncomp = 1;
Vector<BCRec> bcrs(ncomp);
amrex::setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);
setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);

amrex::Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
#ifdef AMREX_USE_GPU
Gpu::htod_memcpy_async(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#else
std::memcpy(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#endif
const amrex::BCRec* bc_ptr = bcrs_d.data();
const BCRec* bc_ptr = bcrs_d.data();

GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,AMREX_SPACEDIM+NVAR_max> l_bc_extdir_vals_d;

Expand Down Expand Up @@ -173,8 +173,8 @@ void ERFPhysBCFunct::impose_vertical_xvel_bcs (const Array4<Real>& dest_arr,
#endif
{
BL_PROFILE_VAR("impose_vertical_xvel_bcs()",impose_vertical_xvel_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

GeometryData const& geomdata = m_geom.data();

Expand All @@ -183,15 +183,15 @@ void ERFPhysBCFunct::impose_vertical_xvel_bcs (const Array4<Real>& dest_arr,
// 0 is used as starting index for bcrs
int ncomp = 1;
Vector<BCRec> bcrs(ncomp);
amrex::setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);
setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);

amrex::Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
#ifdef AMREX_USE_GPU
Gpu::htod_memcpy_async(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#else
std::memcpy(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#endif
const amrex::BCRec* bc_ptr = bcrs_d.data();
const BCRec* bc_ptr = bcrs_d.data();

GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,AMREX_SPACEDIM+NVAR_max> l_bc_extdir_vals_d;

Expand Down Expand Up @@ -236,8 +236,8 @@ void ERFPhysBCFunct::impose_vertical_xvel_bcs (const Array4<Real>& dest_arr,
} // z

if (m_z_phys_nd) {
const auto& bx_lo = amrex::lbound(bx);
const auto& bx_hi = amrex::ubound(bx);
const auto& bx_lo = lbound(bx);
const auto& bx_hi = ubound(bx);
// Neumann conditions (d<var>/dn = 0) must be aware of the surface normal with terrain.
// An additional source term arises from d<var>/dx & d<var>/dy & met_h_xi/eta/zeta.
//=====================================================================================
Expand All @@ -247,7 +247,7 @@ void ERFPhysBCFunct::impose_vertical_xvel_bcs (const Array4<Real>& dest_arr,
// Hit for Neumann condition at kmin
if( bcrs[n].lo(2) == ERFBCType::foextrap) {
// Loop over ghost cells in bottom XY-plane (valid box)
amrex::Box xybx = bx;
Box xybx = bx;
xybx.setBig(2,-1);
xybx.setSmall(2,bx.smallEnd()[2]);
int k0 = 0;
Expand Down
26 changes: 13 additions & 13 deletions Source/BoundaryConditions/BoundaryConditions_yvel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ void ERFPhysBCFunct::impose_lateral_yvel_bcs (const Array4<Real>& dest_arr,
int bccomp)
{
BL_PROFILE_VAR("impose_lateral_yvel_bcs()",impose_lateral_yvel_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

// Based on BCRec for the domain, we need to make BCRec for this Box
// bccomp is used as starting index for m_domain_bcs_type
// 0 is used as starting index for bcrs
int ncomp = 1;
Vector<BCRec> bcrs(ncomp);
amrex::setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);
setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);

// xlo: ori = 0
// ylo: ori = 1
Expand All @@ -33,13 +33,13 @@ void ERFPhysBCFunct::impose_lateral_yvel_bcs (const Array4<Real>& dest_arr,
// yhi: ori = 4
// zhi: ori = 5

amrex::Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
#ifdef AMREX_USE_GPU
Gpu::htod_memcpy_async(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#else
std::memcpy(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#endif
const amrex::BCRec* bc_ptr = bcrs_d.data();
const BCRec* bc_ptr = bcrs_d.data();

GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>, AMREX_SPACEDIM+NVAR_max> l_bc_extdir_vals_d;

Expand Down Expand Up @@ -167,15 +167,15 @@ void ERFPhysBCFunct::impose_vertical_yvel_bcs (const Array4<Real>& dest_arr,
int bccomp)
{
BL_PROFILE_VAR("impose_vertical_yvel_bcs()",impose_vertical_yvel_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

// Based on BCRec for the domain, we need to make BCRec for this Box
// bccomp is used as starting index for m_domain_bcs_type
// 0 is used as starting index for bcrs
int ncomp = 1;
Vector<BCRec> bcrs(ncomp);
amrex::setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);
setBC(bx, domain, bccomp, 0, ncomp, m_domain_bcs_type, bcrs);

// xlo: ori = 0
// ylo: ori = 1
Expand All @@ -184,13 +184,13 @@ void ERFPhysBCFunct::impose_vertical_yvel_bcs (const Array4<Real>& dest_arr,
// yhi: ori = 4
// zhi: ori = 5

amrex::Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
#ifdef AMREX_USE_GPU
Gpu::htod_memcpy_async(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#else
std::memcpy(bcrs_d.data(), bcrs.data(), sizeof(BCRec)*ncomp);
#endif
const amrex::BCRec* bc_ptr = bcrs_d.data();
const BCRec* bc_ptr = bcrs_d.data();

GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>, AMREX_SPACEDIM+NVAR_max> l_bc_extdir_vals_d;

Expand Down Expand Up @@ -233,8 +233,8 @@ void ERFPhysBCFunct::impose_vertical_yvel_bcs (const Array4<Real>& dest_arr,
}

if (m_z_phys_nd) {
const auto& bx_lo = amrex::lbound(bx);
const auto& bx_hi = amrex::ubound(bx);
const auto& bx_lo = lbound(bx);
const auto& bx_hi = ubound(bx);
// Neumann conditions (d<var>/dn = 0) must be aware of the surface normal with terrain.
// An additional source term arises from d<var>/dx & d<var>/dy & met_h_xi/eta/zeta.
//=====================================================================================
Expand All @@ -244,7 +244,7 @@ void ERFPhysBCFunct::impose_vertical_yvel_bcs (const Array4<Real>& dest_arr,
// Hit for Neumann condition at kmin
if( bcrs[n].lo(2) == ERFBCType::foextrap) {
// Loop over ghost cells in bottom XY-plane (valid box)
amrex::Box xybx = bx;
Box xybx = bx;
xybx.setBig(2,-1);
xybx.setSmall(2,bx.smallEnd()[2]);
int k0 = 0;
Expand Down
26 changes: 13 additions & 13 deletions Source/BoundaryConditions/BoundaryConditions_zvel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ void ERFPhysBCFunct::impose_lateral_zvel_bcs (const Array4<Real >& dest_arr
int bccomp)
{
BL_PROFILE_VAR("impose_lateral_zvel_bcs()",impose_lateral_zvel_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

// Based on BCRec for the domain, we need to make BCRec for this Box
// bccomp is used as starting index for m_domain_bcs_type
// 0 is used as starting index for bcrs
int ncomp = 1;
Vector<BCRec> bcrs_w(1);
amrex::setBC(bx, domain, bccomp, 0, 1, m_domain_bcs_type, bcrs_w);
setBC(bx, domain, bccomp, 0, 1, m_domain_bcs_type, bcrs_w);

// xlo: ori = 0
// ylo: ori = 1
Expand All @@ -39,13 +39,13 @@ void ERFPhysBCFunct::impose_lateral_zvel_bcs (const Array4<Real >& dest_arr
// yhi: ori = 4
// zhi: ori = 5

amrex::Gpu::DeviceVector<BCRec> bcrs_w_d(ncomp);
Gpu::DeviceVector<BCRec> bcrs_w_d(ncomp);
#ifdef AMREX_USE_GPU
Gpu::htod_memcpy_async(bcrs_w_d.data(), bcrs_w.data(), sizeof(BCRec));
#else
std::memcpy(bcrs_w_d.data(), bcrs_w.data(), sizeof(BCRec));
#endif
const amrex::BCRec* bc_ptr_w = bcrs_w_d.data();
const BCRec* bc_ptr_w = bcrs_w_d.data();

GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>,AMREX_SPACEDIM+NVAR_max> l_bc_extdir_vals_d;

Expand Down Expand Up @@ -162,8 +162,8 @@ void ERFPhysBCFunct::impose_vertical_zvel_bcs (const Array4<Real>& dest_arr,
TerrainType terrain_type)
{
BL_PROFILE_VAR("impose_vertical_zvel_bcs()",impose_vertical_zvel_bcs);
const auto& dom_lo = amrex::lbound(domain);
const auto& dom_hi = amrex::ubound(domain);
const auto& dom_lo = lbound(domain);
const auto& dom_hi = ubound(domain);

// xlo: ori = 0
// ylo: ori = 1
Expand All @@ -177,14 +177,14 @@ void ERFPhysBCFunct::impose_vertical_zvel_bcs (const Array4<Real>& dest_arr,
// 0 is used as starting index for bcrs
int ncomp = 1;
Vector<BCRec> bcrs_u(1), bcrs_v(1), bcrs_w(1);
amrex::setBC(bx, domain, bccomp_u, 0, 1, m_domain_bcs_type, bcrs_u);
amrex::setBC(bx, domain, bccomp_v, 0, 1, m_domain_bcs_type, bcrs_v);
amrex::setBC(bx, domain, bccomp_w, 0, 1, m_domain_bcs_type, bcrs_w);
setBC(bx, domain, bccomp_u, 0, 1, m_domain_bcs_type, bcrs_u);
setBC(bx, domain, bccomp_v, 0, 1, m_domain_bcs_type, bcrs_v);
setBC(bx, domain, bccomp_w, 0, 1, m_domain_bcs_type, bcrs_w);

// We use these for the asserts below
const amrex::BCRec* bc_ptr_u_h = bcrs_u.data();
const amrex::BCRec* bc_ptr_v_h = bcrs_v.data();
const amrex::BCRec* bc_ptr_w_h = bcrs_w.data();
const BCRec* bc_ptr_u_h = bcrs_u.data();
const BCRec* bc_ptr_v_h = bcrs_v.data();
const BCRec* bc_ptr_w_h = bcrs_w.data();

bool l_use_terrain = (m_z_phys_nd != nullptr);
bool l_moving_terrain = (terrain_type == TerrainType::Moving);
Expand Down
Loading

0 comments on commit 9aa8d65

Please sign in to comment.