/usr/include/trilinos/fei_Reducer.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | /*--------------------------------------------------------------------*/
/* Copyright 2006 Sandia Corporation. */
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
/* non-exclusive license for use of this work by or on behalf */
/* of the U.S. Government. Export of this program may require */
/* a license from the United States Government. */
/*--------------------------------------------------------------------*/
#ifndef _fei_Reducer_hpp_
#define _fei_Reducer_hpp_
#include <fei_macros.hpp>
#include <fei_SharedPtr.hpp>
#include <fei_mpi.h>
#include <fei_Logger.hpp>
#include <fei_FillableVec.hpp>
#include <fei_FillableMat.hpp>
#include <fei_CSVec.hpp>
#include <fei_CSRMat.hpp>
namespace fei {
class MatrixGraph;
class Graph;
class Matrix;
class Vector;
class Reducer : private fei::Logger {
public:
//@{ \name Constructors
Reducer(fei::SharedPtr<FillableMat> globalSlaveDependencyMatrix,
fei::SharedPtr<CSVec> g_vector,
MPI_Comm comm);
Reducer(fei::SharedPtr<fei::MatrixGraph> matrixGraph);
//@}
//@{ \name Destructor
/** Destructor. */
virtual ~Reducer();
//@}
void setLocalUnreducedEqns(const std::vector<int>& localUnreducedEqns);
/** Set the matrix-graph structure. This is the nonzero structure for
locally-owned matrix rows.
*/
void addGraphEntries(fei::SharedPtr<fei::SparseRowGraph> matrixGraph);
void addGraphIndices(int numRows, const int* rows,
int numCols, const int* cols,
fei::Graph& graph);
void addSymmetricGraphIndices(int numIndices, const int* indices,
bool diagonal,
fei::Graph& graph);
/** Put a C-style table (array of pointers) of coefficient data into the
matrix. This is a rectangular array of coefficients for
rows/columns defined by the 'rows' and 'cols' lists.
If the sum_into argument is true, values should be added to any that
already exist at the specified locations. Otherwise (if sum_into is
false) incoming values should overwrite already-existing values.
*/
int addMatrixValues(int numRows, const int* rows,
int numCols, const int* cols,
const double* const* values,
bool sum_into,
fei::Matrix& feimat,
int format);
/** Put coefficient data into a vector at the specified global indices.
If any specified indices are out of range (negative or too large) the
corresponding positions in the values array will not be referenced,
and a positive warning code will be returned.
@param numValues Length of caller-allocated 'globalIndices' and
'values' arrays.
@param globalIndices List of global-indices specifying the locations in
the vector for incoming values to be placed.
@param values List of incoming values.
@param sum_into If true, incoming values should be added to values that
may already be in the specified locations. If sum_into is
false, then incoming values should overwrite existing values.
@param soln_vector If true, incoming values should be placed in the
solution vector. Otherwise, they should be placed in the
rhs vector.
@param vectorIndex If the linear system has multiple rhs/soln vectors,
then this parameter specifies which vector the incoming
values should be put into.
*/
int addVectorValues(int numValues,
const int* globalIndices,
const double* values,
bool sum_into,
bool soln_vector,
int vectorIndex,
fei::Vector& feivec);
int copyOutVectorValues(int numValues,
const int* globalIndices,
double* values,
bool soln_vector,
int vectorIndex,
fei::Vector& feivec);
void getSlaveMasterEqns(int slaveEqn, std::vector<int>& masterEqns);
bool isSlaveEqn(int unreducedEqn) const;
bool isSlaveCol(int unreducedEqn) const;
/** Given an equation-number in the caller's unreduced index-space,
return the corresponding equation in the reduced space.
If unreducedEqn is a slave, an exception will be thrown.
*/
int translateToReducedEqn(int unreducedEqn) const;
int translateFromReducedEqn(int reduced_eqn) const;
void assembleReducedGraph(fei::Graph* graph,
bool global_gather=true);
void assembleReducedGraph(fei::SparseRowGraph* srgraph);
void assembleReducedMatrix(fei::Matrix& matrix);
void assembleReducedVector(bool soln_vector,
fei::Vector& feivec,
bool sum_into=true);
std::vector<int>& getLocalReducedEqns();
void initialize();
private:
void expand_work_arrays(int size);
fei::CSRMat csrD_;
int* slavesPtr_;
fei::FillableMat Kii_, Kid_, Kdi_, Kdd_;
fei::CSRMat csrKii, csrKid, csrKdi, csrKdd;
fei::FillableVec fi_, fd_;
fei::CSVec csfi, csvec, csvec_i;
fei::CSRMat tmpMat1_, tmpMat2_;
fei::CSVec tmpVec1_, tmpVec2_;
fei::CSVec csg_;
bool g_nonzero_;
std::vector<int> localUnreducedEqns_;
std::vector<int> localReducedEqns_;
std::vector<int> nonslaves_;
std::vector<int> reverse_;
bool* isSlaveEqn_;
int numGlobalSlaves_;
int numLocalSlaves_;
int firstLocalReducedEqn_;
int lastLocalReducedEqn_;
int lowestGlobalSlaveEqn_;
int highestGlobalSlaveEqn_;
int localProc_;
int numProcs_;
MPI_Comm comm_;
std::string dbgprefix_;
unsigned mat_counter_;
unsigned rhs_vec_counter_;
bool* bool_array_;
int* int_array_;
double* double_array_;
int array_len_;
std::vector<double> work_1D_;
std::vector<const double*> work_2D_;
};//class Reducer
}//namespace fei
#endif // _fei_Reducer_hpp_
|