mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add Missing Headers to Python Simulator
These were originally obtained through transitive includes, especially from Main.hpp, but that's not a stable condition if the set of transitive includes changes.
This commit is contained in:
parent
c708e28176
commit
54663f96a4
@ -21,15 +21,24 @@
|
|||||||
#define OPM_PY_BLACKOIL_SIMULATOR_HEADER_INCLUDED
|
#define OPM_PY_BLACKOIL_SIMULATOR_HEADER_INCLUDED
|
||||||
|
|
||||||
#include <python/simulators/PyMain.hpp>
|
#include <python/simulators/PyMain.hpp>
|
||||||
#include <opm/simulators/flow/FlowMain.hpp>
|
|
||||||
#include <opm/models/utils/propertysystem.hh>
|
|
||||||
#include <opm/models/utils/parametersystem.hpp>
|
#include <opm/models/utils/parametersystem.hpp>
|
||||||
#include <opm/simulators/flow/python/Pybind11Exporter.hpp>
|
#include <opm/models/utils/propertysystem.hh>
|
||||||
|
|
||||||
|
#include <opm/simulators/flow/FlowMain.hpp>
|
||||||
|
#include <opm/simulators/flow/TTagFlowProblemTPFA.hpp>
|
||||||
#include <opm/simulators/flow/python/PyFluidState.hpp>
|
#include <opm/simulators/flow/python/PyFluidState.hpp>
|
||||||
#include <opm/simulators/flow/python/PyMaterialState.hpp>
|
#include <opm/simulators/flow/python/PyMaterialState.hpp>
|
||||||
|
#include <opm/simulators/flow/python/Pybind11Exporter.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
|
||||||
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||||
|
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm::Pybind {
|
namespace Opm::Pybind {
|
||||||
|
|
||||||
|
@ -23,7 +23,17 @@
|
|||||||
#ifndef OPM_PYMAIN_HEADER_INCLUDED
|
#ifndef OPM_PYMAIN_HEADER_INCLUDED
|
||||||
#define OPM_PYMAIN_HEADER_INCLUDED
|
#define OPM_PYMAIN_HEADER_INCLUDED
|
||||||
|
|
||||||
|
#include <opm/simulators/flow/FlowMain.hpp>
|
||||||
#include <opm/simulators/flow/Main.hpp>
|
#include <opm/simulators/flow/Main.hpp>
|
||||||
|
#include <opm/simulators/flow/TTagFlowProblemTPFA.hpp>
|
||||||
|
|
||||||
|
#include <flow/flow_blackoil.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
@ -32,6 +42,8 @@ namespace Opm {
|
|||||||
class PyMain : public Main
|
class PyMain : public Main
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using FlowMainType = FlowMain<Properties::TTag::FlowProblemTPFA>;
|
||||||
|
|
||||||
using Main::Main;
|
using Main::Main;
|
||||||
|
|
||||||
void setArguments(const std::vector<std::string>& args)
|
void setArguments(const std::vector<std::string>& args)
|
||||||
@ -40,10 +52,9 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have the two arguments previously setup
|
// We have the two arguments previously setup (binary name and input
|
||||||
// (binary name and input case name) by the main
|
// case name) by the main class plus whichever args are in the
|
||||||
// class plus whichever args are in the parameter
|
// parameter that was passed from the python side.
|
||||||
// that was passed from the python side.
|
|
||||||
this->argc_ = 2 + args.size();
|
this->argc_ = 2 + args.size();
|
||||||
|
|
||||||
// Setup our vector of char*'s
|
// Setup our vector of char*'s
|
||||||
@ -54,29 +65,30 @@ public:
|
|||||||
argv_python_[i+2] = const_cast<char*>(args[i].c_str());
|
argv_python_[i+2] = const_cast<char*>(args[i].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally set the main class' argv pointer to
|
// Finally set the main class' argv pointer to the combined
|
||||||
// the combined parameter list.
|
// parameter list.
|
||||||
this->argv_ = argv_python_.data();
|
this->argv_ = argv_python_.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
using FlowMainType = FlowMain<Properties::TTag::FlowProblemTPFA>;
|
// To be called from the Python interface code. Only do the
|
||||||
// To be called from the Python interface code. Only do the
|
// initialization and then return a pointer to the FlowMain object that
|
||||||
// initialization and then return a pointer to the FlowMain
|
// can later be accessed directly from the Python interface to
|
||||||
// object that can later be accessed directly from the Python interface
|
// e.g. advance the simulator one report step
|
||||||
// to e.g. advance the simulator one report step
|
|
||||||
std::unique_ptr<FlowMainType> initFlowBlackoil(int& exitCode)
|
std::unique_ptr<FlowMainType> initFlowBlackoil(int& exitCode)
|
||||||
{
|
{
|
||||||
exitCode = EXIT_SUCCESS;
|
exitCode = EXIT_SUCCESS;
|
||||||
if (initialize_<Properties::TTag::FlowEarlyBird>(exitCode, true)) {
|
|
||||||
|
if (this->initialize_<Properties::TTag::FlowEarlyBird>(exitCode, true)) {
|
||||||
// TODO: check that this deck really represents a blackoil
|
// TODO: check that this deck really represents a blackoil
|
||||||
// case. E.g. check that number of phases == 3
|
// case. E.g. check that number of phases == 3
|
||||||
this->setupVanguard();
|
this->setupVanguard();
|
||||||
return flowBlackoilTpfaMainInit(
|
|
||||||
argc_, argv_, outputCout_, outputFiles_);
|
return flowBlackoilTpfaMainInit
|
||||||
} else {
|
(argc_, argv_, outputCout_, outputFiles_);
|
||||||
//NOTE: exitCode was set by initialize_() above;
|
|
||||||
return std::unique_ptr<FlowMainType>(); // nullptr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: exitCode was set by initialize_() above;
|
||||||
|
return {}; // nullptr
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user