FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_MatrixTraits_LinSysCore.hpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _fei_MatrixTraits_LinSysCore_hpp_
10 #define _fei_MatrixTraits_LinSysCore_hpp_
11 
12 //This file defines matrix traits for LinearSystemCore matrices
13 //(well, "matrix-views" to be more precise).
14 //
15 
16 #include <fei_LinearSystemCore.hpp>
17 
18 namespace fei {
19 
21  template<>
22  struct MatrixTraits<LinearSystemCore> {
23 
25  static const char* typeName()
26  { return("LinearSystemCore"); }
27 
28  static double* getBeginPointer(LinearSystemCore* lsc)
29  {
30  return lsc->getMatrixBeginPointer();
31  }
32 
33  static int getOffset(LinearSystemCore* lsc, int row, int col)
34  {
35  return lsc->getMatrixOffset(row,col);
36  }
37 
40  static int setValues(LinearSystemCore* lsc, double scalar)
41  {
42  return( lsc->resetMatrix(scalar) );
43  }
44 
48  static int getNumLocalRows(LinearSystemCore* lsc, int& numRows)
49  {
50  numRows = -1;
51  return(-1);
52  }
53 
56  static int getRowLength(LinearSystemCore* lsc, int row, int& length)
57  {
58  return( lsc->getMatrixRowLength(row, length) );
59  }
60 
73  static int copyOutRow(LinearSystemCore* lsc,
74  int row, int len, double* coefs, int* indices)
75  {
76  int dummy;
77  return( lsc->getMatrixRow(row, coefs, indices, len, dummy) );
78  }
79 
82  static int putValuesIn(LinearSystemCore* lsc,
83  int numRows, const int* rows,
84  int numCols, const int* cols,
85  const double* const* values,
86  bool sum_into)
87  {
88  if (sum_into) {
89  return( lsc->sumIntoSystemMatrix(numRows, rows,
90  numCols, cols, values) );
91  }
92  else {
93  return( lsc->putIntoSystemMatrix(numRows, rows,
94  numCols, cols, values) );
95  }
96  }
97 
102  static int globalAssemble(LinearSystemCore* lsc)
103  {
104  return( lsc->matrixLoadComplete() );
105  }
106 
108  static int matvec(LinearSystemCore* lsc,
109  fei::Vector* x,
110  fei::Vector* y)
111  {
112  return( -1 );
113  }
114  };//struct MatrixTraits
115 }//namespace fei
116 
117 #endif // _fei_MatrixTraits_LinSysCore_hpp_
virtual int sumIntoSystemMatrix(int numPtRows, const int *ptRows, int numPtCols, const int *ptCols, int numBlkRows, const int *blkRows, int numBlkCols, const int *blkCols, const double *const *values)=0
static const char * typeName()
virtual int resetMatrix(double s)=0
static int matvec(T *A, fei::Vector *x, fei::Vector *y)
virtual int getMatrixRowLength(int row, int &length)=0
static int getRowLength(T *mat, int row, int &length)
static int getNumLocalRows(T *mat, int &numRows)
virtual int putIntoSystemMatrix(int numPtRows, const int *ptRows, int numPtCols, const int *ptCols, const double *const *values)=0
virtual int matrixLoadComplete()=0
static int setValues(T *mat, double scalar)
static int copyOutRow(T *mat, int row, int len, double *coefs, int *indices)
virtual int getMatrixRow(int row, double *coefs, int *indices, int len, int &rowLength)=0
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)