mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
PIDTimeStepControl: add serialization support
This commit is contained in:
parent
87bc1d8c10
commit
1827de96a2
@ -160,6 +160,15 @@ namespace Opm
|
||||
, verbose_( verbose )
|
||||
{}
|
||||
|
||||
PIDTimeStepControl
|
||||
PIDTimeStepControl::serializationTestObject()
|
||||
{
|
||||
PIDTimeStepControl result(1.0, true);
|
||||
result.errors_ = {2.0, 3.0};
|
||||
|
||||
return result;;
|
||||
}
|
||||
|
||||
double PIDTimeStepControl::
|
||||
computeTimeStepSize( const double dt, const int /* iterations */, const RelativeChangeInterface& relChange, const double /*simulationTimeElapsed */) const
|
||||
{
|
||||
@ -204,6 +213,13 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
bool PIDTimeStepControl::operator==(const PIDTimeStepControl& ctrl) const
|
||||
{
|
||||
return this->tol_ == ctrl.tol_ &&
|
||||
this->errors_ == ctrl.errors_ &&
|
||||
this->verbose_ == ctrl.verbose_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -94,14 +94,26 @@ namespace Opm
|
||||
PIDTimeStepControl( const double tol = 1e-3,
|
||||
const bool verbose = false );
|
||||
|
||||
static PIDTimeStepControl serializationTestObject();
|
||||
|
||||
/// \brief \copydoc TimeStepControlInterface::computeTimeStepSize
|
||||
double computeTimeStepSize( const double dt, const int /* iterations */, const RelativeChangeInterface& relativeChange, const double /*simulationTimeElapsed */ ) const;
|
||||
|
||||
protected:
|
||||
const double tol_;
|
||||
mutable std::vector< double > errors_;
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(tol_);
|
||||
serializer(errors_);
|
||||
serializer(verbose_);
|
||||
}
|
||||
|
||||
const bool verbose_;
|
||||
bool operator==(const PIDTimeStepControl&) const;
|
||||
|
||||
protected:
|
||||
const double tol_ = 1e-3;
|
||||
mutable std::vector< double > errors_{};
|
||||
|
||||
const bool verbose_ = false;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -61,6 +61,7 @@ BOOST_AUTO_TEST_CASE(NAME) \
|
||||
TEST_FOR_TYPE_NAMED(TYPE, TYPE)
|
||||
|
||||
TEST_FOR_TYPE(HardcodedTimeStepControl)
|
||||
TEST_FOR_TYPE(PIDTimeStepControl)
|
||||
TEST_FOR_TYPE(SimpleIterationCountTimeStepControl)
|
||||
TEST_FOR_TYPE(SimulatorTimer)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user