// converges in at most <code>src.size()</code> 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 <class Matrix>
+ template <class MatrixType>
class InverseMatrix : public Subscriptor
{
public:
- InverseMatrix (const Matrix &m);
+ InverseMatrix (const MatrixType &m);
void vmult (Vector<double> &dst,
const Vector<double> &src) const;
private:
- const SmartPointer<const Matrix> matrix;
+ const SmartPointer<const MatrixType> matrix;
};
- template <class Matrix>
- InverseMatrix<Matrix>::InverseMatrix (const Matrix &m)
+ template <class MatrixType>
+ InverseMatrix<MatrixType>::InverseMatrix (const MatrixType &m)
:
matrix (&m)
{}
- template <class Matrix>
- void InverseMatrix<Matrix>::vmult (Vector<double> &dst,
- const Vector<double> &src) const
+ template <class MatrixType>
+ void InverseMatrix<MatrixType>::vmult (Vector<double> &dst,
+ const Vector<double> &src) const
{
SolverControl solver_control (std::max(src.size(), static_cast<std::size_t> (200)),
1e-8*src.l2_norm());
// <code>InverseMatrix</code> object is created. The member function
// <code>vmult</code> is, as in step-20, a multiplication with a vector,
// obtained by solving a linear system:
- template <class Matrix, class Preconditioner>
+ template <class MatrixType, class Preconditioner>
class InverseMatrix : public Subscriptor
{
public:
- InverseMatrix (const Matrix &m,
+ InverseMatrix (const MatrixType &m,
const Preconditioner &preconditioner);
void vmult (Vector<double> &dst,
const Vector<double> &src) const;
private:
- const SmartPointer<const Matrix> matrix;
+ const SmartPointer<const MatrixType> matrix;
const SmartPointer<const Preconditioner> preconditioner;
};
- template <class Matrix, class Preconditioner>
- InverseMatrix<Matrix,Preconditioner>::InverseMatrix (const Matrix &m,
- const Preconditioner &preconditioner)
+ template <class MatrixType, class Preconditioner>
+ InverseMatrix<MatrixType,Preconditioner>::InverseMatrix
+ (const MatrixType &m,
+ const Preconditioner &preconditioner)
:
matrix (&m),
preconditioner (&preconditioner)
// 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 <class Matrix, class Preconditioner>
- void InverseMatrix<Matrix,Preconditioner>::vmult (Vector<double> &dst,
- const Vector<double> &src) const
+ template <class MatrixType, class Preconditioner>
+ void InverseMatrix<MatrixType,Preconditioner>::vmult (Vector<double> &dst,
+ const Vector<double> &src) const
{
SolverControl solver_control (src.size(), 1e-6*src.l2_norm());
SolverCG<> cg (solver_control);
// run-time exception into an assertion that fails and triggers a call to
// <code>abort()</code>, allowing us to trace back in a debugger how we
// got to the current place.
- template <class Matrix, class Preconditioner>
+ template <class MatrixType, class Preconditioner>
class InverseMatrix : public Subscriptor
{
public:
- InverseMatrix (const Matrix &m,
+ InverseMatrix (const MatrixType &m,
const Preconditioner &preconditioner);
const VectorType &src) const;
private:
- const SmartPointer<const Matrix> matrix;
+ const SmartPointer<const MatrixType> matrix;
const Preconditioner &preconditioner;
};
- template <class Matrix, class Preconditioner>
- InverseMatrix<Matrix,Preconditioner>::
- InverseMatrix (const Matrix &m,
+ template <class MatrixType, class Preconditioner>
+ InverseMatrix<MatrixType,Preconditioner>::
+ InverseMatrix (const MatrixType &m,
const Preconditioner &preconditioner)
:
matrix (&m),
- template <class Matrix, class Preconditioner>
+ template <class MatrixType, class Preconditioner>
template <typename VectorType>
void
- InverseMatrix<Matrix,Preconditioner>::
+ InverseMatrix<MatrixType,Preconditioner>::
vmult (VectorType &dst,
const VectorType &src) const
{
// darcy_matrix to match our problem.
namespace LinearSolvers
{
- template <class Matrix, class Preconditioner>
+ template <class MatrixType, class Preconditioner>
class InverseMatrix : public Subscriptor
{
public:
- InverseMatrix (const Matrix &m,
+ InverseMatrix (const MatrixType &m,
const Preconditioner &preconditioner);
const VectorType &src) const;
private:
- const SmartPointer<const Matrix> matrix;
+ const SmartPointer<const MatrixType> matrix;
const Preconditioner &preconditioner;
};
- template <class Matrix, class Preconditioner>
- InverseMatrix<Matrix,Preconditioner>::
- InverseMatrix (const Matrix &m,
+ template <class MatrixType, class Preconditioner>
+ InverseMatrix<MatrixType,Preconditioner>::
+ InverseMatrix (const MatrixType &m,
const Preconditioner &preconditioner)
:
matrix (&m),
- template <class Matrix, class Preconditioner>
+ template <class MatrixType, class Preconditioner>
template <typename VectorType>
void
- InverseMatrix<Matrix,Preconditioner>::
+ InverseMatrix<MatrixType,Preconditioner>::
vmult (VectorType &dst,
const VectorType &src) const
{
- template <class Matrix, class Preconditioner>
+ template <class MatrixType, class Preconditioner>
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);
const TrilinosWrappers::MPI::Vector &src) const;
private:
- const SmartPointer<const Matrix> matrix;
+ const SmartPointer<const MatrixType> matrix;
const SmartPointer<const Preconditioner> preconditioner;
const MPI_Comm *mpi_communicator;
- template <class Matrix, class Preconditioner>
- InverseMatrix<Matrix,Preconditioner>::InverseMatrix
- (const Matrix &m,
+ template <class MatrixType, class Preconditioner>
+ InverseMatrix<MatrixType,Preconditioner>::InverseMatrix
+ (const MatrixType &m,
const Preconditioner &preconditioner,
const IndexSet &locally_owned,
const MPI_Comm &mpi_communicator)
- template <class Matrix, class Preconditioner>
- void InverseMatrix<Matrix,Preconditioner>::vmult
+ template <class MatrixType, class Preconditioner>
+ void InverseMatrix<MatrixType,Preconditioner>::vmult
(TrilinosWrappers::MPI::Vector &dst,
const TrilinosWrappers::MPI::Vector &src) const
{