Merge pull request #3416 from akva2/restart_serialize_inplace

Inplace: add restart serialization support
This commit is contained in:
Atgeirr Flø Rasmussen
2023-02-28 07:50:48 +01:00
committed by GitHub
2 changed files with 22 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ public:
for totals, i.e. field properties.
*/
static Inplace serializationTestObject();
void add(const std::string& region, Phase phase, std::size_t region_number, double value);
void add(Phase phase, double value);
@@ -90,6 +91,15 @@ public:
std::vector<double> get_vector(const std::string& region, Phase phase) const;
static const std::vector<Phase>& phases();
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(phase_values);
}
bool operator==(const Inplace& rhs) const;
private:
std::unordered_map<std::string, std::unordered_map<Phase, std::unordered_map<std::size_t, double>>> phase_values;
};

View File

@@ -32,6 +32,14 @@ static const std::string FIELD_NAME = std::string{"FIELD"};
static const std::size_t FIELD_ID = 0;
}
Inplace Inplace::serializationTestObject() {
Inplace result;
result.add("test1", Phase::WaterResVolume, 1, 2.0);
return result;
}
void Inplace::add(const std::string& region, Inplace::Phase phase, std::size_t region_id, double value) {
this->phase_values[region][phase][region_id] = value;
}
@@ -157,5 +165,9 @@ const std::vector<Inplace::Phase>& Inplace::phases() {
return phases_;
}
bool Inplace::operator==(const Inplace& rhs) const
{
return this->phase_values == rhs.phase_values;
}
}