Add derived class GroupNames

This commit is contained in:
Joakim Hove
2021-01-28 18:02:35 +01:00
parent a4ca61dc4e
commit 8da208c0c0
4 changed files with 38 additions and 1 deletions

View File

@@ -59,5 +59,12 @@ private:
std::vector<std::string> m_names2;
};
class GroupOrder : public NameOrder {
public:
GroupOrder();
std::vector<std::string> restart_groups() const;
};
}
#endif

View File

@@ -1073,7 +1073,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
std::vector<std::string> Schedule::wellNames(std::size_t timeStep) const {
const auto& well_order = this->snapshots[timeStep].well_order();
return well_order.wells();
return well_order.names();
}
std::vector<std::string> Schedule::wellNames() const {

View File

@@ -70,4 +70,20 @@ bool NameOrder::operator==(const NameOrder& other) const {
this->m_names2 == other.m_names2;
}
GroupOrder::GroupOrder() :
NameOrder()
{
this->add("FIELD");
}
std::vector<std::string> GroupOrder::restart_groups() const {
const auto& input_groups = this->names();
std::vector<std::string> groups{ input_groups.size() };
for (std::size_t index = 1; index < input_groups.size(); index++)
groups[index - 1] = input_groups[index];
groups.back() = input_groups[0];
return groups;
}
}

View File

@@ -3384,6 +3384,20 @@ BOOST_AUTO_TEST_CASE(WellOrderTest) {
BOOST_CHECK( !wo.has("G1"));
}
BOOST_AUTO_TEST_CASE(GroupOrderTest) {
GroupOrder go;
std::vector<std::string> groups1 = {"FIELD"};
std::vector<std::string> groups2 = {"FIELD", "G1", "G2", "G3"};
std::vector<std::string> groups3 = {"G1", "G2", "G3", "FIELD"};
BOOST_CHECK( go.names() == groups1 );
go.add("G1");
go.add("G2");
go.add("G3");
BOOST_CHECK( go.names() == groups2 );
BOOST_CHECK( go.restart_groups() == groups3 );
}
BOOST_AUTO_TEST_CASE(RFT_CONFIG) {