FEI Version of the Day
fei_MatrixTraits_LinSysCore.hpp
00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _fei_MatrixTraits_LinSysCore_hpp_
00010 #define _fei_MatrixTraits_LinSysCore_hpp_
00011 
00012 //This file defines matrix traits for LinearSystemCore matrices
00013 //(well, "matrix-views" to be more precise).
00014 //
00015 
00016 #include <fei_LinearSystemCore.hpp>
00017 
00018 namespace fei {
00019 
00021   template<>
00022   struct MatrixTraits<LinearSystemCore> {
00023 
00025     static const char* typeName()
00026       { return("LinearSystemCore"); }
00027 
00030     static int setValues(LinearSystemCore* lsc, double scalar)
00031       {
00032   return( lsc->resetMatrix(scalar) );
00033       }
00034 
00038     static int getNumLocalRows(LinearSystemCore* lsc, int& numRows)
00039     {
00040       numRows = -1;
00041       return(-1);
00042     }
00043 
00046     static int getRowLength(LinearSystemCore* lsc, int row, int& length)
00047       {
00048   return( lsc->getMatrixRowLength(row, length) );
00049       }
00050 
00063     static int copyOutRow(LinearSystemCore* lsc,
00064           int row, int len, double* coefs, int* indices)
00065       {
00066         int dummy;
00067   return( lsc->getMatrixRow(row, coefs, indices, len, dummy) );
00068       }
00069 
00072     static int putValuesIn(LinearSystemCore* lsc,
00073                            int numRows, const int* rows,
00074                            int numCols, const int* cols,
00075                            const double* const* values,
00076                            bool sum_into)
00077       {
00078         if (sum_into) {
00079           return( lsc->sumIntoSystemMatrix(numRows, rows,
00080                                            numCols, cols, values) );
00081         }
00082         else {
00083     return( lsc->putIntoSystemMatrix(numRows, rows,
00084                                            numCols, cols, values) );
00085         }
00086       }
00087 
00092     static int globalAssemble(LinearSystemCore* lsc)
00093     {
00094       return( lsc->matrixLoadComplete() );
00095     }
00096 
00098     static int matvec(LinearSystemCore* lsc,
00099           fei::Vector* x,
00100           fei::Vector* y)
00101     {
00102       return( -1 );
00103     }
00104   };//struct MatrixTraits
00105 }//namespace fei
00106 
00107 #endif // _fei_MatrixTraits_LinSysCore_hpp_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends