fei::MatrixTraits< T > Struct Template Reference

#include <fei_MatrixTraits.hpp>

List of all members.

Static Public Member Functions

static const char * typeName ()
static int setValues (T *mat, double scalar)
static int getNumLocalRows (T *mat, int &numRows)
static int getRowLength (T *mat, int row, int &length)
static int copyOutRow (T *mat, int row, int len, double *coefs, int *indices)
static int putValuesIn (T *mat, int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sum_into)
static int globalAssemble (T *A)
static int matvec (T *A, fei::Vector *x, fei::Vector *y)


Detailed Description

template<typename T>
struct fei::MatrixTraits< T >

Define a struct of matrix access traits. The fei matrix implementation class fei::Matrix_Impl is essentially a filter which passes data to library-specific matrix objects (such as Trilinos/Epetra's Epetra_CrsMatrix). fei::Matrix_Impl is a template, and the template parameter is the matrix object. In order to use an arbitrary matrix object with fei::Matrix_Impl, it is only necessary to define a specialization of this MatrixTraits struct for the matrix object.

For an example specialization, see support-Trilinos/fei_MatrixTraits_Epetra.hpp.

This "base" MatrixTraits struct provides function stubs for default type "T", which will catch the use of any matrix type for which specialized traits have not been defined.

Note: Several functions accept row-numbers and/or column-numbers. These are always global indices. In a parallel setting, the fei defines a global set of row-indices which are partitioned across processors so that each processor owns a unique subset of the global row space. (Ownership of column-indices is not unique, a given column-index may appear in rows on multiple processors.)

Note2: Implementers can safely assume that these functions will only be called with locally-owned row-numbers.

Definition at line 45 of file fei_MatrixTraits.hpp.


Member Function Documentation

template<typename T>
static const char* fei::MatrixTraits< T >::typeName (  )  [inline, static]

Return a string type-name for the underlying matrix. May appear in debug-output logs, etc. Does not need to exactly correspond to the type, but should be descriptive.

Definition at line 51 of file fei_MatrixTraits.hpp.

template<typename T>
static int fei::MatrixTraits< T >::setValues ( T *  mat,
double  scalar 
) [inline, static]

Set a specified scalar value throughout the matrix.

Definition at line 56 of file fei_MatrixTraits.hpp.

template<typename T>
static int fei::MatrixTraits< T >::getNumLocalRows ( T *  mat,
int &  numRows 
) [inline, static]

Query the number of local rows. This is expected to be the number of point-entry rows on the local processor.

Definition at line 62 of file fei_MatrixTraits.hpp.

template<typename T>
static int fei::MatrixTraits< T >::getRowLength ( T *  mat,
int  row,
int &  length 
) [inline, static]

Given a locally-owned global row number, query the length (number of nonzeros) of that row.

Definition at line 68 of file fei_MatrixTraits.hpp.

template<typename T>
static int fei::MatrixTraits< T >::copyOutRow ( T *  mat,
int  row,
int  len,
double *  coefs,
int *  indices 
) [inline, static]

Given a locally-owned global row number, pass out a copy of the contents of that row.

Parameters:
mat 
row Global row number
len Length of the user-allocated arrays coefs and indices.
coefs User-allocated array which will hold matrix coefficients on output.
indices User-allocated array which will hold column-indices on output.
Returns:
error-code 0 if successful. Non-zero return-value may indicate that the specified row is not locally owned.

Definition at line 83 of file fei_MatrixTraits.hpp.

template<typename T>
static int fei::MatrixTraits< T >::putValuesIn ( T *  mat,
int  numRows,
const int *  rows,
int  numCols,
const int *  cols,
const double *const *  values,
bool  sum_into 
) [inline, static]

Sum a C-style table of coefficient data into the underlying matrix. This is a rectangular array of coefficients for rows/columns defined by the 'rows' and 'cols' lists.

Definition at line 91 of file fei_MatrixTraits.hpp.

template<typename T>
static int fei::MatrixTraits< T >::globalAssemble ( T *  A  )  [inline, static]

Perform any necessary internal communications/synchronizations or other operations appropriate at end of data input. For some implementations this will be a no-op, so this "default implementation" returns 0. (The Trilinos/Epetra traits specialization calls A->FillComplete() at this point.)

Definition at line 104 of file fei_MatrixTraits.hpp.

template<typename T>
static int fei::MatrixTraits< T >::matvec ( T *  A,
fei::Vector x,
fei::Vector y 
) [inline, static]

Compute the matrix-vector product y = A*x. It is expected that the underlying matrix object will form the local portion of the result 'y' on the local processor.

Definition at line 110 of file fei_MatrixTraits.hpp.


The documentation for this struct was generated from the following file:
Generated on Wed May 12 01:33:52 2010 for FEI by  doxygen 1.4.7