From e27ceb3f410b39a72beeddfaa6a5d4598f40c5d0 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Sun, 21 Jan 2024 10:30:39 -0800 Subject: [PATCH] Prepare for amrex changes --- Source/AGN/AGN_halos.cpp | 6 +++--- Source/DerivedQuantities/ParticleDerive.cpp | 2 +- Source/Driver/Nyx.cpp | 8 ++++---- Source/Gravity/Gravity.cpp | 8 ++++---- Source/Hydro/strang_hydro.cpp | 4 ++-- Source/Initialization/Nyx_setup.cpp | 6 +++--- Source/Particle/DarkMatterParticleContainer.cpp | 4 ++-- Source/Particle/NyxParticleContainer.H | 10 +++++----- Source/TimeStep/Nyx_enforce_minimum_density.cpp | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Source/AGN/AGN_halos.cpp b/Source/AGN/AGN_halos.cpp index 81d2c4f1d..e8ba70869 100644 --- a/Source/AGN/AGN_halos.cpp +++ b/Source/AGN/AGN_halos.cpp @@ -216,9 +216,9 @@ Nyx::agn_halo_find (Real dt) for (BoxIterator bit(vertBox); bit.ok(); ++bit) { IntVect vert = bit(); - IntVect iv(D_DECL(vertices[vert[0]][0], - vertices[vert[1]][1], - vertices[vert[2]][2])); + IntVect iv(AMREX_D_DECL(vertices[vert[0]][0], + vertices[vert[1]][1], + vertices[vert[2]][2])); reeber_halos_pos.push_back(iv); reeber_halos_mass.push_back(haloMass); } diff --git a/Source/DerivedQuantities/ParticleDerive.cpp b/Source/DerivedQuantities/ParticleDerive.cpp index b2677fbcc..365d8e96d 100644 --- a/Source/DerivedQuantities/ParticleDerive.cpp +++ b/Source/DerivedQuantities/ParticleDerive.cpp @@ -44,7 +44,7 @@ Nyx::particle_derive (const std::string& name, Real time, int ngrow) // We want the total particle count at this level or higher. // std::unique_ptr derive_dat = particle_derive("particle_count", time, ngrow); - IntVect trr(D_DECL(1, 1, 1)); + IntVect trr(1); // @todo: level vs. lev for (int lev = level + 1; lev <= parent->finestLevel(); lev++) diff --git a/Source/Driver/Nyx.cpp b/Source/Driver/Nyx.cpp index c0e12c0b8..ba44135a2 100644 --- a/Source/Driver/Nyx.cpp +++ b/Source/Driver/Nyx.cpp @@ -314,14 +314,14 @@ Nyx::read_params () { if (DefaultGeometry().isPeriodic(dir)) { - if (lo_bc[dir] != Interior) + if (lo_bc[dir] != amrex::PhysBCType::interior) { std::cerr << "Nyx::read_params:periodic in direction " << dir << " but low BC is not Interior" << std::endl; amrex::Error(); } - if (hi_bc[dir] != Interior) + if (hi_bc[dir] != amrex::PhysBCType::interior) { std::cerr << "Nyx::read_params:periodic in direction " << dir @@ -338,14 +338,14 @@ Nyx::read_params () // for (int dir = 0; dir < AMREX_SPACEDIM; dir++) { - if (lo_bc[dir] == Interior) + if (lo_bc[dir] == amrex::PhysBCType::interior) { std::cerr << "Nyx::read_params:interior bc in direction " << dir << " but not periodic" << std::endl; amrex::Error(); } - if (hi_bc[dir] == Interior) + if (hi_bc[dir] == amrex::PhysBCType::interior) { std::cerr << "Nyx::read_params:interior bc in direction " << dir diff --git a/Source/Gravity/Gravity.cpp b/Source/Gravity/Gravity.cpp index 7d0e9605d..6697d38b7 100644 --- a/Source/Gravity/Gravity.cpp +++ b/Source/Gravity/Gravity.cpp @@ -958,12 +958,12 @@ Gravity::make_mg_bc () mlmg_lobc[idim] = MLLinOp::BCType::Periodic; mlmg_hibc[idim] = MLLinOp::BCType::Periodic; } else { - if (phys_bc->lo(idim) == Symmetry) { + if (phys_bc->lo(idim) == amrex::PhysBCType::symmetry) { mlmg_lobc[idim] = MLLinOp::BCType::Neumann; } else { mlmg_lobc[idim] = MLLinOp::BCType::Dirichlet; } - if (phys_bc->hi(idim) == Symmetry) { + if (phys_bc->hi(idim) == amrex::PhysBCType::symmetry) { mlmg_hibc[idim] = MLLinOp::BCType::Neumann; } else { mlmg_hibc[idim] = MLLinOp::BCType::Dirichlet; @@ -1430,8 +1430,8 @@ Gravity::set_boundary(BndryData& bd, MultiFab& rhs, const Real* dx) // across an interior boundary or a periodic boundary. { // Define the type of boundary conditions to be Dirichlet (even for periodic) - bd.setBoundCond(Orientation(n, Orientation::low) ,i,0,LO_DIRICHLET); - bd.setBoundCond(Orientation(n, Orientation::high),i,0,LO_DIRICHLET); + bd.setBoundCond(Orientation(n, Orientation::low) ,i,0,AMREX_LO_DIRICHLET); + bd.setBoundCond(Orientation(n, Orientation::high),i,0,AMREX_LO_DIRICHLET); // Set the boundary conditions to the cell centers outside the domain bd.setBoundLoc(Orientation(n, Orientation::low) ,i,0.5*dx[n]); diff --git a/Source/Hydro/strang_hydro.cpp b/Source/Hydro/strang_hydro.cpp index 38eb9dd1b..5ddd5fce0 100644 --- a/Source/Hydro/strang_hydro.cpp +++ b/Source/Hydro/strang_hydro.cpp @@ -156,7 +156,7 @@ Nyx::strang_hydro (Real time, const Box& bx = mfi.tilebox(); for (int i = 0; i < S_new[mfi].nComp(); i++) { - IntVect p_nan(D_DECL(-10, -10, -10)); + IntVect p_nan(AMREX_D_DECL(-10, -10, -10)); if (ParallelDescriptor::IOProcessor()) std::cout << "strang_hydro: testing component " << i << " for NaNs" << std::endl; if (S_new[mfi].contains_nan(bx,Density+i,1,p_nan)) @@ -201,7 +201,7 @@ Nyx::strang_hydro (Real time, { for (int i = 0; i < S_new.nComp(); i++) { - IntVect p_nan(D_DECL(-10, -10, -10)); + IntVect p_nan(AMREX_D_DECL(-10, -10, -10)); if (ParallelDescriptor::IOProcessor()) std::cout << "strang_hydro: testing component " << i << " for NaNs" << std::endl; if (S_new.contains_nan(Density+i,1,0)) diff --git a/Source/Initialization/Nyx_setup.cpp b/Source/Initialization/Nyx_setup.cpp index f8445afe0..86750141a 100644 --- a/Source/Initialization/Nyx_setup.cpp +++ b/Source/Initialization/Nyx_setup.cpp @@ -36,17 +36,17 @@ typedef StateDescriptor::BndryFunc BndryFunc; // static int scalar_bc[] = { - INT_DIR, EXT_DIR, FOEXTRAP, REFLECT_EVEN, REFLECT_EVEN, REFLECT_EVEN + amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even }; static int norm_vel_bc[] = { - INT_DIR, EXT_DIR, FOEXTRAP, REFLECT_ODD, REFLECT_ODD, REFLECT_ODD + amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_odd, amrex::BCType::reflect_odd, amrex::BCType::reflect_odd }; static int tang_vel_bc[] = { - INT_DIR, EXT_DIR, FOEXTRAP, REFLECT_EVEN, REFLECT_EVEN, REFLECT_EVEN + amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even }; static diff --git a/Source/Particle/DarkMatterParticleContainer.cpp b/Source/Particle/DarkMatterParticleContainer.cpp index 50f32f04b..87cf8ee4d 100644 --- a/Source/Particle/DarkMatterParticleContainer.cpp +++ b/Source/Particle/DarkMatterParticleContainer.cpp @@ -334,7 +334,7 @@ DarkMatterParticleContainer::InitCosmo1ppcMultiLevel( Real disp[AMREX_SPACEDIM]; Real vel[AMREX_SPACEDIM]; - Real mean_disp[AMREX_SPACEDIM]={D_DECL(0,0,0)}; + Real mean_disp[AMREX_SPACEDIM]={AMREX_D_DECL(0,0,0)}; // @@ -360,7 +360,7 @@ DarkMatterParticleContainer::InitCosmo1ppcMultiLevel( { for (int ix = fab_lo[0]; ix <= fab_hi[0]; ix++) { - IntVect indices(D_DECL(ix, jx, kx)); + IntVect indices(AMREX_D_DECL(ix, jx, kx)); totalcount++; if (baWhereNot.contains(indices)) { diff --git a/Source/Particle/NyxParticleContainer.H b/Source/Particle/NyxParticleContainer.H index f514d8341..fc0ae6043 100644 --- a/Source/Particle/NyxParticleContainer.H +++ b/Source/Particle/NyxParticleContainer.H @@ -285,7 +285,7 @@ NyxParticleContainer::sumParticleMomentum (int lev, const ParticleLevel& pmap = this->GetParticles(lev); - D_TERM(mom[0] = 0;, mom[1] = 0;, mom[2] = 0;); + AMREX_D_TERM(mom[0] = 0;, mom[1] = 0;, mom[2] = 0;); for (typename ParticleLevel::const_iterator pmap_it = pmap.begin(), pmapEnd = pmap.end(); pmap_it != pmapEnd; ++pmap_it) { @@ -303,13 +303,13 @@ NyxParticleContainer::sumParticleMomentum (int lev, if (p.id() > 0) { - D_TERM(mom_0 += p.rdata(0) * p.rdata(1);, - mom_1 += p.rdata(0) * p.rdata(2);, - mom_2 += p.rdata(0) * p.rdata(3);); + AMREX_D_TERM(mom_0 += p.rdata(0) * p.rdata(1);, + mom_1 += p.rdata(0) * p.rdata(2);, + mom_2 += p.rdata(0) * p.rdata(3);); } } - D_TERM(mom[0] += mom_0;, mom[1] += mom_1;, mom[2] += mom_2;); + AMREX_D_TERM(mom[0] += mom_0;, mom[1] += mom_1;, mom[2] += mom_2;); } amrex::ParallelDescriptor::ReduceRealSum(mom,AMREX_SPACEDIM); diff --git a/Source/TimeStep/Nyx_enforce_minimum_density.cpp b/Source/TimeStep/Nyx_enforce_minimum_density.cpp index d3260fc6e..108f60a76 100644 --- a/Source/TimeStep/Nyx_enforce_minimum_density.cpp +++ b/Source/TimeStep/Nyx_enforce_minimum_density.cpp @@ -164,7 +164,7 @@ Nyx::enforce_minimum_density_cons ( MultiFab& S_old, MultiFab& S_new) const Box& bx = mfi.growntilebox(); for (int i = 0; i < S_new[mfi].nComp(); i++) { - IntVect p_nan(D_DECL(-10, -10, -10)); + IntVect p_nan(AMREX_D_DECL(-10, -10, -10)); // if (ParallelDescriptor::IOProcessor()) // std::cout << "enforce_minimum_density: testing component " << i << " for NaNs" << std::endl; bool has_nan=S_new[mfi].contains_nan(bx,Density_comp+i,1,p_nan);