Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

LocalMatrix.h

Go to the documentation of this file.
00001 #ifndef LOCALMATRIX_H
00002 #define LOCALMATRIX_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "DenseSerialVector.h"
00007 #include "TSFArray.h"
00008 
00009 
00010 namespace Sundance
00011 {
00012 
00013   using namespace TSF;
00014   using std::string;
00015 
00016   using std::ostream;
00017 
00018 
00019   /** \ingroup LowLevelFE
00020    * Storage for an element stiffness matrix
00021    */
00022 
00023   class LocalMatrix
00024     {
00025     public:
00026       /** */
00027       LocalMatrix() : a_(), nRows_(0), nCols_(0) {;}
00028       /** */
00029       LocalMatrix(int nRow, int nCol)
00030         : a_(nRow*nCol), nRows_(nRow), nCols_(nCol) {;}
00031 
00032       /** */
00033       void resize(int nRow, int nCol)
00034         {
00035           a_.resize(nRow*nCol);
00036           a_.zero();
00037           nRows_=nRow;
00038           nCols_=nCol;
00039         }
00040 
00041       /** */
00042       int nRows() const {return nRows_;}
00043 
00044       /** */
00045       int nCols() const {return nCols_;}
00046 
00047       /** */
00048       void getRowValues(int r, const double& f,
00049                         TSFArray<double>& vals) const ;
00050 
00051       /** */
00052       void getSymmetricRowValues(int r, const double& f,
00053                                  TSFArray<double>& vals) const ;
00054 
00055       /** */
00056       void getTransposedRowValues(int r, const double& f,
00057                                   TSFArray<double>& vals) const ;
00058 
00059       /** */
00060       const double& operator()(int i, int j) const {return a_[i*nCols_ + j];}
00061       /** */
00062       double& operator()(int i, int j) {return a_[i*nCols_ + j];}
00063 
00064       /** */
00065       string toString() const ;
00066 
00067 
00068     private:
00069       DenseSerialVector a_;
00070       int nRows_;
00071       int nCols_;
00072     };
00073 
00074 
00075   ostream& operator<<(ostream& os, const LocalMatrix& A);
00076 
00077 }
00078 #endif

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by