class PointerMatrixBase : public Subscriptor
{
public:
- /**
- * Declare type for container size.
- */
- typedef types::global_dof_index size_type;
-
/**
* Value type of this matrix. since the matrix itself is unknown, we take
* the value type of the vector. Therefore, matrix entries must be
*/
virtual void Tvmult_add (VECTOR &dst,
const VECTOR &src) const = 0;
-
- /**
- * Return the dimension of the codomain (or range) space. To remember: the
- * matrix is of dimension $m \times n$.
- */
- virtual size_type m () const = 0;
-
- /**
- * Return the dimension of the domain space. To remember: the matrix is of
- * dimension $m \times n$.
- */
- virtual size_type n () const = 0;
};
* only has a vector as template argument. Therefore, this interface provides
* an abstract base class for matrices.
*
- * @author Guido Kanschat 2000, 2001, 2002; extension for full compatibility
- * with LinearOperator class: Jean-Paul Pelteret, 2015
+ * @author Guido Kanschat 2000, 2001, 2002
*/
template<class MATRIX, class VECTOR>
class PointerMatrix : public PointerMatrixBase<VECTOR>
{
public:
- /**
- * Declare type for container size.
- */
- typedef typename PointerMatrixBase<VECTOR>::size_type size_type;
-
/**
* Constructor. The pointer in the argument is stored in this class. As
* usual, the lifetime of <tt>*M</tt> must be longer than the one of the
PointerMatrix(const MATRIX *M,
const char *name);
- /**
- * Destructor
- */
- virtual ~PointerMatrix ()
- {}
-
// Use doc from base class
virtual void clear();
virtual void Tvmult_add (VECTOR &dst,
const VECTOR &src) const;
- /**
- * Return the dimension of the codomain (or range) space. To remember: the
- * matrix is of dimension $m \times n$.
- */
- virtual size_type m () const;
-
- /**
- * Return the dimension of the domain space. To remember: the matrix is of
- * dimension $m \times n$.
- */
- virtual size_type n () const;
-
private:
/**
* The pointer to the actual matrix.
*/
- SmartPointer<const MATRIX,PointerMatrix<MATRIX,VECTOR> > matrix;
+ SmartPointer<const MATRIX,PointerMatrix<MATRIX,VECTOR> > m;
};
* and by the fact that it implements the functions vmult_add() and
* Tvmult_add() only using vmult() and Tvmult() of the MATRIX.
*
- * @author Guido Kanschat 2006; extension for full compatibility with
- * LinearOperator class: Jean-Paul Pelteret, 2015
+ * @author Guido Kanschat 2006
*/
template<class MATRIX, class VECTOR>
class PointerMatrixAux : public PointerMatrixBase<VECTOR>
{
public:
- /**
- * Declare type for container size.
- */
- typedef typename PointerMatrixBase<VECTOR>::size_type size_type;
-
/**
* Constructor. The pointer in the argument is stored in this class. As
* usual, the lifetime of <tt>*M</tt> must be longer than the one of the
const MATRIX *M,
const char *name);
- /**
- * Destructor
- */
- virtual ~PointerMatrixAux ()
- {}
-
// Use doc from base class
virtual void clear();
virtual void Tvmult_add (VECTOR &dst,
const VECTOR &src) const;
- /**
- * Return the dimension of the codomain (or range) space. To remember: the
- * matrix is of dimension $m \times n$.
- */
- virtual size_type m () const;
-
- /**
- * Return the dimension of the domain space. To remember: the matrix is of
- * dimension $m \times n$.
- */
- virtual size_type n () const;
-
private:
/**
* The backup memory if none was provided.
/**
* The pointer to the actual matrix.
*/
- SmartPointer<const MATRIX,PointerMatrixAux<MATRIX,VECTOR> > matrix;
+ SmartPointer<const MATRIX,PointerMatrixAux<MATRIX,VECTOR> > m;
};
* (#vmult()) and scalar multiplication (#Tvmult()) functions of the Vector
* class.
*
- * @author Guido Kanschat, 2006; extension for full compatibility with
- * LinearOperator class: Jean-Paul Pelteret, 2015
+ * @author Guido Kanschat, 2006
*/
template <typename number>
class PointerMatrixVector : public PointerMatrixBase<Vector<number> >
{
public:
- /**
- * Declare type for container size.
- */
- typedef typename PointerMatrixBase< Vector<number> >::size_type size_type;
-
/**
* Constructor. The pointer in the argument is stored in this class. As
* usual, the lifetime of <tt>*M</tt> must be longer than the one of the
PointerMatrixVector (const Vector<number> *M,
const char *name);
- /**
- * Destructor
- */
- virtual ~PointerMatrixVector ()
- {}
-
// Use doc from base class
virtual void clear();
virtual void Tvmult_add (Vector<number> &dst,
const Vector<number> &src) const;
- /**
- * Return the dimension of the codomain (or range) space. To remember: the
- * matrix is of dimension $m \times n$.
- */
- virtual size_type m () const;
-
- /**
- * Return the dimension of the domain space. To remember: the matrix is of
- * dimension $m \times n$.
- */
- virtual size_type n () const;
-
private:
/**
* The pointer to the actual matrix.
*/
- SmartPointer<const Vector<number>,PointerMatrixVector<number> > matrix;
+ SmartPointer<const Vector<number>,PointerMatrixVector<number> > m;
};
template<class MATRIX, class VECTOR>
PointerMatrix<MATRIX, VECTOR>::PointerMatrix (const MATRIX *M)
- : matrix(M, typeid(*this).name())
+ : m(M, typeid(*this).name())
{}
template<class MATRIX, class VECTOR>
PointerMatrix<MATRIX, VECTOR>::PointerMatrix (const char *name)
- : matrix(0, name)
+ : m(0, name)
{}
PointerMatrix<MATRIX, VECTOR>::PointerMatrix (
const MATRIX *M,
const char *name)
- : matrix(M, name)
+ : m(M, name)
{}
inline void
PointerMatrix<MATRIX, VECTOR>::clear ()
{
- matrix = 0;
+ m = 0;
}
inline const PointerMatrix<MATRIX, VECTOR> &
PointerMatrix<MATRIX, VECTOR>::operator= (const MATRIX *M)
{
- matrix = M;
+ m = M;
return *this;
}
inline bool
PointerMatrix<MATRIX, VECTOR>::empty () const
{
- if (matrix == 0)
+ if (m == 0)
return true;
- return matrix->empty();
+ return m->empty();
}
template<class MATRIX, class VECTOR>
PointerMatrix<MATRIX, VECTOR>::vmult (VECTOR &dst,
const VECTOR &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
- matrix->vmult (dst, src);
+ Assert (m != 0, ExcNotInitialized());
+ m->vmult (dst, src);
}
PointerMatrix<MATRIX, VECTOR>::Tvmult (VECTOR &dst,
const VECTOR &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
- matrix->Tvmult (dst, src);
+ Assert (m != 0, ExcNotInitialized());
+ m->Tvmult (dst, src);
}
PointerMatrix<MATRIX, VECTOR>::vmult_add (VECTOR &dst,
const VECTOR &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
- matrix->vmult_add (dst, src);
+ Assert (m != 0, ExcNotInitialized());
+ m->vmult_add (dst, src);
}
PointerMatrix<MATRIX, VECTOR>::Tvmult_add (VECTOR &dst,
const VECTOR &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
- matrix->Tvmult_add (dst, src);
+ Assert (m != 0, ExcNotInitialized());
+ m->Tvmult_add (dst, src);
}
-template<class MATRIX, class VECTOR>
-inline typename PointerMatrix<MATRIX, VECTOR>::size_type
-PointerMatrix<MATRIX, VECTOR>::m () const
-{
- Assert (matrix != 0, ExcNotInitialized());
- return matrix->m();
-}
-
-
-template<class MATRIX, class VECTOR>
-inline typename PointerMatrix<MATRIX, VECTOR>::size_type
-PointerMatrix<MATRIX, VECTOR>::n () const
-{
- Assert (matrix != 0, ExcNotInitialized());
- return matrix->n();
-}
-
//----------------------------------------------------------------------//
VectorMemory<VECTOR> *mem,
const MATRIX *M)
: mem(mem, typeid(*this).name()),
- matrix(M, typeid(*this).name())
+ m(M, typeid(*this).name())
{
if (mem == 0) mem = &my_memory;
}
VectorMemory<VECTOR> *mem,
const char *name)
: mem(mem, name),
- matrix(0, name)
+ m(0, name)
{
if (mem == 0) mem = &my_memory;
}
const MATRIX *M,
const char *name)
: mem(mem, name),
- matrix(M, name)
+ m(M, name)
{
if (mem == 0) mem = &my_memory;
}
inline void
PointerMatrixAux<MATRIX, VECTOR>::clear ()
{
- matrix = 0;
+ m = 0;
}
inline const PointerMatrixAux<MATRIX, VECTOR> &
PointerMatrixAux<MATRIX, VECTOR>::operator= (const MATRIX *M)
{
- matrix = M;
+ m = M;
return *this;
}
inline bool
PointerMatrixAux<MATRIX, VECTOR>::empty () const
{
- if (matrix == 0)
+ if (m == 0)
return true;
- return matrix->empty();
+ return m->empty();
}
template<class MATRIX, class VECTOR>
if (mem == 0)
mem = &my_memory;
Assert (mem != 0, ExcNotInitialized());
- Assert (matrix != 0, ExcNotInitialized());
- matrix->vmult (dst, src);
+ Assert (m != 0, ExcNotInitialized());
+ m->vmult (dst, src);
}
if (mem == 0)
mem = &my_memory;
Assert (mem != 0, ExcNotInitialized());
- Assert (matrix != 0, ExcNotInitialized());
- matrix->Tvmult (dst, src);
+ Assert (m != 0, ExcNotInitialized());
+ m->Tvmult (dst, src);
}
if (mem == 0)
mem = &my_memory;
Assert (mem != 0, ExcNotInitialized());
- Assert (matrix != 0, ExcNotInitialized());
+ Assert (m != 0, ExcNotInitialized());
VECTOR *v = mem->alloc();
v->reinit(dst);
- matrix->vmult (*v, src);
+ m->vmult (*v, src);
dst += *v;
mem->free(v);
}
if (mem == 0)
mem = &my_memory;
Assert (mem != 0, ExcNotInitialized());
- Assert (matrix != 0, ExcNotInitialized());
+ Assert (m != 0, ExcNotInitialized());
VECTOR *v = mem->alloc();
v->reinit(dst);
- matrix->Tvmult (*v, src);
+ m->Tvmult (*v, src);
dst += *v;
mem->free(v);
}
-template<class MATRIX, class VECTOR>
-inline typename PointerMatrixAux<MATRIX, VECTOR>::size_type
-PointerMatrixAux<MATRIX, VECTOR>::m () const
-{
- Assert (matrix != 0, ExcNotInitialized());
- return matrix->m();
-}
-
-
-template<class MATRIX, class VECTOR>
-inline typename PointerMatrixAux<MATRIX, VECTOR>::size_type
-PointerMatrixAux<MATRIX, VECTOR>::n () const
-{
- Assert (matrix != 0, ExcNotInitialized());
- return matrix->n();
-}
-
-
//----------------------------------------------------------------------//
template<typename number>
PointerMatrixVector<number>::PointerMatrixVector (const Vector<number> *M)
- : matrix(M, typeid(*this).name())
+ : m(M, typeid(*this).name())
{}
template<typename number>
PointerMatrixVector<number>::PointerMatrixVector (const char *name)
- : matrix(0, name)
+ : m(0, name)
{}
PointerMatrixVector<number>::PointerMatrixVector (
const Vector<number> *M,
const char *name)
- : matrix(M, name)
+ : m(M, name)
{}
inline void
PointerMatrixVector<number>::clear ()
{
- matrix = 0;
+ m = 0;
}
inline const PointerMatrixVector<number> &
PointerMatrixVector<number>::operator= (const Vector<number> *M)
{
- matrix = M;
+ m = M;
return *this;
}
inline bool
PointerMatrixVector<number>::empty () const
{
- if (matrix == 0)
+ if (m == 0)
return true;
- return matrix->empty();
+ return m->empty();
}
template<typename number>
Vector<number> &dst,
const Vector<number> &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
+ Assert (m != 0, ExcNotInitialized());
Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1));
- dst(0) = *matrix * src;
+ dst(0) = *m * src;
}
Vector<number> &dst,
const Vector<number> &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
+ Assert (m != 0, ExcNotInitialized());
Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1));
- dst.equ (src(0), *matrix);
+ dst.equ (src(0), *m);
}
Vector<number> &dst,
const Vector<number> &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
+ Assert (m != 0, ExcNotInitialized());
Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1));
- dst(0) += *matrix * src;
+ dst(0) += *m * src;
}
Vector<number> &dst,
const Vector<number> &src) const
{
- Assert (matrix != 0, ExcNotInitialized());
+ Assert (m != 0, ExcNotInitialized());
Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1));
- dst.add (src(0), *matrix);
-}
-
-
-template<typename number>
-inline typename PointerMatrixVector<number>::size_type
-PointerMatrixVector<number>::m () const
-{
- Assert (matrix != 0, ExcNotInitialized());
- return matrix->m();
-}
-
-
-template<typename number>
-inline typename PointerMatrixVector<number>::size_type
-PointerMatrixVector<number>::n () const
-{
- Assert (matrix != 0, ExcNotInitialized());
- return matrix->n();
+ dst.add (src(0), *m);
}