Commit 6e16f901 authored by Melanie Lipp's avatar Melanie Lipp
Browse files

Remove warnings Wfloat-equal from dumux.

parent 62d7c28f
......@@ -32,6 +32,7 @@
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/dynmatrix.hh>
#include <dune/common/float_cmp.hh>
namespace Dumux
{
......@@ -110,7 +111,7 @@ void harmonicMeanMatrix(Dune::FieldMatrix<Scalar, m, n> &K,
{
for (int rowIdx=0; rowIdx < m; rowIdx++){
for (int colIdx=0; colIdx< n; colIdx++){
if (Ki[rowIdx][colIdx] != Kj[rowIdx][colIdx]) {
if (Dune::FloatCmp::ne<Scalar>(Ki[rowIdx][colIdx], Kj[rowIdx][colIdx])) {
K[rowIdx][colIdx] =
harmonicMean(Ki[rowIdx][colIdx],
Kj[rowIdx][colIdx]);
......
......@@ -251,9 +251,9 @@ public:
}
// corner case where the whole spline is a constant
if (moment_(0) == 0 &&
moment_(1) == 0 &&
y_(0) == y_(1))
if (Dune::FloatCmp::eq<Scalar>(moment_(0), 0) &&
Dune::FloatCmp::eq<Scalar>(moment_(1), 0) &&
Dune::FloatCmp::eq<Scalar>(y_(0), y_(1)))
{
// actually the is monotonically increasing as well as
// monotonously decreasing
......@@ -562,9 +562,9 @@ protected:
Scalar xE1 = (-2*b + disc)/(6*a);
Scalar xE2 = (-2*b - disc)/(6*a);
if (disc == 0) {
if (Dune::FloatCmp::eq<Scalar>(disc, 0)) {
// saddle point -> no extrema
if (xE1 == x0)
if (Dune::FloatCmp::eq<Scalar>(xE1, x0))
// make sure that we're not picking the saddle point
// to determine whether we're monotonically increasing
// or decreasing
......
......@@ -153,7 +153,7 @@ private:
const auto outsideScvIdx = scvf.outsideScvIdx();
//this is to not devide by 0 if the saturation in 0 and the effectiveDiffusivity becomes zero due to that
if(insideVolVars.saturation(phaseIdx) == 0 || outsideVolVars.saturation(phaseIdx) == 0)
if(Dune::FloatCmp::eq<Scalar>(insideVolVars.saturation(phaseIdx), 0) || Dune::FloatCmp::eq<Scalar>(outsideVolVars.saturation(phaseIdx), 0))
return reducedDiffusionMatrix;
for (int compIIdx = 0; compIIdx < numComponents-1; compIIdx++)
......
......@@ -115,7 +115,7 @@ public:
}
//we cannot solve that if the matrix is 0 everywhere
if(!(insideVolVars.saturation(phaseIdx) == 0 || outsideVolVars.saturation(phaseIdx) == 0))
if(!(Dune::FloatCmp::eq<Scalar>(insideVolVars.saturation(phaseIdx), 0) || Dune::FloatCmp::eq<Scalar>(outsideVolVars.saturation(phaseIdx), 0)))
{
const auto insideScvIdx = scvf.insideScvIdx();
const auto& insideScv = fvGeometry.scv(insideScvIdx);
......@@ -211,7 +211,7 @@ private:
ReducedComponentMatrix reducedDiffusionMatrix(0.0);
//this is to not devide by 0 if the saturation in 0 and the effectiveDiffusivity becomes zero due to that
if(volVars.saturation(phaseIdx) == 0)
if(Dune::FloatCmp::eq<Scalar>(volVars.saturation(phaseIdx), 0))
return reducedDiffusionMatrix;
for (int compIIdx = 0; compIIdx < numComponents-1; compIIdx++)
......
......@@ -424,7 +424,7 @@ public:
}
// access to ghost vector
double ghost (std::size_t i) const
std::size_t ghost (std::size_t i) const
{
return isGhost_[i];
}
......
......@@ -295,7 +295,6 @@ protected:
Scalar x_i = getQuantity_(fluidState, pvIdx);
const Scalar eps = 1e-10/quantityWeight_(fluidState, pvIdx);
setQuantity_<MaterialLaw>(fluidState, paramCache, matParams, pvIdx, x_i + eps);
assert(getQuantity_(fluidState, pvIdx) == x_i + eps);
// compute derivative of the defect
calculateDefect_(tmp, origFluidState, fluidState, globalMolarities);
......
......@@ -345,7 +345,6 @@ protected:
Scalar x_i = getQuantity_(fluidState, pvIdx);
const Scalar eps = 1e-8/quantityWeight_(fluidState, pvIdx);
setQuantity_<MaterialLaw>(fluidState, paramCache, matParams, pvIdx, x_i + eps);
assert(getQuantity_(fluidState, pvIdx) == x_i + eps);
// compute derivative of the defect
calculateDefect_(tmp, origFluidState, fluidState, globalMolarities);
......
......@@ -266,7 +266,7 @@ public:
return H2O::vaporPressure(t);
else
{
const auto pc = (fluidState.wettingPhase() == H2OIdx)
const auto pc = (fluidState.wettingPhase() == (int) H2OIdx)
? fluidState.pressure(AirIdx)-fluidState.pressure(H2OIdx)
: fluidState.pressure(H2OIdx)-fluidState.pressure(AirIdx);
return H2O::vaporPressure(t)*exp( -pc * molarMass(H2OIdx)
......
......@@ -1026,7 +1026,7 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element
Scalar massw = sumConc * fluidState.phaseMassFraction(wPhaseIdx);
Scalar massn = sumConc * fluidState.phaseMassFraction(nPhaseIdx);
if ((cellData.density(wPhaseIdx)*cellData.density(nPhaseIdx)) == 0)
if (Dune::FloatCmp::eq<Scalar>((cellData.density(wPhaseIdx)*cellData.density(nPhaseIdx)), 0))
DUNE_THROW(Dune::MathError, "Sequential2p2c::postProcessUpdate: try to divide by 0 density");
Scalar vol = massw / cellData.density(wPhaseIdx) + massn / cellData.density(nPhaseIdx);
if (Dune::FloatCmp::ne<Scalar, Dune::FloatCmp::absolute>(problem().timeManager().timeStepSize(), 0.0, 1.0e-30))
......
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