Commit Graph

26 Commits

Author SHA1 Message Date
Arne Morten Kvarving
7f7fbab2f4 remove FLOW_BLACKOIL_ONLY hack from Main.hpp
now that the python simulator uses runStatic, the
runDynamic template is never instanced, and thus there
are no linker issues.
2021-11-10 10:07:11 +01:00
Arne Morten Kvarving
3a512c0f20 changed: use runStatic in python simulator 2021-11-10 09:51:17 +01:00
Håkon Hægland
7a394df43f Include <stdexcept> header to use std::logic_error()
And some minor stylistic changes.
2021-09-23 13:13:23 +02:00
Håkon Hægland
4c5245196b Changed calling convention for shared pointers.
Expect non-reference type shared pointers arguments instead of references
to shared pointer. This will make it clear to the caller that the called
function is making a copy of the pointer for its own use and not trying
to modify the original pointer of the caller.
2021-09-22 23:49:13 +02:00
Håkon Hægland
5ad65c70ee Initialize blackoil simulator from schedule shared with Python.
Adds a new constructor to Main.hpp that takes shared pointers to Deck,
EclipseState, Schedule, and SummaryConfig. This makes it possible to
share these variables with Python without worrying about lifetime issues
of the underlying C++ objects. For example, a Python script can first
create an opm.io.schedule.Schedule object which is modified from Python.
Then, assume the same Python script creates an
opm.simulators.BlackOilSimulator which is initialized with the same
schedule object. Since the underlying C++ object is a shared pointer,
the Schedule object in Python may go out of scope (get deleted by Python)
without having the C++ schedule object being deleted. And the Python
BlackOilSimulator may continue to be used after the Python Schedule object
has been deleted since it still has a valid C++ schedule object.
2021-09-21 15:52:59 +02:00
Markus Blatt
755c23bfb5 Support using pybind from the system.
This should make packaging easier and more streamlined
to the process on some Linux systems.
2021-03-19 19:56:53 +01:00
Arne Morten Kvarving
16d644032c add cmake option to disable the python tests
due to bugs in the openmpi on bionic, this test fails to
execute properly in pbuilder environments. instead
of rebuilding openmpi without dynamic loading
(which is the suggested fix) and potentially break users
systems, this is a non-intrusive workaround to be used
for packaging.

also add explicit option for python support to make it
visible in cmake frontends.
2020-11-18 10:55:46 +01:00
Håkon Hægland
b680d96198 The data directory is relative to the parent.
The test data directory is relative to the parent directory, not the
current directory.
2020-11-05 09:48:39 +01:00
Joakim Hove
68e8c4a900 Use python pushd 2020-11-04 14:24:39 +01:00
Håkon Hægland
7011a6c0b7 Restore cwd after each unittest.
Restores the original cwd after each unittest in test_basic.py. Also
simplifies add_test() in python/simulators/CMakeLists.txt such that the
Bash script wrapper run-python-tests.sh is no longer needed to run the
tests.
2020-11-04 13:51:36 +01:00
Håkon Hægland
648bab7108 Implements access to the porosity from Python.
Implements access (read/write) to the porosity from Python.
2020-11-03 17:18:14 +01:00
Håkon Hægland
53cbe0c57e Initialize boolean variables in-class.
Initialize the boolean variables hasRunInit_ and hasRunCleanup_ in
the class instead of in the constructor.
2020-11-03 16:17:52 +01:00
Håkon Hægland
0403d4e6e7 Implements a Python step_cleanup() method.
Continues the work in #2735 on implementing Python bindings for the flow
simulator.
2020-11-03 16:12:12 +01:00
Arne Morten Kvarving
d286079393 changed: reuse objects if building python inline 2020-09-25 13:47:39 +02:00
Håkon Hægland
81319a7923 Implements the Python step() method.
A resubmission of commit 8e4f748 in PR #2403 and PR #2444 and continues
the work in #2690 implementing Python bindings to the flow simulator.

The Python step() method advances the simulator one report step. Before
calling step() for the first time, step_init() must have been called.
2020-08-25 13:42:48 +02:00
Håkon Hægland
3749dcab7d Implements the Python step_init() function.
A resubmission of commit 11eaa3d7 in PR #2403 and PR #2443 and continues
the work in #2555 implementing Python bindings to the flow simulator.

The step_init() method initializes the simulation. It is required for the
Python script to run step_init() before calling the step() method (which
will be implemented in a later commit).
2020-08-24 10:27:50 +02:00
Arne Morten Kvarving
c4be14c0da mark the pybind11 headers SYSTEM to avoid (shadowing) warnings 2020-05-14 11:12:15 +02:00
Arne Morten Kvarving
d880aee17d fixed: we still want to build the bindings even if pybind11 is already available. 2020-05-14 10:51:00 +02:00
Håkon Hægland
eda0475459 Install Python module as opm.simulators
Install Python module as opm.simulators and not
opm.simulators.simulators. There is currently no need for two levels of
nesting.
2020-05-11 15:03:17 +02:00
Håkon Hægland
4bb7048ba2 Fixed missing prefix for install destination.
The variable PYTHON_INSTALL_PREFIX was not defined, which caused
"make install" to install to a wrong directory. We set
PYTHON_INSTALL_PREFIX such that the Python module is installed the same
place as the Python modules from opm-common.
2020-05-11 15:03:17 +02:00
Håkon Hægland
f94553c5a7 Python bindings for the blackoil simulator.
A simplified version of PR #2518 that uses a deck filename to construct
the simulator.

After private discussion with @joakim-hove it was decided that the
construction of the blackoil simulator from Python using deck,
ecliseState, schedule and summaryConfig as constructor arguments from
\#2518 should be replaced by a constructor taking only the deck filename
as parameter.

A rewrite of the Python bindings for the blackoil simulator using
pybind11 as introduced in PR #2127. The new version uses the
refactored flow.cpp introduced in PR #2516 and thus avoids duplication
of the code in simulators.cpp.

This PR will be the starting point for implementing the Python bindings
introduced in PR #2403.
2020-05-11 15:03:17 +02:00
Arne Morten Kvarving
3d48a1d344 changed: check for pre-existing pybind11 target
this is necessary to allow building all modules in a 'super-build'
2020-04-14 09:16:13 +02:00
Michael Sargado
1661f6579e Removed pycmake 2019-11-06 13:32:21 +01:00
Michael Sargado
9474470984 Added CMakeLists for python folder. 2019-10-31 16:39:36 +01:00
Michael Sargado
076ea3db77 Added pycmake folder. 2019-10-31 16:38:06 +01:00
Michael Sargado
eae6afff80 New python folder containing pybind11 2019-10-31 16:35:29 +01:00