From 0f4605389946b8db5db4fe27b364a37a71245950 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 3 Jul 1998 06:50:14 +0000 Subject: [PATCH] Add some 'const' declarations and change the naming of some functions a bit. git-svn-id: https://svn.dealii.org/trunk@433 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/dsmatrix.h | 21 +++++++++-------- deal.II/lac/source/dsmatrix.cc | 37 ++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/deal.II/lac/include/lac/dsmatrix.h b/deal.II/lac/include/lac/dsmatrix.h index 9291ff0833..e778499b96 100644 --- a/deal.II/lac/include/lac/dsmatrix.h +++ b/deal.II/lac/include/lac/dsmatrix.h @@ -593,22 +593,23 @@ class dSMatrix double matrix_norm (const dVector &v) const; // - double residual (dVector& dst, const dVector& x, const dVector& b); + double residual (dVector& dst, const dVector& x, + const dVector& b) const; // - void Jacobi_precond (dVector& dst, const dVector& src, - const double om = 1.); + void precondition_Jacobi (dVector& dst, const dVector& src, + const double om = 1.) const; // - void SSOR_precond (dVector& dst, const dVector& src, - const double om = 1.); + void precondition_SSOR (dVector& dst, const dVector& src, + const double om = 1.) const; // - void SOR_precond (dVector& dst, const dVector& src, - const double om = 1.); + void precondition_SOR (dVector& dst, const dVector& src, + const double om = 1.) const; // - void SSOR (dVector& dst, const double om = 1.); + void SSOR (dVector& dst, const double om = 1.) const; // - void SOR (dVector& dst, const double om = 1.); + void SOR (dVector& dst, const double om = 1.) const; // - void precondition (dVector& dst, const dVector& src) { dst=src; } + void precondition (dVector& dst, const dVector& src) const; /** * Return a (constant) reference to the diff --git a/deal.II/lac/source/dsmatrix.cc b/deal.II/lac/source/dsmatrix.cc index 77b5b7bf82..32ce7ee08b 100644 --- a/deal.II/lac/source/dsmatrix.cc +++ b/deal.II/lac/source/dsmatrix.cc @@ -539,7 +539,7 @@ dSMatrix::matrix_norm (const dVector& v) const double -dSMatrix::residual (dVector& dst, const dVector& u, const dVector& b) +dSMatrix::residual (dVector& dst, const dVector& u, const dVector& b) const { Assert (cols != 0, ExcMatrixNotInitialized()); Assert (val != 0, ExcMatrixNotInitialized()); @@ -564,21 +564,27 @@ dSMatrix::residual (dVector& dst, const dVector& u, const dVector& b) } void -dSMatrix::Jacobi_precond (dVector& dst, const dVector& src, const double om) +dSMatrix::precondition_Jacobi (dVector& dst, const dVector& src, + const double om) const { Assert (cols != 0, ExcMatrixNotInitialized()); Assert (val != 0, ExcMatrixNotInitialized()); + Assert (m() == n(), ExcMatrixNotSquare()); const unsigned int n = src.size(); - for (unsigned int i=0;irowstart[i]]; - } -} + for (unsigned int i=0; irowstart[i]]; +}; + void -dSMatrix::SSOR_precond (dVector& dst, const dVector& src, const double om) +dSMatrix::precondition_SSOR (dVector& dst, const dVector& src, + const double om) const { Assert (cols != 0, ExcMatrixNotInitialized()); Assert (val != 0, ExcMatrixNotInitialized()); @@ -613,16 +619,23 @@ dSMatrix::SSOR_precond (dVector& dst, const dVector& src, const double om) } void -dSMatrix::SOR_precond (dVector& dst, const dVector& src, const double om) +dSMatrix::precondition_SOR (dVector& dst, const dVector& src, + const double om) const { Assert (cols != 0, ExcMatrixNotInitialized()); Assert (val != 0, ExcMatrixNotInitialized()); dst = src; SOR(dst,om); -} +}; + + +void dSMatrix::precondition (dVector &dst, const dVector &src) const { + dst=src; +}; + void -dSMatrix::SOR (dVector& dst, const double om) +dSMatrix::SOR (dVector& dst, const double om) const { Assert (cols != 0, ExcMatrixNotInitialized()); Assert (val != 0, ExcMatrixNotInitialized()); @@ -643,7 +656,7 @@ dSMatrix::SOR (dVector& dst, const double om) } void -dSMatrix::SSOR (dVector& dst, const double om) +dSMatrix::SSOR (dVector& dst, const double om) const { Assert (cols != 0, ExcMatrixNotInitialized()); Assert (val != 0, ExcMatrixNotInitialized()); -- 2.39.5