FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Static Public Member Functions | List of all members
fei::MatrixTraits< T > Struct Template Reference

#include <fei_MatrixTraits.hpp>

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 ( )
inlinestatic
  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 
)
inlinestatic

Set a specified scalar value throughout the matrix.

Definition at line 66 of file fei_MatrixTraits.hpp.

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

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

Definition at line 72 of file fei_MatrixTraits.hpp.

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

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

Definition at line 78 of file fei_MatrixTraits.hpp.

template<typename T >
static int fei::MatrixTraits< T >::copyOutRow ( T *  mat,
int  row,
int  len,
double *  coefs,
int *  indices 
)
inlinestatic
  Given a locally-owned global row number, pass out a copy of the
  contents of that row.
Parameters
mat
rowGlobal row number
lenLength of the user-allocated arrays coefs and indices.
coefsUser-allocated array which will hold matrix coefficients on output.
indicesUser-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 93 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 
)
inlinestatic
  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 101 of file fei_MatrixTraits.hpp.

template<typename T >
static int fei::MatrixTraits< T >::globalAssemble ( T *  A)
inlinestatic

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 114 of file fei_MatrixTraits.hpp.

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

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 120 of file fei_MatrixTraits.hpp.


The documentation for this struct was generated from the following file: