File: export.cpp

package info (click to toggle)
opm-common 2025.10%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 96,920 kB
  • sloc: cpp: 291,772; python: 3,609; sh: 198; xml: 174; pascal: 136; makefile: 12
file content (53 lines) | stat: -rw-r--r-- 1,932 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <pybind11/pybind11.h>
#include "export.hpp"

#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Schedule/SummaryState.hpp>

void python::common::export_all(py::module& module) {

    // Please do not change the order of the export statements below, since
    // the classes exported earlier are used in the classes exported later.
    // If you change the order, compilation works, but the function signature is
    // not correct in the .pyi file created from the Python module opmcommon_python.

    export_Log(module);
    export_IO(module);

    export_ParseContext(module);
    export_ParserKeywords(module);
    export_DeckKeyword(module);
    export_Deck(module);
    export_Parser(module);

    export_UnitSystem(module);
    export_Connection(module);
    export_Well(module);
    export_Group(module);
    export_EclipseConfig(module);
    export_SimulationConfig(module);
    export_FieldProperties(module);
    export_TableManager(module);
    export_EclipseGrid(module);
    export_EModel(module);

    export_ScheduleState(module);
    export_Schedule(module);
    export_EclipseState(module);
    export_SummaryState(module);
}


PYBIND11_MODULE(opmcommon_python, module) {
    python::common::export_all(module);

    pybind11::module submodule = module.def_submodule("embedded");

    // These attributes are placeholders, they get set to the actual EclipseState, Schedule and SummaryState in PyRunModule.cpp
    // If you change anything here, please recreate and update the python stub file for opm_embedded as described in python/README.md
    submodule.attr("current_ecl_state") = std::make_shared<EclipseState>();
    submodule.attr("current_summary_state") = std::make_shared<SummaryState>();
    submodule.attr("current_schedule") = std::make_shared<Schedule>();
    submodule.attr("current_report_step") = 0;
}