3.2.11.3. causality/EventTrace.hpp¶
-
using causality::Action = std::variant<causality::EdgeAction, causality::InputAction, causality::OutputAction>¶
3.2.11.3.1. Class causality::EdgeAction
¶
-
class causality::EdgeAction¶
3.2.11.3.1.1. Synopsis¶
-
EdgeAction()
-
EdgeAction(dg::DG::HyperEdge edge)
-
void applyTo(DGPetriNetMarking &m) const
-
dg::DG::HyperEdge edge
3.2.11.3.2. Class causality::InputAction
¶
-
class causality::InputAction¶
3.2.11.3.2.1. Synopsis¶
-
InputAction()
-
InputAction(dg::DG::Vertex vertex)
-
void applyTo(DGPetriNetMarking &m) const
-
dg::DG::Vertex vertex
3.2.11.3.3. Class causality::OutputAction
¶
-
class causality::OutputAction¶
3.2.11.3.3.1. Synopsis¶
-
OutputAction()
-
OutputAction(dg::DG::Vertex vertex)
-
void applyTo(DGPetriNetMarking &m) const
-
dg::DG::Vertex vertex
3.2.11.3.4. Class causality::EventTrace
¶
-
class causality::EventTrace¶
A helper class to hold an initial state with a subsequent trace of
Event
s.
3.2.11.3.4.1. Synopsis¶
-
type iterator
-
using const_iterator = iterator
-
EventTrace(DGPetriNetMarking initialState)
-
DGPetriNetMarking getInitialState() const
-
int size() const
-
double getTime() const
-
const_iterator begin() const
-
const_iterator end() const
-
Event operator[](int i) const
-
friend std::ostream &operator<<(std::ostream &s, const EventTrace &t)
-
friend bool operator==(const EventTrace &a, const EventTrace &b)
-
void add(double time, Action action)
-
std::string print() const
-
std::string print(int maxPointsPerMolecule) const
-
std::string dump() const
-
std::string dump(const std::string &filename) const
-
static EventTrace load(std::shared_ptr<dg::DG> dg_, const std::string &file)
-
static EventTrace load(std::shared_ptr<DGPetriNet> net, const std::string &file)
-
class causality::EventTrace::Event
3.2.11.3.4.2. Details¶
-
EventTrace(DGPetriNetMarking initialState)¶
Construct an empty event trace with an initial state. A copy of the given marking is being stored.
-
DGPetriNetMarking getInitialState() const¶
- Returns
a copy of the initial state for this event trace.
-
int size() const¶
- Returns
the number of events in the trace.
-
const_iterator begin() const¶
-
const_iterator end() const¶
- Returns
the begin/end iterator for the range of events in the trace.
-
Event operator[](int i) const¶
- Returns
the ith event in the trace.
- Throws
LogicError
if i is out of bounds.
-
friend std::ostream &operator<<(std::ostream &s, const EventTrace &t)¶
-
friend bool operator==(const EventTrace &a, const EventTrace &b)¶
Calls
syncSize()
on the internal initial state and the underlying net.
-
void add(double time, Action action)¶
Append an event to the trace.
- Throws
LogicError
if the time is less than the current time of the trace.- Throws
LogicError
if the action has null descriptors.- Throws
LogicError
if the descriptors in the action does not belong to the underlying derivation graph.
-
std::string print() const¶
-
std::string print(int maxPointsPerMolecule) const¶
Create a plot of the counts throughout the event trace at each time point.
The maxPointsPerMolecule controls how many points are rendered for each molecule in the plot. It defaults to 500.
- Returns
the filename for the PDF that will be compiled by the post processor.
-
std::string dump() const¶
-
std::string dump(const std::string &filename) const¶
Dump the initial marking and list of events to a file. This file can be loaded in again.
- Parameters
filename – the name of the file to save the dump to. If non is given an auto-generated name in the
out/
folder is used. If an empty string is given, it is treated as if non is given.- Returns
the filename with the dumped trace.
The version taking a derivation graph will first create a Petri net and call the second version, i.e., it is equivalent to load(DGPetriNet::make(dg_), file).
- Returns
an event trace loaded from the given file. The given derivation graph or the underlying derivation graph of the given net must match the derivation graph originally used to create the dump.
- Throws
LogicError
if dg_/net is a null pointer.- Throws
InputError
on bad data or if the given derivation graph does not match the data.