48 #define MAX_NUM_INSTANCES 10
157 mainDirectory(), referenceMomentum(0), modified(false), itsTitle_m(),
158 hasPriorRun_m(false),
161 hasRestartFile_m(false),
162 restart_dump_freq_m(1), last_step_m(0),
163 hasBunchAllocated_m(false),
164 hasDataSinkAllocated_m(false),
165 hasSLBunchAllocated_m(false),
168 isInOPALCyclMode_m(false),
169 isInOPALTMode_m(false),
170 isInOPALEnvMode_m(false),
171 isOptimizerFlag_m(false),
172 isInPrepState_m(false)
229 "too many OpalData instances stashed");
239 "no OpalData instances stashed");
511 return p->
bg_m !=
nullptr;
529 if(oldObject !=
nullptr) {
531 "You cannot replace the object \"" + name +
"\".");
543 if(oldObject !=
nullptr && oldObject != newObject) {
547 "You cannot replace the object \"" + name +
"\".");
550 INFOMSG(
"Replacing the object \"" << name <<
"\"." <<
endl);
559 const std::string &tableName = table->
getOpalName();
563 cerr <<
endl <<
"Erasing dependent table \"" << tableName
577 (*i).second->replace(oldObject, newObject);
602 if(oldObject !=
nullptr) {
606 Object *child = &*i->second;
624 static const double energy_scale = 1.0e+9;
638 os <<
endl <<
"Object names matching the pattern \""
639 << pattern <<
"\":" <<
endl;
643 const std::string
name = (*index).first;
645 if(! name.empty() && regex.
match(name)) {
649 column += name.length();
654 }
while((column % 20) != 0);
662 if(column) os <<
endl;
719 int const pdot = fn.rfind(
".");
720 return fn.substr(0, pdot);
741 (*i).second->update();
750 std::vector<std::string> result;
754 std::string tmpName = (*index).first;
755 if(!tmpName.empty()) result.push_back(tmpName);
767 std::cout <<
"\nUser-defined variables:\n";
775 std::string tmpName = (*index).first;
776 if(!tmpName.empty()) {
778 if(!tmpObject || tmpObject->
isBuiltin())
continue;
780 std::cout << tmpName;
781 if(dynamic_cast<RealVariable *>(&*tmpObject)) {
784 std::cout <<
"\tr= " << variable.
getReal();
785 std::cout <<
"\ta= " << variable.
itsAttr[0];
832 for (
int i = 0; i < argc; ++ i) {
void setPartBunch(PartBunchBase< double, 3 > *p)
static void deleteInstance()
std::string getRestartFileName()
get opals restart h5 format filename
The global OPAL structure.
energyEvolution_t::iterator getLastEnergyData()
PartBunchBase< double, 3 > * getPartBunch()
void setParent(Object *)
Set parent object.
std::vector< MaxPhasesT >::iterator getLastMaxPhases()
virtual const std::string getCategory() const =0
Return the object category as a string.
void setPriorTrack(const bool &value=true)
true if in follow-up track
void erase()
Delete all entries.
A map of string versus pointer to Object.
void setOpenMode(OPENMODE openMode)
Abstract base class for attribute values of different types.
void define(Object *newObject)
Define a new object.
double getP0() const
Return value of global reference momentum.
void create(Object *newObject)
Create new object.
int getRestartDumpFreq() const
get the dump frequency as found in restart file
core of the envelope tracker based on Rene Bakkers BET implementation
void setRestartRun(const bool &value=true)
set OPAL in restart mode
std::string getImage() const
Convert to string.
bool isBuiltin() const
True, if [b]this[/b] is a built-in object.
The base class for all OPAL exceptions.
bool inRestartRun()
true if we do a restart run
virtual double getReal() const
Return value.
std::vector< std::string > getAllNames()
ValueDefinition * referenceMomentum
void storeInputFn(const std::string &fn)
store opals input filename
bool hasSLBunchAllocated()
true if we already allocated a ParticleBunch object
Attribute & value()
Return the attribute representing the value of the definition.
Object * getParent() const
Return parent pointer.
bool hasDataSinkAllocated()
true if we already allocated a DataSink object
The REAL VARIABLE definition.
int getRestartStep()
get the step where to restart
void setDirty(bool)
Set/reset the [b]modified[/b] flag.
The default parser for OPAL-9.
static std::stack< OpalData * > stashedInstances
void update()
Update all objects.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
unsigned long long getMaxTrackSteps()
const std::map< std::string, unsigned int > & getProblemCharacteristicValues() const
static OpalData * instance
void setDataSink(DataSink *s)
void apply(const ObjectFunction &)
Apply a function to all objects.
std::vector< std::string > arguments_m
std::pair< std::string, double > MaxPhasesT
bool hasPriorTrack()
true if in follow-up track
void addEnergyData(double spos, double ekin)
void printTitle(std::ostream &)
Print the page title.
std::vector< std::string > getArguments()
std::string getTitle()
Get the title string.
void unregisterTable(Table *t)
Unregister table.
virtual double getReal() const
Return real value.
std::set< AttributeBase * >::iterator exprIterator
static OpalData * getInstance()
const std::string & getOpalName() const
Return object name.
void storeTitle(const std::string &)
Store the page title.
PartBunchBase< double, 3 > * bunch_m
static bool isInstantiated
EnvelopeBunch * slbunch_m
void incMaxTrackSteps(unsigned long long s)
double getGlobalPhaseShift()
units: (sec)
void setRestartDumpFreq(const int &N)
set the dump frequency as found in restart file
int getLastStep() const
get the last step from a possible previous run
std::list< Table * > tableDirectory
void setGlobalGeometry(BoundaryGeometry *bg)
OPENMODE
Enum for writing to files.
virtual void operator()(Object *) const
The function to be executed.
ObjectDir::iterator begin()
First object in alphabetic order of name.
Object * find(const std::string &name) const
Find entry.
bool hasBunchAllocated()
true if we already allocated a ParticleBunch object
static void stashInstance()
void addProblemCharacteristicValue(const std::string &name, unsigned int value)
void insert(const std::string &name, Object *newObject)
Define new object.
std::string getInputFn()
get opals input filename
OPENMODE getOpenMode() const
virtual bool isDependent(const std::string &name) const =0
Find out if table depends on the object identified by [b]name[/b].
bool match(const std::string &s) const
Match a string against the pattern.
std::map< double, double > energyEvolution_t
EnvelopeBunch * getSLPartBunch()
bool hasSLBunchAllocated_m
void registerExpression(AttributeBase *)
Register expression.
unsigned long long maxTrackSteps_m
#define MAX_NUM_INSTANCES
std::vector< MaxPhasesT >::iterator getFirstMaxPhases()
int getNumberOfMaxPhases()
void printNames(std::ostream &stream, const std::string &pattern)
Print all objects.
OpalData::OPENMODE openMode_m
Mode for writing files.
void setLastStep(const int &step)
set the last step in a run for possible follow-up run
void unregisterExpression(AttributeBase *)
Unregister expression.
ObjectDir::iterator end()
Last object in alphabetic order of name.
std::set< AttributeBase * > exprDirectory
static OpalData * popInstance()
bool hasRestartFile()
true if we do a restart from specified h5 file
Object * find(const std::string &name)
Find entry.
void setGlobalPhaseShift(double shift)
units: (sec)
The base class for all OPAL objects.
bool hasDataSinkAllocated_m
The base class for all OPAL value definitions.
void storeArguments(int argc, char *argv[])
std::list< Table * >::iterator tableIterator
void setRestartFileName(std::string s)
store opals restart h5 format filename
void reset()
reset object for consecutive runs
void setMaxTrackSteps(unsigned long long s)
std::map< std::string, unsigned int > problemSize_m
Abstract base class for functor objects whose argument is an Object.
void erase(const std::string &name)
Delete existing entry.
void setP0(ValueDefinition *p0)
Set the global momentum.
std::string::iterator iterator
void setSLPartBunch(EnvelopeBunch *p)
The base class for all OPAL tables.
std::string getInputBasename()
get input file name without extension
std::vector< MaxPhasesT > maxPhases_m
energyEvolution_t energyEvolution_m
energyEvolution_t::iterator getFirstEnergyData()
void setMaxPhase(std::string elName, double phi)
void slbunchIsAllocated()
void registerTable(Table *t)
Register table.
void setInPrepState(bool state)
AttributeBase & getBase() const
Return reference to polymorphic value.
Inform & endl(Inform &inf)
BoundaryGeometry * getGlobalGeometry()
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
void makeDirty(Object *object)
Invalidate expressions.
void setRestartStep(int s)
store the location where to restart