Skip to content
Snippets Groups Projects
Commit f4edafde authored by Timo Koch's avatar Timo Koch
Browse files

[test][generalproblem] Use epsilons for float comparisons!

parent 4cf6576c
No related branches found
No related tags found
2 merge requests!31Feature/colebrookwhiteboundarylayer,!19Fix/generallensproblem
......@@ -412,7 +412,7 @@ private:
{
Scalar width = this->bBoxMax()[0] - this->bBoxMin()[0];
Scalar lambda = (this->bBoxMax()[0] - globalPos[0])/width;
return onUpperBoundary_(globalPos) && 0.5 < lambda && lambda < 2.0/3.0;
return onUpperBoundary_(globalPos) && 0.5 < lambda + eps_ && lambda < 2.0/3.0 + eps_;
}
Scalar temperature_;
......
......@@ -89,7 +89,7 @@ public:
typedef typename MaterialLaw::Params MaterialLawParams;
GeneralLensSpatialParams(const GridView& gridView)
: ParentType(gridView)
: ParentType(gridView), eps_(3e-6)
{
lensLowerLeft_[0] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensLowerLeftX);
lensLowerLeft_[1] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensLowerLeftY);
......@@ -155,10 +155,10 @@ public:
private:
bool isInLens_(const GlobalPosition &globalPos) const
{
for (int i = 0; i < dim; ++i) {
if (globalPos[i] < lensLowerLeft_[i] || globalPos[i] > lensUpperRight_[i])
for (int i = 0; i < dim; ++i)
if (globalPos[i] < lensLowerLeft_[i] + eps_ || globalPos[i] > lensUpperRight_[i])
return false;
}
return true;
}
......@@ -170,6 +170,8 @@ private:
MaterialLawParams lensMaterialParams_;
MaterialLawParams outerMaterialParams_;
const Scalar eps_;
};
} // end namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment