Commit 4490b428 authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

[brookscorey] implement equality operator for params

parent c6a8be9a
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#ifndef DUMUX_BROOKS_COREY_PARAMS_HH #ifndef DUMUX_BROOKS_COREY_PARAMS_HH
#define DUMUX_BROOKS_COREY_PARAMS_HH #define DUMUX_BROOKS_COREY_PARAMS_HH
#include <dune/common/float_cmp.hh>
#include <dumux/common/valgrind.hh> #include <dumux/common/valgrind.hh>
namespace Dumux namespace Dumux
...@@ -55,6 +57,16 @@ public: ...@@ -55,6 +57,16 @@ public:
{ {
} }
/*!
* \brief Equality comparison with another set of params
*/
template<class OtherParams>
bool operator== (const OtherParams& otherParams) const
{
return Dune::FloatCmp::eq(pe_, otherParams.pe(), /*eps*/1e-6*pe_)
&& Dune::FloatCmp::eq(lambda_, otherParams.lambda(), /*eps*/1e-6*lambda_);
}
/*! /*!
* \brief Returns the entry pressure in \f$\mathrm{[Pa]}\f$ * \brief Returns the entry pressure in \f$\mathrm{[Pa]}\f$
*/ */
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#ifndef DUMUX_REGULARIZED_BROOKS_COREY_PARAMS_HH #ifndef DUMUX_REGULARIZED_BROOKS_COREY_PARAMS_HH
#define DUMUX_REGULARIZED_BROOKS_COREY_PARAMS_HH #define DUMUX_REGULARIZED_BROOKS_COREY_PARAMS_HH
#include <dune/common/float_cmp.hh>
#include "brookscoreyparams.hh" #include "brookscoreyparams.hh"
namespace Dumux namespace Dumux
...@@ -54,6 +56,16 @@ public: ...@@ -54,6 +56,16 @@ public:
setThresholdSw(0.01); setThresholdSw(0.01);
} }
/*!
* \brief Equality comparison with another set of params
*/
template<class OtherParams>
bool operator== (const OtherParams& otherParams) const
{
return Dune::FloatCmp::eq(thresholdSw_, otherParams.thresholdSw(), /*eps*/1e-6*thresholdSw_)
&& BrooksCoreyParams::operator==(otherParams);
}
/*! /*!
* \brief Set the threshold saturation below which the capillary pressure * \brief Set the threshold saturation below which the capillary pressure
* is regularized. * is regularized.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment