OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
OpalData.cpp
Go to the documentation of this file.
1//
2// Class OpalData
3// The global OPAL structure.
4// The OPAL object holds all global data required for a OPAL execution.
5// In particular it contains the main Directory, which allows retrieval
6// of command objects by their name. For other data refer to the
7// implementation file.
8//
9// Copyright (c) 200x - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
10// All rights reserved
11//
12// This file is part of OPAL.
13//
14// OPAL is free software: you can redistribute it and/or modify
15// it under the terms of the GNU General Public License as published by
16// the Free Software Foundation, either version 3 of the License, or
17// (at your option) any later version.
18//
19// You should have received a copy of the GNU General Public License
20// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
21//
23
35#include "PartBunch/PartBunch.h"
36#include "Physics/Units.h"
38#include "Structure/DataSink.h"
40#include "Utilities/Options.h"
44
45#include <algorithm>
46#include <iostream>
47#include <list>
48#include <set>
49
50#define MAX_NUM_INSTANCES 10
51
52void OpalData::ClearReference::operator()(Object* object) const { object->clear(); }
53
54// Struct OpalDataImpl.
55// ------------------------------------------------------------------------
59
60 // The main object directory.
62
63 // The value of the global momentum.
65
66 // The flag telling that something has changed.
68
69 // Directory of tables, for recalculation when something changes.
70 std::list<Table*> tableDirectory;
71 typedef std::list<Table*>::iterator tableIterator;
72
73 // The set of expressions to be invalidated when something changes.
74 std::set<AttributeBase*> exprDirectory;
75 typedef std::set<AttributeBase*>::iterator exprIterator;
76
77 // The page title from the latest TITLE command.
78 std::string itsTitle_m;
79
81
82 // true if we restart a simulation
84
85 // Where to resume in a restart run
87
88 // Where to resume in a restart run
89 std::string restartFn_m;
90
91 // true if the name of a restartFile is specified
93
94 // dump frequency as found in restart file
96
97 // Input file name
98 std::string inputFn_m;
99
100 std::set<std::string> outFiles_m;
101
104
105 // last step of a run
107
109 // The particle bunch to be tracked.
111
113
115
116 // In units of seconds. This is half of tEmission
118
120
121 std::vector<MaxPhasesT> maxPhases_m;
123
124 // The cartesian mesh
126
127 // The field layout f
129
130 // The particle layout
132
133 // the accumulated (over all TRACKs) number of steps
134 unsigned long long maxTrackSteps_m;
135
140
141 std::map<std::string, unsigned int> problemSize_m;
142
143 std::vector<std::string> arguments_m;
144};
145
147 : mainDirectory(),
148 referenceMomentum(0),
149 modified(false),
150 itsTitle_m(),
151 hasPriorRun_m(false),
152 isRestart_m(false),
153 restartStep_m(0),
154 hasRestartFile_m(false),
155 restart_dump_freq_m(1),
156 last_step_m(0),
157 hasBunchAllocated_m(false),
158 hasDataSinkAllocated_m(false),
159 gPhaseShift_m(0.0),
160 maxTrackSteps_m(0),
161 isInOPALCyclMode_m(false),
162 isInOPALTMode_m(false),
163 isOptimizerFlag_m(false),
164 isInPrepState_m(false) {
165 bunch_m = nullptr;
166 dataSink_m = nullptr;
167 bg_m = nullptr;
168 mesh_m = nullptr;
169 FL_m = nullptr;
170 PL_m = nullptr;
171}
172
174 // Make sure the main directory is cleared before the directories
175 // for tables and expressions are deleted.
176 delete mesh_m; // somehow this needs to be deleted first
177 delete FL_m;
178 // delete PL_m; //this gets deleted by FL_m
179
180 delete bunch_m;
181 delete bg_m;
182 delete dataSink_m;
183
185 tableDirectory.clear();
186 exprDirectory.clear();
187}
188
189bool OpalData::isInstantiated = false;
191std::stack<OpalData*> OpalData::stashedInstances;
192
194 if (!isInstantiated) {
195 instance = new OpalData();
196 isInstantiated = true;
197 return instance;
198 } else {
199 return instance;
200 }
201}
202
204 delete instance;
205 instance = nullptr;
206 isInstantiated = false;
207}
208
210 if (!isInstantiated) return;
211 if (stashedInstances.size() + 1 > MAX_NUM_INSTANCES) {
212 throw OpalException("OpalData::stashInstance()", "too many OpalData instances stashed");
213 }
215 instance = nullptr;
216 isInstantiated = false;
217}
218
220 if (stashedInstances.size() == 0) {
221 throw OpalException("OpalData::popInstance()", "no OpalData instances stashed");
222 }
225 isInstantiated = true;
226 stashedInstances.pop();
227
228 return instance;
229}
230
231unsigned long long OpalData::getMaxTrackSteps() { return p->maxTrackSteps_m; }
232
233void OpalData::setMaxTrackSteps(unsigned long long s) { p->maxTrackSteps_m = s; }
234
235void OpalData::incMaxTrackSteps(unsigned long long s) { p->maxTrackSteps_m += s; }
236
238
240
242 delete p;
243 p = new OpalDataImpl();
244 p->hasPriorRun_m = false;
245 p->isRestart_m = false;
246 p->hasRestartFile_m = false;
247 p->hasBunchAllocated_m = false;
248 p->hasDataSinkAllocated_m = false;
249 p->gPhaseShift_m = 0.0;
250 p->maxPhases_m.clear();
251 p->isInOPALCyclMode_m = false;
252 p->isInOPALTMode_m = false;
253 p->isInPrepState_m = false;
254 p->isOptimizerFlag_m = false;
255}
256
258
260
262
264
266
268
270
271void OpalData::setInPrepState(bool state) { p->isInPrepState_m = state; }
272
274
275void OpalData::setPriorTrack(const bool& value) { p->hasPriorRun_m = value; }
276
278
279void OpalData::setRestartRun(const bool& value) { p->isRestart_m = value; }
280
282
284
286
287void OpalData::setRestartFileName(std::string s) {
288 p->restartFn_m = s;
289 p->hasRestartFile_m = true;
290}
291
293
295
297
298void OpalData::setOpenMode(OpenMode openMode) { p->openMode_m = openMode; }
299
301
302void OpalData::setLastStep(const int& step) { p->last_step_m = step; }
303
304int OpalData::getLastStep() const { return p->last_step_m; }
305
307
309
311
313
315
317 p->dataSink_m = s;
319}
320
322
323void OpalData::setMaxPhase(std::string elName, double phi) {
324 p->maxPhases_m.push_back(MaxPhasesT(elName, phi));
325}
326
327std::vector<MaxPhasesT>::iterator OpalData::getFirstMaxPhases() { return p->maxPhases_m.begin(); }
328
329std::vector<MaxPhasesT>::iterator OpalData::getLastMaxPhases() { return p->maxPhases_m.end(); }
330
332
333void OpalData::addEnergyData(double spos, double ekin) {
334 p->energyEvolution_m.insert(std::make_pair(spos, ekin));
335}
336
337energyEvolution_t::iterator OpalData::getFirstEnergyData() { return p->energyEvolution_m.begin(); }
338
339energyEvolution_t::iterator OpalData::getLastEnergyData() { return p->energyEvolution_m.end(); }
340
341// Mesh_t* OpalData::getMesh() {
342// return p->mesh_m;
343// }
344
345// FieldLayout_t* OpalData::getFieldLayout() {
346// return p->FL_m;
347// }
348
349// Layout_t* OpalData::getLayout() {
350// return p->PL_m;
351// }
352
353// void OpalData::setMesh(Mesh_t *mesh) {
354// p->mesh_m = mesh;
355// }
356
357// void OpalData::setFieldLayout(FieldLayout_t *fieldlayout) {
358// p->FL_m = fieldlayout;
359// }
360
361// void OpalData::setLayout(Layout_t *layout) {
362// p->PL_m = layout;
363// }
364
367 p->gPhaseShift_m = shift;
368}
369
372 return p->gPhaseShift_m;
373}
374
376
378
379bool OpalData::hasGlobalGeometry() { return p->bg_m != nullptr; }
380
382 for (ObjectDir::iterator i = p->mainDirectory.begin(); i != p->mainDirectory.end(); ++i) {
383 fun(&*i->second);
384 }
385}
386
387void OpalData::create(Object* newObject) {
388 // Test for existing node with same name.
389 const std::string name = newObject->getOpalName();
390 Object* oldObject = p->mainDirectory.find(name);
391
392 if (oldObject != nullptr) {
393 throw OpalException(
394 "OpalData::create()", "You cannot replace the object \"" + name + "\".");
395 } else {
396 p->mainDirectory.insert(name, newObject);
397 }
398}
399
400void OpalData::define(Object* newObject) {
401 // Test for existing node with same name.
402 const std::string name = newObject->getOpalName();
403 Object* oldObject = p->mainDirectory.find(name);
404
405 if (oldObject != nullptr && oldObject != newObject) {
406 // Attempt to replace an object.
407 if (oldObject->isBuiltin() || !oldObject->canReplaceBy(newObject)) {
408 throw OpalException(
409 "OpalData::define()", "You cannot replace the object \"" + name + "\".");
410 } else {
411 if (Options::info) {
412 *ippl::Info << "Replacing the object \"" << name << "\"." << endl;
413 }
414
415 // Erase all tables which depend on the new object.
417 while (i != p->tableDirectory.end()) {
418 // We must increment i before calling erase(name),
419 // since erase(name) removes "this" from "tables".
420 Table* table = *i++;
421 const std::string& tableName = table->getOpalName();
422
423 if (table->isDependent(name)) {
424 if (Options::info) {
425 std::cerr << std::endl
426 << "Erasing dependent table \"" << tableName << "\"."
427 << std::endl;
428 }
429
430 // Remove table from directory.
431 // This erases the table from the main directory,
432 // and its destructor unregisters it from the table directory.
433 erase(tableName);
434 }
435 }
436
437 // Replace all references to this object.
438 for (ObjectDir::iterator i = p->mainDirectory.begin(); i != p->mainDirectory.end();
439 ++i) {
440 (*i).second->replace(oldObject, newObject);
441 }
442
443 // Remove old object.
444 erase(name);
445 }
446 }
447
448 // Force re-evaluation of expressions.
449 p->modified = true;
450 newObject->setDirty(true);
451 p->mainDirectory.insert(name, newObject);
452
453 // If this is a new definition of "P0", insert its definition.
454 if (name == "P0") {
455 if (ValueDefinition* p0 = dynamic_cast<ValueDefinition*>(newObject)) {
456 setP0(p0);
457 }
458 }
459}
460
461void OpalData::erase(const std::string& name) {
462 Object* oldObject = p->mainDirectory.find(name);
463
464 if (oldObject != nullptr) {
465 // Relink all children of "this" to "this->getParent()".
466 for (ObjectDir::iterator i = p->mainDirectory.begin(); i != p->mainDirectory.end(); ++i) {
467 Object* child = &*i->second;
468 if (child->getParent() == oldObject) {
469 child->setParent(oldObject->getParent());
470 }
471 }
472 // Remove the object.
473 p->mainDirectory.erase(name);
474 }
475}
476
477Object* OpalData::find(const std::string& name) { return p->mainDirectory.find(name); }
478
480
482 p->modified = true;
483 if (obj) obj->setDirty(true);
484}
485
486void OpalData::printAllNames(std::ostream& os) {
487 int column = 0;
488
489 os << std::endl << "All object names " << std::endl;
490
491 for (ObjectDir::const_iterator index = p->mainDirectory.begin();
492 index != p->mainDirectory.end(); ++index) {
493 const std::string name = (*index).first;
494
495 os << name << " = " << *(*index).second << std::endl;
496 /*
497 if (column < 80) {
498 column += name.length();
499
500 do {
501 os << ' ';
502 column++;
503 } while((column % 20) != 0);
504 } else {
505 os << std::endl;
506 column = 0;
507 }
508 */
509 }
510
511 if (column) os << std::endl;
512 os << std::endl;
513}
514void OpalData::printNames(std::ostream& os, const std::string& pattern) {
515 int column = 0;
516 RegularExpression regex(pattern);
517 os << std::endl << "Object names matching the pattern \"" << pattern << "\":" << std::endl;
518
519 for (ObjectDir::const_iterator index = p->mainDirectory.begin();
520 index != p->mainDirectory.end(); ++index) {
521 const std::string name = (*index).first;
522
523 if (!name.empty() && regex.match(name)) {
524 os << name;
525
526 if (column < 80) {
527 column += name.length();
528
529 do {
530 os << ' ';
531 column++;
532 } while ((column % 20) != 0);
533 } else {
534 os << std::endl;
535 column = 0;
536 }
537 }
538 }
539
540 if (column) os << std::endl;
541 os << std::endl;
542}
543
544void OpalData::registerTable(Table* table) { p->tableDirectory.push_back(table); }
545
547 for (OpalDataImpl::tableIterator i = p->tableDirectory.begin(); i != p->tableDirectory.end();) {
549 if (*j == table) p->tableDirectory.erase(j);
550 }
551}
552
554
556
558
559void OpalData::storeTitle(const std::string& title) { p->itsTitle_m = title; }
560
561void OpalData::storeInputFn(const std::string& fn) { p->inputFn_m = fn; }
562
563void OpalData::printTitle(std::ostream& os) { os << p->itsTitle_m; }
564
565std::string OpalData::getTitle() { return p->itsTitle_m; }
566
567std::string OpalData::getAuxiliaryOutputDirectory() const { return "data"; }
568
569std::string OpalData::getInputFn() { return p->inputFn_m; }
570
572 std::string& fn = p->inputFn_m;
573 int const pdot = fn.rfind(".");
574 return fn.substr(0, pdot);
575}
576
577void OpalData::checkAndAddOutputFileName(const std::string& outfn) {
578 if (p->outFiles_m.count(outfn) == 0) {
579 p->outFiles_m.insert(outfn);
580 } else if (!hasBunchAllocated()) {
581 throw OpalException(
582 "OpalData::checkAndAddOutputFileName",
583 "Duplicate file name for output, '" + outfn + "', detected");
584 }
585}
586
588 Inform msg("OpalData ");
589 if (p->modified) {
590 // Force re-evaluation of expressions.
591 for (OpalDataImpl::exprIterator i = p->exprDirectory.begin(); i != p->exprDirectory.end();
592 ++i) {
593 (*i)->invalidate();
594 }
595
596 // Force refilling of dynamic tables.
598 i != p->tableDirectory.end(); ++i) {
599 (*i)->invalidate();
600 }
601
602 // Update all definitions.
603 for (ObjectDir::iterator i = p->mainDirectory.begin(); i != p->mainDirectory.end(); ++i) {
604 (*i).second->update();
605 }
606
607 // Definitions are up-to-date.
608 p->modified = false;
609 }
610}
611
612std::map<std::string, std::string> OpalData::getVariableData() {
613 std::map<std::string, std::string> udata;
614 std::vector<std::string> uvars = this->getVariableNames();
615 for (auto& uvar : uvars) {
616 Object* tmpObject = OpalData::getInstance()->find(uvar);
617 if (dynamic_cast<RealVariable*>(tmpObject)) {
618 RealVariable* variable =
619 dynamic_cast<RealVariable*>(OpalData::getInstance()->find(uvar));
620 udata[uvar] = std::to_string(variable->getReal());
621 } else if (dynamic_cast<StringConstant*>(tmpObject)) {
622 StringConstant* variable =
623 dynamic_cast<StringConstant*>(OpalData::getInstance()->find(uvar));
624 udata[uvar] = variable->getString();
625 } else {
626 throw OpalException("OpalData::getVariableData()",
627 "Type of '" + uvar + "' not supported. "
628 "Only support for REAL and STRING.");
629 }
630 }
631 return udata;
632}
633
634std::vector<std::string> OpalData::getVariableNames() {
635 std::vector<std::string> result;
636
637 for (ObjectDir::const_iterator index = p->mainDirectory.begin();
638 index != p->mainDirectory.end(); ++index) {
639 std::string tmpName = (*index).first;
640 if (!tmpName.empty()) {
641 Object* tmpObject = OpalData::getInstance()->find(tmpName);
642 if (tmpObject) {
643 if (!tmpObject || tmpObject->isBuiltin()) continue;
644 if (tmpObject->getCategory() == "VARIABLE") {
645 result.push_back(tmpName);
646 }
647 }
648 }
649 }
650 return result;
651}
652
653void OpalData::addProblemCharacteristicValue(const std::string& name, unsigned int value) {
654 if (p->problemSize_m.find(name) != p->problemSize_m.end()) {
655 p->problemSize_m.insert(std::make_pair(name, value));
656 } else {
657 p->problemSize_m[name] = value;
658 }
659}
660
661const std::map<std::string, unsigned int>& OpalData::getProblemCharacteristicValues() const {
662 return p->problemSize_m;
663}
664
665void OpalData::storeArguments(int argc, char* argv[]) {
666 p->arguments_m.clear();
667 for (int i = 0; i < argc; ++i) {
668 p->arguments_m.push_back(argv[i]);
669 }
670}
671
672std::vector<std::string> OpalData::getArguments() { return p->arguments_m; }
typename ippl::ParticleSpatialLayout< T, Dim, Mesh_t< Dim > > PLayout_t
#define MAX_NUM_INSTANCES
Definition OpalData.cpp:50
std::map< double, double > energyEvolution_t
Definition OpalData.h:42
std::pair< std::string, double > MaxPhasesT
Definition OpalData.h:41
ippl::FieldLayout< Dim > FieldLayout_t
Definition PBunchDefs.h:25
ippl::UniformCartesian< double, 3 > Mesh_t
Definition PBunchDefs.h:18
Template PIC bunch: IPPL PicManager, shared field mesh/solver, and multiple particle containers.
Abstract base class for attribute values of different types.
A map of string versus pointer to Object.
Definition Directory.h:36
void erase()
Delete all entries.
Definition Directory.cpp:37
ObjectDir::iterator end()
Last object in alphabetic order of name.
Definition Directory.cpp:33
ObjectDir::iterator begin()
First object in alphabetic order of name.
Definition Directory.cpp:29
Object * find(const std::string &name) const
Find entry.
Definition Directory.cpp:41
void insert(const std::string &name, Object *newObject)
Define new object.
Definition Directory.cpp:51
The base class for all OPAL objects.
Definition Object.h:45
void setParent(Object *)
Set parent object.
Definition Object.cpp:283
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
Definition Object.cpp:45
Object * getParent() const
Return parent pointer.
Definition Object.cpp:269
const std::string & getOpalName() const
Return object name.
Definition Object.cpp:267
void setDirty(bool)
Set/reset the [b]modified[/b] flag.
Definition Object.cpp:249
virtual const std::string getCategory() const =0
Return the object category as a string.
bool isBuiltin() const
True, if [b]this[/b] is a built-in object.
Definition Object.cpp:243
The global OPAL structure.
Definition OpalData.h:45
void addEnergyData(double spos, double ekin)
Definition OpalData.cpp:333
void printAllNames(std::ostream &stream)
Definition OpalData.cpp:486
DataSink * getDataSink()
Definition OpalData.cpp:321
void storeTitle(const std::string &)
Store the page title.
Definition OpalData.cpp:559
double getP0() const
Return value of global reference momentum.
Definition OpalData.cpp:479
int getLastStep() const
get the last step from a possible previous run
Definition OpalData.cpp:304
void registerExpression(AttributeBase *)
Register expression.
Definition OpalData.cpp:553
int getNumberOfMaxPhases()
Definition OpalData.cpp:331
PartBunch_t * getPartBunch()
Definition OpalData.cpp:312
unsigned long long getMaxTrackSteps()
Definition OpalData.cpp:231
void storeInputFn(const std::string &fn)
store opals input filename
Definition OpalData.cpp:561
void setPartBunch(PartBunch_t *p)
Definition OpalData.cpp:310
bool hasGlobalGeometry()
Definition OpalData.cpp:379
void setRestartDumpFreq(const int &N)
set the dump frequency as found in restart file
Definition OpalData.cpp:294
std::vector< MaxPhasesT >::iterator getLastMaxPhases()
Definition OpalData.cpp:329
void erase(const std::string &name)
Delete existing entry.
Definition OpalData.cpp:461
std::string getInputBasename()
get input file name without extension
Definition OpalData.cpp:571
void makeDirty(Object *object)
Invalidate expressions.
Definition OpalData.cpp:481
bool isInOPALTMode()
Definition OpalData.cpp:259
void setP0(ValueDefinition *p0)
Set the global momentum.
Definition OpalData.cpp:557
double getGlobalPhaseShift()
units: (sec)
Definition OpalData.cpp:370
bool isOptimizerRun()
Definition OpalData.cpp:261
std::map< std::string, std::string > getVariableData()
Definition OpalData.cpp:612
struct OpalDataImpl * p
Definition OpalData.h:272
void setOptimizerFlag()
Definition OpalData.cpp:267
bool isInPrepState()
Definition OpalData.cpp:269
std::string getTitle()
Get the title string.
Definition OpalData.cpp:565
void checkAndAddOutputFileName(const std::string &outfn)
checks the output file names of all items to avoid duplicates
Definition OpalData.cpp:577
std::vector< MaxPhasesT >::iterator getFirstMaxPhases()
Definition OpalData.cpp:327
void printNames(std::ostream &stream, const std::string &pattern)
Print all objects.
Definition OpalData.cpp:514
void setInOPALCyclMode()
Definition OpalData.cpp:263
void update()
Update all objects.
Definition OpalData.cpp:587
bool isInOPALCyclMode()
Definition OpalData.cpp:257
void apply(const ObjectFunction &)
Apply a function to all objects.
Definition OpalData.cpp:381
bool hasRestartFile()
true if we do a restart from specified h5 file
Definition OpalData.cpp:292
void setRestartRun(const bool &value=true)
set OPAL in restart mode
Definition OpalData.cpp:279
void setMaxPhase(std::string elName, double phi)
Definition OpalData.cpp:323
void setLastStep(const int &step)
set the last step in a run for possible follow-up run
Definition OpalData.cpp:302
std::vector< std::string > getArguments()
Definition OpalData.cpp:672
static void stashInstance()
Definition OpalData.cpp:209
int getRestartDumpFreq() const
get the dump frequency as found in restart file
Definition OpalData.cpp:296
std::string getRestartFileName()
get opals restart h5 format filename
Definition OpalData.cpp:285
std::string getInputFn()
get opals input filename
Definition OpalData.cpp:569
void bunchIsAllocated()
Definition OpalData.cpp:308
void unregisterExpression(AttributeBase *)
Unregister expression.
Definition OpalData.cpp:555
Object * find(const std::string &name)
Find entry.
Definition OpalData.cpp:477
bool hasPriorTrack()
true if in follow-up track
Definition OpalData.cpp:273
static std::stack< OpalData * > stashedInstances
Definition OpalData.h:263
int getRestartStep()
get the step where to restart
Definition OpalData.cpp:283
void create(Object *newObject)
Create new object.
Definition OpalData.cpp:387
static OpalData * instance
Definition OpalData.h:261
void printTitle(std::ostream &)
Print the page title.
Definition OpalData.cpp:563
static void deleteInstance()
Definition OpalData.cpp:203
void setRestartFileName(std::string s)
store opals restart h5 format filename
Definition OpalData.cpp:287
void setInPrepState(bool state)
Definition OpalData.cpp:271
void setPriorTrack(const bool &value=true)
true if in follow-up track
Definition OpalData.cpp:275
void setDataSink(DataSink *s)
Definition OpalData.cpp:316
OpenMode getOpenMode() const
Definition OpalData.cpp:300
bool hasDataSinkAllocated()
true if we already allocated a DataSink object
Definition OpalData.cpp:314
void setGlobalPhaseShift(double shift)
units: (sec)
Definition OpalData.cpp:365
bool hasBunchAllocated()
true if we already allocated a ParticleBunch object
Definition OpalData.cpp:306
energyEvolution_t::iterator getFirstEnergyData()
Definition OpalData.cpp:337
void unregisterTable(Table *t)
Unregister table.
Definition OpalData.cpp:546
void reset()
reset object for consecutive runs
Definition OpalData.cpp:241
static OpalData * getInstance()
Definition OpalData.cpp:193
void setMaxTrackSteps(unsigned long long s)
Definition OpalData.cpp:233
void storeArguments(int argc, char *argv[])
Definition OpalData.cpp:665
void setInOPALTMode()
Definition OpalData.cpp:265
static bool isInstantiated
Definition OpalData.h:260
BoundaryGeometry * getGlobalGeometry()
Definition OpalData.cpp:377
void define(Object *newObject)
Define a new object.
Definition OpalData.cpp:400
energyEvolution_t::iterator getLastEnergyData()
Definition OpalData.cpp:339
OpenMode
Enum for writing to files.
Definition OpalData.h:58
void setRestartStep(int s)
store the location where to restart
Definition OpalData.cpp:281
void setGlobalGeometry(BoundaryGeometry *bg)
Definition OpalData.cpp:375
void incMaxTrackSteps(unsigned long long s)
Definition OpalData.cpp:235
static OpalData * popInstance()
Definition OpalData.cpp:219
void registerTable(Table *t)
Register table.
Definition OpalData.cpp:544
std::string getAuxiliaryOutputDirectory() const
get the name of the the additional data directory
Definition OpalData.cpp:567
void addProblemCharacteristicValue(const std::string &name, unsigned int value)
Definition OpalData.cpp:653
void setOpenMode(OpenMode openMode)
Definition OpalData.cpp:298
bool inRestartRun()
true if we do a restart run
Definition OpalData.cpp:277
const std::map< std::string, unsigned int > & getProblemCharacteristicValues() const
Definition OpalData.cpp:661
std::vector< std::string > getVariableNames()
Definition OpalData.cpp:634
virtual double getReal() const
Return value.
A regular expression.
bool match(const std::string &s) const
Match a string against the pattern.
virtual std::string getString() const
Return value.
The base class for all OPAL tables.
Definition Table.h:41
virtual bool isDependent(const std::string &name) const =0
Find out if table depends on the object identified by [b]name[/b].
The base class for all OPAL value definitions.
virtual double getReal() const
Return real value.
bool info
Info flag.
Definition Options.cpp:28
constexpr double GeV2eV
Definition Units.h:68
Abstract base class for functor objects whose argument is an Object.
std::string inputFn_m
Definition OpalData.cpp:98
int restart_dump_freq_m
Definition OpalData.cpp:95
energyEvolution_t energyEvolution_m
Definition OpalData.cpp:122
bool hasPriorRun_m
Definition OpalData.cpp:80
bool isInOPALCyclMode_m
Definition OpalData.cpp:136
std::list< Table * >::iterator tableIterator
Definition OpalData.cpp:71
Directory mainDirectory
Definition OpalData.cpp:61
bool hasRestartFile_m
Definition OpalData.cpp:92
bool isOptimizerFlag_m
Definition OpalData.cpp:138
PLayout_t< double, 3 > * PL_m
Definition OpalData.cpp:131
std::map< std::string, unsigned int > problemSize_m
Definition OpalData.cpp:141
int restartStep_m
Definition OpalData.cpp:86
std::set< std::string > outFiles_m
Definition OpalData.cpp:100
std::vector< std::string > arguments_m
Definition OpalData.cpp:143
BoundaryGeometry * bg_m
Definition OpalData.cpp:119
bool hasDataSinkAllocated_m
Definition OpalData.cpp:112
bool isRestart_m
Definition OpalData.cpp:83
OpalData::OpenMode openMode_m
Mode for writing files.
Definition OpalData.cpp:103
ValueDefinition * referenceMomentum
Definition OpalData.cpp:64
FieldLayout_t< 3 > * FL_m
Definition OpalData.cpp:128
std::list< Table * > tableDirectory
Definition OpalData.cpp:70
std::string restartFn_m
Definition OpalData.cpp:89
std::set< AttributeBase * > exprDirectory
Definition OpalData.cpp:74
PartBunch_t * bunch_m
Definition OpalData.cpp:110
std::set< AttributeBase * >::iterator exprIterator
Definition OpalData.cpp:75
bool isInPrepState_m
Definition OpalData.cpp:139
DataSink * dataSink_m
Definition OpalData.cpp:114
unsigned long long maxTrackSteps_m
Definition OpalData.cpp:134
bool isInOPALTMode_m
Definition OpalData.cpp:137
Mesh_t< 3 > * mesh_m
Definition OpalData.cpp:125
bool hasBunchAllocated_m
Definition OpalData.cpp:108
double gPhaseShift_m
Definition OpalData.cpp:117
std::vector< MaxPhasesT > maxPhases_m
Definition OpalData.cpp:121
std::string itsTitle_m
Definition OpalData.cpp:78
virtual void operator()(Object *) const
The function to be executed.
Definition OpalData.cpp:52