Commit bf453fa2 authored by ext-calvo_p's avatar ext-calvo_p
Browse files

Merge branch '647-add-option-to-write-vtk-file' into 'master'

Resolve "Add option to write VTK file"

Closes #647

See merge request !488
parents c1a4eba7 4afce1f2
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <limits> #include <limits>
#include <cstddef> #include <cstddef>
extern Inform *gmsg; extern Inform* gmsg;
using namespace Options; using namespace Options;
...@@ -64,13 +64,13 @@ namespace { ...@@ -64,13 +64,13 @@ namespace {
EBDUMP, EBDUMP,
CSRDUMP, CSRDUMP,
AUTOPHASE, AUTOPHASE,
SURFDUMPFREQ,
NUMBLOCKS, NUMBLOCKS,
RECYCLEBLOCKS, RECYCLEBLOCKS,
NLHS, NLHS,
CZERO, CZERO,
RNGTYPE, RNGTYPE,
ENABLEHDF5, ENABLEHDF5,
ENABLEVTK,
ASCIIDUMP, ASCIIDUMP,
BOUNDPDESTROYFQ, BOUNDPDESTROYFQ,
BEAMHALOBOUNDARY, BEAMHALOBOUNDARY,
...@@ -105,7 +105,9 @@ Option::Option(): ...@@ -105,7 +105,9 @@ Option::Option():
("INFO", "If true, print information messages", info); ("INFO", "If true, print information messages", info);
itsAttr[TRACE] = Attributes::makeBool itsAttr[TRACE] = Attributes::makeBool
("TRACE", "If true, print execution trace", mtrace); ("TRACE", "If true, print execution trace"
"Must be the first option in the inputfile in "
"order to render correct results", mtrace);
itsAttr[WARN] = Attributes::makeBool itsAttr[WARN] = Attributes::makeBool
("WARN", "If true, print warning messages", warn); ("WARN", "If true, print warning messages", warn);
...@@ -136,14 +138,16 @@ Option::Option(): ...@@ -136,14 +138,16 @@ Option::Option():
itsAttr[SCSOLVEFREQ] = Attributes::makeReal itsAttr[SCSOLVEFREQ] = Attributes::makeReal
("SCSOLVEFREQ", "The frequency to solve space charge fields. its default value is 1"); ("SCSOLVEFREQ", "The frequency to solve space charge fields. its default value is 1");
itsAttr[MTSSUBSTEPS] = Attributes::makeReal("MTSSUBSTEPS", "How many small timesteps " itsAttr[MTSSUBSTEPS] = Attributes::makeReal
("MTSSUBSTEPS", "How many small timesteps "
"are inside the large timestep used in multiple " "are inside the large timestep used in multiple "
"time stepping (MTS) integrator"); "time stepping (MTS) integrator");
itsAttr[REMOTEPARTDEL] = Attributes::makeReal itsAttr[REMOTEPARTDEL] = Attributes::makeReal
("REMOTEPARTDEL", "Artifically delete the remote particle if its distance " ("REMOTEPARTDEL", "Artifically delete the remote particle "
"to the beam mass is larger than REMOTEPARTDEL times of the beam rms size, " "if its distance to the beam mass is larger than "
"its default values is 0 (no delete) ",0.0); "REMOTEPARTDEL times of the beam rms size, "
"its default values is 0 (no delete) ",remotePartDel);
itsAttr[PSDUMPFRAME] = Attributes::makeUpperCaseString itsAttr[PSDUMPFRAME] = Attributes::makeUpperCaseString
("PSDUMPFRAME", "Controls the frame of phase space dump in " ("PSDUMPFRAME", "Controls the frame of phase space dump in "
...@@ -151,13 +155,13 @@ Option::Option(): ...@@ -151,13 +155,13 @@ Option::Option():
"lab (global) Cartesian frame; if 'BUNCH_MEAN' OPAL will " "lab (global) Cartesian frame; if 'BUNCH_MEAN' OPAL will "
"dump in the local Cartesian frame of the beam mean; " "dump in the local Cartesian frame of the beam mean; "
"if 'REFERENCE' OPAL will dump in the local Cartesian " "if 'REFERENCE' OPAL will dump in the local Cartesian "
"frame of the reference particle 0. Only aviable for " "frame of the reference particle 0. Only available for "
"OPAL-cycl, its default value is 'GLOBAL'"); "OPAL-cycl, its default value is 'GLOBAL'");
itsAttr[SPTDUMPFREQ] = Attributes::makeReal itsAttr[SPTDUMPFREQ] = Attributes::makeReal
("SPTDUMPFREQ", "The frequency to dump single " ("SPTDUMPFREQ", "The frequency to dump single "
"particle trajectory of particles with ID = 0 & 1, " "particle trajectory of particles with ID = 0 & 1, "
"its default value is 1. "); "its default value is 1.", sptDumpFreq);
itsAttr[REPARTFREQ] = Attributes::makeReal itsAttr[REPARTFREQ] = Attributes::makeReal
("REPARTFREQ", "The frequency to do particles repartition " ("REPARTFREQ", "The frequency to do particles repartition "
...@@ -195,20 +199,14 @@ Option::Option(): ...@@ -195,20 +199,14 @@ Option::Option():
"acceleration. Defines the number of refinements of the " "acceleration. Defines the number of refinements of the "
"search range", autoPhase); "search range", autoPhase);
itsAttr[SURFDUMPFREQ] = Attributes::makeReal
("SURFDUMPFREQ", "The frequency to dump surface-particle "
"interaction data, its default value is -1 (no dump).",
surfDumpFreq);
itsAttr[CZERO] = Attributes::makeBool itsAttr[CZERO] = Attributes::makeBool
("CZERO", "If set to true a symmetric distribution is " ("CZERO", "If set to true a symmetric distribution is "
"created -> centroid == 0.0 ", cZero); "created -> centroid == 0.0", cZero);
itsAttr[RNGTYPE] = Attributes::makeUpperCaseString itsAttr[RNGTYPE] = Attributes::makeUpperCaseString
("RNGTYPE", "RANDOM (default), Quasi-random number " ("RNGTYPE", "RANDOM (default), Quasi-random number "
"generators: HALTON, SOBOL, NIEDERREITER (Gsl ref manual 18.5)", rngtype); "generators: HALTON, SOBOL, NIEDERREITER (Gsl ref manual 18.5)", rngtype);
itsAttr[CLOTUNEONLY] = Attributes::makeBool itsAttr[CLOTUNEONLY] = Attributes::makeBool
("CLOTUNEONLY", "If set to true stop after " ("CLOTUNEONLY", "If set to true stop after "
"CLO and tune calculation ", cloTuneOnly); "CLO and tune calculation ", cloTuneOnly);
...@@ -216,9 +214,11 @@ Option::Option(): ...@@ -216,9 +214,11 @@ Option::Option():
itsAttr[NUMBLOCKS] = Attributes::makeReal itsAttr[NUMBLOCKS] = Attributes::makeReal
("NUMBLOCKS", "Maximum number of vectors in the Krylov " ("NUMBLOCKS", "Maximum number of vectors in the Krylov "
"space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used."); "space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used.");
itsAttr[RECYCLEBLOCKS] = Attributes::makeReal itsAttr[RECYCLEBLOCKS] = Attributes::makeReal
("RECYCLEBLOCKS", "Number of vectors in the recycle " ("RECYCLEBLOCKS", "Number of vectors in the recycle "
"space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used."); "space (for RCGSolMgr). Default value is 0 and BlockCGSolMgr will be used.");
itsAttr[NLHS] = Attributes::makeReal itsAttr[NLHS] = Attributes::makeReal
("NLHS", "Number of stored old solutions for extrapolating " ("NLHS", "Number of stored old solutions for extrapolating "
"the new starting vector. Default value is 1 and just the last solution is used."); "the new starting vector. Default value is 1 and just the last solution is used.");
...@@ -226,23 +226,30 @@ Option::Option(): ...@@ -226,23 +226,30 @@ Option::Option():
itsAttr[ENABLEHDF5] = Attributes::makeBool itsAttr[ENABLEHDF5] = Attributes::makeBool
("ENABLEHDF5", "If true, HDF5 actions are enabled", enableHDF5); ("ENABLEHDF5", "If true, HDF5 actions are enabled", enableHDF5);
itsAttr[ENABLEVTK] = Attributes::makeBool
("ENABLEVTK", "If true, writing of VTK files are enabled", enableVTK);
itsAttr[ASCIIDUMP] = Attributes::makeBool itsAttr[ASCIIDUMP] = Attributes::makeBool
("ASCIIDUMP", "If true, some of the elements dump in ASCII instead of HDF5", false); ("ASCIIDUMP", "If true, some of the elements dump in ASCII instead of HDF5", asciidump);
itsAttr[BOUNDPDESTROYFQ] = Attributes::makeReal itsAttr[BOUNDPDESTROYFQ] = Attributes::makeReal
("BOUNDPDESTROYFQ", "The frequency to do boundp_destroy to delete lost particles. Default 10",10.0); ("BOUNDPDESTROYFQ", "The frequency to do boundp_destroy to "
"delete lost particles. Default 10", boundpDestroyFreq);
itsAttr[BEAMHALOBOUNDARY] = Attributes::makeReal itsAttr[BEAMHALOBOUNDARY] = Attributes::makeReal
("BEAMHALOBOUNDARY", "Defines in terms of sigma where the halo starts. Default 0.0",0.0); ("BEAMHALOBOUNDARY", "Defines in terms of sigma where "
"the halo starts. Default 0.0", beamHaloBoundary);
itsAttr[IDEALIZED] = Attributes::makeBool itsAttr[IDEALIZED] = Attributes::makeBool
("IDEALIZED", "Using the hard edge model for the calculation of path length. Default: false", false); ("IDEALIZED", "Using the hard edge model for the calculation "
"of path length. Default: false", idealized);
itsAttr[LOGBENDTRAJECTORY] = Attributes::makeBool itsAttr[LOGBENDTRAJECTORY] = Attributes::makeBool
("LOGBENDTRAJECTORY", "Writing the trajectory of every bend to disk. Default: false", false); ("LOGBENDTRAJECTORY", "Writing the trajectory of "
"every bend to disk. Default: false", writeBendTrajectories);
itsAttr[VERSION] = Attributes::makeReal itsAttr[VERSION] = Attributes::makeReal
("VERSION", "Version of OPAL for which input file was written", 10000); ("VERSION", "Version of OPAL for which input file was written", version);
#ifdef ENABLE_AMR #ifdef ENABLE_AMR
itsAttr[AMR] = Attributes::makeBool itsAttr[AMR] = Attributes::makeBool
...@@ -258,6 +265,7 @@ Option::Option(): ...@@ -258,6 +265,7 @@ Option::Option():
"in multi-bunch mode (default: 10)", "in multi-bunch mode (default: 10)",
amrRegridFreq); amrRegridFreq);
#endif #endif
itsAttr[MEMORYDUMP] = Attributes::makeBool itsAttr[MEMORYDUMP] = Attributes::makeBool
("MEMORYDUMP", "If true, write memory to SDDS file", memoryDump); ("MEMORYDUMP", "If true, write memory to SDDS file", memoryDump);
...@@ -265,7 +273,8 @@ Option::Option(): ...@@ -265,7 +273,8 @@ Option::Option():
("HALOSHIFT", "Constant parameter to shift halo value (default: 0.0)", haloShift); ("HALOSHIFT", "Constant parameter to shift halo value (default: 0.0)", haloShift);
itsAttr[DELPARTFREQ] = Attributes::makeReal itsAttr[DELPARTFREQ] = Attributes::makeReal
("DELPARTFREQ", "The frequency to delete particles, i.e. delete when step%delPartFreq == 0. Default: 1", delPartFreq); ("DELPARTFREQ", "The frequency to delete particles, "
"i.e. delete when step%delPartFreq == 0. Default: 1", delPartFreq);
registerOwnership(AttributeHandler::STATEMENT); registerOwnership(AttributeHandler::STATEMENT);
...@@ -273,7 +282,7 @@ Option::Option(): ...@@ -273,7 +282,7 @@ Option::Option():
} }
Option::Option(const std::string &name, Option *parent): Option::Option(const std::string& name, Option* parent):
Action(name, parent) { Action(name, parent) {
Attributes::setBool(itsAttr[ECHO], echo); Attributes::setBool(itsAttr[ECHO], echo);
Attributes::setBool(itsAttr[INFO], info); Attributes::setBool(itsAttr[INFO], info);
...@@ -296,7 +305,6 @@ Option::Option(const std::string &name, Option *parent): ...@@ -296,7 +305,6 @@ Option::Option(const std::string &name, Option *parent):
Attributes::setBool(itsAttr[EBDUMP], ebDump); Attributes::setBool(itsAttr[EBDUMP], ebDump);
Attributes::setBool(itsAttr[CSRDUMP], csrDump); Attributes::setBool(itsAttr[CSRDUMP], csrDump);
Attributes::setReal(itsAttr[AUTOPHASE], autoPhase); Attributes::setReal(itsAttr[AUTOPHASE], autoPhase);
Attributes::setReal(itsAttr[SURFDUMPFREQ], surfDumpFreq);
Attributes::setBool(itsAttr[CZERO], cZero); Attributes::setBool(itsAttr[CZERO], cZero);
Attributes::setBool(itsAttr[CLOTUNEONLY], cloTuneOnly); Attributes::setBool(itsAttr[CLOTUNEONLY], cloTuneOnly);
Attributes::setUpperCaseString(itsAttr[RNGTYPE], std::string(rngtype)); Attributes::setUpperCaseString(itsAttr[RNGTYPE], std::string(rngtype));
...@@ -304,6 +312,7 @@ Option::Option(const std::string &name, Option *parent): ...@@ -304,6 +312,7 @@ Option::Option(const std::string &name, Option *parent):
Attributes::setReal(itsAttr[RECYCLEBLOCKS], recycleBlocks); Attributes::setReal(itsAttr[RECYCLEBLOCKS], recycleBlocks);
Attributes::setReal(itsAttr[NLHS], nLHS); Attributes::setReal(itsAttr[NLHS], nLHS);
Attributes::setBool(itsAttr[ENABLEHDF5], enableHDF5); Attributes::setBool(itsAttr[ENABLEHDF5], enableHDF5);
Attributes::setBool(itsAttr[ENABLEVTK], enableVTK);
Attributes::setBool(itsAttr[ASCIIDUMP], asciidump); Attributes::setBool(itsAttr[ASCIIDUMP], asciidump);
Attributes::setReal(itsAttr[BOUNDPDESTROYFQ], boundpDestroyFreq); Attributes::setReal(itsAttr[BOUNDPDESTROYFQ], boundpDestroyFreq);
Attributes::setReal(itsAttr[BEAMHALOBOUNDARY], beamHaloBoundary); Attributes::setReal(itsAttr[BEAMHALOBOUNDARY], beamHaloBoundary);
...@@ -325,7 +334,7 @@ Option::~Option() ...@@ -325,7 +334,7 @@ Option::~Option()
{} {}
Option *Option::clone(const std::string &name) { Option* Option::clone(const std::string& name) {
return new Option(name, this); return new Option(name, this);
} }
...@@ -337,11 +346,18 @@ void Option::execute() { ...@@ -337,11 +346,18 @@ void Option::execute() {
mtrace = Attributes::getBool(itsAttr[TRACE]); mtrace = Attributes::getBool(itsAttr[TRACE]);
warn = Attributes::getBool(itsAttr[WARN]); warn = Attributes::getBool(itsAttr[WARN]);
psDumpEachTurn = Attributes::getBool(itsAttr[PSDUMPEACHTURN]); psDumpEachTurn = Attributes::getBool(itsAttr[PSDUMPEACHTURN]);
remotePartDel = Attributes::getReal(itsAttr[REMOTEPARTDEL]);
rhoDump = Attributes::getBool(itsAttr[RHODUMP]); rhoDump = Attributes::getBool(itsAttr[RHODUMP]);
ebDump = Attributes::getBool(itsAttr[EBDUMP]); ebDump = Attributes::getBool(itsAttr[EBDUMP]);
csrDump = Attributes::getBool(itsAttr[CSRDUMP]); csrDump = Attributes::getBool(itsAttr[CSRDUMP]);
enableHDF5 = Attributes::getBool(itsAttr[ENABLEHDF5]); enableHDF5 = Attributes::getBool(itsAttr[ENABLEHDF5]);
enableVTK = Attributes::getBool(itsAttr[ENABLEVTK]);
idealized = Attributes::getBool(itsAttr[IDEALIZED]);
asciidump = Attributes::getBool(itsAttr[ASCIIDUMP]);
version = Attributes::getReal(itsAttr[VERSION]); version = Attributes::getReal(itsAttr[VERSION]);
seed = Attributes::getReal(itsAttr[SEED]);
writeBendTrajectories = Attributes::getBool(itsAttr[LOGBENDTRAJECTORY]);
#ifdef ENABLE_AMR #ifdef ENABLE_AMR
amr = Attributes::getBool(itsAttr[AMR]); amr = Attributes::getBool(itsAttr[AMR]);
amrYtDumpFreq = int(Attributes::getReal(itsAttr[AMR_YT_DUMP_FREQ])); amrYtDumpFreq = int(Attributes::getReal(itsAttr[AMR_YT_DUMP_FREQ]));
...@@ -353,6 +369,7 @@ void Option::execute() { ...@@ -353,6 +369,7 @@ void Option::execute() {
amrRegridFreq = int(Attributes::getReal(itsAttr[AMR_REGRID_FREQ])); amrRegridFreq = int(Attributes::getReal(itsAttr[AMR_REGRID_FREQ]));
amrRegridFreq = ( amrRegridFreq < 1 ) ? 1 : amrRegridFreq; amrRegridFreq = ( amrRegridFreq < 1 ) ? 1 : amrRegridFreq;
#endif #endif
memoryDump = Attributes::getBool(itsAttr[MEMORYDUMP]); memoryDump = Attributes::getBool(itsAttr[MEMORYDUMP]);
haloShift = Attributes::getReal(itsAttr[HALOSHIFT]); haloShift = Attributes::getReal(itsAttr[HALOSHIFT]);
delPartFreq = Attributes::getReal(itsAttr[DELPARTFREQ]); delPartFreq = Attributes::getReal(itsAttr[DELPARTFREQ]);
...@@ -363,8 +380,6 @@ void Option::execute() { ...@@ -363,8 +380,6 @@ void Option::execute() {
memory->sample(); memory->sample();
} }
seed = Attributes::getReal(itsAttr[SEED]);
/// note: rangen is used only for the random number generator in the OPAL language /// note: rangen is used only for the random number generator in the OPAL language
/// not for the distributions /// not for the distributions
...@@ -373,19 +388,14 @@ void Option::execute() { ...@@ -373,19 +388,14 @@ void Option::execute() {
else else
rangen.init55(seed); rangen.init55(seed);
IpplInfo::Info->on(info); IpplInfo::Info->on(info);
IpplInfo::Warn->on(warn); IpplInfo::Warn->on(warn);
handlePsDumpFrame(Attributes::getString(itsAttr[PSDUMPFRAME])); handlePsDumpFrame(Attributes::getString(itsAttr[PSDUMPFRAME]));
if(itsAttr[ASCIIDUMP]) {
asciidump = Attributes::getBool(itsAttr[ASCIIDUMP]);
}
/// note: rangen is used only for the random number generator in the OPAL language /// note: rangen is used only for the random number generator in the OPAL language
/// not for the distributions /// not for the distributions
if(itsAttr[SEED]) { if (itsAttr[SEED]) {
seed = int(Attributes::getReal(itsAttr[SEED])); seed = int(Attributes::getReal(itsAttr[SEED]));
if (seed == -1) if (seed == -1)
rangen.init55(time(0)); rangen.init55(time(0));
...@@ -393,41 +403,34 @@ void Option::execute() { ...@@ -393,41 +403,34 @@ void Option::execute() {
rangen.init55(seed); rangen.init55(seed);
} }
if(itsAttr[PSDUMPFREQ]) { if (itsAttr[PSDUMPFREQ]) {
psDumpFreq = int(Attributes::getReal(itsAttr[PSDUMPFREQ])); psDumpFreq = int(Attributes::getReal(itsAttr[PSDUMPFREQ]));
if (psDumpFreq==0) if (psDumpFreq==0)
psDumpFreq = std::numeric_limits<int>::max(); psDumpFreq = std::numeric_limits<int>::max();
} }
if(itsAttr[STATDUMPFREQ]) { if (itsAttr[STATDUMPFREQ]) {
statDumpFreq = int(Attributes::getReal(itsAttr[STATDUMPFREQ])); statDumpFreq = int(Attributes::getReal(itsAttr[STATDUMPFREQ]));
if (statDumpFreq==0) if (statDumpFreq==0)
statDumpFreq = std::numeric_limits<int>::max(); statDumpFreq = std::numeric_limits<int>::max();
} }
if(itsAttr[SPTDUMPFREQ]) { if (itsAttr[SPTDUMPFREQ]) {
sptDumpFreq = int(Attributes::getReal(itsAttr[SPTDUMPFREQ])); sptDumpFreq = int(Attributes::getReal(itsAttr[SPTDUMPFREQ]));
if (sptDumpFreq==0) if (sptDumpFreq==0)
sptDumpFreq = std::numeric_limits<int>::max(); sptDumpFreq = std::numeric_limits<int>::max();
} }
if (itsAttr[SCSOLVEFREQ]) {
if(itsAttr[SCSOLVEFREQ]) {
scSolveFreq = int(Attributes::getReal(itsAttr[SCSOLVEFREQ])); scSolveFreq = int(Attributes::getReal(itsAttr[SCSOLVEFREQ]));
scSolveFreq = ( scSolveFreq < 1 ) ? 1 : scSolveFreq; scSolveFreq = ( scSolveFreq < 1 ) ? 1 : scSolveFreq;
} }
if (itsAttr[MTSSUBSTEPS]) {
if(itsAttr[MTSSUBSTEPS]) {
mtsSubsteps = int(Attributes::getReal(itsAttr[MTSSUBSTEPS])); mtsSubsteps = int(Attributes::getReal(itsAttr[MTSSUBSTEPS]));
} }
if (itsAttr[REPARTFREQ]) {
if(itsAttr[REMOTEPARTDEL]) {
remotePartDel = Attributes::getReal(itsAttr[REMOTEPARTDEL]);
}
if(itsAttr[REPARTFREQ]) {
repartFreq = int(Attributes::getReal(itsAttr[REPARTFREQ])); repartFreq = int(Attributes::getReal(itsAttr[REPARTFREQ]));
} }
...@@ -439,48 +442,43 @@ void Option::execute() { ...@@ -439,48 +442,43 @@ void Option::execute() {
minStepForRebin = int(Attributes::getReal(itsAttr[MINSTEPFORREBIN])); minStepForRebin = int(Attributes::getReal(itsAttr[MINSTEPFORREBIN]));
} }
if(itsAttr[REBINFREQ]) { if (itsAttr[REBINFREQ]) {
rebinFreq = int(Attributes::getReal(itsAttr[REBINFREQ])); rebinFreq = int(Attributes::getReal(itsAttr[REBINFREQ]));
} }
if(itsAttr[AUTOPHASE]) { if (itsAttr[AUTOPHASE]) {
autoPhase = int(Attributes::getReal(itsAttr[AUTOPHASE])); autoPhase = int(Attributes::getReal(itsAttr[AUTOPHASE]));
} }
if(itsAttr[SURFDUMPFREQ]) {
surfDumpFreq = int(Attributes::getReal(itsAttr[SURFDUMPFREQ])); if (itsAttr[NUMBLOCKS]) {
}
if(itsAttr[NUMBLOCKS]) {
numBlocks = int(Attributes::getReal(itsAttr[NUMBLOCKS])); numBlocks = int(Attributes::getReal(itsAttr[NUMBLOCKS]));
} }
if(itsAttr[RECYCLEBLOCKS]) {
if (itsAttr[RECYCLEBLOCKS]) {
recycleBlocks = int(Attributes::getReal(itsAttr[RECYCLEBLOCKS])); recycleBlocks = int(Attributes::getReal(itsAttr[RECYCLEBLOCKS]));
} }
if(itsAttr[NLHS]) {
if (itsAttr[NLHS]) {
nLHS = int(Attributes::getReal(itsAttr[NLHS])); nLHS = int(Attributes::getReal(itsAttr[NLHS]));
} }
if(itsAttr[CZERO]) { if (itsAttr[CZERO]) {
cZero = bool(Attributes::getBool(itsAttr[CZERO])); cZero = bool(Attributes::getBool(itsAttr[CZERO]));
} }
if(itsAttr[RNGTYPE]) { if (itsAttr[RNGTYPE]) {
rngtype = std::string(Attributes::getString(itsAttr[RNGTYPE])); rngtype = std::string(Attributes::getString(itsAttr[RNGTYPE]));
} else { } else {
rngtype = std::string("RANDOM"); rngtype = std::string("RANDOM");
} }
if(itsAttr[BEAMHALOBOUNDARY]) { if (itsAttr[BEAMHALOBOUNDARY]) {
beamHaloBoundary = Attributes::getReal(itsAttr[BEAMHALOBOUNDARY]); beamHaloBoundary = Attributes::getReal(itsAttr[BEAMHALOBOUNDARY]);
} } else {
else {
beamHaloBoundary = 0; beamHaloBoundary = 0;
} }
idealized = Attributes::getBool(itsAttr[IDEALIZED]); if (itsAttr[CLOTUNEONLY]) {
writeBendTrajectories = Attributes::getBool(itsAttr[LOGBENDTRAJECTORY]);
if(itsAttr[CLOTUNEONLY]) {
cloTuneOnly = bool(Attributes::getBool(itsAttr[CLOTUNEONLY])); cloTuneOnly = bool(Attributes::getBool(itsAttr[CLOTUNEONLY]));
} else { } else {
cloTuneOnly = false; cloTuneOnly = false;
...@@ -489,7 +487,7 @@ void Option::execute() { ...@@ -489,7 +487,7 @@ void Option::execute() {
// Set message flags. // Set message flags.
FileStream::setEcho(echo); FileStream::setEcho(echo);
if(Attributes::getBool(itsAttr[TELL])) { if (Attributes::getBool(itsAttr[TELL])) {
*gmsg << "\nCurrent settings of options:\n" << *this << endl; *gmsg << "\nCurrent settings of options:\n" << *this << endl;
} }
...@@ -499,7 +497,7 @@ void Option::execute() { ...@@ -499,7 +497,7 @@ void Option::execute() {
} }
} }
void Option::handlePsDumpFrame(const std::string &dumpFrame) { void Option::handlePsDumpFrame(const std::string& dumpFrame) {
if (dumpFrame == "GLOBAL") { if (dumpFrame == "GLOBAL") {
psDumpFrame = GLOBAL; psDumpFrame = GLOBAL;
} else if (dumpFrame == "BUNCH_MEAN") { } else if (dumpFrame == "BUNCH_MEAN") {
......
...@@ -32,21 +32,21 @@ public: ...@@ -32,21 +32,21 @@ public:
virtual ~Option(); virtual ~Option();
/// Make clone. /// Make clone.
virtual Option *clone(const std::string &name); virtual Option* clone(const std::string& name);
/// Execute the command. /// Execute the command.
virtual void execute(); virtual void execute();
private: private:
void handlePsDumpFrame(const std::string &dumpFrame); void handlePsDumpFrame(const std::string& dumpFrame);
void update(const std::vector<Attribute>&); void update(const std::vector<Attribute>&);
// Not implemented. // Not implemented.
Option(const Option &); Option(const Option&);
void operator=(const Option &); void operator=(const Option&);
// Clone constructor. // Clone constructor.
Option(const std::string &name, Option *parent); Option(const std::string& name, Option* parent);
}; };
#endif // OPAL_Option_HH #endif // OPAL_Option_HH
...@@ -18,104 +18,86 @@ ...@@ -18,104 +18,86 @@
// //
#include "OptionTypes.h" #include "OptionTypes.h"
#include "Utilities/ClassicRandom.h" #include "Utilities/ClassicRandom.h"
#include <string> #include <string>
namespace Options { namespace Options {
// The global program options. // The global program options.
bool echo = false; bool echo = false;
bool info = true; bool info = true;
int infoLevel = 1; int infoLevel = 1;
bool warn = true;
int warnLevel = 1;
bool csrDump = false;
// If true create symmetric distribution
bool c