From 7ab529bef1fa7dc2de959656e91e54b0be08d0bb Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed, 30 Nov 2011 15:16:27 +0100 Subject: [PATCH] fixed some wanring of unused parameters --- .../Preconditioner/generateDiagPrecond.cpp | 8 ++------ .../LinAlg/Preconditioner/generateDiagPrecond.h | 10 ++++------ MathLib/LinAlg/Sparse/CRSMatrix.h | 2 +- MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h | 16 +++++++++------- SimpleTests/SolverTests/BiCGStabDiagPrecond.cpp | 4 ++-- .../ConjugateGradientUnpreconditioned.cpp | 3 +++ 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/MathLib/LinAlg/Preconditioner/generateDiagPrecond.cpp b/MathLib/LinAlg/Preconditioner/generateDiagPrecond.cpp index 607ea01f7da..6fcb92031d9 100644 --- a/MathLib/LinAlg/Preconditioner/generateDiagPrecond.cpp +++ b/MathLib/LinAlg/Preconditioner/generateDiagPrecond.cpp @@ -30,11 +30,9 @@ bool generateDiagPrecond (unsigned n, unsigned const*const iA, unsigned const*co return true; } -bool generateDiagPrecondRowSum(unsigned n, unsigned const*const iA, unsigned const*const jA, - double const*const A, double* diag) +bool generateDiagPrecondRowSum(unsigned n, unsigned const*const iA, double const*const A, double* diag) { unsigned idx; // first idx of next row - unsigned c; // column unsigned j; for (unsigned r(0); r<n; ++r) { @@ -52,11 +50,9 @@ bool generateDiagPrecondRowSum(unsigned n, unsigned const*const iA, unsigned con return true; } -bool generateDiagPrecondRowMax(unsigned n, unsigned const*const iA, unsigned const*const jA, - double const*const A, double* diag) +bool generateDiagPrecondRowMax(unsigned n, unsigned const*const iA, double const*const A, double* diag) { unsigned idx; // first idx of next row - unsigned c; // column unsigned j; for (unsigned r(0); r<n; ++r) { diff --git a/MathLib/LinAlg/Preconditioner/generateDiagPrecond.h b/MathLib/LinAlg/Preconditioner/generateDiagPrecond.h index 5a5aa98cb23..7d7568a74e0 100644 --- a/MathLib/LinAlg/Preconditioner/generateDiagPrecond.h +++ b/MathLib/LinAlg/Preconditioner/generateDiagPrecond.h @@ -26,25 +26,23 @@ bool generateDiagPrecond(unsigned n, unsigned const*const iA, unsigned const*con * diagonal preconditioner \f$P_{ii} = \left(\sum_{j} |a_{ij}|\right)^{-1}\f$ associated with \f$n \times n\f$ matrix \f$A\f$ * @param n number of rows / columns * @param iA row pointer of compressed row storage format - * @param jA column index of compressed row storage format * @param A data entries of compressed row storage format * @param diag inverse entries of the diagonal * @return true, if all row sums are distinct from zero, else false */ -bool generateDiagPrecondRowSum(unsigned n, unsigned const*const iA, unsigned const*const jA, - double const*const A, double* diag); +bool generateDiagPrecondRowSum(unsigned n, unsigned const*const iA, double const*const A, + double* diag); /** * diagonal preconditioner \f$P_{ii} = \left(\max_{j} a_{ij}\right)^{-1}\f$ associated with \f$n \times n\f$ matrix \f$A\f$ * @param n number of rows / columns * @param iA row pointer of compressed row storage format - * @param jA column index of compressed row storage format * @param A data entries of compressed row storage format * @param diag inverse entries of the diagonal * @return true, if all row sums are distinct from zero, else false */ -bool generateDiagPrecondRowMax(unsigned n, unsigned const*const iA, unsigned const*const jA, - double const*const A, double* diag); +bool generateDiagPrecondRowMax(unsigned n, unsigned const*const iA, double const*const A, + double* diag); } // end namespace MathLib diff --git a/MathLib/LinAlg/Sparse/CRSMatrix.h b/MathLib/LinAlg/Sparse/CRSMatrix.h index 4ec9bb1033d..31d97a39c0a 100644 --- a/MathLib/LinAlg/Sparse/CRSMatrix.h +++ b/MathLib/LinAlg/Sparse/CRSMatrix.h @@ -64,7 +64,7 @@ public: amuxCRS<FP_TYPE, IDX_TYPE>(d, this->getNRows(), _row_ptr, _col_idx, _data, x, y); } - virtual void precondApply(FP_TYPE* x) const + virtual void precondApply(FP_TYPE* /*x*/) const {} /** diff --git a/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h b/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h index 9edf0b622c0..51982a1f93e 100644 --- a/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h +++ b/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h @@ -55,19 +55,20 @@ public: delete [] _inv_diag; _inv_diag = new double[_n_rows]; -// if (!generateDiagPrecond(_n_rows, _row_ptr, _col_idx, _data, _inv_diag)) { -// std::cout << "Could not create diagonal preconditioner" << std::endl; -// } - if (!generateDiagPrecondRowSum(_n_rows, _row_ptr, _col_idx, _data, _inv_diag)) { + if (!generateDiagPrecond(_n_rows, _row_ptr, _col_idx, _data, _inv_diag)) { std::cout << "Could not create diagonal preconditioner" << std::endl; } -// if (!generateDiagPrecondRowMax(_n_rows, _row_ptr, _col_idx, _data, _inv_diag)) { +// if (!generateDiagPrecondRowSum(_n_rows, _row_ptr, _data, _inv_diag)) { +// std::cout << "Could not create diagonal preconditioner" << std::endl; +// } +// if (!generateDiagPrecondRowMax(_n_rows, _row_ptr, _data, _inv_diag)) { // std::cout << "Could not create diagonal preconditioner" << std::endl; // } } - void precondApply(double* x) const { + void precondApply(double* x) const + { { unsigned k; // #pragma omp parallel for @@ -77,7 +78,8 @@ public: } } - ~CRSMatrixDiagPrecond() { + ~CRSMatrixDiagPrecond() + { delete [] _inv_diag; } private: diff --git a/SimpleTests/SolverTests/BiCGStabDiagPrecond.cpp b/SimpleTests/SolverTests/BiCGStabDiagPrecond.cpp index 2336255acd5..5bdd39217dd 100644 --- a/SimpleTests/SolverTests/BiCGStabDiagPrecond.cpp +++ b/SimpleTests/SolverTests/BiCGStabDiagPrecond.cpp @@ -18,8 +18,8 @@ int main(int argc, char *argv[]) } // read number of threads - unsigned num_omp_threads (1); - num_omp_threads = atoi (argv[3]); +// unsigned num_omp_threads (1); +// num_omp_threads = atoi (argv[3]); // *** reading matrix in crs format from file std::string fname(argv[1]); diff --git a/SimpleTests/SolverTests/ConjugateGradientUnpreconditioned.cpp b/SimpleTests/SolverTests/ConjugateGradientUnpreconditioned.cpp index 52f1ba239f7..258fde9616b 100644 --- a/SimpleTests/SolverTests/ConjugateGradientUnpreconditioned.cpp +++ b/SimpleTests/SolverTests/ConjugateGradientUnpreconditioned.cpp @@ -9,6 +9,9 @@ int main(int argc, char *argv[]) { + (void) argc; + (void) argv; + // *** reading matrix in crs format from file std::string fname("/work/fischeth/data/testmat.bin"); // std::ifstream in(fname.c_str(), std::ios::binary); -- GitLab