Merge pull request #1112 from stefoss23/remove_common_state
Remove common state
This commit is contained in:
@@ -250,8 +250,6 @@ if (OPM_ENABLE_PYTHON)
|
||||
python/cxx/schedule.cpp
|
||||
python/cxx/export.cpp
|
||||
python/cxx/export.hpp
|
||||
python/cxx/common_state.cpp
|
||||
python/cxx/common_state.hpp
|
||||
python/cxx/table_manager.cpp
|
||||
python/cxx/well.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/python/ ${CMAKE_BINARY_DIR}/python
|
||||
|
||||
@@ -186,7 +186,6 @@ if(ENABLE_ECL_INPUT)
|
||||
python/cxx/parser.cpp
|
||||
python/cxx/schedule.cpp
|
||||
python/cxx/export.cpp
|
||||
python/cxx/common_state.cpp
|
||||
python/cxx/table_manager.cpp
|
||||
python/cxx/well.cpp
|
||||
python/cxx/log.cpp
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#include "common_state.hpp"
|
||||
|
||||
|
||||
SunbeamState::SunbeamState(bool file_input, const std::string& deck_input, const Opm::ParseContext& context, const Opm::Parser& parser)
|
||||
: deck(file_input
|
||||
? parser.parseFile(deck_input, context, guard)
|
||||
: parser.parseString(deck_input, context, guard)),
|
||||
ecl_state(deck, context, guard),
|
||||
schedule(deck, ecl_state, context, guard),
|
||||
summary_config(deck, schedule, ecl_state.getTableManager(), context, guard)
|
||||
{
|
||||
guard.clear();
|
||||
}
|
||||
|
||||
|
||||
SunbeamState::SunbeamState(bool file_input, const std::string& deck_input) :
|
||||
SunbeamState(file_input, deck_input, Opm::ParseContext(), Opm::Parser())
|
||||
{}
|
||||
|
||||
|
||||
SunbeamState::SunbeamState(bool file_input, const std::string& deck_input, const Opm::ParseContext& context) :
|
||||
SunbeamState(file_input, deck_input, context, Opm::Parser())
|
||||
{}
|
||||
|
||||
|
||||
const Opm::EclipseState& SunbeamState::getEclipseState() const {
|
||||
return this->ecl_state;
|
||||
}
|
||||
|
||||
const Opm::Deck& SunbeamState::getDeck() const {
|
||||
return this->deck;
|
||||
}
|
||||
|
||||
const Opm::Schedule SunbeamState::getSchedule() const {
|
||||
return this->schedule;
|
||||
}
|
||||
|
||||
const Opm::SummaryConfig SunbeamState::getSummmaryConfig() const {
|
||||
return this->summary_config;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#include <opm/json/JsonObject.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
|
||||
|
||||
class SunbeamState {
|
||||
public:
|
||||
SunbeamState(bool file_input, const std::string& deck_input);
|
||||
SunbeamState(bool file_input, const std::string& deck_input, const Opm::ParseContext& context);
|
||||
SunbeamState(bool file_input, const std::string& deck_input, const Opm::ParseContext& context, const Opm::Parser& parser);
|
||||
|
||||
const Opm::EclipseState& getEclipseState() const;
|
||||
const Opm::Deck& getDeck() const;
|
||||
const Opm::Schedule getSchedule() const;
|
||||
const Opm::SummaryConfig getSummmaryConfig() const;
|
||||
|
||||
private:
|
||||
Opm::ErrorGuard guard;
|
||||
Opm::Deck deck;
|
||||
Opm::EclipseState ecl_state;
|
||||
Opm::Schedule schedule;
|
||||
Opm::SummaryConfig summary_config;
|
||||
};
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "common_state.hpp"
|
||||
#include "export.hpp"
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "common_state.hpp"
|
||||
#include "export.hpp"
|
||||
|
||||
|
||||
@@ -33,15 +32,6 @@ namespace {
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
SunbeamState * parse_file(const std::string& filename, const ParseContext& context, const Parser& parser) {
|
||||
return new SunbeamState(true, filename, context, parser);
|
||||
}
|
||||
|
||||
SunbeamState * parse_string(const std::string& filename, const ParseContext& context, const Parser& parser) {
|
||||
return new SunbeamState(false, filename, context, parser);
|
||||
}
|
||||
|
||||
void add_keyword(Parser* parser, const std::string& json_string) {
|
||||
const Json::JsonObject keyword(json_string);
|
||||
parser->addParserKeyword(keyword);
|
||||
@@ -51,8 +41,6 @@ namespace {
|
||||
|
||||
void python::common::export_Parser(py::module& module) {
|
||||
|
||||
module.def( "parse", parse_file );
|
||||
module.def( "parse_string", parse_string);
|
||||
module.def( "create_deck", &create_deck );
|
||||
module.def( "create_deck_string", &create_deck_string);
|
||||
|
||||
@@ -61,13 +49,6 @@ void python::common::export_Parser(py::module& module) {
|
||||
.def_property_readonly("name", &ParserKeyword::getName);
|
||||
|
||||
|
||||
py::class_<SunbeamState>(module, "SunbeamState")
|
||||
.def("_schedule", &SunbeamState::getSchedule, ref_internal)
|
||||
.def("_state", &SunbeamState::getEclipseState, ref_internal)
|
||||
.def("_deck", &SunbeamState::getDeck, ref_internal)
|
||||
.def("_summary_config", &SunbeamState::getSummmaryConfig, ref_internal);
|
||||
|
||||
|
||||
py::class_<Parser>(module, "Parser")
|
||||
.def(py::init<>())
|
||||
.def("parse", py::overload_cast<const std::string&>(&Parser::parseFile, py::const_))
|
||||
|
||||
@@ -54,9 +54,6 @@ namespace {
|
||||
throw py::key_error( name );
|
||||
}
|
||||
|
||||
GTNode get_grouptree ( const Schedule& sch, const std::string& root_node, const size_t& timestep) {
|
||||
return sch.groupTree(root_node, timestep);
|
||||
}
|
||||
system_clock::time_point get_start_time( const Schedule& s ) {
|
||||
return datetime(s.posixStartTime());
|
||||
}
|
||||
@@ -102,7 +99,6 @@ void python::common::export_Schedule(py::module& module) {
|
||||
.def( "get_wells", &Schedule::getWells2)
|
||||
.def( "get_well", &get_well)
|
||||
.def( "__contains__", &has_well )
|
||||
.def( "group", &Schedule::getGroup2, ref_internal)
|
||||
.def( "_group_tree", &get_grouptree, ref_internal);
|
||||
.def( "group", &Schedule::getGroup2, ref_internal);
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ ext_modules = [
|
||||
'cxx/parsecontext.cpp',
|
||||
'cxx/parser.cpp',
|
||||
'cxx/schedule.cpp',
|
||||
'cxx/common_state.cpp',
|
||||
'cxx/table_manager.cpp',
|
||||
'cxx/well.cpp',
|
||||
'cxx/export.cpp'
|
||||
|
||||
Reference in New Issue
Block a user