Public Member Functions | Private Member Functions | Private Attributes | List of all members
oomph::MatrixVectorProduct Class Reference

Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product methods. This allows the epetra matrix to be assembled once and the matrix vector product to be performed many times. More...

#include <matrix_vector_product.h>

+ Inheritance diagram for oomph::MatrixVectorProduct:

Public Member Functions

 MatrixVectorProduct ()
 Constructor. More...
 
 MatrixVectorProduct (const MatrixVectorProduct &)
 Broken copy constructor. More...
 
void operator= (const MatrixVectorProduct &)
 Broken assignment operator. More...
 
 ~MatrixVectorProduct ()
 Destructor. More...
 
void clean_up_memory ()
 clear the memory More...
 
void setup (CRDoubleMatrix *matrix_pt, const LinearAlgebraDistribution *col_dist_pt=0)
 Setup the matrix vector product operator. WARNING: This class is wrapper to Trilinos Epetra matrix vector multiply methods, if Trilinos is not installed then this class will function as expected, but there will be no computational speed gain. By default the Epetra_CrsMatrix::multiply(...) are employed. The optional argument col_dist_pt is the distribution of: x if using multiply(...) or y if using multiply_transpose(...) where this is A x = y. By default, this is assumed to the uniformly distributed based on matrix_pt->ncol(). More...
 
void multiply (const DoubleVector &x, DoubleVector &y) const
 Apply the operator to the vector x and return the result in the vector y. More...
 
void multiply_transpose (const DoubleVector &x, DoubleVector &y) const
 Apply the transpose of the operator to the vector x and return the result in the vector y. More...
 
const unsigned & ncol () const
 Access function to the number of columns. More...
 
- Public Member Functions inherited from oomph::DistributableLinearAlgebraObject
 DistributableLinearAlgebraObject ()
 Default constructor - create a distribution. More...
 
 DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)
 Broken copy constructor. More...
 
void operator= (const DistributableLinearAlgebraObject &)
 Broken assignment operator. More...
 
virtual ~DistributableLinearAlgebraObject ()
 Destructor. More...
 
LinearAlgebraDistributiondistribution_pt () const
 access to the LinearAlgebraDistribution More...
 
unsigned nrow () const
 access function to the number of global rows. More...
 
unsigned nrow_local () const
 access function for the num of local rows on this processor. More...
 
unsigned nrow_local (const unsigned &p) const
 access function for the num of local rows on this processor. More...
 
unsigned first_row () const
 access function for the first row on this processor More...
 
unsigned first_row (const unsigned &p) const
 access function for the first row on this processor More...
 
bool distributed () const
 distribution is serial or distributed More...
 
bool distribution_built () const
 
void build_distribution (const LinearAlgebraDistribution *const dist_pt)
 setup the distribution of this distributable linear algebra object More...
 
void build_distribution (const LinearAlgebraDistribution &dist)
 setup the distribution of this distributable linear algebra object More...
 

Private Member Functions

void trilinos_multiply_helper (const DoubleVector &x, DoubleVector &y) const
 Helper function for multiply(...) More...
 
void trilinos_multiply_transpose_helper (const DoubleVector &x, DoubleVector &y) const
 Helper function for multiply_transpose(...) More...
 

Private Attributes

Epetra_CrsMatrix * Epetra_matrix_pt
 The Epetra version of the matrix. More...
 
bool Using_trilinos
 boolean indicating whether we are using trilinos to perform matvec More...
 
CRDoubleMatrixOomph_matrix_pt
 an oomph-lib matrix More...
 
LinearAlgebraDistributionColumn_distribution_pt
 The distribution of: x if using multiply(...) or y if using multiply_transpose(...) where this is A x = y. More...
 
unsigned Ncol
 number of columns of the matrix More...
 

Additional Inherited Members

- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 clear the distribution of this distributable linear algebra object More...
 

Detailed Description

Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product methods. This allows the epetra matrix to be assembled once and the matrix vector product to be performed many times.

Definition at line 55 of file matrix_vector_product.h.

Constructor & Destructor Documentation

oomph::MatrixVectorProduct::MatrixVectorProduct ( )
inline

Constructor.

Definition at line 61 of file matrix_vector_product.h.

References Column_distribution_pt, Epetra_matrix_pt, and Oomph_matrix_pt.

oomph::MatrixVectorProduct::MatrixVectorProduct ( const MatrixVectorProduct )
inline

Broken copy constructor.

Definition at line 72 of file matrix_vector_product.h.

References oomph::BrokenCopy::broken_copy().

oomph::MatrixVectorProduct::~MatrixVectorProduct ( )
inline

Destructor.

Definition at line 84 of file matrix_vector_product.h.

References clean_up_memory().

Member Function Documentation

void oomph::MatrixVectorProduct::clean_up_memory ( )
inline
void oomph::MatrixVectorProduct::multiply ( const DoubleVector x,
DoubleVector y 
) const
void oomph::MatrixVectorProduct::multiply_transpose ( const DoubleVector x,
DoubleVector y 
) const
const unsigned& oomph::MatrixVectorProduct::ncol ( ) const
inline

Access function to the number of columns.

Definition at line 123 of file matrix_vector_product.h.

References Ncol.

void oomph::MatrixVectorProduct::operator= ( const MatrixVectorProduct )
inline

Broken assignment operator.

Definition at line 78 of file matrix_vector_product.h.

References oomph::BrokenCopy::broken_assign().

void oomph::MatrixVectorProduct::setup ( CRDoubleMatrix matrix_pt,
const LinearAlgebraDistribution col_dist_pt = 0 
)

Setup the matrix vector product operator. WARNING: This class is wrapper to Trilinos Epetra matrix vector multiply methods, if Trilinos is not installed then this class will function as expected, but there will be no computational speed gain. By default the Epetra_CrsMatrix::multiply(...) are employed. The optional argument col_dist_pt is the distribution of: x if using multiply(...) or y if using multiply_transpose(...) where this is A x = y. By default, this is assumed to the uniformly distributed based on matrix_pt->ncol().

Definition at line 47 of file matrix_vector_product.cc.

References oomph::DistributableLinearAlgebraObject::build_distribution(), clean_up_memory(), Column_distribution_pt, oomph::LinearAlgebraDistribution::communicator_pt(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Epetra_matrix_pt, oomph::MPI_Helpers::mpi_has_been_initialised(), Ncol, oomph::CRDoubleMatrix::ncol(), oomph::oomph_info, Oomph_matrix_pt, oomph::TimingHelpers::timer(), and Using_trilinos.

Referenced by oomph::BlockPreconditioner< CRDoubleMatrix >::setup_matrix_vector_product().

void oomph::MatrixVectorProduct::trilinos_multiply_helper ( const DoubleVector x,
DoubleVector y 
) const
private

Helper function for multiply(...)

Apply the operator to the vector x and return the result in the vector y (helper function)

Definition at line 248 of file matrix_vector_product.cc.

References oomph::TrilinosEpetraHelpers::copy_to_oomphlib_vector(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_vector(), and Epetra_matrix_pt.

Referenced by multiply().

void oomph::MatrixVectorProduct::trilinos_multiply_transpose_helper ( const DoubleVector x,
DoubleVector y 
) const
private

Helper function for multiply_transpose(...)

Apply the transpose of the operator to the vector x and return the result in the vector y (helper function)

Definition at line 296 of file matrix_vector_product.cc.

References oomph::TrilinosEpetraHelpers::copy_to_oomphlib_vector(), and oomph::TrilinosEpetraHelpers::create_distributed_epetra_vector().

Referenced by multiply_transpose().

Member Data Documentation

LinearAlgebraDistribution* oomph::MatrixVectorProduct::Column_distribution_pt
private

The distribution of: x if using multiply(...) or y if using multiply_transpose(...) where this is A x = y.

Definition at line 152 of file matrix_vector_product.h.

Referenced by clean_up_memory(), MatrixVectorProduct(), multiply(), multiply_transpose(), and setup().

Epetra_CrsMatrix* oomph::MatrixVectorProduct::Epetra_matrix_pt
private

The Epetra version of the matrix.

Definition at line 140 of file matrix_vector_product.h.

Referenced by clean_up_memory(), MatrixVectorProduct(), setup(), and trilinos_multiply_helper().

unsigned oomph::MatrixVectorProduct::Ncol
private

number of columns of the matrix

Definition at line 155 of file matrix_vector_product.h.

Referenced by ncol(), and setup().

CRDoubleMatrix* oomph::MatrixVectorProduct::Oomph_matrix_pt
private

an oomph-lib matrix

Definition at line 148 of file matrix_vector_product.h.

Referenced by clean_up_memory(), MatrixVectorProduct(), multiply(), multiply_transpose(), and setup().

bool oomph::MatrixVectorProduct::Using_trilinos
private

boolean indicating whether we are using trilinos to perform matvec

Definition at line 145 of file matrix_vector_product.h.

Referenced by multiply(), multiply_transpose(), and setup().


The documentation for this class was generated from the following files: