From 603fd681adbd515923076e8254e28f174b468c61 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 21 Feb 2016 09:18:32 -0500 Subject: [PATCH] Prefer MatrixType to Matrix in the tutorials. --- examples/step-21/step-21.cc | 16 ++++++++-------- examples/step-22/step-22.cc | 19 ++++++++++--------- examples/step-31/step-31.cc | 16 ++++++++-------- examples/step-43/step-43.cc | 16 ++++++++-------- examples/step-45/step-45.cc | 16 ++++++++-------- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/examples/step-21/step-21.cc b/examples/step-21/step-21.cc index 3b821afd44..e5ecd5d9e6 100644 --- a/examples/step-21/step-21.cc +++ b/examples/step-21/step-21.cc @@ -461,31 +461,31 @@ namespace Step21 // converges in at most src.size() steps.) As a consequence, we // set the maximum number of iterations equal to the maximum of the size of // the linear system and 200. - template + template class InverseMatrix : public Subscriptor { public: - InverseMatrix (const Matrix &m); + InverseMatrix (const MatrixType &m); void vmult (Vector &dst, const Vector &src) const; private: - const SmartPointer matrix; + const SmartPointer matrix; }; - template - InverseMatrix::InverseMatrix (const Matrix &m) + template + InverseMatrix::InverseMatrix (const MatrixType &m) : matrix (&m) {} - template - void InverseMatrix::vmult (Vector &dst, - const Vector &src) const + template + void InverseMatrix::vmult (Vector &dst, + const Vector &src) const { SolverControl solver_control (std::max(src.size(), static_cast (200)), 1e-8*src.l2_norm()); diff --git a/examples/step-22/step-22.cc b/examples/step-22/step-22.cc index 1986daab7f..b4ca614e5b 100644 --- a/examples/step-22/step-22.cc +++ b/examples/step-22/step-22.cc @@ -264,25 +264,26 @@ namespace Step22 // InverseMatrix object is created. The member function // vmult is, as in step-20, a multiplication with a vector, // obtained by solving a linear system: - template + template class InverseMatrix : public Subscriptor { public: - InverseMatrix (const Matrix &m, + InverseMatrix (const MatrixType &m, const Preconditioner &preconditioner); void vmult (Vector &dst, const Vector &src) const; private: - const SmartPointer matrix; + const SmartPointer matrix; const SmartPointer preconditioner; }; - template - InverseMatrix::InverseMatrix (const Matrix &m, - const Preconditioner &preconditioner) + template + InverseMatrix::InverseMatrix + (const MatrixType &m, + const Preconditioner &preconditioner) : matrix (&m), preconditioner (&preconditioner) @@ -299,9 +300,9 @@ namespace Step22 // inverse of the Laplace matrix – which is hence directly responsible // for the accuracy of the solution itself, so we can't choose a too large // tolerance, either. - template - void InverseMatrix::vmult (Vector &dst, - const Vector &src) const + template + void InverseMatrix::vmult (Vector &dst, + const Vector &src) const { SolverControl solver_control (src.size(), 1e-6*src.l2_norm()); SolverCG<> cg (solver_control); diff --git a/examples/step-31/step-31.cc b/examples/step-31/step-31.cc index 4a0bb5a6c0..83453cea51 100644 --- a/examples/step-31/step-31.cc +++ b/examples/step-31/step-31.cc @@ -266,11 +266,11 @@ namespace Step31 // run-time exception into an assertion that fails and triggers a call to // abort(), allowing us to trace back in a debugger how we // got to the current place. - template + template class InverseMatrix : public Subscriptor { public: - InverseMatrix (const Matrix &m, + InverseMatrix (const MatrixType &m, const Preconditioner &preconditioner); @@ -279,14 +279,14 @@ namespace Step31 const VectorType &src) const; private: - const SmartPointer matrix; + const SmartPointer matrix; const Preconditioner &preconditioner; }; - template - InverseMatrix:: - InverseMatrix (const Matrix &m, + template + InverseMatrix:: + InverseMatrix (const MatrixType &m, const Preconditioner &preconditioner) : matrix (&m), @@ -295,10 +295,10 @@ namespace Step31 - template + template template void - InverseMatrix:: + InverseMatrix:: vmult (VectorType &dst, const VectorType &src) const { diff --git a/examples/step-43/step-43.cc b/examples/step-43/step-43.cc index 89910f98f0..c7b4e198e0 100644 --- a/examples/step-43/step-43.cc +++ b/examples/step-43/step-43.cc @@ -361,11 +361,11 @@ namespace Step43 // darcy_matrix to match our problem. namespace LinearSolvers { - template + template class InverseMatrix : public Subscriptor { public: - InverseMatrix (const Matrix &m, + InverseMatrix (const MatrixType &m, const Preconditioner &preconditioner); @@ -374,14 +374,14 @@ namespace Step43 const VectorType &src) const; private: - const SmartPointer matrix; + const SmartPointer matrix; const Preconditioner &preconditioner; }; - template - InverseMatrix:: - InverseMatrix (const Matrix &m, + template + InverseMatrix:: + InverseMatrix (const MatrixType &m, const Preconditioner &preconditioner) : matrix (&m), @@ -390,10 +390,10 @@ namespace Step43 - template + template template void - InverseMatrix:: + InverseMatrix:: vmult (VectorType &dst, const VectorType &src) const { diff --git a/examples/step-45/step-45.cc b/examples/step-45/step-45.cc index f6b30e5949..fb8aae047a 100644 --- a/examples/step-45/step-45.cc +++ b/examples/step-45/step-45.cc @@ -182,11 +182,11 @@ namespace Step45 - template + template class InverseMatrix : public Subscriptor { public: - InverseMatrix (const Matrix &m, + InverseMatrix (const MatrixType &m, const Preconditioner &preconditioner, const IndexSet &locally_owned, const MPI_Comm &mpi_communicator); @@ -195,7 +195,7 @@ namespace Step45 const TrilinosWrappers::MPI::Vector &src) const; private: - const SmartPointer matrix; + const SmartPointer matrix; const SmartPointer preconditioner; const MPI_Comm *mpi_communicator; @@ -204,9 +204,9 @@ namespace Step45 - template - InverseMatrix::InverseMatrix - (const Matrix &m, + template + InverseMatrix::InverseMatrix + (const MatrixType &m, const Preconditioner &preconditioner, const IndexSet &locally_owned, const MPI_Comm &mpi_communicator) @@ -219,8 +219,8 @@ namespace Step45 - template - void InverseMatrix::vmult + template + void InverseMatrix::vmult (TrilinosWrappers::MPI::Vector &dst, const TrilinosWrappers::MPI::Vector &src) const { -- 2.39.5