FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_MatrixTraits_LinProbMgr.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_LinProbMgr_hpp_
10 #define _fei_MatrixTraits_LinProbMgr_hpp_
11 
12 //This file defines matrix traits for LinearProblemManager matrix
13 //representations.
14 //
15 
16 #include <fei_LinearProblemManager.hpp>
17 
18 namespace fei {
19 
21  template<>
23 
25  static const char* typeName()
26  { return("fei::LinearProblemManager"); }
27 
28  static double* getBeginPointer(fei::LinearProblemManager* /*mat*/)
29  {
30  return NULL;
31  }
32 
33  static int getOffset(fei::LinearProblemManager* /*mat*/, int /*row*/, int /*col*/)
34  {
35  return -1;
36  }
37 
40  static int setValues(fei::LinearProblemManager* mat, double scalar)
41  {
42  mat->setMatrixValues(scalar);
43  return(0);
44  }
45 
49  static int getNumLocalRows(fei::LinearProblemManager* mat, int& numRows)
50  {
51  numRows = mat->getLocalNumRows();
52  return(0);
53  }
54 
57  static int getRowLength(fei::LinearProblemManager* mat, int row, int& length)
58  {
59  length = mat->getRowLength(row);
60  if (length < 0) return(length);
61  return(0);
62  }
63 
77  int row, int len, double* coefs, int* indices)
78  {
79  return( mat->copyOutMatrixRow(row, len, coefs, indices) );
80  }
81 
85  int numRows, const int* rows,
86  int numCols, const int* cols,
87  const double* const* values,
88  bool sum_into)
89  {
90  return( mat->insertMatrixValues(numRows, rows,
91  numCols, cols,
92  values, sum_into) );
93  }
94 
99  {
100  return( mat->globalAssemble() );
101  }
102 
105  fei::Vector* x,
106  fei::Vector* y)
107  {
108  return( -1 );
109  }
110  };//struct MatrixTraits
111 }//namespace fei
112 
113 #endif // _fei_MatrixTraits_LinProbMgr_hpp_
114 
static int copyOutRow(fei::LinearProblemManager *mat, int row, int len, double *coefs, int *indices)
static int globalAssemble(fei::LinearProblemManager *mat)
virtual int insertMatrixValues(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sum_into)=0
virtual int copyOutMatrixRow(int row, int len, double *coefs, int *indices)=0
virtual int getLocalNumRows()=0
static int getRowLength(fei::LinearProblemManager *mat, int row, int &length)
static int matvec(fei::LinearProblemManager *mat, fei::Vector *x, fei::Vector *y)
virtual void setMatrixValues(double scalar)=0
static int setValues(fei::LinearProblemManager *mat, double scalar)
static int getNumLocalRows(fei::LinearProblemManager *mat, int &numRows)
virtual int getRowLength(int row)=0
static int putValuesIn(fei::LinearProblemManager *mat, int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sum_into)
virtual int globalAssemble()=0