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.1.2. Details

EdgeAction()
EdgeAction(dg::DG::HyperEdge edge)
void applyTo(DGPetriNetMarking &m) const

Perform m.fire(edge).

dg::DG::HyperEdge edge

May not be a null 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.2.2. Details

InputAction()
InputAction(dg::DG::Vertex vertex)
void applyTo(DGPetriNetMarking &m) const

Perform m.add(vertex, 1).

dg::DG::Vertex vertex

May not be a null 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.3.2. Details

OutputAction()
OutputAction(dg::DG::Vertex vertex)
void applyTo(DGPetriNetMarking &m) const

Perform m.remove(vertex, 1).

dg::DG::Vertex vertex

May not be a null 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 Events.

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

type iterator
using const_iterator = iterator
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.

double getTime() const
Returns

the time of the latest added event, or 0 if size() == 0.

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.

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)

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.

3.2.11.3.5. Class causality::EventTrace::Event

class causality::EventTrace::Event
double time
Action action