File: schedule_state.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 (29 lines) | stat: -rw-r--r-- 1,161 bytes parent folder | download
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
#include <opm/input/eclipse/Schedule/ScheduleState.hpp>

#include "export.hpp"

#include <python/cxx/OpmCommonPythonDoc.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) {

    using namespace Opm::Common::DocStrings;

    py::class_<ScheduleState>(module, "ScheduleState", ScheduleStateClass_docstring)
        .def_property_readonly("nupcol", py::overload_cast<>(&ScheduleState::nupcol, py::const_), ScheduleState_nupcol_docstring)
        .def("group", &get_group, ref_internal, py::arg("group_name"), ScheduleState_get_group_docstring)
        ;
}