struct ComputationalGraphHandle

Overview

Uses a Computation Graph to execute datapack transformation operations. More…

#include <computational_graph_handle.h>

struct ComputationalGraphHandle: public DataPackProcessor {
    // fields

    bool _slaveMode;
    bool _spinROS;
    PyGILState_STATE _pyGILState;
    std::map<std::string, InputEngineNode*> _inputs;
    std::map<std::string, OutputEngineNode*> _outputs;
    InputClockNode* _clock = nullptr;
    InputIterationNode* _iteration = nullptr;

    // construction

    ComputationalGraphHandle(
        SimulationDataManager* simulationDataManager,
        bool slaveMode = false,
        bool spinROS = false
    );

    // methods

    virtual void init(
        const jsonSharedPtr& simConfig,
        const engine_interfaces_t& engines
    );

    virtual void updateDataPacksFromEngines(const std::vector<EngineClientInterfaceSharedPtr>& engines);
    virtual void compute(const std::vector<EngineClientInterfaceSharedPtr>& engines);
    virtual void sendDataPacksToEngines(const std::vector<EngineClientInterfaceSharedPtr>& engines);
};

Inherited Members

public:
    // typedefs

    typedef std::vector<EngineClientInterfaceSharedPtr> engine_interfaces_t;

    // methods

    virtual void init(
        const jsonSharedPtr& simConfig,
        const engine_interfaces_t& engines
    ) = 0;

    virtual void updateDataPacksFromEngines(const std::vector<EngineClientInterfaceSharedPtr>& engines) = 0;
    virtual void compute(const std::vector<EngineClientInterfaceSharedPtr>& engines) = 0;
    virtual void sendDataPacksToEngines(const std::vector<EngineClientInterfaceSharedPtr>& engines) = 0;
    virtual void postEngineInit(const std::vector<EngineClientInterfaceSharedPtr>&);
    virtual void preEngineReset(const std::vector<EngineClientInterfaceSharedPtr>&);
    virtual void postEngineReset(const std::vector<EngineClientInterfaceSharedPtr>&);
    void datapackCycle(const std::vector<EngineClientInterfaceSharedPtr>& engines);
    void setSimulationTime(SimulationTime simulationTime);
    void setSimulationIteration(unsigned long simulationIteration);

Detailed Documentation

Uses a Computation Graph to execute datapack transformation operations.

Fields

std::map<std::string, InputEngineNode*> _inputs

Map containing all InputEngineNodes associated with this simulation.

std::map<std::string, OutputEngineNode*> _outputs

Map containing all OutputEngineNodes associated with this simulation.

InputClockNode* _clock = nullptr

Pointer to the clock_node of the graph.

InputIterationNode* _iteration = nullptr

Pointer to the iteration_node of the graph.

Methods

virtual void init(
    const jsonSharedPtr& simConfig,
    const engine_interfaces_t& engines
)

Initializes the handler.

Parameters:

simConfig

json object containing configuration information to initialize the handler

engines

list of Engine clients participating in the simulation

virtual void updateDataPacksFromEngines(const std::vector<EngineClientInterfaceSharedPtr>& engines)

Request datapacks from engines.

Parameters:

engines

Engines that are been synchronize in the current loop

virtual void compute(const std::vector<EngineClientInterfaceSharedPtr>& engines)

Perform computations on datapacks.

Parameters:

engines

Engines that are been synchronize in the current loop

virtual void sendDataPacksToEngines(const std::vector<EngineClientInterfaceSharedPtr>& engines)

Send datapacks to engines.

Parameters:

engines

Engines that are been synchronize in the current loop