20 #ifndef BLOCKED_MATRIX_HPP
21 #define BLOCKED_MATRIX_HPP
27 #include <opm/simulators/linalg/bda/FPGAMatrix.hpp>
34 template<
unsigned int block_size>
44 : nnzValues(new double[nnzbs_*block_size*block_size]),
45 colIndices(new int[nnzbs_*block_size*block_size]),
46 rowPointers(new int[Nb_+1]),
56 : nnzValues(new double[M.nnzbs*block_size*block_size]),
57 colIndices(M.colIndices),
58 rowPointers(M.rowPointers),
71 BlockedMatrix(
int Nb_,
int nnzbs_,
double *nnzValues_,
int *colIndices_,
int *rowPointers_)
72 : nnzValues(nnzValues_),
73 colIndices(colIndices_),
74 rowPointers(rowPointers_),
92 constexpr
static double nnzThreshold = 1e-80;
94 int countUnblockedNnzs();
96 void unblock(Matrix *mat,
bool isUMatrix);
100 int toRDF(
int numColors,
int *nodesPerColor,
bool isUMatrix,
101 std::vector<std::vector<int> >& colIndicesInColor,
int nnzsPerRowLimit,
int *nnzValsSizes,
102 std::vector<std::vector<double> >& nnzValues,
short int *colIndices,
unsigned char *NROffsets,
int *colorSizes,
int *valSize);
106 int findPartitionColumns(
int numColors,
int *nodesPerColor,
107 int rowsPerColorLimit,
int columnsPerColorLimit,
108 std::vector<std::vector<int> >& colIndicesInColor,
int *PIndicesAddr,
int *colorSizes,
109 std::vector<std::vector<int> >& LColIndicesInColor,
int *LPIndicesAddr,
int *LColorSizes,
110 std::vector<std::vector<int> >& UColIndicesInColor,
int *UPIndicesAddr,
int *UColorSizes);
128 template <
unsigned int block_size>
129 void sortBlockedRow(
int *colIndices,
double *data,
int left,
int right);
136 template <
unsigned int block_size>
137 void blockMultSub(
double *a,
double *b,
double *c);
143 template <
unsigned int block_size>
144 void blockMult(
double *mat1,
double *mat2,
double *resMat);
148 template <
unsigned int block_size>
149 void blockSub(
double *mat1,
double *mat2,
double *resMat);
151 template <
unsigned int block_size>
152 void blockVectMult(
double *mat,
double *vect,
double scale,
double *resVect,
bool resetRes);
164 void blockedDiagtoRDF(
double *blockedDiagVals,
int rowSize,
int numColors, std::vector<int>& rowsPerColor,
double *RDFDiag);
This struct resembles a blocked csr matrix, like Dune::BCRSMatrix.
Definition: BlockedMatrix.hpp:36
BlockedMatrix(const BlockedMatrix &M)
Allocate BlockedMatrix, but copy sparsity pattern instead of allocating new memory.
Definition: BlockedMatrix.hpp:55
BlockedMatrix(int Nb_, int nnzbs_)
Allocate BlockedMatrix and data arrays with given sizes.
Definition: BlockedMatrix.hpp:43
BlockedMatrix(int Nb_, int nnzbs_, double *nnzValues_, int *colIndices_, int *rowPointers_)
Allocate BlockedMatrix, but let data arrays point to existing arrays.
Definition: BlockedMatrix.hpp:71