Simplify Erasure From PLT States
Suggested by: [at]blattms
This commit is contained in:
parent
328ee9b591
commit
1a3166d913
@ -82,14 +82,21 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename Kind>
|
||||
using StateMap = std::unordered_map<std::string, Kind>;
|
||||
|
||||
// Please make sure that member functions serializeOp(), operator==(),
|
||||
// and serializeObject() are also up to date when changing this list of
|
||||
// data members.
|
||||
bool first_open_rft = false;
|
||||
std::unordered_map<std::string, RFT> rft_state;
|
||||
std::unordered_map<std::string, PLT> plt_state;
|
||||
std::unordered_map<std::string, PLT> seg_state;
|
||||
std::unordered_map<std::string, bool> open_wells;
|
||||
StateMap<RFT> rft_state{};
|
||||
StateMap<PLT> plt_state{};
|
||||
StateMap<PLT> seg_state{};
|
||||
std::unordered_map<std::string, bool> open_wells{};
|
||||
|
||||
void update_state(const std::string& wname,
|
||||
const PLT mode,
|
||||
StateMap<PLT>& state);
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -140,11 +140,7 @@ void RFTConfig::first_open(const bool on)
|
||||
void RFTConfig::update(const std::string& wname, RFT mode)
|
||||
{
|
||||
if (mode == RFT::NO) {
|
||||
auto iter = this->rft_state.find(wname);
|
||||
if (iter != this->rft_state.end()) {
|
||||
this->rft_state.erase(iter);
|
||||
}
|
||||
|
||||
this->rft_state.erase(wname);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -160,30 +156,28 @@ void RFTConfig::update(const std::string& wname, RFT mode)
|
||||
this->rft_state.insert_or_assign(wname, mode);
|
||||
}
|
||||
|
||||
void RFTConfig::update(const std::string& wname, const PLT mode)
|
||||
void RFTConfig::update_state(const std::string& wname,
|
||||
const PLT mode,
|
||||
StateMap<PLT>& state)
|
||||
{
|
||||
if (mode == PLT::NO) {
|
||||
auto iter = this->plt_state.find(wname);
|
||||
if (iter != this->plt_state.end()) {
|
||||
this->plt_state.erase(iter);
|
||||
}
|
||||
|
||||
return;
|
||||
// Remove 'wname' from list of wells for which to output PLT-type
|
||||
// data.
|
||||
state.erase(wname);
|
||||
}
|
||||
else {
|
||||
state.insert_or_assign(wname, mode);
|
||||
}
|
||||
}
|
||||
|
||||
this->plt_state[wname] = mode;
|
||||
void RFTConfig::update(const std::string& wname, const PLT mode)
|
||||
{
|
||||
this->update_state(wname, mode, this->plt_state);
|
||||
}
|
||||
|
||||
void RFTConfig::update_segment(const std::string& wname, const PLT mode)
|
||||
{
|
||||
if (mode == PLT::NO) {
|
||||
// Remove 'wname' from list of wells for which to output segment
|
||||
// data.
|
||||
this->seg_state.erase(wname);
|
||||
}
|
||||
else {
|
||||
this->seg_state.insert_or_assign(wname, mode);
|
||||
}
|
||||
this->update_state(wname, mode, this->seg_state);
|
||||
}
|
||||
|
||||
bool RFTConfig::active() const
|
||||
|
Loading…
Reference in New Issue
Block a user