Commit e7812d0b authored by frey_m's avatar frey_m
Browse files

Merge branch '529-follow-up-from-resolve-add-missing-enable_amr' into 'master'

Resolve "Follow-up from "Resolve "Add missing ENABLE_AMR"""

Closes #529

See merge request !348
parents 66b6ab16 aa64d366
...@@ -1911,11 +1911,7 @@ size_t PartBunchBase<T, Dim>::calcMoments() { ...@@ -1911,11 +1911,7 @@ size_t PartBunchBase<T, Dim>::calcMoments() {
std::vector<double> loc_moments(4 * Dim + Dim * ( 2 * Dim + 1 )); std::vector<double> loc_moments(4 * Dim + Dim * ( 2 * Dim + 1 ));
long int totalNum = this->getTotalNum(); long int totalNum = this->getTotalNum();
if ( if (!Options::amr && OpalData::getInstance()->isInOPALCyclMode())
#ifdef ENABLE_AMR
!Options::amr &&
#endif
OpalData::getInstance()->isInOPALCyclMode())
{ {
/* FIXME After issue 287 is resolved this shouldn't be necessary /* FIXME After issue 287 is resolved this shouldn't be necessary
* anymore * anymore
......
...@@ -47,14 +47,7 @@ Tracker::Tracker(const Beamline &beamline, const PartData &reference, ...@@ -47,14 +47,7 @@ Tracker::Tracker(const Beamline &beamline, const PartData &reference,
AbstractTracker(beamline, reference, backBeam, backTrack), AbstractTracker(beamline, reference, backBeam, backTrack),
itsBeamline_m(beamline), itsBeamline_m(beamline),
itsBunch_m(nullptr) itsBunch_m(nullptr)
{ { }
// #ifdef ENABLE_AMR
// if ( Options::amr )
// itsBunch = new AmrPartBunch(&reference);
// else
// #endif
// itsBunch = new PartBunch(&reference);
}
Tracker::Tracker(const Beamline &beamline, Tracker::Tracker(const Beamline &beamline,
......
...@@ -96,14 +96,12 @@ namespace Options { ...@@ -96,14 +96,12 @@ namespace Options {
// opal version of input file // opal version of input file
int version = 10000; int version = 10000;
#ifdef ENABLE_AMR
bool amr = false; bool amr = false;
/// The frequency to dump AMR grid data and particles into file /// The frequency to dump AMR grid data and particles into file
int amrYtDumpFreq = 10; int amrYtDumpFreq = 10;
int amrRegridFreq = 10; int amrRegridFreq = 10;
#endif
bool memoryDump = false; bool memoryDump = false;
......
...@@ -148,7 +148,6 @@ namespace Options { ...@@ -148,7 +148,6 @@ namespace Options {
/// opal version of input file /// opal version of input file
extern int version; extern int version;
#ifdef ENABLE_AMR
/// Enable AMR if true /// Enable AMR if true
extern bool amr; extern bool amr;
...@@ -157,7 +156,6 @@ namespace Options { ...@@ -157,7 +156,6 @@ namespace Options {
/// After how many steps the AMR grid hierarchy is updated /// After how many steps the AMR grid hierarchy is updated
extern int amrRegridFreq; extern int amrRegridFreq;
#endif
extern bool memoryDump; extern bool memoryDump;
......
...@@ -431,18 +431,14 @@ void FieldSolver::initCartesianFields() { ...@@ -431,18 +431,14 @@ void FieldSolver::initCartesianFields() {
} }
// create prototype mesh and layout objects for this problem domain // create prototype mesh and layout objects for this problem domain
#ifdef ENABLE_AMR
if ( !isAmrSolverType() ) { if ( !isAmrSolverType() ) {
#endif
mesh_m = new Mesh_t(domain); mesh_m = new Mesh_t(domain);
FL_m = new FieldLayout_t(*mesh_m, decomp); FL_m = new FieldLayout_t(*mesh_m, decomp);
PL_m.reset(new Layout_t(*FL_m, *mesh_m)); PL_m.reset(new Layout_t(*FL_m, *mesh_m));
// OpalData::getInstance()->setMesh(mesh_m); // OpalData::getInstance()->setMesh(mesh_m);
// OpalData::getInstance()->setFieldLayout(FL_m); // OpalData::getInstance()->setFieldLayout(FL_m);
// OpalData::getInstance()->setLayout(PL_m); // OpalData::getInstance()->setLayout(PL_m);
#ifdef ENABLE_AMR
} }
#endif
} }
bool FieldSolver::hasPeriodicZ() { bool FieldSolver::hasPeriodicZ() {
...@@ -452,11 +448,9 @@ bool FieldSolver::hasPeriodicZ() { ...@@ -452,11 +448,9 @@ bool FieldSolver::hasPeriodicZ() {
return (Attributes::getString(itsAttr[BCFFTZ]) == "PERIODIC"); return (Attributes::getString(itsAttr[BCFFTZ]) == "PERIODIC");
} }
#ifdef ENABLE_AMR
inline bool FieldSolver::isAmrSolverType() const { inline bool FieldSolver::isAmrSolverType() const {
return Options::amr; return Options::amr;
} }
#endif
void FieldSolver::initSolver(PartBunchBase<double, 3> *b) { void FieldSolver::initSolver(PartBunchBase<double, 3> *b) {
itsBunch_m = b; itsBunch_m = b;
...@@ -469,19 +463,16 @@ void FieldSolver::initSolver(PartBunchBase<double, 3> *b) { ...@@ -469,19 +463,16 @@ void FieldSolver::initSolver(PartBunchBase<double, 3> *b) {
bcz = Attributes::getString(itsAttr[BCFFTZ]); bcz = Attributes::getString(itsAttr[BCFFTZ]);
} }
#ifdef ENABLE_AMR
if ( isAmrSolverType() ) { if ( isAmrSolverType() ) {
Inform m("FieldSolver::initAmrSolver"); Inform m("FieldSolver::initAmrSolver");
fsType_m = "AMR"; fsType_m = "AMR";
#ifdef ENABLE_AMR
initAmrObject_m(); initAmrObject_m();
initAmrSolver_m(); initAmrSolver_m();
} else if(fsType_m == "FFT") {
#else
if(fsType_m == "FFT") {
#endif #endif
} else if(fsType_m == "FFT") {
bool sinTrafo = ((bcx == "DIRICHLET") && (bcy == "DIRICHLET") && (bcz == "DIRICHLET")); bool sinTrafo = ((bcx == "DIRICHLET") && (bcy == "DIRICHLET") && (bcz == "DIRICHLET"));
if(sinTrafo) { if(sinTrafo) {
std::cout << "FFTBOX ACTIVE" << std::endl; std::cout << "FFTBOX ACTIVE" << std::endl;
...@@ -568,13 +559,13 @@ Inform &FieldSolver::printInfo(Inform &os) const { ...@@ -568,13 +559,13 @@ Inform &FieldSolver::printInfo(Inform &os) const {
<< "* MT " << Attributes::getReal(itsAttr[MT]) << '\n' << "* MT " << Attributes::getReal(itsAttr[MT]) << '\n'
<< "* BBOXINCR " << Attributes::getReal(itsAttr[BBOXINCR]) << endl; << "* BBOXINCR " << Attributes::getReal(itsAttr[BBOXINCR]) << endl;
if(fsType == "P3M") if (fsType == "P3M")
os << "* RC " << Attributes::getReal(itsAttr[RC]) << '\n' os << "* RC " << Attributes::getReal(itsAttr[RC]) << '\n'
<< "* ALPHA " << Attributes::getReal(itsAttr[ALPHA]) << '\n' << "* ALPHA " << Attributes::getReal(itsAttr[ALPHA]) << '\n'
<< "* EPSILON " << Attributes::getReal(itsAttr[EPSILON]) << endl; << "* EPSILON " << Attributes::getReal(itsAttr[EPSILON]) << endl;
if(fsType == "FFT") { if (fsType == "FFT") {
os << "* GRRENSF " << Attributes::getString(itsAttr[GREENSF]) << endl; os << "* GRRENSF " << Attributes::getString(itsAttr[GREENSF]) << endl;
} else if (fsType == "SAAMG") { } else if (fsType == "SAAMG") {
os << "* GEOMETRY " << Attributes::getString(itsAttr[GEOMETRY]) << '\n' os << "* GEOMETRY " << Attributes::getString(itsAttr[GEOMETRY]) << '\n'
...@@ -583,9 +574,8 @@ Inform &FieldSolver::printInfo(Inform &os) const { ...@@ -583,9 +574,8 @@ Inform &FieldSolver::printInfo(Inform &os) const {
<< "* TOL " << Attributes::getReal(itsAttr[TOL]) << '\n' << "* TOL " << Attributes::getReal(itsAttr[TOL]) << '\n'
<< "* MAXITERS " << Attributes::getReal(itsAttr[MAXITERS]) << '\n' << "* MAXITERS " << Attributes::getReal(itsAttr[MAXITERS]) << '\n'
<< "* PRECMODE " << Attributes::getString(itsAttr[PRECMODE]) << endl; << "* PRECMODE " << Attributes::getString(itsAttr[PRECMODE]) << endl;
} } else if (Options::amr) {
#ifdef ENABLE_AMR #ifdef ENABLE_AMR
else if (fsType == "AMR" || Options::amr) {
os << "* AMR_MAXLEVEL " << Attributes::getReal(itsAttr[AMR_MAXLEVEL]) << '\n' os << "* AMR_MAXLEVEL " << Attributes::getReal(itsAttr[AMR_MAXLEVEL]) << '\n'
<< "* AMR_REFX " << Attributes::getReal(itsAttr[AMR_REFX]) << '\n' << "* AMR_REFX " << Attributes::getReal(itsAttr[AMR_REFX]) << '\n'
<< "* AMR_REFY " << Attributes::getReal(itsAttr[AMR_REFY]) << '\n' << "* AMR_REFY " << Attributes::getReal(itsAttr[AMR_REFY]) << '\n'
...@@ -608,8 +598,8 @@ Inform &FieldSolver::printInfo(Inform &os) const { ...@@ -608,8 +598,8 @@ Inform &FieldSolver::printInfo(Inform &os) const {
os << l << " "; os << l << " ";
} }
os << ")" << endl; os << ")" << endl;
}
#endif #endif
}
#ifdef HAVE_AMR_MG_SOLVER #ifdef HAVE_AMR_MG_SOLVER
if (fsType == "AMR_MG") { if (fsType == "AMR_MG") {
...@@ -662,14 +652,10 @@ Inform &FieldSolver::printInfo(Inform &os) const { ...@@ -662,14 +652,10 @@ Inform &FieldSolver::printInfo(Inform &os) const {
else else
os << "* Z(T)DIM serial " << endl; os << "* Z(T)DIM serial " << endl;
#ifdef ENABLE_AMR
if ( !isAmrSolverType() ) { if ( !isAmrSolverType() ) {
#endif
INFOMSG(level3 << *mesh_m << endl); INFOMSG(level3 << *mesh_m << endl);
INFOMSG(level3 << *PL_m << endl); INFOMSG(level3 << *PL_m << endl);
#ifdef ENABLE_AMR
} }
#endif
if(solver_m) if(solver_m)
os << *solver_m << endl; os << *solver_m << endl;
......
...@@ -98,9 +98,9 @@ public: ...@@ -98,9 +98,9 @@ public:
bool hasPeriodicZ(); bool hasPeriodicZ();
#ifdef ENABLE_AMR
bool isAmrSolverType() const; bool isAmrSolverType() const;
#ifdef ENABLE_AMR
AmrObject *getAmrObject() { AmrObject *getAmrObject() {
return itsAmrObject_mp.get(); return itsAmrObject_mp.get();
} }
......
...@@ -58,7 +58,7 @@ Track::Track(BeamSequence *u, const PartData &ref, const std::vector<double> & d ...@@ -58,7 +58,7 @@ Track::Track(BeamSequence *u, const PartData &ref, const std::vector<double> & d
{ {
if(!OpalData::getInstance()->hasBunchAllocated()) { if(!OpalData::getInstance()->hasBunchAllocated()) {
#ifdef ENABLE_AMR #ifdef ENABLE_AMR
if ( Options::amr ) if (Options::amr)
OpalData::getInstance()->setPartBunch(new AmrPartBunch(&ref)); OpalData::getInstance()->setPartBunch(new AmrPartBunch(&ref));
else else
#endif #endif
......
...@@ -603,11 +603,7 @@ void TrackRun::setupFieldsolver() { ...@@ -603,11 +603,7 @@ void TrackRun::setupFieldsolver() {
if (!opal->inRestartRun() && numParticles < numGridPoints if (!opal->inRestartRun() && numParticles < numGridPoints
&& fs->getType() != std::string("SAAMG") // in SPIRAL/SAAMG we're meshing the whole domain -DW && fs->getType() != std::string("SAAMG") // in SPIRAL/SAAMG we're meshing the whole domain -DW
#ifdef ENABLE_AMR
&& !Options::amr) && !Options::amr)
#else
)
#endif
{ {
throw OpalException("TrackRun::setupFieldsolver()", throw OpalException("TrackRun::setupFieldsolver()",
"The number of simulation particles (" + std::to_string(numParticles) + ") \n" + "The number of simulation particles (" + std::to_string(numParticles) + ") \n" +
......
...@@ -36,7 +36,7 @@ int run_opal(char */*args*/[], std::string inputfile, int restartStep, ...@@ -36,7 +36,7 @@ int run_opal(char */*args*/[], std::string inputfile, int restartStep,
IpplInfo::Warn->setDestination(output); IpplInfo::Warn->setDestination(output);
#ifdef ENABLE_AMR #ifdef ENABLE_AMR
if ( Options::amr ) if (Options::amr)
amrex::Initialize(comm); amrex::Initialize(comm);
#endif #endif
...@@ -79,7 +79,7 @@ int run_opal(char */*args*/[], std::string inputfile, int restartStep, ...@@ -79,7 +79,7 @@ int run_opal(char */*args*/[], std::string inputfile, int restartStep,
delete gmsg; delete gmsg;
#ifdef ENABLE_AMR #ifdef ENABLE_AMR
if ( Options::amr ) if (Options::amr)
amrex::Finalize(true); amrex::Finalize(true);
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment