Commit 5c449870 authored by frey_m's avatar frey_m
Browse files

AMR: Make OPAL + miniapps compile again with newer AMReX version

Latest AMReX commit
-------------------

commit 207c75da3ad51deb2da1ba20bf8ce0a86264332a
Date:   Thu Nov 2 12:55:13 2017 -0600

    Use amrex_constants_module in amrex_filcc_2d

Affected files
--------------

modified:   ../../../../CMakeLists.txt
modified:   ../AmrOpal.cpp
modified:   ../AmrOpal.h
modified:   ../Distribution.cpp
modified:   ../Distribution.h
modified:   ../MGTSolver.cpp
modified:   ../MGTSolver.h
modified:   ../Solver.cpp
modified:   ../Solver.h
modified:   ../amrex-only/AssignMultiLevelDensity.cpp
modified:   ../amrex-only/CMakeLists.txt
modified:   ../amrex-only/Solver.cpp
modified:   ../amrex-only/testDeposition.cpp
modified:   ../amrex-only/testDepositionFail.cpp
modified:   ../amrex-only/testGeometry.cpp
modified:   ../amrex-only/testSolverFail.cpp
modified:   ../helper_functions.h
modified:   AmrParticleBase.h
modified:   AmrParticleBase.hpp
modified:   CMakeLists.txt
modified:   PartBunchAmr.h
modified:   ParticleAmrLayout.h
modified:   ParticleAmrLayout.hpp
modified:   testAmrPartBase.cpp
modified:   testCRTP.cpp
modified:   testDomainTransformSolve.cpp
modified:   testGaussian.cpp
modified:   testInitGuessSolver.cpp
modified:   testInitialBox.cpp
modified:   testLayout.cpp
modified:   testNewTracker.cpp
modified:   testPerformance.cpp
modified:   testPlasma.cpp
modified:   testReal.cpp
modified:   testScatterAMReX.cpp
modified:   testTagging.cpp
modified:   testUnifSphere.cpp
modified:   ../ippl-bunch/CMakeLists.txt
modified:   ../ippl-bunch/PartBunchBase.h
modified:   ../ippl-bunch/testAdapterPattern.cpp
modified:   ../trilinos/AmrBoundary.h
modified:   ../trilinos/AmrDirichletBoundary.h
modified:   ../trilinos/AmrLagrangeInterpolater.h
modified:   ../trilinos/AmrLagrangeInterpolater.hpp
modified:   ../trilinos/AmrMultiGridCore.h
modified:   ../trilinos/AmrMultiGridLevel.h
modified:   ../trilinos/AmrMultiGridLevel.hpp
modified:   ../trilinos/AmrOpenBoundary.h
modified:   ../trilinos/AmrTrilinearInterpolater.hpp
modified:   ../trilinos/AmrTrilinos.cpp
modified:   ../trilinos/AmrTrilinos.h
modified:   ../trilinos/CMakeLists.txt
modified:   ../trilinos/IrregularDomain.h
modified:   ../trilinos/build.h
modified:   ../trilinos/testAmrMultigrid.cpp
modified:   ../trilinos/testBoundaryMatrix.cpp
modified:   ../trilinos/testBoundaryVector.cpp
modified:   ../trilinos/testCopy.cpp
modified:   ../trilinos/testInterpolationMatrix.cpp
modified:   ../trilinos/testLagrange.cpp
modified:   ../trilinos/testNoFine.cpp
modified:   ../trilinos/testPoissonMatrix.cpp
modified:   ../trilinos/testRestrictionMatrix.cpp
modified:   ../trilinos/testSmootherMatrix.cpp
modified:   ../trilinos/testSolverComparison.cpp
modified:   ../trilinos/testSpecialPoissonMatrix.cpp
modified:   ../trilinos/testTrilinosGeometry.cpp
modified:   ../trilinos/testTrilinosSolver.cpp
modified:   ../trilinos/testWithFine.cpp
modified:   ../trilinos/tools.h
modified:   ../writePlotFile.H
modified:   ../../../../src/Amr/AmrBoxLib.cpp
modified:   ../../../../src/Amr/AmrPythonWriter.cpp
modified:   ../../../../src/Amr/AmrYtWriter.cpp
modified:   ../../../../src/Amr/BoxLibLayout.hpp
modified:   ../../../../src/Solvers/BoxLibSolvers/FMGPoissonSolver.cpp
modified:   ../../../../src/Solvers/BoxLibSolvers/FMGPoissonSolver.h
parent 06c8cf7e
......@@ -131,13 +131,11 @@ IF (ENABLE_AMR)
MESSAGE (STATUS "Found AMReX include dir: ${AMREX_INCLUDE_DIR}")
MESSAGE (STATUS "Found AMReX library dir: ${AMREX_LIBRARY_DIR}")
MESSAGE (STATUS "Found AMReX libraries: ${AMREX_LIBRARIES}")
MESSAGE (STATUS "AMReX built with: ${AMREX_DEFINES}")
# We need to replace the quotes of the AMREX_GIT_VERSION flag in AMREX_DEFINES
# otherwise IpplVersions.h complains
STRING(REPLACE "\"" "'" AMREX_DEFINES ${AMREX_DEFINES})
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_AMR ${AMREX_DEFINES}")
echo_amrex_config_options()
add_definitions(${AMREX_DEFINES})
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_AMR")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-unused-but-set-variable -Wno-maybe-uninitialized")
ENDIF (ENABLE_AMR)
......
This diff is collapsed.
......@@ -15,8 +15,6 @@
#include <memory>
using namespace amrex;
/*!
* @file AmrOpal.h
* @authors Matthias Frey
......@@ -30,11 +28,11 @@ using namespace amrex;
*/
/// Concrete AMR implementation
class AmrOpal : public AmrMesh {
class AmrOpal : public amrex::AmrMesh {
private:
typedef Array<std::unique_ptr<MultiFab> > mfs_mt;
typedef Vektor<double, BL_SPACEDIM> Vector_t;
typedef amrex::Array<std::unique_ptr<amrex::MultiFab> > mfs_mt;
typedef Vektor<double, AMREX_SPACEDIM> Vector_t;
public:
/// Methods for tag cells for refinement
......@@ -50,7 +48,7 @@ public:
#ifdef IPPL_AMR
typedef ParticleAmrLayout<double, BL_SPACEDIM> amrplayout_t;
typedef ParticleAmrLayout<double, AMREX_SPACEDIM> amrplayout_t;
typedef AmrParticleBase<amrplayout_t> amrbase_t;
typedef PartBunchAmr<amrplayout_t> amrbunch_t;
#endif
......@@ -67,7 +65,8 @@ public:
* @param coord is the coordinate system (0: cartesian)
* @param bunch is the particle bunch
*/
AmrOpal(const RealBox* rb, int max_level_in, const Array<int>& n_cell_in, int coord,
AmrOpal(const amrex::RealBox* rb, int max_level_in,
const amrex::Array<int>& n_cell_in, int coord,
#ifdef IPPL_AMR
PartBunchAmr<amrplayout_t>* bunch);
#else
......@@ -82,7 +81,8 @@ public:
* @param coord is the coordinate system (0: cartesian)
* @param refratio
*/
AmrOpal(const RealBox* rb, int max_level_in, const Array<int>& n_cell_in, int coord,
AmrOpal(const amrex::RealBox* rb, int max_level_in,
const amrex::Array<int>& n_cell_in, int coord,
const std::vector<int>& refratio);
/*!
......@@ -92,7 +92,8 @@ public:
* @param n_cell_in is the number of grid cells at the coarsest level
* @param coord is the coordinate system (0: cartesian)
*/
AmrOpal(const RealBox* rb, int max_level_in, const Array<int>& n_cell_in, int coord);
AmrOpal(const amrex::RealBox* rb, int max_level_in,
const amrex::Array<int>& n_cell_in, int coord);
virtual ~AmrOpal(); ///< does nothing
......@@ -102,7 +103,7 @@ public:
* @param lbase is the level on top of which a new level is created
* @param time not used
*/
void regrid (int lbase, Real time);
void regrid (int lbase, amrex::Real time);
/*!
* Update the grids and the distributionmapping for a specific level
......@@ -111,8 +112,9 @@ public:
* @param new_grids are the new created grids for this level
* @param new_dmap is the new distribution to processors
*/
void RemakeLevel (int lev, Real time,
const BoxArray& new_grids, const DistributionMapping& new_dmap);
void RemakeLevel (int lev, amrex::Real time,
const amrex::BoxArray& new_grids,
const amrex::DistributionMapping& new_dmap);
/*!
* Create completeley new grids for a level
......@@ -121,8 +123,9 @@ public:
* @param new_grids are the new created grids for this level
* @param new_dmap is the new distribution to processors
*/
void MakeNewLevel (int lev, Real time,
const BoxArray& new_grids, const DistributionMapping& new_dmap);
void MakeNewLevel (int lev, amrex::Real time,
const amrex::BoxArray& new_grids,
const amrex::DistributionMapping& new_dmap);
void ClearLevel(int lev);
......@@ -180,24 +183,29 @@ protected:
/*!
* Is called in the AmrCore function for performing tagging.
*/
virtual void ErrorEst(int lev, TagBoxArray& tags, Real time, int ngrow) override;
virtual void ErrorEst(int lev, amrex::TagBoxArray& tags,
amrex::Real time, int ngrow) override;
virtual void MakeNewLevelFromScratch (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm);
virtual void MakeNewLevelFromScratch (int lev, amrex::Real time,
const amrex::BoxArray& ba,
const amrex::DistributionMapping& dm);
//! Make a new level using provided BoxArray and DistributionMapping and fill with interpolated coarse level data.
virtual void MakeNewLevelFromCoarse (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm);
virtual void MakeNewLevelFromCoarse (int lev, amrex::Real time,
const amrex::BoxArray& ba,
const amrex::DistributionMapping& dm);
private:
// used in tagging
void scatter_m(int lev);
void tagForChargeDensity_m(int lev, TagBoxArray& tags, Real time, int ngrow);
void tagForPotentialStrength_m(int lev, TagBoxArray& tags, Real time, int ngrow);
void tagForEfieldStrength_m(int lev, TagBoxArray& tags, Real time, int ngrow);
void tagForMomentum_m(int lev, TagBoxArray& tags, Real time, int ngrow);
void tagForMaxNumParticles_m(int lev, TagBoxArray& tags, Real time, int ngrow);
void tagForMinNumParticles_m(int lev, TagBoxArray& tags, Real time, int ngrow);
void tagForCenteredRegion_m(int lev, TagBoxArray& tags, Real time, int ngrow);
void tagForChargeDensity_m(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow);
void tagForPotentialStrength_m(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow);
void tagForEfieldStrength_m(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow);
void tagForMomentum_m(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow);
void tagForMaxNumParticles_m(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow);
void tagForMinNumParticles_m(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow);
void tagForCenteredRegion_m(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow);
......@@ -213,7 +221,7 @@ private:
double scaling_m; ///< Scaling factor for tagging [0, 1]
// (tagForPotentialStrength_m, tagForEfieldStrength_m)
Real nCharge_m; ///< Tagging value for tagForChargeDensity_m
amrex::Real nCharge_m; ///< Tagging value for tagForChargeDensity_m
size_t minNumPart_m;
size_t maxNumPart_m;
......
......@@ -308,7 +308,7 @@ void Distribution::readH5(const std::string& filename, int step) {
void Distribution::injectBeam(
#ifdef IPPL_AMR
PartBunchAmr< ParticleAmrLayout<double, BL_SPACEDIM> >& bunch,
PartBunchAmr< ParticleAmrLayout<double, AMREX_SPACEDIM> >& bunch,
#else
PartBunchBase& bunch,
#endif
......@@ -355,7 +355,7 @@ void Distribution::injectBeam(
void Distribution::setDistribution(
#ifdef IPPL_AMR
PartBunchAmr< ParticleAmrLayout<double, BL_SPACEDIM> >& bunch,
PartBunchAmr< ParticleAmrLayout<double, AMREX_SPACEDIM> >& bunch,
#else
PartBunchBase& bunch,
#endif
......
......@@ -37,7 +37,7 @@ class Distribution {
public:
typedef std::vector<double> container_t;
typedef Vektor<double, BL_SPACEDIM> Vector_t;
typedef Vektor<double, AMREX_SPACEDIM> Vector_t;
typedef std::function<double(const Vector_t&,
const Vector_t&,
double,
......@@ -177,7 +177,7 @@ public:
*/
void injectBeam(
#ifdef IPPL_AMR
PartBunchAmr< ParticleAmrLayout<double, BL_SPACEDIM> > & bunch,
PartBunchAmr< ParticleAmrLayout<double, AMREX_SPACEDIM> > & bunch,
#else
PartBunchBase& bunch,
#endif
......@@ -190,7 +190,7 @@ public:
*/
void setDistribution(
#ifdef IPPL_AMR
PartBunchAmr< ParticleAmrLayout<double, BL_SPACEDIM> >& bunch,
PartBunchAmr< ParticleAmrLayout<double, AMREX_SPACEDIM> >& bunch,
#else
PartBunchBase& bunch,
#endif
......
......@@ -11,6 +11,12 @@ void MGTSolver::solve(const container_t& rho,
container_t& efield,
const amrex::Array<amrex::Geometry>& geom)
{
using amrex::Geometry;
using amrex::Array;
using amrex::BoxArray;
using amrex::Real;
using amrex::MultiFab;
// Real reltol = 1.0e-14;
// Real abstol = 1.0e-12;
double abstol = 0.0;
......@@ -31,7 +37,7 @@ void MGTSolver::solve(const container_t& rho,
dmv[lev] = rho[baseLevel+lev]->DistributionMap();
phi[lev] = std::unique_ptr<amrex::MultiFab>(new amrex::MultiFab(bav[lev], dmv[lev], 1 , 1));
efield[lev] = std::unique_ptr<amrex::MultiFab>(new amrex::MultiFab(bav[lev], dmv[lev], BL_SPACEDIM, 1));
efield[lev] = std::unique_ptr<amrex::MultiFab>(new amrex::MultiFab(bav[lev], dmv[lev], AMREX_SPACEDIM, 1));
efield[lev]->setVal(0.0, 1);
}
......@@ -40,11 +46,11 @@ void MGTSolver::solve(const container_t& rho,
for (int lev = baseLevel; lev <= finestLevel; lev++)
{
grad_phi_prev[lev].resize(BL_SPACEDIM);
BL_ASSERT(grad_phi_prev[lev].size() == BL_SPACEDIM);
for (int n = 0; n < BL_SPACEDIM; ++n)
grad_phi_prev[lev].resize(AMREX_SPACEDIM);
BL_ASSERT(grad_phi_prev[lev].size() == AMREX_SPACEDIM);
for (int n = 0; n < AMREX_SPACEDIM; ++n)
{
const BoxArray eba = amrex::BoxArray(bav[lev]).surroundingNodes(n);
const amrex::BoxArray eba = amrex::BoxArray(bav[lev]).surroundingNodes(n);
grad_phi_prev[lev][n].reset(new amrex::MultiFab(eba, dmv[lev], 1, 1));
}
}
......@@ -59,11 +65,11 @@ void MGTSolver::solve(const container_t& rho,
for (int lev = 0; lev < num_levels; lev++)
{
xa[lev].resize(BL_SPACEDIM);
xb[lev].resize(BL_SPACEDIM);
xa[lev].resize(AMREX_SPACEDIM);
xb[lev].resize(AMREX_SPACEDIM);
if (baseLevel + lev == 0)
{
for (int i = 0; i < BL_SPACEDIM; ++i)
for (int i = 0; i < AMREX_SPACEDIM; ++i)
{
xa[lev][i] = 0;
xb[lev][i] = 0;
......@@ -72,7 +78,7 @@ void MGTSolver::solve(const container_t& rho,
else
{
const Real* dx_crse = geom[baseLevel + lev - 1].CellSize();
for (int i = 0; i < BL_SPACEDIM; ++i)
for (int i = 0; i < AMREX_SPACEDIM; ++i)
{
xa[lev][i] = 0.5 * dx_crse[i];
xb[lev][i] = 0.5 * dx_crse[i];
......@@ -108,7 +114,7 @@ void MGTSolver::solve(const container_t& rho,
//
// Store the Dirichlet boundary condition for phi in bndry.
//
MacBndry bndry(bav[baseLevel], dmv[baseLevel], 1, geom[baseLevel]);
amrex::MacBndry bndry(bav[baseLevel], dmv[baseLevel], 1, geom[baseLevel]);
const int src_comp = 0;
const int dest_comp = 0;
const int num_comp = 1;
......@@ -116,7 +122,7 @@ void MGTSolver::solve(const container_t& rho,
amrex::BCRec phys_bc;
// Get boundary conditions
for (int i = 0; i < BL_SPACEDIM; i++)
for (int i = 0; i < AMREX_SPACEDIM; i++)
{
phys_bc.setLo(i, 0);
phys_bc.setHi(i, 0);
......@@ -126,9 +132,9 @@ void MGTSolver::solve(const container_t& rho,
bndry.setBndryValues(*phi_p[0], src_comp, dest_comp, num_comp, phys_bc);
int stencil_type = amrex::CC_CROSS_STENCIL;
int mg_bc[2*BL_SPACEDIM];
int mg_bc[2*AMREX_SPACEDIM];
for (int dir = 0; dir < BL_SPACEDIM; ++dir)
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir)
{
if (geom[0].isPeriodic(dir))
{
......@@ -142,7 +148,7 @@ void MGTSolver::solve(const container_t& rho,
}
}
MGT_Solver mgt_solver(fgeom, mg_bc, bav, dmv, false, stencil_type, false, 0, 1, 0);
amrex::MGT_Solver mgt_solver(fgeom, mg_bc, bav, dmv, false, stencil_type, false, 0, 1, 0);
mgt_solver.set_const_gravity_coeffs(xa, xb);
......@@ -174,7 +180,7 @@ void MGTSolver::solve(const container_t& rho,
mgt_solver.get_fluxes(lev, amrex::GetArrOfPtrs(grad_phi_prev[baseLevel+lev]), dx);
}
IntVect fine_ratio = amrex::IntVect::TheUnitVector() * 2;
amrex::IntVect fine_ratio = amrex::IntVect::TheUnitVector() * 2;
// Average phi from fine to coarse level
for (int lev = finestLevel; lev > baseLevel; lev--)
......@@ -190,18 +196,18 @@ void MGTSolver::solve(const container_t& rho,
//
// Coarsen() the fine stuff on processors owning the fine data.
//
BoxArray crse_gphi_fine_BA(bav[lev+1].size());
amrex::BoxArray crse_gphi_fine_BA(bav[lev+1].size());
IntVect fine_ratio = amrex::IntVect::TheUnitVector() * 2;
amrex::IntVect fine_ratio = amrex::IntVect::TheUnitVector() * 2;
for (int i = 0; i < crse_gphi_fine_BA.size(); ++i)
crse_gphi_fine_BA.set(i, amrex::coarsen(bav[lev+1][i],
fine_ratio));
Array<std::unique_ptr<MultiFab> > crse_gphi_fine(BL_SPACEDIM);
for (int n = 0; n < BL_SPACEDIM; ++n)
Array<std::unique_ptr<MultiFab> > crse_gphi_fine(AMREX_SPACEDIM);
for (int n = 0; n < AMREX_SPACEDIM; ++n)
{
const BoxArray eba = BoxArray(crse_gphi_fine_BA).surroundingNodes(n);
const amrex::BoxArray eba = amrex::BoxArray(crse_gphi_fine_BA).surroundingNodes(n);
crse_gphi_fine[n].reset(new MultiFab(eba, dmv[lev+1], 1, 0));
}
......@@ -210,7 +216,7 @@ void MGTSolver::solve(const container_t& rho,
const Geometry& cgeom = geom[lev];
for (int n = 0; n < BL_SPACEDIM; ++n) {
for (int n = 0; n < AMREX_SPACEDIM; ++n) {
grad_phi_prev[lev][n]->copy(*crse_gphi_fine[n], cgeom.periodicity());
}
......@@ -223,7 +229,7 @@ void MGTSolver::solve(const container_t& rho,
amrex::GetArrOfConstPtrs(grad_phi_prev[lev]),
geom[lev]);
efield[lev]->FillBoundary(0,BL_SPACEDIM,geom[lev].periodicity());
efield[lev]->FillBoundary(0,AMREX_SPACEDIM,geom[lev].periodicity());
}
for (int lev = baseLevel; lev <= finestLevel; ++lev) {
......
......@@ -4,8 +4,6 @@
#include <AMReX_MGT_Solver.H>
#include <memory>
using namespace amrex;
/// Based on https://github.com/AMReX-Codes/Nyx.git Gravity.cpp
class MGTSolver {
......
#include "Solver.h"
#include "Ippl.h"
void
Solver::solve_for_accel(const container_t& rhs,
const container_t& phi,
const container_t& grad_phi,
const Array<Geometry>& geom,
const amrex::Array<amrex::Geometry>& geom,
int base_level,
int finest_level,
Real offset,
amrex::Real offset,
bool timing,
bool doGradient)
{
using amrex::Array;
static IpplTimings::TimerRef edge2centerTimer;
if ( timing )
edge2centerTimer = IpplTimings::getTimer("grad-edge2center");
// Real reltol = 1.0e-14;
// Real abstol = 1.0e-12;
// amrex::Real reltol = 1.0e-14;
// amrex::Real abstol = 1.0e-12;
// Real reltol = 1.0e-12;
Real reltol = 1.0e-14;
Real abstol = 1.0e-10;
// amrex::Real reltol = 1.0e-12;
amrex::Real reltol = 1.0e-14;
amrex::Real abstol = 1.0e-10;
Array<container_t> grad_phi_edge(rhs.size());
amrex::Array<container_t> grad_phi_edge(rhs.size());
if ( doGradient ) {
for (int lev = base_level; lev <= finest_level ; lev++)
{
const DistributionMapping& dm = rhs[lev]->DistributionMap();
grad_phi_edge[lev].resize(BL_SPACEDIM);
for (int n = 0; n < BL_SPACEDIM; ++n) {
BoxArray ba = rhs[lev]->boxArray();
grad_phi_edge[lev][n].reset(new MultiFab(ba.surroundingNodes(n), dm, 1, 1));
const amrex::DistributionMapping& dm = rhs[lev]->DistributionMap();
grad_phi_edge[lev].resize(AMREX_SPACEDIM);
for (int n = 0; n < AMREX_SPACEDIM; ++n) {
amrex::BoxArray ba = rhs[lev]->boxArray();
grad_phi_edge[lev][n].reset(new amrex::MultiFab(ba.surroundingNodes(n), dm, 1, 1));
}
}
}
......@@ -73,7 +73,7 @@ Solver::solve_for_accel(const container_t& rhs,
amrex::GetArrOfConstPtrs(grad_phi_edge[lev]),
geom[lev]);
grad_phi[lev]->FillBoundary(0,BL_SPACEDIM,geom[lev].periodicity());
grad_phi[lev]->FillBoundary(0,AMREX_SPACEDIM,geom[lev].periodicity());
}
for (int lev = base_level; lev <= finest_level; ++lev) {
......@@ -89,12 +89,12 @@ Solver::solve_for_accel(const container_t& rhs,
void
Solver::solve_with_f90(const container_pt& rhs,
const container_pt& phi,
const Array<container_pt>& grad_phi_edge,
const Array<Geometry>& geom,
const amrex::Array<container_pt>& grad_phi_edge,
const amrex::Array<amrex::Geometry>& geom,
int base_level,
int finest_level,
Real reltol,
Real abstol,
amrex::Real reltol,
amrex::Real abstol,
bool timing,
bool doGradient)
{
......@@ -114,21 +114,21 @@ Solver::solve_with_f90(const container_pt& rhs,
int nlevs = finest_level - base_level + 1;
int mg_bc[2*BL_SPACEDIM];
int mg_bc[2*AMREX_SPACEDIM];
// This tells the solver that we are using Dirichlet bc's
if (Geometry::isAllPeriodic()) {
if (amrex::Geometry::isAllPeriodic()) {
// if ( ParallelDescriptor::IOProcessor() )
// std::cerr << "Periodic BC" << std::endl;
for (int dir = 0; dir < BL_SPACEDIM; ++dir) {
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
// periodic BC
mg_bc[2*dir + 0] = MGT_BC_PER;
mg_bc[2*dir + 1] = MGT_BC_PER;
}
} else if ( Geometry::isAnyPeriodic() ) {
for (int dir = 0; dir < BL_SPACEDIM; ++dir) {
if ( Geometry::isPeriodic(dir) ) {
} else if ( amrex::Geometry::isAnyPeriodic() ) {
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
if ( amrex::Geometry::isPeriodic(dir) ) {
mg_bc[2*dir + 0] = MGT_BC_PER;
mg_bc[2*dir + 1] = MGT_BC_PER;
} else {
......@@ -140,7 +140,7 @@ Solver::solve_with_f90(const container_pt& rhs,
// if ( ParallelDescriptor::IOProcessor() )
// std::cerr << "Dirichlet BC" << std::endl;
for (int dir = 0; dir < BL_SPACEDIM; ++dir) {
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
// Dirichlet BC
mg_bc[2*dir + 0] = MGT_BC_DIR;
mg_bc[2*dir + 1] = MGT_BC_DIR;
......@@ -148,7 +148,7 @@ Solver::solve_with_f90(const container_pt& rhs,
}
// Have to do some packing because these arrays does not always start with base_level
Array<Geometry> geom_p(nlevs);
amrex::Array<amrex::Geometry> geom_p(nlevs);
container_pt rhs_p(nlevs);
container_pt phi_p(nlevs);
......@@ -159,10 +159,10 @@ Solver::solve_with_f90(const container_pt& rhs,
}
//FIXME Refinement ratio is hardwired to 2 here.
IntVect crse_ratio = (base_level == 0) ?
IntVect::TheZeroVector() : IntVect::TheUnitVector() * 2;
amrex::IntVect crse_ratio = (base_level == 0) ?
amrex::IntVect::TheZeroVector() : amrex::IntVect::TheUnitVector() * 2;
FMultiGrid fmg(geom_p, base_level, crse_ratio);
amrex::FMultiGrid fmg(geom_p, base_level, crse_ratio);
if (base_level == 0) {
fmg.set_bc(mg_bc, *phi_p[base_level]);
......@@ -190,7 +190,7 @@ Solver::solve_with_f90(const container_pt& rhs,
if ( timing )
IpplTimings::startTimer(doSolveTimer);
Real final_resnorm = fmg.solve(phi_p, rhs_p, reltol, abstol, always_use_bnorm, need_grad_phi);
amrex::Real final_resnorm = fmg.solve(phi_p, rhs_p, reltol, abstol, always_use_bnorm, need_grad_phi);
if ( final_resnorm > abstol ) {
std::stringstream ss;
......@@ -219,27 +219,27 @@ Solver::solve_with_f90(const container_pt& rhs,
#ifdef USEHYPRE
// We solve (a alpha - b del dot beta grad) soln = rhs
// where a and b are scalars, alpha and beta are arrays
void Solver::solve_with_hypre(MultiFab& soln, MultiFab& rhs, const BoxArray& bs, const Geometry& geom)
void Solver::solve_with_hypre(amrex::MultiFab& soln, amrex::MultiFab& rhs, const amrex::BoxArray& bs, const amrex::Geometry& geom)
{
int verbose = 2;
Real tolerance_rel = 1.e-8;
Real tolerance_abs = 0.0;
amrex::Real tolerance_rel = 1.e-8;
amrex::Real tolerance_abs = 0.0;
int maxiter = 100;
BL_PROFILE("solve_with_hypre()");
BndryData bd(bs, 1, geom);
set_boundary(bd, rhs, 0);
Real a = 0.0;
Real b = 1.0;
amrex::Real a = 0.0;
amrex::Real b = 1.0;
// Set up the Helmholtz operator coefficients.
MultiFab alpha(bs, 1, 0);
amrex::MultiFab alpha(bs, 1, 0);
alpha.setVal(0.0);
PArray<MultiFab> beta(BL_SPACEDIM, PArrayManage);
for ( int n=0; n<BL_SPACEDIM; ++n ) {
BoxArray bx(bs);
beta.set(n, new MultiFab(bx.surroundingNodes(n), 1, 0, Fab_allocate));
PArray<amrex::MultiFab> beta(AMREX_SPACEDIM, PArrayManage);
for ( int n=0; n<AMREX_SPACEDIM; ++n ) {
amrex::BoxArray bx(bs);
beta.set(n, new amrex::MultiFab(bx.surroundingNodes(n), 1, 0, Fab_allocate));
beta[n].setVal(1.0);
}
......@@ -252,12 +252,12 @@ void Solver::solve_with_hypre(MultiFab& soln, MultiFab& rhs, const BoxArray& bs,
}
void Solver::set_boundary(BndryData& bd, const MultiFab& rhs, int comp)
void Solver::set_boundary(BndryData& bd, const amrex::MultiFab& rhs, int comp)
{
BL_PROFILE("set_boundary()");
Real bc_value = 0.0;
amrex::Real bc_value = 0.0;
for (int n=0; n<BL_SPACEDIM; ++n) {
for (int n=0; n<AMREX_SPACEDIM; ++n) {
for (MFIter mfi(rhs); mfi.isValid(); ++mfi ) {
int i = mfi.index();
......@@ -279,7 +279,7 @@ void Solver::set_boundary(BndryData& bd, const MultiFab& rhs, int comp)
// Now test to see if we should override the above with Dirichlet or Neumann physical bc's
// if (bc_type != Periodic) {
int ibnd = static_cast<int>(LO_DIRICHLET);
const Geometry& geom = bd.getGeom();
const amrex::Geometry& geom = bd.getGeom();
// We are on the low side of the domain in coordinate direction n
if (bx.smallEnd(n) == geom.Domain().smallEnd(n)) {
......
......@@ -14,7 +14,7 @@
#include <AMReX_VisMF.H>
#include <AMReX_FMultiGrid.H>
using namespace amrex;
#include "Ippl.h"
#include <memory>
#include <vector>
......@@ -42,8 +42,8 @@ using namespace amrex;
class Solver {
public:
typedef Array<std::unique_ptr<MultiFab> > container_t;
typedef Array<MultiFab*> container_pt;
typedef amrex::Array<std::unique_ptr<amrex::MultiFab> > container_t;
typedef amrex::Array<amrex::MultiFab*> container_pt;
/*!
* Prepares the solver and calls the solve_with_f90 function.
......@@ -60,10 +60,10 @@ public:
void solve_for_accel(const container_t& rhs,
const container_t& phi,
const container_t& grad_phi,
const Array<Geometry>& geom,
const amrex::Array<amrex::Geometry>& geom,
int base_level,