Commit 886fd3d3 authored by Andreas Lauser's avatar Andreas Lauser

fix warnings only occuring with optim.opts

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7610 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent e3dd39f9
GXX_WARNING_OPTS=" \
-Wall \
-Wunused \
-Wmissing-include-dirs \
-Wcast-align \
-Wno-sign-compare \
......
......@@ -95,15 +95,15 @@ public:
{
ParentType::update(priVars, problem, element, elemGeom, scvIdx, isOldSol);
completeFluidState(priVars, problem, element, elemGeom, scvIdx, fluidState_);
completeFluidState(priVars, problem, element, elemGeom, scvIdx, fluidState_);
porosity_ = problem.spatialParameters().porosity(element, elemGeom, scvIdx);
tortuosity_ = problem.spatialParameters().tortuosity(element, elemGeom, scvIdx);
dispersivity_ = problem.spatialParameters().dispersivity(element, elemGeom, scvIdx);
// Second instance of a parameter cache.
// Second instance of a parameter cache.
// Could be avoided if diffusion coefficients also
// became part of the fluid state.
// became part of the fluid state.
typename FluidSystem::ParameterCache paramCache;
paramCache.updatePhase(fluidState_, /*phaseIdx=*/0);
......
......@@ -421,8 +421,7 @@ private:
}
// update the cache
ParamType defaultValue;
ParamType value = Params::tree().template get<ParamType>(canonicalName, defaultValue);
ParamType value = Params::tree().template get<ParamType>(canonicalName);
paramCache[canonicalName] = value;
// remember whether the parameter was taken from the parameter
......
GXX_WARNING_OPTS=" \
-Wall \
-Wunused \
-Wmissing-include-dirs \
-Wcast-align \
-Wno-sign-compare \
-Wno-packed-bitfield-compat \
-Wno-unused-parameter"
# additional -W flags for g++ which will lead to many warnings in
# other dune modules
# -Wextra \
......
......@@ -61,25 +61,23 @@ void testCommon(const Spline &sp,
double y0 = (i>0)?sp.eval(x[i]-eps):y[0];
double y1 = sp.eval(x[i]);
double y2 = (i<n-1)?sp.eval(x[i]+eps):y[n-1];
assert(std::abs(y0 - y[i]) < 100*eps);
assert(std::abs(y1 - y[i]) < eps);
assert(std::abs(y2 - y[i]) < 100*eps);
if (std::abs(y0 - y[i]) > 100*eps || std::abs(y2 - y[i]) > 100*eps)
DUNE_THROW(Dune::InvalidStateException,
"Spline seems to be discontinuous at sampling point " << i << "!");
if (std::abs(y1 - y[i]) > eps)
DUNE_THROW(Dune::InvalidStateException,
"Spline does not capture sampling point " << i << "!");
// make sure the derivative is continuous (assuming that the
// second derivative is smaller than 1000)
double d1 = sp.evalDerivative(x[i]);
double d0 = (i>0)?sp.evalDerivative(x[i]-eps):d1;
double d2 = (i<n-1)?sp.evalDerivative(x[i]+eps):d1;
assert(std::abs(d1 - d0) < 1000*eps);
assert(std::abs(d2 - d0) < 1000*eps);
// make sure the derivative is consistent with the y values
y0 = sp.eval(x[i] - ((i>0)?eps*1e2:0));
y2 = sp.eval(x[i] + ((i<n-1)?eps*1e2:0));
double dC = (y2 - y0)/(2*1e2*eps);
if (i == 0 || i == n-1)
dC *= 2;
assert(std::abs(dC - d0) < 1e-5);
if (std::abs(d1 - d0) > 1000*eps || std::abs(d2 - d0) > 1000*eps)
DUNE_THROW(Dune::InvalidStateException,
"Spline seems to exhibit a discontinuous derivative at sampling point " << i << "!");
}
}
......@@ -99,8 +97,14 @@ void testFull(const Spline &sp,
// make sure the derivative at both end points is correct
double d0 = sp.evalDerivative(x[0]);
double d1 = sp.evalDerivative(x[n-1]);
assert(std::abs(d0 - m0) < eps);
assert(std::abs(d1 - m1) < eps);
if (std::abs(d0 - m0) > eps)
DUNE_THROW(Dune::InvalidStateException,
"Invalid derivative at beginning of interval: is "
<< d0 << " ought to be " << m0);
if (std::abs(d1 - m1) > eps)
DUNE_THROW(Dune::InvalidStateException,
"Invalid derivative at end of interval: is "
<< d1 << " ought to be " << m1);
}
template <class Spline>
......@@ -120,8 +124,16 @@ void testNatural(const Spline &sp,
double d2 = sp.evalDerivative(x[n-1] - eps);
double d3 = sp.evalDerivative(x[n-1]);
assert(std::abs(d1 - d0)/eps < 1000*eps);
assert(std::abs(d3 - d2)/eps < 1000*eps);
if (std::abs(d1 - d0)/eps > 1000*eps)
DUNE_THROW(Dune::InvalidStateException,
"Invalid derivative at beginning of interval: is "
<< (d1 - d0)/eps << " ought to be 0");
if (std::abs(d3 - d2)/eps > 1000*eps)
DUNE_THROW(Dune::InvalidStateException,
"Invalid derivative at end of interval: is "
<< (d3 - d2)/eps << " ought to be 0");
}
void testAll()
......
Markdown is supported
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