Merge pull request #1593 from joakim-hove/internalize-pyaction
Internalize pyaction
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/PyAction.hpp>
|
||||
|
||||
namespace Opm {
|
||||
namespace Action {
|
||||
@@ -38,11 +39,12 @@ namespace Action {
|
||||
class Actions {
|
||||
public:
|
||||
Actions() = default;
|
||||
Actions(const std::vector<ActionX>& action);
|
||||
Actions(const std::vector<ActionX>& action, const std::vector<PyAction>& pyactions);
|
||||
size_t size() const;
|
||||
int max_input_lines() const;
|
||||
bool empty() const;
|
||||
void add(const ActionX& action);
|
||||
void add(const PyAction& pyaction);
|
||||
bool ready(std::time_t sim_time) const;
|
||||
const ActionX& get(const std::string& name) const;
|
||||
const ActionX& get(std::size_t index) const;
|
||||
@@ -57,10 +59,12 @@ public:
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer.vector(actions);
|
||||
serializer.vector(pyactions);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<ActionX> actions;
|
||||
std::vector<PyAction> pyactions;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,26 @@
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
namespace Action {
|
||||
|
||||
class PyAction {
|
||||
public:
|
||||
explicit PyAction(const std::string& code_arg);
|
||||
enum class RunCount {
|
||||
single,
|
||||
unlimited,
|
||||
first_true
|
||||
};
|
||||
|
||||
|
||||
static RunCount from_string(std::string run_count);
|
||||
static std::string load(const std::string& input_path, const std::string& fname);
|
||||
|
||||
PyAction() = default;
|
||||
PyAction(const std::string& name, RunCount run_count, const std::string& code);
|
||||
const std::string& code() const;
|
||||
const std::string& name() const;
|
||||
bool operator==(const PyAction& other) const;
|
||||
PyAction::RunCount run_count() const;
|
||||
~PyAction();
|
||||
|
||||
/*
|
||||
@@ -43,10 +58,22 @@ public:
|
||||
between invocations.
|
||||
*/
|
||||
void * storage() const;
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(m_name);
|
||||
serializer(m_run_count);
|
||||
serializer(input_code);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
RunCount m_run_count;
|
||||
std::string input_code;
|
||||
void * m_storage;
|
||||
void * m_storage = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace Opm
|
||||
void updateUDQActive( std::size_t timeStep, std::shared_ptr<UDQActive> udq );
|
||||
bool updateWellStatus( const std::string& well, size_t reportStep , Well::Status status, bool update_connections);
|
||||
void addWellToGroup( const std::string& group_name, const std::string& well_name , size_t timeStep);
|
||||
void iterateScheduleSection(const ParseContext& parseContext , ErrorGuard& errors, const SCHEDULESection& , const EclipseGrid& grid,
|
||||
void iterateScheduleSection(const std::string& input_path, const ParseContext& parseContext , ErrorGuard& errors, const SCHEDULESection& , const EclipseGrid& grid,
|
||||
const FieldPropsManager& fp);
|
||||
void addACTIONX(const Action::ActionX& action, std::size_t currentStep);
|
||||
void addGroupToGroup( const std::string& parent_group, const std::string& child_group, size_t timeStep);
|
||||
@@ -418,6 +418,7 @@ namespace Opm
|
||||
void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
|
||||
void handleTUNING( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handlePYACTION( const std::string& input_path, const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleNUPCOL( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleGRUPNET( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system);
|
||||
@@ -437,7 +438,8 @@ namespace Opm
|
||||
void handleVFPINJ(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
|
||||
void checkUnhandledKeywords( const SCHEDULESection& ) const;
|
||||
void checkIfAllConnectionsIsShut(size_t currentStep);
|
||||
void handleKeyword(size_t currentStep,
|
||||
void handleKeyword(const std::string& input_path,
|
||||
size_t currentStep,
|
||||
const SCHEDULESection& section,
|
||||
size_t keywordIdx,
|
||||
const DeckKeyword& keyword,
|
||||
|
||||
Reference in New Issue
Block a user