Commit aa64d366 authored by frey_m's avatar frey_m
Browse files

make AMR options internally always available

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