diff --git a/opm/material/localad/Evaluation.hpp b/opm/material/localad/Evaluation.hpp index f86651207..73cc143f0 100644 --- a/opm/material/localad/Evaluation.hpp +++ b/opm/material/localad/Evaluation.hpp @@ -32,6 +32,8 @@ #include #include +#include + namespace Opm { namespace LocalAd { /*! @@ -419,9 +421,9 @@ std::ostream& operator<<(std::ostream& os, const Evaluation +const Opm::LocalAd::Evaluation abs(const Opm::LocalAd::Evaluation& x) +{ return Opm::LocalAd::abs(x); } + +} // namespace std + +#if defined DUNE_DENSEMATRIX_HH +#warning \ + "Due to some C++ peculiarity regarding function overloads, the 'Evaluation.hpp'" \ + "header file must be included before Dune's 'densematrix.hh' for Dune < 2.4. " \ + "(If Evaluations are to be used in conjunction with a dense matrix.)" #endif +#endif + +// this makes the Dune matrix/vector classes happy... #include namespace Dune { @@ -454,16 +472,11 @@ struct FieldTraits > { public: typedef Opm::LocalAd::Evaluation field_type; - typedef Scalar real_type; + // setting real_type to field_type here potentially leads to slightly worse + // performance, but at least it makes things compile. + typedef field_type real_type; }; -namespace fvmeta { -template -inline Scalar absreal(const Opm::LocalAd::Evaluation& k) -{ - return std::abs(k.value); -} - -}} // namespace fvmeta, Dune +} // namespace Dune #endif