OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
#include <DumpEMFields.h>
Public Types | |
enum | { FILE_NAME , COORDINATE_SYSTEM , X_START , DX , X_STEPS , Y_START , DY , Y_STEPS , Z_START , DZ , Z_STEPS , T_START , DT , T_STEPS , R_START , DR , R_STEPS , PHI_START , DPHI , PHI_STEPS , SIZE } |
The common attributes of DumpEMFields. More... | |
Public Member Functions | |
DumpEMFields () | |
DumpEMFields (const std::string &name, DumpEMFields *parent) | |
virtual | ~DumpEMFields () |
virtual DumpEMFields * | clone (const std::string &name) |
virtual void | execute () |
void | print (std::ostream &os) const |
Public Member Functions inherited from Action | |
virtual | ~Action () |
virtual bool | canReplaceBy (Object *object) |
Test if replacement is allowed. More... | |
virtual const std::string | getCategory () const |
Return the object category as a string. More... | |
virtual bool | shouldTrace () const |
Trace flag. More... | |
virtual bool | shouldUpdate () const |
Update flag. More... | |
Public Member Functions inherited from Object | |
virtual | ~Object () |
virtual bool | canReplaceBy (Object *object) |
Test if replacement is allowed. More... | |
virtual Object * | clone (const std::string &name)=0 |
Return a clone. More... | |
void | copyAttributes (const Object &) |
Copy attributes from another object. More... | |
virtual void | execute () |
Execute the command. More... | |
virtual Attribute * | findAttribute (const std::string &name) |
Find an attribute by name. More... | |
virtual const Attribute * | findAttribute (const std::string &name) const |
Find an attribute by name. More... | |
virtual const std::string | getCategory () const =0 |
Return the object category as a string. More... | |
virtual bool | shouldTrace () const =0 |
Trace flag. More... | |
virtual bool | shouldUpdate () const =0 |
Update flag. More... | |
virtual Object * | makeTemplate (const std::string &, TokenStream &, Statement &) |
Macro handler function. More... | |
virtual Object * | makeInstance (const std::string &name, Statement &, const Parser *) |
Macro handler function. More... | |
virtual void | parse (Statement &) |
Parse the object. More... | |
virtual void | parseShortcut (Statement &, bool eval=true) |
Parser for single-attribute commands. More... | |
virtual void | print (std::ostream &) const |
Print the object. More... | |
virtual void | printValue (std::ostream &) const |
virtual void | printHelp (std::ostream &) const |
Print help. More... | |
virtual void | replace (Object *oldObject, Object *newObject) |
Replace references. More... | |
virtual void | update () |
Update this object. More... | |
bool | isBuiltin () const |
True, if [b]this[/b] is a built-in object. More... | |
virtual bool | isShared () const |
Shared flag. More... | |
virtual void | setShared (bool) |
Set/reset shared flag. More... | |
void | setDirty (bool) |
Set/reset the [b]modified[/b] flag. More... | |
bool | isDirty () const |
True, if the [b]modified[/b] flag is set. More... | |
void | setFlag (bool) |
Flag/unflag this object, e. g. to control output of objects for. More... | |
bool | isFlagged () const |
True, if [b]this[/b] is flagged by setFlag(true). More... | |
const Object * | getBaseObject () const |
Return the object's base type object. More... | |
const std::string & | getOpalName () const |
Return object name. More... | |
Object * | getParent () const |
Return parent pointer. More... | |
bool | isTreeMember (const Object *subTree) const |
Test for tree membership. More... | |
void | setOpalName (const std::string &name) |
Set object name. More... | |
void | setParent (Object *) |
Set parent object. More... | |
void | clear () |
Clear the occurrence counter. More... | |
int | increment () |
Increment and return the occurrence counter. More... | |
int | occurrenceCount () |
Return the occurrence counter. More... | |
void | registerReference (Invalidator *a) |
Register a reference to this object. More... | |
void | unregisterReference (Invalidator *a) |
Unegister a reference to this object. More... | |
void | registerOwnership (const AttributeHandler::OwnerType &itsClass) const |
Public Member Functions inherited from RCObject | |
int | addReference () const |
Increment reference count. More... | |
int | removeReference () const |
Decrement the reference count. More... | |
bool | isShared () const |
Test for sharing. More... | |
Static Public Member Functions | |
static void | writeFields (Component *field) |
Private Types | |
enum class | CoordinateSystem : unsigned short { CARTESIAN , CYLINDRICAL } |
Private Member Functions | |
virtual void | writeFieldThis (Component *field) |
virtual void | buildGrid () |
void | parseCoordinateSystem () |
void | writeHeader (std::ofstream &fout) const |
void | writeFieldLine (Component *field, const Vector_t &point, const double &time, std::ofstream &fout) const |
DumpEMFields (const DumpEMFields &dump) | |
DumpEMFields & | operator= (const DumpEMFields &dump) |
Static Private Member Functions | |
static void | checkInt (double value, std::string name, double tolerance=1e-9) |
Private Attributes | |
interpolation::NDGrid * | grid_m |
std::string | filename_m |
CoordinateSystem | coordinates_m = CoordinateSystem::CARTESIAN |
Static Private Attributes | |
static std::unordered_set< DumpEMFields * > | dumpsSet_m |
Additional Inherited Members | |
Public Attributes inherited from Object | |
std::vector< Attribute > | itsAttr |
The object attributes. More... | |
Protected Member Functions inherited from Action | |
Action (int size, const char *name, const char *help) | |
Constructor for exemplars. More... | |
Action (const std::string &name, Action *parent) | |
Constructor for cloning. More... | |
Protected Member Functions inherited from Object | |
Object (int size, const char *name, const char *help) | |
Constructor for exemplars. More... | |
Object (const std::string &name, Object *parent) | |
Constructor for clones. More... | |
Protected Member Functions inherited from RCObject | |
RCObject () | |
Default constructor. More... | |
RCObject (const RCObject &) | |
Copy constructor. More... | |
virtual | ~RCObject ()=0 |
RCObject & | operator= (const RCObject &right) |
Protected Attributes inherited from Object | |
bool | builtin |
Built-in flag. More... | |
bool | modified |
Dirty flag. More... | |
bool | flagged |
Object flag. More... | |
DumpEMFields dumps the dynamically changing fields of a Ring in a user- defined grid.
The idea is to print out the field map across a 4D grid in space-time for debugging purposes. The problem is to manage the DumpEMFields object through three phases of program execution; initial construction, parsing and then actual field map writing (where we need to somehow let DumpFields know what the field maps are). So for each DumpEMFields object created, we store in a set. When the execute() method is called, DumpEMFields builds a grid using the parsed information.
When the ParallelCyclotronTracker is about to start tracking, it calls writeFields method which loops over the static set of DumpEMFields and writes each one. It is not the cleanest implementation, but I can't see a better way.
The DumpEMFields themselves operate by iterating over a NDGrid object and looking up the field/writing it out on each grid point.
Definition at line 54 of file DumpEMFields.h.
anonymous enum |
The common attributes of DumpEMFields.
Enumerator | |
---|---|
FILE_NAME | |
COORDINATE_SYSTEM | |
X_START | |
DX | |
X_STEPS | |
Y_START | |
DY | |
Y_STEPS | |
Z_START | |
DZ | |
Z_STEPS | |
T_START | |
DT | |
T_STEPS | |
R_START | |
DR | |
R_STEPS | |
PHI_START | |
DPHI | |
PHI_STEPS | |
SIZE |
Definition at line 58 of file DumpEMFields.h.
|
strongprivate |
Enumerator | |
---|---|
CARTESIAN | |
CYLINDRICAL |
Definition at line 128 of file DumpEMFields.h.
DumpEMFields::DumpEMFields | ( | ) |
Constructor
Definition at line 39 of file DumpEMFields.cpp.
References COORDINATE_SYSTEM, DPHI, DR, DT, DX, DY, DZ, FILE_NAME, Object::itsAttr, Attributes::makePredefinedString(), Attributes::makeReal(), Attributes::makeString(), PHI_START, PHI_STEPS, R_START, R_STEPS, Object::registerOwnership(), AttributeHandler::STATEMENT, T_START, T_STEPS, X_START, X_STEPS, Y_START, Y_STEPS, Z_START, and Z_STEPS.
Referenced by clone().
DumpEMFields::DumpEMFields | ( | const std::string & | name, |
DumpEMFields * | parent | ||
) |
Constructor
Definition at line 111 of file DumpEMFields.cpp.
|
virtual |
Destructor deletes grid_m and if in the dumps set, take it out
Definition at line 115 of file DumpEMFields.cpp.
References dumpsSet_m, and grid_m.
|
private |
|
privatevirtual |
Definition at line 150 of file DumpEMFields.cpp.
References CARTESIAN, checkInt(), coordinates_m, CYLINDRICAL, DPHI, DR, DT, DX, DY, DZ, FILE_NAME, filename_m, Attributes::getReal(), Attributes::getString(), grid_m, Object::itsAttr, nr, parseCoordinateSystem(), PHI_START, PHI_STEPS, R_START, R_STEPS, T_START, T_STEPS, X_START, X_STEPS, Y_START, Y_STEPS, Z_START, and Z_STEPS.
Referenced by execute().
|
staticprivate |
Definition at line 217 of file DumpEMFields.cpp.
References abs(), floor(), name, and real().
Referenced by buildGrid().
|
virtual |
Make a clone (overloadable copy-constructor).
name | not used If this is in the dumpsSet_m, so will the clone. Not sure how the itsAttr stuff works, so this may not get properly copied? |
Implements Object.
Definition at line 120 of file DumpEMFields.cpp.
References interpolation::NDGrid::clone(), coordinates_m, DumpEMFields(), dumpsSet_m, filename_m, grid_m, and name.
Referenced by execute().
|
virtual |
Builds the grid but does not write the field map
Builds a grid of points in x-y-z space using the NDGrid algorithm. Checks that X_STEPS, Y_STEPS, Z_STEPS are integers or throws OpalException.
Reimplemented from Object.
Definition at line 141 of file DumpEMFields.cpp.
References buildGrid(), clone(), and dumpsSet_m.
|
private |
|
private |
Definition at line 133 of file DumpEMFields.cpp.
References CARTESIAN, COORDINATE_SYSTEM, coordinates_m, CYLINDRICAL, Attributes::getString(), and Object::itsAttr.
Referenced by buildGrid().
|
virtual |
Print the attributes of DumpEMFields to standard out
Reimplemented from Object.
Definition at line 349 of file DumpEMFields.cpp.
References CARTESIAN, COORDINATE_SYSTEM, coordinates_m, CYLINDRICAL, DPHI, DR, DT, DX, DY, DZ, endl(), filename_m, Attributes::getReal(), Attributes::getString(), Object::itsAttr, PHI_START, PHI_STEPS, R_START, R_STEPS, T_START, T_STEPS, X_START, X_STEPS, Y_START, Y_STEPS, Z_START, and Z_STEPS.
Referenced by operator<<().
|
private |
Definition at line 263 of file DumpEMFields.cpp.
References Component::apply(), coordinates_m, cos(), CYLINDRICAL, Units::rad2deg, and sin().
Referenced by writeFieldThis().
|
static |
Write the fields for all defined DumpEMFields objects
field | borrowed reference to the Component object that holds the field map; caller owns the memory. Iterates over the DumpEMFields in the dumpsSet_m and calls writeFieldThis on each DumpEMFields. This writes each field map in turn. Format is: <number of rows> <column 1> <units> <column 2> <units> <column 3> <units> <column 4> <units> <column 5> <units> <column 6> <units> 0 <field map data> |
Definition at line 210 of file DumpEMFields.cpp.
References dumpsSet_m.
Referenced by ParallelCyclotronTracker::execute().
|
privatevirtual |
Definition at line 295 of file DumpEMFields.cpp.
References interpolation::NDGrid::begin(), Util::combineFilePath(), end(), endl(), filename_m, OpalData::getAuxiliaryOutputDirectory(), OpalData::getInstance(), gmsg, grid_m, writeFieldLine(), and writeHeader().
|
private |
Definition at line 230 of file DumpEMFields.cpp.
References CARTESIAN, coordinates_m, CYLINDRICAL, interpolation::NDGrid::end(), endl(), grid_m, and interpolation::Mesh::Iterator::toInteger().
Referenced by writeFieldThis().
|
private |
Definition at line 146 of file DumpEMFields.h.
Referenced by buildGrid(), clone(), parseCoordinateSystem(), print(), writeFieldLine(), and writeHeader().
|
staticprivate |
Definition at line 148 of file DumpEMFields.h.
Referenced by clone(), execute(), writeFields(), and ~DumpEMFields().
|
private |
Definition at line 144 of file DumpEMFields.h.
Referenced by buildGrid(), clone(), print(), and writeFieldThis().
|
private |
Definition at line 143 of file DumpEMFields.h.
Referenced by buildGrid(), clone(), writeFieldThis(), writeHeader(), and ~DumpEMFields().