diff --git a/exercises/exercise-fluidsystem/spatialparams.hh b/exercises/exercise-fluidsystem/spatialparams.hh index 36297290e39597bf906f30495a2b6b181a128ae6..ce90f6117142c18004ecff2506eb1b29a2e5cdd2 100644 --- a/exercises/exercise-fluidsystem/spatialparams.hh +++ b/exercises/exercise-fluidsystem/spatialparams.hh @@ -147,11 +147,12 @@ public: { const auto x = globalPos[0]; const auto y = globalPos[1]; - return (x < 40 && x > 20 && y > 35 && y < 45) || - (x < 50 && x > 30 && y < 30 && y > 15); + return (x < 40 + eps_ && x > 20 - eps_ && y > 35 - eps_ && y < 45 + eps_) || + (x < 50 + eps_ && x > 30 - eps_ && y < 30 + eps_ && y > 15 - eps_); } private: + static constexpr Scalar eps_ = 1e-6; Dune::FieldMatrix<Scalar, dim, dim> K_; Dune::FieldMatrix<Scalar, dim, dim> KLens_; diff --git a/exercises/solution/ex3/spatialparams.hh b/exercises/solution/ex3/spatialparams.hh index 36297290e39597bf906f30495a2b6b181a128ae6..68d62e481503e6d1fcec624308817758c42851b9 100644 --- a/exercises/solution/ex3/spatialparams.hh +++ b/exercises/solution/ex3/spatialparams.hh @@ -147,14 +147,16 @@ public: { const auto x = globalPos[0]; const auto y = globalPos[1]; - return (x < 40 && x > 20 && y > 35 && y < 45) || - (x < 50 && x > 30 && y < 30 && y > 15); + return (x < 40 + eps_ && x > 20 - eps_ && y > 35 - eps_ && y < 45 + eps_) || + (x < 50 + eps_ && x > 30 - eps_ && y < 30 + eps_ && y > 15 - eps_); } private: + static constexpr Scalar eps_ = 1e-6; Dune::FieldMatrix<Scalar, dim, dim> K_; Dune::FieldMatrix<Scalar, dim, dim> KLens_; + // Object that holds the values/parameters of the selected material law. MaterialLawParams materialParams_; MaterialLawParams materialParamsLens_;