The abstract base class for all simulation state objects. More...
#include <base.h>
Classes | |
struct | ArrayInfo |
Used with StateBase::getArray() to describe a single parameter. More... | |
struct | clone_tag |
Used with clone ctor. More... | |
Public Member Functions | |
virtual void | assign (const StateBase &other)=0 |
virtual void | show (std::ostream &, int level=0) const |
virtual bool | getArray (unsigned index, ArrayInfo &Info) |
Introspect named parameter of the derived class. More... | |
virtual StateBase * | clone () const =0 |
Public Attributes | |
size_t | next_elem |
double | pos |
absolute longitudinal position at end of Element | |
Protected Member Functions | |
StateBase (const Config &c) | |
StateBase (const StateBase &c, clone_tag) | |
For use in clone() | |
The abstract base class for all simulation state objects.
Represents the state of some bunch of particles moving through a Machine
|
protected |
|
pure virtual |
virtual equivalent to operator=() Should only be used with another State originating from the same Machine from Machine::allocState() or clone().
Implemented in MomentState, MatrixState, and VectorState.
|
pure virtual |
Allocate a new instance which is a copy of this one. Caller is responsible to delete the returned pointer
Implemented in MomentState, MatrixState, and VectorState.
|
virtual |
Introspect named parameter of the derived class.
idx | The index of the parameter |
Info | mailbox to be filled with information about this paramter |
To introspect call this with index increasing from zero until false is returned.
Sub-classes are required to maintain a fixed number of parameters. The same ArrayInfo::name should alwaysbe returned for a given index. Similarly ArrayInfo::ndim and ArrayInfo.type should not change.
ArrayInfo::ptr, ArrayInfo::dim, ArrayInfo::stride are allowed to change when the state is passed to Machine::propagate().
Therefore, if getArray() for an instance has returned true for some index, then a caller may assume that all future calls to getArray() for this instance will also return true. However, the caller must still re-call getArray() in future as the storage and sizes may have changed.
Reimplemented in MomentState, MatrixState, and VectorState.
|
inlinevirtual |
Print information about the state. level is a hint as to the verbosity expected by the caller.
Reimplemented in MomentState, and MatrixState.
size_t StateBase::next_elem |
Index of ElementVoid in Machine to follow this the current one. May be altered within ElementVoid::advance() to achieve branching or looping.