Merge pull request #489 from atgeirr/fix-more-warnings

Fix more warnings found by clang
This commit is contained in:
Atgeirr Flø Rasmussen 2014-02-05 18:26:57 +01:00
commit 45b080b5be
5 changed files with 27 additions and 25 deletions

View File

@ -68,7 +68,6 @@ namespace
} }
void buildTracerheadsFromWells(const Wells* wells, void buildTracerheadsFromWells(const Wells* wells,
const Opm::WellState& well_state,
Opm::SparseTable<int>& tracerheads) Opm::SparseTable<int>& tracerheads)
{ {
if (wells == 0) { if (wells == 0) {
@ -257,7 +256,7 @@ try
std::vector<double> tracer; std::vector<double> tracer;
Opm::SparseTable<int> tracerheads; Opm::SparseTable<int> tracerheads;
if (compute_tracer) { if (compute_tracer) {
buildTracerheadsFromWells(wells->c_wells(), well_state, tracerheads); buildTracerheadsFromWells(wells->c_wells(), tracerheads);
} }
if (use_dg) { if (use_dg) {
if (compute_tracer) { if (compute_tracer) {

View File

@ -36,7 +36,7 @@ namespace Opm
void SatFuncBase<NonuniformTableLinear<double> >::initializeTableType(NonuniformTableLinear<double> & table, void SatFuncBase<NonuniformTableLinear<double> >::initializeTableType(NonuniformTableLinear<double> & table,
const std::vector<double>& arg, const std::vector<double>& arg,
const std::vector<double>& value, const std::vector<double>& value,
const int samples) const int /*samples*/)
{ {
table = NonuniformTableLinear<double>(arg, value); table = NonuniformTableLinear<double>(arg, value);
} }
@ -84,7 +84,7 @@ namespace Opm
} }
} }
double EPSTransforms::Transform::scaleSatDeriv(double s, double s_r, double s_cr, double s_max) const double EPSTransforms::Transform::scaleSatDeriv(double s, double /*s_r*/, double /*s_cr*/, double /*s_max*/) const
{ {
if (doNotScale) { if (doNotScale) {
return 1.0; return 1.0;

View File

@ -68,16 +68,18 @@ namespace Opm
{ {
static double handleBracketingFailure(const double x0, const double x1, const double f0, const double f1) static double handleBracketingFailure(const double x0, const double x1, const double f0, const double f1)
{ {
OPM_MESSAGE("Error in parameters, zero not bracketed: [a, b] = [" OPM_REPORT;
std::cerr << "Error in parameters, zero not bracketed: [a, b] = ["
<< x0 << ", " << x1 << "] f(a) = " << f0 << " f(b) = " << f1 << x0 << ", " << x1 << "] f(a) = " << f0 << " f(b) = " << f1
<< ""); << "";
return std::fabs(f0) < std::fabs(f1) ? x0 : x1; return std::fabs(f0) < std::fabs(f1) ? x0 : x1;
} }
static double handleTooManyIterations(const double x0, const double x1, const int maxiter) static double handleTooManyIterations(const double x0, const double x1, const int maxiter)
{ {
OPM_MESSAGE("Maximum number of iterations exceeded: " << maxiter OPM_REPORT;
std::cerr << "Maximum number of iterations exceeded: " << maxiter
<< ", current interval is [" << std::min(x0, x1) << ", " << ", current interval is [" << std::min(x0, x1) << ", "
<< std::max(x0, x1) << "]"); << std::max(x0, x1) << "]";
return 0.5*(x0 + x1); return 0.5*(x0 + x1);
} }
}; };

View File

@ -945,6 +945,7 @@ public:
int r = 3; int r = 3;
if (x0 < xMin()) { if (x0 < xMin()) {
static_cast<void>(extrapolate);
assert(extrapolate); assert(extrapolate);
Scalar m = evalDerivative_(xMin(), /*segmentIdx=*/0); Scalar m = evalDerivative_(xMin(), /*segmentIdx=*/0);
if (std::abs(m) < 1e-20) if (std::abs(m) < 1e-20)
@ -1575,16 +1576,16 @@ protected:
{ return 2*3*t - 2; } { return 2*3*t - 2; }
// third derivative of the hermite basis functions // third derivative of the hermite basis functions
Scalar h00_prime3_(Scalar t) const Scalar h00_prime3_(Scalar /*t*/) const
{ return 2*3*2; } { return 2*3*2; }
Scalar h10_prime3_(Scalar t) const Scalar h10_prime3_(Scalar /*t*/) const
{ return 2*3; } { return 2*3; }
Scalar h01_prime3_(Scalar t) const Scalar h01_prime3_(Scalar /*t*/) const
{ return -2*3*2; } { return -2*3*2; }
Scalar h11_prime3_(Scalar t) const Scalar h11_prime3_(Scalar /*t*/) const
{ return 2*3; } { return 2*3; }
// returns the monotonicality of an interval of a spline segment // returns the monotonicality of an interval of a spline segment

View File

@ -80,14 +80,14 @@ void testCommon(const Spline &sp,
// make sure the derivatives are consistent with the curve // make sure the derivatives are consistent with the curve
int np = 3*n; int np = 3*n;
for (int i = 0; i < np; ++i) { for (int i = 0; i < np; ++i) {
double x = sp.xMin() + (sp.xMax() - sp.xMin())*i/np; double xval = sp.xMin() + (sp.xMax() - sp.xMin())*i/np;
// first derivative // first derivative
double y1 = sp.eval(x+epsFD); double y1 = sp.eval(xval+epsFD);
double y0 = sp.eval(x); double y0 = sp.eval(xval);
double mFD = (y1 - y0)/epsFD; double mFD = (y1 - y0)/epsFD;
double m = sp.evalDerivative(x); double m = sp.evalDerivative(xval);
if (std::abs( mFD - m ) > 1000*epsFD) if (std::abs( mFD - m ) > 1000*epsFD)
OPM_THROW(std::runtime_error, OPM_THROW(std::runtime_error,
@ -95,11 +95,11 @@ void testCommon(const Spline &sp,
" (" << mFD << " - " << m << " = " << mFD - m << ")!"); " (" << mFD << " - " << m << " = " << mFD - m << ")!");
// second derivative // second derivative
y1 = sp.evalDerivative(x+epsFD); y1 = sp.evalDerivative(xval+epsFD);
y0 = sp.evalDerivative(x); y0 = sp.evalDerivative(xval);
mFD = (y1 - y0)/epsFD; mFD = (y1 - y0)/epsFD;
m = sp.evalSecondDerivative(x); m = sp.evalSecondDerivative(xval);
if (std::abs( mFD - m ) > 1000*epsFD) if (std::abs( mFD - m ) > 1000*epsFD)
OPM_THROW(std::runtime_error, OPM_THROW(std::runtime_error,
@ -107,11 +107,11 @@ void testCommon(const Spline &sp,
" (" << mFD << " - " << m << " = " << mFD - m << ")!"); " (" << mFD << " - " << m << " = " << mFD - m << ")!");
// Third derivative // Third derivative
y1 = sp.evalSecondDerivative(x+epsFD); y1 = sp.evalSecondDerivative(xval+epsFD);
y0 = sp.evalSecondDerivative(x); y0 = sp.evalSecondDerivative(xval);
mFD = (y1 - y0)/epsFD; mFD = (y1 - y0)/epsFD;
m = sp.evalThirdDerivative(x); m = sp.evalThirdDerivative(xval);
if (std::abs( mFD - m ) > 1000*epsFD) if (std::abs( mFD - m ) > 1000*epsFD)
OPM_THROW(std::runtime_error, OPM_THROW(std::runtime_error,
@ -331,7 +331,7 @@ void plot()
std::cout << "\n"; std::cout << "\n";
} }
int main(int argc, char** argv) int main()
{ {
try { try {
testAll(); testAll();