Add basic Python exec of PYACTION
This commit is contained in:
@@ -30,8 +30,22 @@ class PyAction {
|
||||
public:
|
||||
explicit PyAction(const std::string& code_arg);
|
||||
const std::string& code() const;
|
||||
~PyAction();
|
||||
|
||||
/*
|
||||
Storage is a void pointer to a Python dictionary: py::dict. It is represented
|
||||
with a void pointer in this way to avoid adding the Pybind11 headers to this
|
||||
file. Calling scope must do a cast before using the storage pointer:
|
||||
|
||||
py::dict * storage = static_cast<py::dict *>(py_action.storage());
|
||||
|
||||
The purpose of this dictionary is to allow PYACTION scripts to store state
|
||||
between invocations.
|
||||
*/
|
||||
void * storage() const;
|
||||
private:
|
||||
std::string input_code;
|
||||
void * m_storage;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ namespace Opm {
|
||||
class PythonInterp;
|
||||
class Parser;
|
||||
class Deck;
|
||||
|
||||
class SummaryState;
|
||||
class Schedule;
|
||||
class EclipseState;
|
||||
|
||||
/*
|
||||
This class is a thin wrapper around the PythonInterp class. The Python class
|
||||
@@ -57,7 +59,7 @@ public:
|
||||
Python();
|
||||
bool exec(const std::string& python_code) const;
|
||||
bool exec(const std::string& python_code, const Parser& parser, Deck& deck) const;
|
||||
bool exec(const PyAction& py_action) const;
|
||||
bool exec(const PyAction& py_action, EclipseState& ecl_state, Schedule& schedule, std::size_t report_step, SummaryState& st) const;
|
||||
explicit operator bool() const;
|
||||
private:
|
||||
std::shared_ptr<PythonInterp> interp;
|
||||
|
||||
Reference in New Issue
Block a user