OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalData.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: OpalData.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1.4.2 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: OpalData
10 // The global OPAL structure.
11 // The OPAL object holds all global data required for a OPAL execution.
12 //
13 // ------------------------------------------------------------------------
14 //
15 // $Date: 2004/11/12 20:10:11 $
16 // $Author: adelmann $
17 //
18 // ------------------------------------------------------------------------
19 
21 #include "Structure/DataSink.h"
25 #include "AbstractObjects/Object.h"
27 #include "AbstractObjects/Table.h"
30 #include "Utilities/Options.h"
32 #include <iostream>
33 #include <list>
34 #include <set>
35 
36 // DTA
38 #include "Attributes/Attributes.h"
41 #include "OpalParser/OpalParser.h"
42 #include "Parser/FileStream.h"
43 #include "Parser/StringStream.h"
46 // /DTA
47 
48 #define MAX_NUM_INSTANCES 10
49 using namespace std;
50 
51 // Class OpalData::ClearReference
52 // ------------------------------------------------------------------------
53 
55  object->clear();
56 }
57 
58 
59 // Struct OpalDataImpl.
60 // ------------------------------------------------------------------------
61 
62 struct OpalDataImpl {
63  OpalDataImpl();
64  ~OpalDataImpl();
65 
66  // The main object directory.
68 
69  // The value of the global momentum.
71 
72  // The flag telling that something has changed.
73  bool modified;
74 
75  // Directory of tables, for recalculation when something changes.
76  std::list<Table *> tableDirectory;
78 
79  // The set of expressions to be invalidated when something changes.
80  std::set <AttributeBase *> exprDirectory;
82 
83  // The page title from the latest TITLE command.
84  std::string itsTitle_m;
85 
87 
88  // true if we restart a simulation
90 
91  // Input file name
92  std::string inputFn_m;
93 
94  // Where to resume in a restart run
96 
97  // Where to resume in a restart run
98  std::string restartFn_m;
99 
100  // true if the name of a restartFile is specified
102 
103  // dump frequency as found in restart file
105 
108 
109  // last step of a run
111 
113  // The particle bunch to be tracked.
115 
117 
119 
121  // The particle bunch to be tracked.
123 
124  // In units of seconds. This is half of tEmission
126 
128 
129  std::vector<MaxPhasesT> maxPhases_m;
131 
132  // The cartesian mesh
134 
135  // The field layout f
137 
138  // The particle layout
140 
141  // the accumulated (over all TRACKs) number of steps
142  unsigned long long maxTrackSteps_m;
143 
149 
150  std::map<std::string, unsigned int> problemSize_m;
151 
152  std::vector<std::string> arguments_m;
153 };
154 
155 
157  mainDirectory(), referenceMomentum(0), modified(false), itsTitle_m(),
158  hasPriorRun_m(false),
159  isRestart_m(false),
160  restartStep_m(0),
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),
166  gPhaseShift_m(0.0),
167  maxTrackSteps_m(0),
168  isInOPALCyclMode_m(false),
169  isInOPALTMode_m(false),
170  isInOPALEnvMode_m(false),
171  isOptimizerFlag_m(false),
172  isInPrepState_m(false)
173 {
174  bunch_m = nullptr;
175  slbunch_m = nullptr;
176  dataSink_m = nullptr;
177  bg_m = nullptr;
178  mesh_m = nullptr;
179  FL_m = nullptr;
180  PL_m = nullptr;
181 }
182 
184  // Make sure the main directory is cleared before the directories
185  // for tables and expressions are deleted.
186  delete mesh_m;// somehow this needs to be deleted first
187  delete FL_m;
188  //delete PL_m; //this gets deleted by FL_m
189 
190  delete bunch_m;
191  delete slbunch_m;
192  delete bg_m;
193  delete dataSink_m;
194 
195 
197  tableDirectory.clear();
198  exprDirectory.clear();
199 }
200 
201 
202 // Class OpalData
203 // ------------------------------------------------------------------------
204 
205 bool OpalData::isInstantiated = false;
206 OpalData *OpalData::instance = nullptr;
207 std::stack<OpalData*> OpalData::stashedInstances;
208 
210  if(!isInstantiated) {
211  instance = new OpalData();
212  isInstantiated = true;
213  return instance;
214  } else {
215  return instance;
216  }
217 }
218 
220  delete instance;
221  instance = nullptr;
222  isInstantiated = false;
223 }
224 
226  if (!isInstantiated) return;
227  if (stashedInstances.size() + 1 > MAX_NUM_INSTANCES) {
228  throw OpalException("OpalData::stashInstance()",
229  "too many OpalData instances stashed");
230  }
232  instance = nullptr;
233  isInstantiated = false;
234 }
235 
237  if (stashedInstances.size() == 0) {
238  throw OpalException("OpalData::popInstance()",
239  "no OpalData instances stashed");
240  }
242  instance = stashedInstances.top();
243  isInstantiated = true;
244  stashedInstances.pop();
245 
246  return instance;
247 }
248 
249 unsigned long long OpalData::getMaxTrackSteps() {
250  return p->maxTrackSteps_m;
251 }
252 
253 void OpalData::setMaxTrackSteps(unsigned long long s) {
254  p->maxTrackSteps_m = s;
255 }
256 
257 void OpalData::incMaxTrackSteps(unsigned long long s) {
258  p->maxTrackSteps_m += s;
259 }
260 
261 
263  p = new OpalDataImpl();
264 }
265 
267  delete p;
268 }
269 
271  delete p;
272  p = new OpalDataImpl();
273  p->hasPriorRun_m = false;
274  p->isRestart_m = false;
275  p->hasRestartFile_m = false;
276  p->hasBunchAllocated_m = false;
277  p->hasDataSinkAllocated_m = false;
278  p->hasSLBunchAllocated_m = false;
279  p->gPhaseShift_m = 0.0;
280  p->maxPhases_m.clear();
281  p->isInOPALCyclMode_m = false;
282  p->isInOPALTMode_m = false;
283  p->isInOPALEnvMode_m = false;
284  p->isInPrepState_m = false;
285  p->isOptimizerFlag_m = false;
286 }
287 
289  return p->isInOPALCyclMode_m;
290 }
291 
293  return p->isInOPALTMode_m;
294 }
295 
297  return p->isInOPALEnvMode_m;
298 }
299 
301  return p->isOptimizerFlag_m;
302 }
303 
305  p->isInOPALCyclMode_m = true;
306 }
307 
309  p->isInOPALTMode_m = true;
310 }
311 
313  p->isInOPALEnvMode_m = true;
314 }
315 
317  p->isOptimizerFlag_m = true;
318 }
319 
321  return p->isInPrepState_m;
322 }
323 
324 void OpalData::setInPrepState(bool state) {
325  p->isInPrepState_m = state;
326 }
327 
329  return p->hasPriorRun_m;
330 }
331 
332 void OpalData::setPriorTrack(const bool &value) {
333  p->hasPriorRun_m = value;
334 }
335 
337  return p->isRestart_m;
338 }
339 
340 void OpalData::setRestartRun(const bool &value) {
341  p->isRestart_m = value;
342 }
343 
344 
346  p->restartStep_m = s;
347 }
348 
350  return p->restartStep_m;
351 }
352 
353 
355  return p->restartFn_m;
356 }
357 
358 
359 void OpalData::setRestartFileName(std::string s) {
360  p->restartFn_m = s;
361  p->hasRestartFile_m = true;
362 }
363 
365  return p->hasRestartFile_m;
366 
367 }
368 
369 void OpalData::setRestartDumpFreq(const int &N) {
370  p->restart_dump_freq_m = N;
371 }
372 
374  return p->restart_dump_freq_m;
375 }
376 
378  p->openMode_m = openMode;
379 }
380 
382  return p->openMode_m;
383 }
384 
385 void OpalData::setLastStep(const int &step) {
386  p->last_step_m = step;
387 }
388 
390  return p->last_step_m;
391 }
392 
394  return p->hasSLBunchAllocated_m;
395 }
396 
398  p->hasSLBunchAllocated_m = true;
399 }
400 
402  p->slbunch_m = b;
403 }
404 
406  return p->slbunch_m;
407 }
408 
410  return p->hasBunchAllocated_m;
411 }
412 
414  p->hasBunchAllocated_m = true;
415 }
416 
418  p->bunch_m = b;
419 }
420 
422  return p->bunch_m;
423 }
424 
425 
427  return p->hasDataSinkAllocated_m;
428 }
429 
431  p->dataSink_m = s;
432  p->hasDataSinkAllocated_m = true;
433 }
434 
436  return p->dataSink_m;
437 }
438 
439 void OpalData::setMaxPhase(std::string elName, double phi) {
440  p->maxPhases_m.push_back(MaxPhasesT(elName, phi));
441 }
442 
444  return p->maxPhases_m.begin();
445 }
446 
448  return p->maxPhases_m.end();
449 }
450 
452  return p->maxPhases_m.size();
453 }
454 
455 void OpalData::addEnergyData(double spos, double ekin) {
456  p->energyEvolution_m.insert(std::make_pair(spos, ekin));
457 }
458 
460  return p->energyEvolution_m.begin();
461 }
462 
464  return p->energyEvolution_m.end();
465 }
466 
467 
468 // Mesh_t* OpalData::getMesh() {
469 // return p->mesh_m;
470 // }
471 
472 // FieldLayout_t* OpalData::getFieldLayout() {
473 // return p->FL_m;
474 // }
475 
476 // Layout_t* OpalData::getLayout() {
477 // return p->PL_m;
478 // }
479 
480 // void OpalData::setMesh(Mesh_t *mesh) {
481 // p->mesh_m = mesh;
482 // }
483 
484 // void OpalData::setFieldLayout(FieldLayout_t *fieldlayout) {
485 // p->FL_m = fieldlayout;
486 // }
487 
488 // void OpalData::setLayout(Layout_t *layout) {
489 // p->PL_m = layout;
490 // }
491 
492 void OpalData::setGlobalPhaseShift(double shift) {
494  p->gPhaseShift_m = shift;
495 }
496 
499  return p->gPhaseShift_m;
500 }
501 
503  p->bg_m = bg;
504 }
505 
507  return p->bg_m;
508 }
509 
511  return p->bg_m != nullptr;
512 }
513 
514 
515 
516 void OpalData::apply(const ObjectFunction &fun) {
518  i != p->mainDirectory.end(); ++i) {
519  fun(&*i->second);
520  }
521 }
522 
523 
524 void OpalData::create(Object *newObject) {
525  // Test for existing node with same name.
526  const std::string name = newObject->getOpalName();
527  Object *oldObject = p->mainDirectory.find(name);
528 
529  if(oldObject != nullptr) {
530  throw OpalException("OpalData::create()",
531  "You cannot replace the object \"" + name + "\".");
532  } else {
533  p->mainDirectory.insert(name, newObject);
534  }
535 }
536 
537 
538 void OpalData::define(Object *newObject) {
539  // Test for existing node with same name.
540  const std::string name = newObject->getOpalName();
541  Object *oldObject = p->mainDirectory.find(name);
542 
543  if(oldObject != nullptr && oldObject != newObject) {
544  // Attempt to replace an object.
545  if(oldObject->isBuiltin() || ! oldObject->canReplaceBy(newObject)) {
546  throw OpalException("OpalData::define()",
547  "You cannot replace the object \"" + name + "\".");
548  } else {
549  if(Options::info) {
550  INFOMSG("Replacing the object \"" << name << "\"." << endl);
551  }
552 
553  // Erase all tables which depend on the new object.
555  while(i != p->tableDirectory.end()) {
556  // We must increment i before calling erase(name),
557  // since erase(name) removes "this" from "tables".
558  Table *table = *i++;
559  const std::string &tableName = table->getOpalName();
560 
561  if(table->isDependent(name)) {
562  if(Options::info) {
563  cerr << endl << "Erasing dependent table \"" << tableName
564  << "\"." << endl << endl;
565  }
566 
567  // Remove table from directory.
568  // This erases the table from the main directory,
569  // and its destructor unregisters it from the table directory.
570  erase(tableName);
571  }
572  }
573 
574  // Replace all references to this object.
576  i != p->mainDirectory.end(); ++i) {
577  (*i).second->replace(oldObject, newObject);
578  }
579 
580  // Remove old object.
581  erase(name);
582  }
583  }
584 
585  // Force re-evaluation of expressions.
586  p->modified = true;
587  newObject->setDirty(true);
588  p->mainDirectory.insert(name, newObject);
589 
590  // If this is a new definition of "P0", insert its definition.
591  if(name == "P0") {
592  if(ValueDefinition *p0 = dynamic_cast<ValueDefinition *>(newObject)) {
593  setP0(p0);
594  }
595  }
596 }
597 
598 
599 void OpalData::erase(const std::string &name) {
600  Object *oldObject = p->mainDirectory.find(name);
601 
602  if(oldObject != nullptr) {
603  // Relink all children of "this" to "this->getParent()".
605  i != p->mainDirectory.end(); ++i) {
606  Object *child = &*i->second;
607  if(child->getParent() == oldObject) {
608  child->setParent(oldObject->getParent());
609  }
610  }
611 
612  // Remove the object.
613  p->mainDirectory.erase(name);
614  }
615 }
616 
617 
618 Object *OpalData::find(const std::string &name) {
619  return p->mainDirectory.find(name);
620 }
621 
622 
623 double OpalData::getP0() const {
624  static const double energy_scale = 1.0e+9;
625  return p->referenceMomentum->getReal() * energy_scale;
626 }
627 
628 
630  p->modified = true;
631  if(obj) obj->setDirty(true);
632 }
633 
634 
635 void OpalData::printNames(std::ostream &os, const std::string &pattern) {
636  int column = 0;
637  RegularExpression regex(pattern);
638  os << endl << "Object names matching the pattern \""
639  << pattern << "\":" << endl;
640 
641  for(ObjectDir::const_iterator index = p->mainDirectory.begin();
642  index != p->mainDirectory.end(); ++index) {
643  const std::string name = (*index).first;
644 
645  if(! name.empty() && regex.match(name)) {
646  os << name;
647 
648  if(column < 80) {
649  column += name.length();
650 
651  do {
652  os << ' ';
653  column++;
654  } while((column % 20) != 0);
655  } else {
656  os << endl;
657  column = 0;
658  }
659  }
660  }
661 
662  if(column) os << endl;
663  os << endl;
664 }
665 
666 
668  p->tableDirectory.push_back(table);
669 }
670 
671 
674  i != p->tableDirectory.end();) {
676  if(*j == table) p->tableDirectory.erase(j);
677  }
678 }
679 
680 
682  p->exprDirectory.insert(expr);
683 }
684 
685 
687  p->exprDirectory.erase(expr);
688 }
689 
690 
692  p->referenceMomentum = p0;
693 }
694 
695 
696 void OpalData::storeTitle(const std::string &title) {
697  p->itsTitle_m = title;
698 }
699 
700 void OpalData::storeInputFn(const std::string &fn) {
701  p->inputFn_m = fn;
702 }
703 
704 
705 void OpalData::printTitle(std::ostream &os) {
706  os << p->itsTitle_m;
707 }
708 
709 std::string OpalData::getTitle() {
710  return p->itsTitle_m;
711 }
712 
713 std::string OpalData::getInputFn() {
714  return p->inputFn_m;
715 }
716 
718  std::string & fn = p->inputFn_m;
719  int const pdot = fn.rfind(".");
720  return fn.substr(0, pdot);
721 }
722 
724  Inform msg("OpalData ");
725  if(p->modified) {
726  // Force re-evaluation of expressions.
727  for(OpalDataImpl::exprIterator i = p->exprDirectory.begin();
728  i != p->exprDirectory.end(); ++i) {
729  (*i)->invalidate();
730  }
731 
732  // Force refilling of dynamic tables.
734  i != p->tableDirectory.end(); ++i) {
735  (*i)->invalidate();
736  }
737 
738  // Update all definitions.
740  i != p->mainDirectory.end(); ++i) {
741  (*i).second->update();
742  }
743 
744  // Definitions are up-to-date.
745  p->modified = false;
746  }
747 }
748 
749 std::vector<std::string> OpalData::getAllNames() {
750  std::vector<std::string> result;
751 
752  for(ObjectDir::const_iterator index = p->mainDirectory.begin();
753  index != p->mainDirectory.end(); ++index) {
754  std::string tmpName = (*index).first;
755  if(!tmpName.empty()) result.push_back(tmpName);
757  //if (!tmpName.empty()) {
758  // Object *tmpObject = OPAL.find(tmpName);
759  // std::cerr << tmpObject->getCategory() << "\t" << tmpName << "\t";
760  // string bi = (tmpObject->isBuiltin()) ? "BUILT-IN" : "";
761  // std::cerr << bi << std::endl;
762  //}
764  }
765 
766  // DTA
767  std::cout << "\nUser-defined variables:\n";
768  const OpalParser mp;
769  // FileStream *is;
770  // is = new FileStream("/home/research/dabell/projects/opal9/src/tmp/myExpr.txt");
771  // StringStream *ss;
772  // ss = new StringStream("myVar:=ALPHA+BETA;");
773  for(ObjectDir::const_iterator index = p->mainDirectory.begin();
774  index != p->mainDirectory.end(); ++index) {
775  std::string tmpName = (*index).first;
776  if(!tmpName.empty()) {
777  Object *tmpObject = OpalData::getInstance()->find(tmpName);
778  if(!tmpObject || tmpObject->isBuiltin()) continue;
779  if(tmpObject->getCategory() == "VARIABLE") {
780  std::cout << tmpName;
781  if(dynamic_cast<RealVariable *>(&*tmpObject)) {
782  RealVariable &variable = *dynamic_cast<RealVariable *>(OpalData::getInstance()->find(tmpName));
783  std::cout << "\te= " << variable.value().getBase().getImage();
784  std::cout << "\tr= " << variable.getReal();
785  std::cout << "\ta= " << variable.itsAttr[0];
786  //Attributes::setReal(variable.itsAttr[0],137.);
787  //std::cout << "\te= " << variable.value().getBase().getImage();
788  //std::cout << "\tx= " << variable.itsAttr[0];
789  }
790  std::cout << std::endl;
791  }
792  // if(tmpName=="MYL"){
793  // std::cout << "myL noted" << std::endl;
794  // RealVariable& variable = *dynamic_cast<RealVariable*>(OPAL.find(tmpName));
795  // std::cout << tmpName;
796  // std::cout << "\te= " << variable.value().getBase().getImage();
797  // std::cout << "\tr= " << variable.getReal();
798  // std::cout << "\ta= " << variable.itsAttr[0] << std::endl;
799  // mp.run(is);
800  // std::cout << tmpName;
801  // std::cout << "\te= " << variable.value().getBase().getImage();
802  // std::cout << "\tr= " << variable.getReal();
803  // std::cout << "\ta= " << variable.itsAttr[0] << std::endl;
804  // mp.run(ss);
805  // }
806  }
807  }
808  std::cout << std::endl;
814 
815  return result;
816 }
817 
818 void OpalData::addProblemCharacteristicValue(const std::string &name, unsigned int value) {
819  if (p->problemSize_m.find(name) != p->problemSize_m.end()) {
820  p->problemSize_m.insert(std::make_pair(name, value));
821  } else {
822  p->problemSize_m[name] = value;
823  }
824 }
825 
826 const std::map<std::string, unsigned int> &OpalData::getProblemCharacteristicValues() const {
827  return p->problemSize_m;
828 }
829 
830 void OpalData::storeArguments(int argc, char *argv[]) {
831  p->arguments_m.clear();
832  for (int i = 0; i < argc; ++ i) {
833  p->arguments_m.push_back(argv[i]);
834  }
835 }
836 
837 std::vector<std::string> OpalData::getArguments() {
838  return p->arguments_m;
839 }
void setPartBunch(PartBunchBase< double, 3 > *p)
Definition: OpalData.cpp:417
static void deleteInstance()
Definition: OpalData.cpp:219
std::string getRestartFileName()
get opals restart h5 format filename
Definition: OpalData.cpp:354
The global OPAL structure.
Definition: OpalData.h:54
Layout_t * PL_m
Definition: OpalData.cpp:139
energyEvolution_t::iterator getLastEnergyData()
Definition: OpalData.cpp:463
PartBunchBase< double, 3 > * getPartBunch()
Definition: OpalData.cpp:421
void setParent(Object *)
Set parent object.
Definition: Object.cpp:310
std::vector< MaxPhasesT >::iterator getLastMaxPhases()
Definition: OpalData.cpp:447
bool isInPrepState()
Definition: OpalData.cpp:320
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
Definition: OpalData.cpp:332
void erase()
Delete all entries.
Definition: Directory.cpp:56
A map of string versus pointer to Object.
Definition: Directory.h:38
void setOpenMode(OPENMODE openMode)
Definition: OpalData.cpp:377
Abstract base class for attribute values of different types.
Definition: AttributeBase.h:32
void setInOPALCyclMode()
Definition: OpalData.cpp:304
bool hasBunchAllocated_m
Definition: OpalData.cpp:112
void define(Object *newObject)
Define a new object.
Definition: OpalData.cpp:538
double getP0() const
Return value of global reference momentum.
Definition: OpalData.cpp:623
void create(Object *newObject)
Create new object.
Definition: OpalData.cpp:524
int getRestartDumpFreq() const
get the dump frequency as found in restart file
Definition: OpalData.cpp:373
core of the envelope tracker based on Rene Bakkers BET implementation
Definition: EnvelopeBunch.h:60
void bunchIsAllocated()
Definition: OpalData.cpp:413
void setRestartRun(const bool &value=true)
set OPAL in restart mode
Definition: OpalData.cpp:340
void setInOPALEnvMode()
Definition: OpalData.cpp:312
std::string getImage() const
Convert to string.
bool isBuiltin() const
True, if [b]this[/b] is a built-in object.
Definition: Object.cpp:242
The base class for all OPAL exceptions.
Definition: OpalException.h:28
bool inRestartRun()
true if we do a restart run
Definition: OpalData.cpp:336
virtual double getReal() const
Return value.
std::vector< std::string > getAllNames()
Definition: OpalData.cpp:749
ValueDefinition * referenceMomentum
Definition: OpalData.cpp:70
void storeInputFn(const std::string &fn)
store opals input filename
Definition: OpalData.cpp:700
bool hasSLBunchAllocated()
true if we already allocated a ParticleBunch object
Definition: OpalData.cpp:393
Attribute & value()
Return the attribute representing the value of the definition.
Object * getParent() const
Return parent pointer.
Definition: Object.cpp:289
bool hasDataSinkAllocated()
true if we already allocated a DataSink object
Definition: OpalData.cpp:426
bool isInOPALCyclMode()
Definition: OpalData.cpp:288
The REAL VARIABLE definition.
Definition: RealVariable.h:26
int getRestartStep()
get the step where to restart
Definition: OpalData.cpp:349
void setDirty(bool)
Set/reset the [b]modified[/b] flag.
Definition: Object.cpp:257
A regular expression.
std::string restartFn_m
Definition: OpalData.cpp:98
The default parser for OPAL-9.
Definition: OpalParser.h:44
struct OpalDataImpl * p
Definition: OpalData.h:291
static std::stack< OpalData * > stashedInstances
Definition: OpalData.h:282
void update()
Update all objects.
Definition: OpalData.cpp:723
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
bool info
Info flag.
Definition: Options.cpp:8
unsigned long long getMaxTrackSteps()
Definition: OpalData.cpp:249
bool isInOPALEnvMode_m
Definition: OpalData.cpp:146
const std::map< std::string, unsigned int > & getProblemCharacteristicValues() const
Definition: OpalData.cpp:826
static OpalData * instance
Definition: OpalData.h:281
Mesh_t * mesh_m
Definition: OpalData.cpp:133
void setDataSink(DataSink *s)
Definition: OpalData.cpp:430
void apply(const ObjectFunction &)
Apply a function to all objects.
Definition: OpalData.cpp:516
std::vector< std::string > arguments_m
Definition: OpalData.cpp:152
std::pair< std::string, double > MaxPhasesT
Definition: OpalData.h:37
bool hasPriorTrack()
true if in follow-up track
Definition: OpalData.cpp:328
bool hasGlobalGeometry()
Definition: OpalData.cpp:510
void addEnergyData(double spos, double ekin)
Definition: OpalData.cpp:455
void printTitle(std::ostream &)
Print the page title.
Definition: OpalData.cpp:705
std::vector< std::string > getArguments()
Definition: OpalData.cpp:837
std::string getTitle()
Get the title string.
Definition: OpalData.cpp:709
void unregisterTable(Table *t)
Unregister table.
Definition: OpalData.cpp:672
virtual double getReal() const
Return real value.
std::set< AttributeBase * >::iterator exprIterator
Definition: OpalData.cpp:81
static OpalData * getInstance()
Definition: OpalData.cpp:209
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:284
FieldLayout_t * FL_m
Definition: OpalData.cpp:136
void storeTitle(const std::string &)
Store the page title.
Definition: OpalData.cpp:696
PartBunchBase< double, 3 > * bunch_m
Definition: OpalData.cpp:114
bool isInOPALTMode()
Definition: OpalData.cpp:292
static bool isInstantiated
Definition: OpalData.h:280
EnvelopeBunch * slbunch_m
Definition: OpalData.cpp:122
void incMaxTrackSteps(unsigned long long s)
Definition: OpalData.cpp:257
double getGlobalPhaseShift()
units: (sec)
Definition: OpalData.cpp:497
void setRestartDumpFreq(const int &N)
set the dump frequency as found in restart file
Definition: OpalData.cpp:369
bool hasPriorRun_m
Definition: OpalData.cpp:86
int getLastStep() const
get the last step from a possible previous run
Definition: OpalData.cpp:389
std::list< Table * > tableDirectory
Definition: OpalData.cpp:76
void setGlobalGeometry(BoundaryGeometry *bg)
Definition: OpalData.cpp:502
OPENMODE
Enum for writing to files.
Definition: OpalData.h:69
virtual void operator()(Object *) const
The function to be executed.
Definition: OpalData.cpp:54
Directory mainDirectory
Definition: OpalData.cpp:67
ObjectDir::iterator begin()
First object in alphabetic order of name.
Definition: Directory.cpp:36
Object * find(const std::string &name) const
Find entry.
Definition: Directory.cpp:66
bool hasBunchAllocated()
true if we already allocated a ParticleBunch object
Definition: OpalData.cpp:409
static void stashInstance()
Definition: OpalData.cpp:225
void addProblemCharacteristicValue(const std::string &name, unsigned int value)
Definition: OpalData.cpp:818
void insert(const std::string &name, Object *newObject)
Define new object.
Definition: Directory.cpp:77
std::string inputFn_m
Definition: OpalData.cpp:92
int restart_dump_freq_m
Definition: OpalData.cpp:104
std::string getInputFn()
get opals input filename
Definition: OpalData.cpp:713
void setOptimizerFlag()
Definition: OpalData.cpp:316
#define INFOMSG(msg)
Definition: IpplInfo.h:397
bool modified
Definition: OpalData.cpp:73
OPENMODE getOpenMode() const
Definition: OpalData.cpp:381
std::string itsTitle_m
Definition: OpalData.cpp:84
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
Definition: OpalData.h:41
EnvelopeBunch * getSLPartBunch()
Definition: OpalData.cpp:405
bool isRestart_m
Definition: OpalData.cpp:89
bool hasSLBunchAllocated_m
Definition: OpalData.cpp:120
void registerExpression(AttributeBase *)
Register expression.
Definition: OpalData.cpp:681
unsigned long long maxTrackSteps_m
Definition: OpalData.cpp:142
#define MAX_NUM_INSTANCES
Definition: OpalData.cpp:48
BoundaryGeometry * bg_m
Definition: OpalData.cpp:127
std::vector< MaxPhasesT >::iterator getFirstMaxPhases()
Definition: OpalData.cpp:443
int getNumberOfMaxPhases()
Definition: OpalData.cpp:451
void printNames(std::ostream &stream, const std::string &pattern)
Print all objects.
Definition: OpalData.cpp:635
OpalData::OPENMODE openMode_m
Mode for writing files.
Definition: OpalData.cpp:107
void setLastStep(const int &step)
set the last step in a run for possible follow-up run
Definition: OpalData.cpp:385
void unregisterExpression(AttributeBase *)
Unregister expression.
Definition: OpalData.cpp:686
ObjectDir::iterator end()
Last object in alphabetic order of name.
Definition: Directory.cpp:46
std::set< AttributeBase * > exprDirectory
Definition: OpalData.cpp:80
static OpalData * popInstance()
Definition: OpalData.cpp:236
bool hasRestartFile()
true if we do a restart from specified h5 file
Definition: OpalData.cpp:364
double gPhaseShift_m
Definition: OpalData.cpp:125
Object * find(const std::string &name)
Find entry.
Definition: OpalData.cpp:618
void setGlobalPhaseShift(double shift)
units: (sec)
Definition: OpalData.cpp:492
The base class for all OPAL objects.
Definition: Object.h:48
bool isInPrepState_m
Definition: OpalData.cpp:148
bool isInOPALTMode_m
Definition: OpalData.cpp:145
bool hasDataSinkAllocated_m
Definition: OpalData.cpp:116
The base class for all OPAL value definitions.
const std::string name
bool isOptimizerFlag_m
Definition: OpalData.cpp:147
DataSink * getDataSink()
Definition: OpalData.cpp:435
void storeArguments(int argc, char *argv[])
Definition: OpalData.cpp:830
DataSink * dataSink_m
Definition: OpalData.cpp:118
std::list< Table * >::iterator tableIterator
Definition: OpalData.cpp:77
void setRestartFileName(std::string s)
store opals restart h5 format filename
Definition: OpalData.cpp:359
void reset()
reset object for consecutive runs
Definition: OpalData.cpp:270
void setMaxTrackSteps(unsigned long long s)
Definition: OpalData.cpp:253
int restartStep_m
Definition: OpalData.cpp:95
std::map< std::string, unsigned int > problemSize_m
Definition: OpalData.cpp:150
Abstract base class for functor objects whose argument is an Object.
bool isInOPALCyclMode_m
Definition: OpalData.cpp:144
void erase(const std::string &name)
Delete existing entry.
Definition: OpalData.cpp:599
void setP0(ValueDefinition *p0)
Set the global momentum.
Definition: OpalData.cpp:691
bool isOptimizerRun()
Definition: OpalData.cpp:300
std::string::iterator iterator
Definition: MSLang.h:16
void setInOPALTMode()
Definition: OpalData.cpp:308
void setSLPartBunch(EnvelopeBunch *p)
Definition: OpalData.cpp:401
The base class for all OPAL tables.
Definition: Table.h:42
std::string getInputBasename()
get input file name without extension
Definition: OpalData.cpp:717
Definition: Inform.h:41
std::vector< MaxPhasesT > maxPhases_m
Definition: OpalData.cpp:129
energyEvolution_t energyEvolution_m
Definition: OpalData.cpp:130
energyEvolution_t::iterator getFirstEnergyData()
Definition: OpalData.cpp:459
bool isInOPALEnvMode()
Definition: OpalData.cpp:296
bool hasRestartFile_m
Definition: OpalData.cpp:101
void setMaxPhase(std::string elName, double phi)
Definition: OpalData.cpp:439
void slbunchIsAllocated()
Definition: OpalData.cpp:397
void registerTable(Table *t)
Register table.
Definition: OpalData.cpp:667
void setInPrepState(bool state)
Definition: OpalData.cpp:324
AttributeBase & getBase() const
Return reference to polymorphic value.
Definition: Attribute.cpp:67
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
BoundaryGeometry * getGlobalGeometry()
Definition: OpalData.cpp:506
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
Definition: Object.cpp:51
void makeDirty(Object *object)
Invalidate expressions.
Definition: OpalData.cpp:629
void setRestartStep(int s)
store the location where to restart
Definition: OpalData.cpp:345