WellContainer: add serialization support

This commit is contained in:
Arne Morten Kvarving
2023-02-02 11:52:08 +01:00
parent e1942d145f
commit 7f36bac579
2 changed files with 36 additions and 2 deletions

View File

@@ -45,15 +45,23 @@ namespace Opm {
template <class T>
class WellContainer {
public:
WellContainer() = default;
WellContainer(std::initializer_list<std::pair<std::string,T>> init_list) {
for (const auto& [name, value] : init_list)
this->add(name, value);
}
static WellContainer serializationTestObject(const T& data)
{
WellContainer<T> result;
result.m_data = {data};
result.index_map = {{"test1", 1}, {"test2", 4}};
return result;
}
bool empty() const {
return this->index_map.empty();
}
@@ -167,6 +175,18 @@ public:
return wlist;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_data);
serializer(index_map);
}
bool operator==(const WellContainer<T>& rhs) const
{
return this->m_data == rhs.m_data &&
this->index_map == rhs.index_map;
}
private:
void update_if(std::size_t index, const std::string& name, const WellContainer<T>& other) {