-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4017 from lisajulia/fix/pyAction-separate-python-…
…bindings-and-opm-embedded Fix/pyAction: Separate classes for python bindings and opm embedded
- Loading branch information
Showing
18 changed files
with
3,652 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <opm/input/eclipse/Schedule/ScheduleState.hpp> | ||
|
||
#include "export.hpp" | ||
|
||
namespace { | ||
const Group& get_group(const ScheduleState& st, const std::string& group_name) { | ||
return st.groups.get(group_name); | ||
} | ||
} | ||
|
||
/** | ||
* @brief Function to export the ScheduleState class and some methods to Python. | ||
* | ||
* In the below class we use std::shared_ptr as the holder type, see https://pybind11.readthedocs.io/en/stable/advanced/smart_ptrs.html | ||
* this makes it possible to share the ScheduleState (which is created only once per simulation) with e.g. the opm.simulators.BlackOilSimulator Python object. | ||
* | ||
* @param module Reference to the python module. | ||
*/ | ||
void python::common::export_ScheduleState(py::module& module) { | ||
|
||
py::class_<ScheduleState>(module, "ScheduleState") | ||
.def_property_readonly("nupcol", py::overload_cast<>(&ScheduleState::nupcol, py::const_)) | ||
.def("group", &get_group, ref_internal) | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp> | ||
|
||
#include "export.hpp" | ||
|
||
/** | ||
* @brief Function to export the SimulationConfig class and some methods to Python. | ||
* | ||
* In the below class we use std::shared_ptr as the holder type, see https://pybind11.readthedocs.io/en/stable/advanced/smart_ptrs.html | ||
* this makes it possible to share the SimulationConfig (which is created only once per simulation) with e.g. the opm.simulators.BlackOilSimulator Python object. | ||
* | ||
* @param module Reference to the python module. | ||
*/ | ||
void python::common::export_SimulationConfig(py::module& module) | ||
{ | ||
py::class_< SimulationConfig , std::shared_ptr<SimulationConfig>>( module, "SimulationConfig") | ||
.def("hasThresholdPressure", &SimulationConfig::useThresholdPressure ) | ||
.def("useCPR", &SimulationConfig::useCPR ) | ||
.def("useNONNC", &SimulationConfig::useNONNC ) | ||
.def("hasDISGAS", &SimulationConfig::hasDISGAS ) | ||
.def("hasDISGASW", &SimulationConfig::hasDISGASW ) | ||
.def("hasVAPOIL", &SimulationConfig::hasVAPOIL ) | ||
.def("hasVAPWAT", &SimulationConfig::hasVAPWAT ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
""" | ||
This is the opm_embedded module for embedding python code in PYACTION. | ||
""" | ||
|
||
# If you change anything here, please recreate and update the python stub file for opm_embedded as described in python/README.md | ||
from opm.opmcommon_python.embedded import current_ecl_state, current_summary_state, current_schedule, current_report_step | ||
from opm.opmcommon_python import OpmLog | ||
from opm.opmcommon_python import DeckKeyword # Needed for PYINPUT |
Oops, something went wrong.