Fixed warnings

This commit is contained in:
babrodtk 2015-08-27 14:16:58 +02:00
parent 54137c742b
commit 6a6a1d5280
3 changed files with 27 additions and 8 deletions

View File

@ -116,7 +116,6 @@ try
{ {
typedef Opm::AutoDiffBlock<double> ADB; typedef Opm::AutoDiffBlock<double> ADB;
typedef ADB::V V; typedef ADB::V V;
typedef ADB::M M;
typedef Eigen::SparseMatrix<double> S; typedef Eigen::SparseMatrix<double> S;
Opm::time::StopWatch clock; Opm::time::StopWatch clock;

View File

@ -339,9 +339,6 @@ namespace Opm
int num_blocks = numBlocks(); int num_blocks = numBlocks();
std::vector<M> jac(num_blocks); std::vector<M> jac(num_blocks);
assert(numBlocks() == rhs.numBlocks()); assert(numBlocks() == rhs.numBlocks());
// typedef Eigen::DiagonalMatrix<Scalar, Eigen::Dynamic> D;
// D D1 = val_.matrix().asDiagonal();
// D D2 = rhs.val_.matrix().asDiagonal();
M D1(val_.matrix().asDiagonal()); M D1(val_.matrix().asDiagonal());
M D2(rhs.val_.matrix().asDiagonal()); M D2(rhs.val_.matrix().asDiagonal());
for (int block = 0; block < num_blocks; ++block) { for (int block = 0; block < num_blocks; ++block) {
@ -377,10 +374,6 @@ namespace Opm
int num_blocks = numBlocks(); int num_blocks = numBlocks();
std::vector<M> jac(num_blocks); std::vector<M> jac(num_blocks);
assert(numBlocks() == rhs.numBlocks()); assert(numBlocks() == rhs.numBlocks());
typedef Eigen::DiagonalMatrix<Scalar, Eigen::Dynamic> D;
// D D1 = val_.matrix().asDiagonal();
// D D2 = rhs.val_.matrix().asDiagonal();
// D D3 = (1.0/(rhs.val_*rhs.val_)).matrix().asDiagonal();
M D1(val_.matrix().asDiagonal()); M D1(val_.matrix().asDiagonal());
M D2(rhs.val_.matrix().asDiagonal()); M D2(rhs.val_.matrix().asDiagonal());
M D3((1.0/(rhs.val_*rhs.val_)).matrix().asDiagonal()); M D3((1.0/(rhs.val_*rhs.val_)).matrix().asDiagonal());

View File

@ -27,6 +27,7 @@
#include <opm/core/utility/platform_dependent/reenable_warnings.h> #include <opm/core/utility/platform_dependent/reenable_warnings.h>
#include <opm/core/utility/ErrorMacros.hpp>
#include <opm/autodiff/fastSparseProduct.hpp> #include <opm/autodiff/fastSparseProduct.hpp>
#include <vector> #include <vector>
@ -136,6 +137,8 @@ namespace Opm
return rhs + (*this); return rhs + (*this);
case S: case S:
return rhs + (*this); return rhs + (*this);
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
case D: case D:
switch (rhs.type_) { switch (rhs.type_) {
@ -147,6 +150,8 @@ namespace Opm
return sumDD(*this, rhs); return sumDD(*this, rhs);
case S: case S:
return rhs + (*this); return rhs + (*this);
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
case S: case S:
switch (rhs.type_) { switch (rhs.type_) {
@ -158,7 +163,11 @@ namespace Opm
return sumSD(*this, rhs); return sumSD(*this, rhs);
case S: case S:
return sumSS(*this, rhs); return sumSS(*this, rhs);
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
} }
@ -178,6 +187,8 @@ namespace Opm
return rhs; return rhs;
case S: case S:
return rhs; return rhs;
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
case D: case D:
switch (rhs.type_) { switch (rhs.type_) {
@ -189,6 +200,8 @@ namespace Opm
return prodDD(*this, rhs); return prodDD(*this, rhs);
case S: case S:
return prodDS(*this, rhs); return prodDS(*this, rhs);
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
case S: case S:
switch (rhs.type_) { switch (rhs.type_) {
@ -200,7 +213,11 @@ namespace Opm
return prodSD(*this, rhs); return prodSD(*this, rhs);
case S: case S:
return prodSS(*this, rhs); return prodSS(*this, rhs);
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << rhs.type_);
} }
} }
@ -258,6 +275,8 @@ namespace Opm
retval.s_ *= rhs; retval.s_ *= rhs;
return retval; return retval;
} }
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
} }
} }
@ -292,6 +311,8 @@ namespace Opm
retval.s_ /= rhs; retval.s_ /= rhs;
return retval; return retval;
} }
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
} }
} }
@ -312,6 +333,8 @@ namespace Opm
return Eigen::Map<const Eigen::VectorXd>(d_.data(), rows_) * rhs; return Eigen::Map<const Eigen::VectorXd>(d_.data(), rows_) * rhs;
case S: case S:
return s_ * rhs; return s_ * rhs;
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
} }
} }
@ -490,6 +513,8 @@ namespace Opm
return rows_; return rows_;
case S: case S:
return s_.nonZeros(); return s_.nonZeros();
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
} }
} }
@ -505,6 +530,8 @@ namespace Opm
return (row == col) ? d_[row] : 0.0; return (row == col) ? d_[row] : 0.0;
case S: case S:
return s_.coeff(row, col); return s_.coeff(row, col);
default:
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
} }
} }