*
* @author Wolfgang Bangerth 2001
*/
-template <class Matrix, class Vector=::Vector<typename Matrix::value_type> >
+template <class MATRIX, class VECTOR=Vector<typename MATRIX::value_type> >
class FilteredMatrix : public Subscriptor
{
public:
* analogy to the STL container
* classes.
*/
- typedef typename Matrix::value_type value_type;
+ typedef typename MATRIX::value_type value_type;
/**
* Typedef defining a type that
* Constructor. Use the given
* matrix for future operations.
*/
- FilteredMatrix (const Matrix &matrix);
+ FilteredMatrix (const MATRIX &matrix);
/**
* Copy operator. Take over
* function if constraits were
* previously added.
*/
- void set_referenced_matrix (const Matrix &m);
+ void set_referenced_matrix (const MATRIX &m);
/**
* Return a reference to the
* matrix that is used by this
* object.
*/
- const Matrix & get_referenced_matrix () const;
+ const MATRIX & get_referenced_matrix () const;
/**
* Add a list of constraints to
* parameter to @p{true} to use a
* faster algorithm.
*/
- void apply_constraints (Vector &v,
+ void apply_constraints (VECTOR &v,
const bool matrix_is_symmetric) const;
/**
* matrix is the filtered one to
* which we store a reference.)
*/
- void vmult (Vector &dst,
- const Vector &src) const;
+ void vmult (VECTOR &dst,
+ const VECTOR &src) const;
/**
* Matrix-vector multiplication:
* function only works for square
* matrices.
*/
- void Tvmult (Vector &dst,
- const Vector &src) const;
+ void Tvmult (VECTOR &dst,
+ const VECTOR &src) const;
/**
* Return the square of the norm
* have eliminated Dirichlet
* boundary values.
*/
- value_type matrix_norm_square (const Vector &v) const;
+ value_type matrix_norm_square (const VECTOR &v) const;
/**
* Compute the residual of an
* do not contribute to the
* residual at all.
*/
- value_type residual (Vector &dst,
- const Vector &x,
- const Vector &b) const;
+ value_type residual (VECTOR &dst,
+ const VECTOR &x,
+ const VECTOR &b) const;
/**
* Apply the Jacobi
* multiplies the result with the
* damping factor @p{omega}.
*/
- void precondition_Jacobi (Vector &dst,
- const Vector &src,
+ void precondition_Jacobi (VECTOR &dst,
+ const VECTOR &src,
const value_type omega = 1.) const;
/**
* it using the @p{SmartPointer}
* class.
*/
- SmartPointer<const Matrix> matrix;
+ SmartPointer<const MATRIX> matrix;
/**
* Sorted list of pairs denoting
* have to synchronise access to
* this vector.
*/
- mutable Vector tmp_vector;
+ mutable VECTOR tmp_vector;
/**
* Mutex used to synchronise use
* that belong to constrained
* degrees of freedom.
*/
- void pre_filter (Vector &v) const;
+ void pre_filter (VECTOR &v) const;
/**
* Do the postfiltering step,
* diagonal for these degrees of
* freedom.
*/
- void post_filter (const Vector &in,
- Vector &out) const;
+ void post_filter (const VECTOR &in,
+ VECTOR &out) const;
/**
* Based on the size of the
* algorithm.
*
* This function needs to be
- * specialised for the different
+ * specialized for the different
* matrix types.
*/
void get_column_entries (const unsigned int index,
/*---------------------- Inline functions -----------------------------------*/
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
inline
bool
-FilteredMatrix<Matrix,Vector>::PairComparison::
+FilteredMatrix<MATRIX,VECTOR>::PairComparison::
operator () (const IndexValuePair &i1,
const IndexValuePair &i2) const
{
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
template <class ConstraintList>
void
-FilteredMatrix<Matrix,Vector>::
+FilteredMatrix<MATRIX,VECTOR>::
add_constraints (const ConstraintList &new_constraints)
{
// add new constraints to end
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
inline
-const Matrix &
-FilteredMatrix<Matrix,Vector>::get_referenced_matrix () const
+const MATRIX &
+FilteredMatrix<MATRIX,VECTOR>::get_referenced_matrix () const
{
return *matrix;
}
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
inline
-unsigned int FilteredMatrix<Matrix,Vector>::m () const
+unsigned int FilteredMatrix<MATRIX,VECTOR>::m () const
{
return matrix->m();
}
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
inline
-unsigned int FilteredMatrix<Matrix,Vector>::n () const
+unsigned int FilteredMatrix<MATRIX,VECTOR>::n () const
{
return matrix->n();
}
-//---------------------------- filtered_matrix.templates.h ---------------------------
+//----------------------------------------------------------------------------
// $Id$
// Version: $Name$
//
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
-//---------------------------- filtered_matrix.templates.h ---------------------------
+//----------------------------------------------------------------------------
#ifndef __deal2__filtered_matrix_templates_h
#define __deal2__filtered_matrix_templates_h
#include <lac/block_vector.h>
-template <class Matrix, class Vector>
-FilteredMatrix<Matrix,Vector>::
+template <class MATRIX, class VECTOR>
+FilteredMatrix<MATRIX,VECTOR>::
FilteredMatrix ()
{}
-template <class Matrix, class Vector>
-FilteredMatrix<Matrix,Vector>::
+template <class MATRIX, class VECTOR>
+FilteredMatrix<MATRIX,VECTOR>::
FilteredMatrix (const FilteredMatrix &fm)
:
Subscriptor (),
-template <class Matrix, class Vector>
-FilteredMatrix<Matrix,Vector>::
-FilteredMatrix (const Matrix &m)
+template <class MATRIX, class VECTOR>
+FilteredMatrix<MATRIX,VECTOR>::
+FilteredMatrix (const MATRIX &m)
{
set_referenced_matrix (m);
}
-template <class Matrix, class Vector>
-FilteredMatrix<Matrix,Vector> &
-FilteredMatrix<Matrix,Vector>::operator = (const FilteredMatrix &fm)
+template <class MATRIX, class VECTOR>
+FilteredMatrix<MATRIX,VECTOR> &
+FilteredMatrix<MATRIX,VECTOR>::operator = (const FilteredMatrix &fm)
{
set_referenced_matrix (*fm.matrix);
constraints = fm.constraints;
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::
-set_referenced_matrix (const Matrix &m)
+FilteredMatrix<MATRIX,VECTOR>::
+set_referenced_matrix (const MATRIX &m)
{
matrix = &m;
allocate_tmp_vector ();
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::clear_constraints ()
+FilteredMatrix<MATRIX,VECTOR>::clear_constraints ()
{
// swap vectors to release memory
std::vector<IndexValuePair> empty;
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::
-apply_constraints (Vector &v,
+FilteredMatrix<MATRIX,VECTOR>::
+apply_constraints (VECTOR &v,
const bool matrix_is_symmetric) const
{
// array that will hold the pairs
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::pre_filter (Vector &v) const
+FilteredMatrix<MATRIX,VECTOR>::pre_filter (VECTOR &v) const
{
// iterate over all constraints and
// zero out value
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::post_filter (const Vector &in,
- Vector &out) const
+FilteredMatrix<MATRIX,VECTOR>::post_filter (const VECTOR &in,
+ VECTOR &out) const
{
// iterate over all constraints and
// set value correctly
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::vmult (Vector &dst,
- const Vector &src) const
+FilteredMatrix<MATRIX,VECTOR>::vmult (VECTOR &dst,
+ const VECTOR &src) const
{
tmp_mutex.acquire ();
// first copy over src vector and
-template <class Matrix, class Vector>
-typename FilteredMatrix<Matrix,Vector>::value_type
-FilteredMatrix<Matrix,Vector>::residual (Vector &dst,
- const Vector &x,
- const Vector &b) const
+template <class MATRIX, class VECTOR>
+typename FilteredMatrix<MATRIX,VECTOR>::value_type
+FilteredMatrix<MATRIX,VECTOR>::residual (VECTOR &dst,
+ const VECTOR &x,
+ const VECTOR &b) const
{
tmp_mutex.acquire ();
// first copy over x vector and
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::Tvmult (Vector &dst,
- const Vector &src) const
+FilteredMatrix<MATRIX,VECTOR>::Tvmult (VECTOR &dst,
+ const VECTOR &src) const
{
tmp_mutex.acquire ();
// first copy over src vector and
-template <class Matrix, class Vector>
-typename FilteredMatrix<Matrix,Vector>::value_type
-FilteredMatrix<Matrix,Vector>::matrix_norm_square (const Vector &v) const
+template <class MATRIX, class VECTOR>
+typename FilteredMatrix<MATRIX,VECTOR>::value_type
+FilteredMatrix<MATRIX,VECTOR>::matrix_norm_square (const VECTOR &v) const
{
tmp_mutex.acquire ();
tmp_vector = v;
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
void
-FilteredMatrix<Matrix,Vector>::
-precondition_Jacobi (Vector &dst,
- const Vector &src,
+FilteredMatrix<MATRIX,VECTOR>::
+precondition_Jacobi (VECTOR &dst,
+ const VECTOR &src,
const value_type omega) const
{
// first precondition as usual,
-template <class Matrix, class Vector>
+template <class MATRIX, class VECTOR>
unsigned int
-FilteredMatrix<Matrix,Vector>::memory_consumption () const
+FilteredMatrix<MATRIX,VECTOR>::memory_consumption () const
{
return (MemoryConsumption::memory_consumption (matrix) +
MemoryConsumption::memory_consumption (constraints) +