Logo
Explore Help
Sign In
OilfieldToolsNet/opm-simulators
4
0
Fork 0
You've already forked opm-simulators
mirror of https://github.com/OPM/opm-simulators.git synced 2025-02-25 18:55:30 -06:00
Code Issues Packages Projects Releases Wiki Activity
Files
cde38bc23f1ff5a1d455beee872c965b5bae5578
opm-simulators/python/simulators/Pybind11Exporter.cpp

12 lines
242 B
C++
Raw Normal View History

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 01:13:39 +02:00
#include <pybind11/pybind11.h>
#include <opm/simulators/flow/python/Pybind11Exporter.hpp>
void Opm::Pybind::export_all(py::module& m) {
export_PyBlackOilSimulator(m);
}
PYBIND11_MODULE(simulators, m)
{
Opm::Pybind::export_all(m);
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 26ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API