FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fei_Reducer.hpp
Go to the documentation of this file.
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2006 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_Reducer_hpp_
10 #define _fei_Reducer_hpp_
11 
12 #include <fei_macros.hpp>
13 #include <fei_SharedPtr.hpp>
14 #include <fei_mpi.h>
15 #include <fei_Logger.hpp>
16 #include <fei_CSVec.hpp>
17 #include <fei_FillableMat.hpp>
18 #include <fei_CSVec.hpp>
19 #include <fei_CSRMat.hpp>
20 
21 namespace fei {
22  class MatrixGraph;
23  class Graph;
24  class Matrix;
25  class Vector;
26 
27  class Reducer : private fei::Logger {
28  public:
30  Reducer(fei::SharedPtr<FillableMat> globalSlaveDependencyMatrix,
31  fei::SharedPtr<CSVec> g_vector,
32  MPI_Comm comm);
33 
36 
38 
40  virtual ~Reducer();
41 
43  void setLocalUnreducedEqns(const std::vector<int>& localUnreducedEqns);
44 
45 
50 
51  void addGraphIndices(int numRows, const int* rows,
52  int numCols, const int* cols,
53  fei::Graph& graph);
54 
55  void addSymmetricGraphIndices(int numIndices, const int* indices,
56  bool diagonal,
57  fei::Graph& graph);
58 
66  int addMatrixValues(int numRows, const int* rows,
67  int numCols, const int* cols,
68  const double* const* values,
69  bool sum_into,
70  fei::Matrix& feimat,
71  int format);
72 
98  int addVectorValues(int numValues,
99  const int* globalIndices,
100  const double* values,
101  bool sum_into,
102  bool soln_vector,
103  int vectorIndex,
104  fei::Vector& feivec);
105 
106  int copyOutVectorValues(int numValues,
107  const int* globalIndices,
108  double* values,
109  bool soln_vector,
110  int vectorIndex,
111  fei::Vector& feivec);
112 
113  void getSlaveMasterEqns(int slaveEqn, std::vector<int>& masterEqns);
114  bool isSlaveEqn(int unreducedEqn) const;
115  bool isSlaveCol(int unreducedEqn) const;
116 
121  int translateToReducedEqn(int unreducedEqn) const;
122  int translateFromReducedEqn(int reduced_eqn) const;
123  void assembleReducedGraph(fei::Graph* graph,
124  bool global_gather=true);
126  void assembleReducedMatrix(fei::Matrix& matrix);
127  void assembleReducedVector(bool soln_vector,
128  fei::Vector& feivec);
129 
130  std::vector<int>& getLocalReducedEqns();
131 
132  void initialize();
133  private:
134  void expand_work_arrays(int size);
135 
144 
147 
148  std::vector<int> localUnreducedEqns_;
149  std::vector<int> localReducedEqns_;
150  std::vector<int> nonslaves_;
151  std::vector<int> reverse_;
152  bool* isSlaveEqn_;
159 
163  std::string dbgprefix_;
164  unsigned mat_counter_;
166 
167  bool* bool_array_;
169  double* double_array_;
171 
172  std::vector<double> work_1D_;
173  std::vector<const double*> work_2D_;
174  };//class Reducer
175 
176 }//namespace fei
177 
178 #endif // _fei_Reducer_hpp_
179 
Reducer(fei::SharedPtr< FillableMat > globalSlaveDependencyMatrix, fei::SharedPtr< CSVec > g_vector, MPI_Comm comm)
Definition: fei_Reducer.cpp:24
std::vector< const double * > work_2D_
std::vector< double > work_1D_
int highestGlobalSlaveEqn_
int lowestGlobalSlaveEqn_
int addMatrixValues(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sum_into, fei::Matrix &feimat, int format)
fei::FillableMat Kid_
fei::CSRMat csrKdd
fei::CSRMat csrKid
std::vector< int > reverse_
void assembleReducedMatrix(fei::Matrix &matrix)
void assembleReducedVector(bool soln_vector, fei::Vector &feivec)
fei::CSRMat csrD_
fei::CSVec csvec
bool * bool_array_
int translateToReducedEqn(int unreducedEqn) const
int firstLocalReducedEqn_
void getSlaveMasterEqns(int slaveEqn, std::vector< int > &masterEqns)
fei::CSVec csvec_i
fei::CSVec tmpVec2_
void addGraphEntries(fei::SharedPtr< fei::SparseRowGraph > matrixGraph)
int copyOutVectorValues(int numValues, const int *globalIndices, double *values, bool soln_vector, int vectorIndex, fei::Vector &feivec)
void expand_work_arrays(int size)
#define MPI_Comm
Definition: fei_mpi.h:56
void addGraphIndices(int numRows, const int *rows, int numCols, const int *cols, fei::Graph &graph)
unsigned mat_counter_
std::vector< int > localReducedEqns_
unsigned rhs_vec_counter_
fei::FillableMat Kdi_
fei::CSRMat csrKii
void setLocalUnreducedEqns(const std::vector< int > &localUnreducedEqns)
double * double_array_
std::string dbgprefix_
fei::CSRMat tmpMat2_
MPI_Comm comm_
fei::FillableMat Kdd_
fei::CSVec tmpVec1_
fei::FillableMat Kii_
fei::CSRMat tmpMat1_
int translateFromReducedEqn(int reduced_eqn) const
virtual ~Reducer()
int addVectorValues(int numValues, const int *globalIndices, const double *values, bool sum_into, bool soln_vector, int vectorIndex, fei::Vector &feivec)
std::vector< int > & getLocalReducedEqns()
void assembleReducedGraph(fei::Graph *graph, bool global_gather=true)
void addSymmetricGraphIndices(int numIndices, const int *indices, bool diagonal, fei::Graph &graph)
fei::CSVec fd_
int lastLocalReducedEqn_
std::vector< int > nonslaves_
bool isSlaveCol(int unreducedEqn) const
bool isSlaveEqn(int unreducedEqn) const
std::vector< int > localUnreducedEqns_
fei::CSVec csg_
void initialize()
Definition: fei_Reducer.cpp:80
bool * isSlaveEqn_
fei::CSVec fi_
fei::CSRMat csrKdi