FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fei_MatrixReducer.hpp
Go to the documentation of this file.
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_MatrixReducer_hpp_
10 #define _fei_MatrixReducer_hpp_
11 
12 #include <fei_iosfwd.hpp>
13 #include <fei_mpi.h>
14 #include <fei_defs.h>
15 
16 #include <fei_Matrix.hpp>
17 #include <fei_Reducer.hpp>
18 #include <fei_MatrixGraph.hpp>
19 #include <fei_Matrix_core.hpp>
20 
21 #undef fei_file
22 #define fei_file "fei_MatrixReducer.hpp"
23 #include <fei_ErrMacros.hpp>
24 
25 namespace fei {
26 
27  class MatrixReducer : public fei::Matrix {
28  public:
32 
34  virtual ~MatrixReducer();
35 
38  { return(target_); }
39 
43  const char* typeName() { return(target_->typeName()); }
44 
47  int parameters(const fei::ParameterSet& paramset);
48 
50  {return( target_->getMatrixGraph() ); }
51 
54 
57  int getGlobalNumRows() const;
58 
61  int getLocalNumRows() const;
62 
64  int putScalar(double scalar);
65 
71  int getRowLength(int row, int& length) const;
72 
82  int copyOutRow(int row, int len, double* coefs, int* indices) const;
83 
95  int sumIn(int numRows, const int* rows,
96  int numCols, const int* cols,
97  const double* const* values,
98  int format=0);
99 
111  int copyIn(int numRows, const int* rows,
112  int numCols, const int* cols,
113  const double* const* values,
114  int format=0);
115 
131  int sumInFieldData(int fieldID,
132  int idType,
133  int rowID,
134  int colID,
135  const double* const* data,
136  int format=0);
137 
155  int sumInFieldData(int fieldID,
156  int idType,
157  int rowID,
158  int colID,
159  const double* data,
160  int format=0);
161 
171  int sumIn(int blockID, int connectivityID,
172  const double* const* values,
173  int format=0);
174 
179  int globalAssemble();
180 
183  int multiply(fei::Vector* x,
184  fei::Vector* y);
185 
187 
193  int gatherFromOverlap(bool accumulate = true);
194 
196  int writeToFile(const char* filename,
197  bool matrixMarketFormat=true);
198 
201  int writeToStream(FEI_OSTREAM& ostrm,
202  bool matrixMarketFormat=true);
203 
205  { return(target_->usingBlockEntryStorage()); }
206 
208  int giveToUnderlyingMatrix(int numRows, const int* rows,
209  int numCols, const int* cols,
210  const double* const* values,
211  bool sumInto,
212  int format);
213 
215  int giveToUnderlyingBlockMatrix(int row,
216  int rowDim,
217  int numCols,
218  const int* cols,
219  const int* LDAs,
220  const int* colDims,
221  const double* const* values,
222  bool sumInto);
223 
224  void markState();
225 
226  bool changedSinceMark();
227 
228  private:
229  int giveToMatrix(int numRows, const int* rows,
230  int numCols, const int* cols,
231  const double* const* values,
232  bool sumInto,
233  int format);
234 
235  int giveToBlockMatrix(int numRows, const int* rows,
236  int numCols, const int* cols,
237  const double* const* values,
238  bool sumInto);
239 
244  };//class MatrixReducer
245 }//namespace fei
246 
247 #endif
248 
virtual const char * typeName()=0
virtual bool usingBlockEntryStorage()=0
int writeToStream(FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)
int giveToBlockMatrix(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sumInto)
int getRowLength(int row, int &length) const
const char * typeName()
virtual void setCommSizes()=0
#define FEI_OSTREAM
Definition: fei_iosfwd.hpp:24
int putScalar(double scalar)
int sumIn(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, int format=0)
int giveToUnderlyingMatrix(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sumInto, int format)
int sumInFieldData(int fieldID, int idType, int rowID, int colID, const double *const *data, int format=0)
void setMatrixGraph(fei::SharedPtr< fei::MatrixGraph > matrixGraph)
int getGlobalNumRows() const
int multiply(fei::Vector *x, fei::Vector *y)
virtual fei::SharedPtr< fei::MatrixGraph > getMatrixGraph() const =0
fei::SharedPtr< fei::Matrix > getTargetMatrix()
int giveToUnderlyingBlockMatrix(int row, int rowDim, int numCols, const int *cols, const int *LDAs, const int *colDims, const double *const *values, bool sumInto)
int parameters(const fei::ParameterSet &paramset)
int gatherFromOverlap(bool accumulate=true)
fei::SharedPtr< fei::Matrix > target_
int writeToFile(const char *filename, bool matrixMarketFormat=true)
int copyOutRow(int row, int len, double *coefs, int *indices) const
int copyIn(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, int format=0)
int getLocalNumRows() const
int giveToMatrix(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sumInto, int format)
fei::SharedPtr< fei::Reducer > reducer_
MatrixReducer(fei::SharedPtr< fei::Reducer > reducer, fei::SharedPtr< fei::Matrix > target)
fei::SharedPtr< fei::MatrixGraph > getMatrixGraph() const