FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_FillableMat.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_FillableMat_hpp_
10 #define _fei_FillableMat_hpp_
11 
12 #include <fei_CSVec.hpp>
13 #include <fei_Pool_alloc.hpp>
14 #include <fei_EqnBuffer.hpp>
15 #include <vector>
16 #include <map>
17 
18 namespace fei {
19 
20 class FillableMat {
21  public:
22  FillableMat();
23  FillableMat(EqnBuffer& eqnbuf);
24  virtual ~FillableMat();
25 
26  FillableMat& operator=(const FillableMat& src);
27 
28  void setValues(double value);
29 
30  void createPosition(int row, int col);
31 
32  void sumInCoef(int row, int col, double coef);
33  void putCoef(int row, int col, double coef);
34 
35  void sumInRow(int row, const int* cols, const double* coefs, unsigned len);
36  void putRow(int row, const int* cols, const double* coefs, unsigned len);
37 
38  unsigned getNumRows() const;
39 
40  bool hasRow(int row) const;
41 
42  const CSVec* getRow(int row) const;
43  CSVec* create_or_getRow(int row);
44 
45  typedef std::map<int, CSVec*, std::less<int>,
47 
48  typedef feipoolmat::iterator iterator;
49  typedef feipoolmat::const_iterator const_iterator;
50 
51  iterator begin() {return matdata_.begin();}
52  iterator end() {return matdata_.end();}
53 
54  const_iterator begin() const {return matdata_.begin();}
55  const_iterator end() const {return matdata_.end();}
56 
57  void clear();
58 
59  bool operator==(const FillableMat& rhs) const;
60 
61  bool operator!=(const FillableMat& rhs) const;
62 
63  private:
64  feipoolmat matdata_;
65  fei_Pool_alloc<CSVec> vecpool_;
66 }; //class FillableMat
67 
69 void print(std::ostream& os, const FillableMat& mat);
70 
72 int count_nnz(const FillableMat& mat);
73 
75 void get_row_numbers(const FillableMat& mat, std::vector<int>& rows);
76 
77 }//namespace fei
78 
79 #endif
80 
void get_row_numbers(const FillableMat &mat, std::vector< int > &rows)
bool operator==(const SharedPtr< T > &a, const SharedPtr< U > &b)
bool operator!=(const SharedPtr< T > &a, const SharedPtr< U > &b)
int count_nnz(const FillableMat &mat)
void print(std::ostream &os, const FillableMat &mat)