SimulatorReport: add serialization support

This commit is contained in:
Arne Morten Kvarving 2023-02-09 11:52:49 +01:00
parent f0ca3120ff
commit a21d59977d
3 changed files with 26 additions and 0 deletions

View File

@ -202,6 +202,20 @@ namespace Opm
os << std::endl;
}
SimulatorReport SimulatorReport::serializationTestObject()
{
return SimulatorReport{SimulatorReportSingle::serializationTestObject(),
SimulatorReportSingle::serializationTestObject(),
{SimulatorReportSingle::serializationTestObject()}};
}
bool SimulatorReport::operator==(const SimulatorReport& rhs) const
{
return this->success == rhs.success &&
this->failure == rhs.failure &&
this->stepreports == rhs.stepreports;
}
void SimulatorReport::operator+=(const SimulatorReportSingle& sr)
{
if (sr.converged) {

View File

@ -102,10 +102,21 @@ namespace Opm
SimulatorReportSingle failure;
std::vector<SimulatorReportSingle> stepreports;
static SimulatorReport serializationTestObject();
bool operator==(const SimulatorReport&) const;
void operator+=(const SimulatorReportSingle& sr);
void operator+=(const SimulatorReport& sr);
void reportFullyImplicit(std::ostream& os) const;
void fullReports(std::ostream& os) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(success);
serializer(failure);
serializer(stepreports);
}
};
} // namespace Opm

View File

@ -87,6 +87,7 @@ TEST_FOR_TYPE(PIDAndIterationCountTimeStepControl)
TEST_FOR_TYPE(PIDTimeStepControl)
TEST_FOR_TYPE(SegmentState)
TEST_FOR_TYPE(SimpleIterationCountTimeStepControl)
TEST_FOR_TYPE(SimulatorReport)
TEST_FOR_TYPE(SimulatorReportSingle)
TEST_FOR_TYPE(SimulatorTimer)