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 
00028     static double* getBeginPointer(LinearSystemCore* lsc)
00029       {
00030          return lsc->getMatrixBeginPointer();
00031       }
00032 
00033     static int getOffset(LinearSystemCore* lsc, int row, int col)
00034       {
00035          return lsc->getMatrixOffset(row,col);
00036       }
00037 
00040     static int setValues(LinearSystemCore* lsc, double scalar)
00041       {
00042   return( lsc->resetMatrix(scalar) );
00043       }
00044 
00048     static int getNumLocalRows(LinearSystemCore* lsc, int& numRows)
00049     {
00050       numRows = -1;
00051       return(-1);
00052     }
00053 
00056     static int getRowLength(LinearSystemCore* lsc, int row, int& length)
00057       {
00058   return( lsc->getMatrixRowLength(row, length) );
00059       }
00060 
00073     static int copyOutRow(LinearSystemCore* lsc,
00074           int row, int len, double* coefs, int* indices)
00075       {
00076         int dummy;
00077   return( lsc->getMatrixRow(row, coefs, indices, len, dummy) );
00078       }
00079 
00082     static int putValuesIn(LinearSystemCore* lsc,
00083                            int numRows, const int* rows,
00084                            int numCols, const int* cols,
00085                            const double* const* values,
00086                            bool sum_into)
00087       {
00088         if (sum_into) {
00089           return( lsc->sumIntoSystemMatrix(numRows, rows,
00090                                            numCols, cols, values) );
00091         }
00092         else {
00093     return( lsc->putIntoSystemMatrix(numRows, rows,
00094                                            numCols, cols, values) );
00095         }
00096       }
00097 
00102     static int globalAssemble(LinearSystemCore* lsc)
00103     {
00104       return( lsc->matrixLoadComplete() );
00105     }
00106 
00108     static int matvec(LinearSystemCore* lsc,
00109           fei::Vector* x,
00110           fei::Vector* y)
00111     {
00112       return( -1 );
00113     }
00114   };//struct MatrixTraits
00115 }//namespace fei
00116 
00117 #endif // _fei_MatrixTraits_LinSysCore_hpp_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends