Merge pull request #1997 from joakim-hove/group-constructor
Add Group constructor based on RstGroup
This commit is contained in:
commit
20e253a27a
@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
|
namespace RestartIO {
|
||||||
|
class RstGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class UDQConfig;
|
class UDQConfig;
|
||||||
class UDQActive;
|
class UDQActive;
|
||||||
@ -215,6 +220,7 @@ struct ProductionControls {
|
|||||||
|
|
||||||
Group();
|
Group();
|
||||||
Group(const std::string& group_name, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system);
|
Group(const std::string& group_name, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system);
|
||||||
|
Group(const RestartIO::RstGroup& rst_group, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system);
|
||||||
|
|
||||||
static Group serializeObject();
|
static Group serializeObject();
|
||||||
|
|
||||||
|
@ -400,6 +400,7 @@ namespace Opm
|
|||||||
void addGroupToGroup( const std::string& parent_group, const std::string& child_group, std::size_t timeStep);
|
void addGroupToGroup( const std::string& parent_group, const std::string& child_group, std::size_t timeStep);
|
||||||
void addGroupToGroup( const std::string& parent_group, const Group& child_group, std::size_t timeStep);
|
void addGroupToGroup( const std::string& parent_group, const Group& child_group, std::size_t timeStep);
|
||||||
void addGroup(const std::string& groupName , std::size_t timeStep, const UnitSystem& unit_system);
|
void addGroup(const std::string& groupName , std::size_t timeStep, const UnitSystem& unit_system);
|
||||||
|
void addGroup(const Group& group, std::size_t timeStep);
|
||||||
void addWell(const std::string& wellName, const DeckRecord& record, std::size_t timeStep, Connection::Order connection_order, const UnitSystem& unit_system);
|
void addWell(const std::string& wellName, const DeckRecord& record, std::size_t timeStep, Connection::Order connection_order, const UnitSystem& unit_system);
|
||||||
void checkUnhandledKeywords( const SCHEDULESection& ) const;
|
void checkUnhandledKeywords( const SCHEDULESection& ) const;
|
||||||
void checkIfAllConnectionsIsShut(std::size_t currentStep);
|
void checkIfAllConnectionsIsShut(std::size_t currentStep);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||||
|
#include <opm/io/eclipse/rst/group.hpp>
|
||||||
|
|
||||||
#include "../eval_uda.hpp"
|
#include "../eval_uda.hpp"
|
||||||
|
|
||||||
@ -49,6 +50,12 @@ Group::Group(const std::string& name, std::size_t insert_index_arg, std::size_t
|
|||||||
this->parent_group = "FIELD";
|
this->parent_group = "FIELD";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group::Group(const RestartIO::RstGroup& rst_group, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system_arg) :
|
||||||
|
Group(rst_group.name, insert_index_arg, init_step_arg, udq_undefined_arg, unit_system_arg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Group Group::serializeObject()
|
Group Group::serializeObject()
|
||||||
{
|
{
|
||||||
Group result;
|
Group result;
|
||||||
|
@ -1117,24 +1117,30 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Schedule::addGroup(const std::string& groupName, std::size_t timeStep, const UnitSystem& unit_system) {
|
void Schedule::addGroup(const Group& group, std::size_t timeStep) {
|
||||||
const std::size_t insert_index = this->groups.size();
|
this->groups.insert( std::make_pair( group.name(), DynamicState<std::shared_ptr<Group>>(this->m_timeMap, nullptr)));
|
||||||
|
auto group_ptr = std::make_shared<Group>(group);
|
||||||
groups.insert( std::make_pair( groupName, DynamicState<std::shared_ptr<Group>>(this->m_timeMap, nullptr)));
|
auto& dynamic_state = this->groups.at(group.name());
|
||||||
auto group_ptr = std::make_shared<Group>(groupName, insert_index, timeStep, this->getUDQConfig(timeStep).params().undefinedValue(), unit_system);
|
|
||||||
auto& dynamic_state = this->groups.at(groupName);
|
|
||||||
dynamic_state.update(timeStep, group_ptr);
|
dynamic_state.update(timeStep, group_ptr);
|
||||||
|
|
||||||
m_events.addEvent( ScheduleEvents::NEW_GROUP , timeStep );
|
this->m_events.addEvent( ScheduleEvents::NEW_GROUP , timeStep );
|
||||||
wellgroup_events.insert( std::make_pair(groupName, Events(this->m_timeMap)));
|
this->wellgroup_events.insert( std::make_pair(group.name(), Events(this->m_timeMap)));
|
||||||
this->addWellGroupEvent(groupName, ScheduleEvents::NEW_GROUP, timeStep);
|
this->addWellGroupEvent(group.name(), ScheduleEvents::NEW_GROUP, timeStep);
|
||||||
|
|
||||||
// All newly created groups are attached to the field group,
|
// All newly created groups are attached to the field group,
|
||||||
// can then be relocated with the GRUPTREE keyword.
|
// can then be relocated with the GRUPTREE keyword.
|
||||||
if (groupName != "FIELD")
|
if (group.name() != "FIELD")
|
||||||
this->addGroupToGroup("FIELD", *group_ptr, timeStep);
|
this->addGroupToGroup("FIELD", *group_ptr, timeStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Schedule::addGroup(const std::string& groupName, std::size_t timeStep, const UnitSystem& unit_system) {
|
||||||
|
const std::size_t insert_index = this->groups.size();
|
||||||
|
auto udq_undefined = this->getUDQConfig(timeStep).params().undefinedValue();
|
||||||
|
auto group = Group{ groupName, insert_index, timeStep, udq_undefined, unit_system };
|
||||||
|
this->addGroup(group, timeStep);
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t Schedule::numGroups() const {
|
std::size_t Schedule::numGroups() const {
|
||||||
return groups.size();
|
return groups.size();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user