fei_Matrix_Local.hpp

00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2007 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_Matrix_Local_hpp_
00010 #define _fei_Matrix_Local_hpp_
00011 
00012 #include <fei_SharedPtr.hpp>
00013 #include <fei_MatrixGraph.hpp>
00014 #include <fei_Matrix.hpp>
00015 #include <fei_SparseRowGraph.hpp>
00016 
00017 #include <vector>
00018 
00019 namespace fei {
00020 class Matrix_Local : public fei::Matrix {
00021  public:
00022   Matrix_Local(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00023                fei::SharedPtr<fei::SparseRowGraph> sparseRowGraph);
00024 
00025   virtual ~Matrix_Local();
00026 
00027   static fei::SharedPtr<fei::Matrix>
00028     create_Matrix_Local(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00029                         bool blockEntry);
00030 
00031   const char* typeName();
00032 
00035   int parameters(const fei::ParameterSet& paramset);
00036 
00039   int parameters(int numParams, const char* const* paramStrings);
00040 
00042     fei::SharedPtr<fei::MatrixGraph> getMatrixGraph();
00043 
00045     void setMatrixGraph(fei::SharedPtr<fei::MatrixGraph> matrixGraph);
00046 
00049     int getGlobalNumRows() const;
00050 
00053     int getLocalNumRows() const;
00054 
00060     int getRowLength(int row, int& length) const;
00061 
00063     int putScalar(double scalar);
00064 
00074     int copyOutRow(int row, int len, double* coefs, int* indices) const;
00075 
00088     int sumIn(int numRows, const int* rows,
00089                       int numCols, const int* cols,
00090                       const double* const* values,
00091                       int format=0);
00092 
00105     int copyIn(int numRows, const int* rows,
00106                        int numCols, const int* cols,
00107                        const double* const* values,
00108                       int format=0);
00109 
00125     int sumInFieldData(int fieldID,
00126                                int idType,
00127                                int rowID,
00128                                int colID,
00129                                const double* const* data,
00130                                int format=0);
00131 
00149     int sumInFieldData(int fieldID,
00150                                int idType,
00151                                int rowID,
00152                                int colID,
00153                                const double* data,
00154                                int format=0);
00155 
00165     int sumIn(int blockID, int connectivityID,
00166                       const double* const* values,
00167                       int format=0);
00168 
00173     int globalAssemble();
00174 
00177     int multiply(fei::Vector* x,
00178                          fei::Vector* y);
00179 
00185     int gatherFromOverlap(bool accumulate = true);
00186 
00202     int writeToFile(const char* filename,
00203                             bool matrixMarketFormat=true);
00204 
00217     int writeToStream(FEI_OSTREAM& ostrm,
00218                               bool matrixMarketFormat=true);
00219 
00222     bool usingBlockEntryStorage();
00223 
00228     void markState();
00229 
00234     bool changedSinceMark();
00235 
00236     const std::vector<int>& getRowNumbers() const;
00237 
00238     const std::vector<int>& getRowOffsets() const;
00239 
00240     const std::vector<int>& getColumnIndices() const;
00241 
00242     const std::vector<double>& getCoefs() const;
00243 
00244  private:
00245   int getRowIndex(int rowNumber) const;
00246 
00247   int giveToMatrix(int numRows, const int* rows,
00248                       int numCols, const int* cols,
00249                       const double* const* values,
00250                       bool sumInto, int format);
00251 
00252   fei::SharedPtr<fei::MatrixGraph> matrixGraph_;
00253   fei::SharedPtr<fei::SparseRowGraph> sparseRowGraph_;
00254   std::vector<double> coefs_;
00255   bool stateChanged_;
00256   std::vector<double> work_data1D_;
00257   std::vector<const double*> work_data2D_;
00258 };//class Matrix_Local
00259 }//namespace fei
00260 
00261 #endif
00262 

Generated on Tue Jul 13 09:27:45 2010 for FEI by  doxygen 1.4.7