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
|
||||
|
||||
#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/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/PyMaterialState.hpp>
|
||||
#include <opm/simulators/flow/python/Pybind11Exporter.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/Schedule/Schedule.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm::Pybind {
|
||||
|
||||
|
@ -23,7 +23,17 @@
|
||||
#ifndef 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/TTagFlowProblemTPFA.hpp>
|
||||
|
||||
#include <flow/flow_blackoil.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@ -32,6 +42,8 @@ namespace Opm {
|
||||
class PyMain : public Main
|
||||
{
|
||||
public:
|
||||
using FlowMainType = FlowMain<Properties::TTag::FlowProblemTPFA>;
|
||||
|
||||
using Main::Main;
|
||||
|
||||
void setArguments(const std::vector<std::string>& args)
|
||||
@ -40,10 +52,9 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// We have the two arguments previously setup
|
||||
// (binary name and input case name) by the main
|
||||
// class plus whichever args are in the parameter
|
||||
// that was passed from the python side.
|
||||
// We have the two arguments previously setup (binary name and input
|
||||
// case name) by the main class plus whichever args are in the
|
||||
// parameter that was passed from the python side.
|
||||
this->argc_ = 2 + args.size();
|
||||
|
||||
// Setup our vector of char*'s
|
||||
@ -54,29 +65,30 @@ public:
|
||||
argv_python_[i+2] = const_cast<char*>(args[i].c_str());
|
||||
}
|
||||
|
||||
// Finally set the main class' argv pointer to
|
||||
// the combined parameter list.
|
||||
// Finally set the main class' argv pointer to the combined
|
||||
// parameter list.
|
||||
this->argv_ = argv_python_.data();
|
||||
}
|
||||
|
||||
using FlowMainType = FlowMain<Properties::TTag::FlowProblemTPFA>;
|
||||
// To be called from the Python interface code. Only do the
|
||||
// initialization and then return a pointer to the FlowMain
|
||||
// object that can later be accessed directly from the Python interface
|
||||
// to e.g. advance the simulator one report step
|
||||
// To be called from the Python interface code. Only do the
|
||||
// initialization and then return a pointer to the FlowMain object that
|
||||
// can later be accessed directly from the Python interface to
|
||||
// e.g. advance the simulator one report step
|
||||
std::unique_ptr<FlowMainType> initFlowBlackoil(int& exitCode)
|
||||
{
|
||||
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
|
||||
// case. E.g. check that number of phases == 3
|
||||
this->setupVanguard();
|
||||
return flowBlackoilTpfaMainInit(
|
||||
argc_, argv_, outputCout_, outputFiles_);
|
||||
} else {
|
||||
//NOTE: exitCode was set by initialize_() above;
|
||||
return std::unique_ptr<FlowMainType>(); // nullptr
|
||||
|
||||
return flowBlackoilTpfaMainInit
|
||||
(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
|
||||
// NOTE: exitCode was set by initialize_() above;
|
||||
return {}; // nullptr
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user