Inplace: add restart serialization support
This commit is contained in:
parent
1c0ddf1402
commit
eaaf02f51f
@ -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;
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user