From 9e3d360b5bfb77d87b916a97e001280c2e0dff47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 7 Oct 2015 10:07:45 +0200 Subject: [PATCH 1/2] Silence warnings (shadowing and unused argument). --- opm/autodiff/BlackoilSolventModel_impl.hpp | 4 --- .../NewtonIterationBlackoilInterleaved.cpp | 34 ++++++++++--------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/opm/autodiff/BlackoilSolventModel_impl.hpp b/opm/autodiff/BlackoilSolventModel_impl.hpp index aecd46fc1..33d3e92dc 100644 --- a/opm/autodiff/BlackoilSolventModel_impl.hpp +++ b/opm/autodiff/BlackoilSolventModel_impl.hpp @@ -370,7 +370,6 @@ namespace Opm { // A weighted sum of the b-factors of gas and solvent are used. const int nc = Opm::AutoDiffGrid::numCells(grid_); - const Opm::PhaseUsage& pu = fluid_.phaseUsage(); const ADB zero = ADB::constant(V::Zero(nc)); const ADB& ss = state.solvent_saturation; const ADB& sg = (active_[ Gas ] @@ -380,7 +379,6 @@ namespace Opm { Selector zero_selector(ss.value() + sg.value(), Selector::Zero); V F_solvent = subset(zero_selector.select(ss, ss / (ss + sg)),well_cells).value(); - const int nw = wells().number_of_wells; V injectedSolventFraction = Eigen::Map(&xw.solventFraction()[0], nperf); V isProducer = V::Zero(nperf); @@ -637,7 +635,6 @@ namespace Opm { mob_perfcells[gas_pos] += subset(rq_[solvent_pos_].mob, well_cells); // A weighted sum of the b-factors of gas and solvent are used. - const int nperf = wells().well_connpos[wells().number_of_wells]; const int nc = Opm::AutoDiffGrid::numCells(grid_); const Opm::PhaseUsage& pu = fluid_.phaseUsage(); @@ -647,7 +644,6 @@ namespace Opm { ? state.saturation[ pu.phase_pos[ Gas ] ] : zero); - const std::vector well_cells(wells().well_cells, wells().well_cells + nperf); Selector zero_selector(ss.value() + sg.value(), Selector::Zero); ADB F_solvent = subset(zero_selector.select(ss, ss / (ss + sg)),well_cells); V ones = V::Constant(nperf,1.0); diff --git a/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp b/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp index bb1217285..420fcfb8d 100644 --- a/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp +++ b/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp @@ -207,7 +207,7 @@ namespace Opm */ template struct PointOneOp { EIGEN_EMPTY_STRUCT_CTOR(PointOneOp) - Scalar operator()(const Scalar& a, const Scalar& b) const { return 0.1; } + Scalar operator()(const Scalar&, const Scalar&) const { return 0.1; } }; } @@ -234,23 +234,25 @@ namespace Opm assert(size == row_major.cols()); // Create ISTL matrix with interleaved rows and columns (block structured). - assert(np == 3); - istlA.setSize(row_major.rows(), row_major.cols(), row_major.nonZeros()); - istlA.setBuildMode(Mat::row_wise); - const int* ia = row_major.outerIndexPtr(); - const int* ja = row_major.innerIndexPtr(); - for (Mat::CreateIterator row = istlA.createbegin(); row != istlA.createend(); ++row) { - const int ri = row.index(); - for (int i = ia[ri]; i < ia[ri + 1]; ++i) { - row.insert(ja[i]); + { + assert(np == 3); + istlA.setSize(row_major.rows(), row_major.cols(), row_major.nonZeros()); + istlA.setBuildMode(Mat::row_wise); + const int* ia = row_major.outerIndexPtr(); + const int* ja = row_major.innerIndexPtr(); + for (Mat::CreateIterator row = istlA.createbegin(); row != istlA.createend(); ++row) { + const int ri = row.index(); + for (int i = ia[ri]; i < ia[ri + 1]; ++i) { + row.insert(ja[i]); + } } - } - // Set all blocks to zero. - for (int row = 0; row < size; ++row) { - for (int col_ix = ia[row]; col_ix < ia[row + 1]; ++col_ix) { - const int col = ja[col_ix]; - istlA[row][col] = 0.0; + // Set all blocks to zero. + for (int row = 0; row < size; ++row) { + for (int col_ix = ia[row]; col_ix < ia[row + 1]; ++col_ix) { + const int col = ja[col_ix]; + istlA[row][col] = 0.0; + } } } From 9be05f4206e8eeb6bdf5c162a562cbc6fdd5809f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 8 Oct 2015 15:11:50 +0200 Subject: [PATCH 2/2] Undo changes to NewtonIterationsBlackoilInterleaved. --- .../NewtonIterationBlackoilInterleaved.cpp | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp b/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp index 420fcfb8d..bb1217285 100644 --- a/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp +++ b/opm/autodiff/NewtonIterationBlackoilInterleaved.cpp @@ -207,7 +207,7 @@ namespace Opm */ template struct PointOneOp { EIGEN_EMPTY_STRUCT_CTOR(PointOneOp) - Scalar operator()(const Scalar&, const Scalar&) const { return 0.1; } + Scalar operator()(const Scalar& a, const Scalar& b) const { return 0.1; } }; } @@ -234,25 +234,23 @@ namespace Opm assert(size == row_major.cols()); // Create ISTL matrix with interleaved rows and columns (block structured). - { - assert(np == 3); - istlA.setSize(row_major.rows(), row_major.cols(), row_major.nonZeros()); - istlA.setBuildMode(Mat::row_wise); - const int* ia = row_major.outerIndexPtr(); - const int* ja = row_major.innerIndexPtr(); - for (Mat::CreateIterator row = istlA.createbegin(); row != istlA.createend(); ++row) { - const int ri = row.index(); - for (int i = ia[ri]; i < ia[ri + 1]; ++i) { - row.insert(ja[i]); - } + assert(np == 3); + istlA.setSize(row_major.rows(), row_major.cols(), row_major.nonZeros()); + istlA.setBuildMode(Mat::row_wise); + const int* ia = row_major.outerIndexPtr(); + const int* ja = row_major.innerIndexPtr(); + for (Mat::CreateIterator row = istlA.createbegin(); row != istlA.createend(); ++row) { + const int ri = row.index(); + for (int i = ia[ri]; i < ia[ri + 1]; ++i) { + row.insert(ja[i]); } + } - // Set all blocks to zero. - for (int row = 0; row < size; ++row) { - for (int col_ix = ia[row]; col_ix < ia[row + 1]; ++col_ix) { - const int col = ja[col_ix]; - istlA[row][col] = 0.0; - } + // Set all blocks to zero. + for (int row = 0; row < size; ++row) { + for (int col_ix = ia[row]; col_ix < ia[row + 1]; ++col_ix) { + const int col = ja[col_ix]; + istlA[row][col] = 0.0; } }