20 #ifndef OPM_BLOCKED_MATRIX_HPP
21 #define OPM_BLOCKED_MATRIX_HPP
25 #include <opm/simulators/linalg/bda/Matrix.hpp>
46 : nnzValues(new double[nnzbs_*block_size_*block_size_]),
47 colIndices(new int[nnzbs_*block_size_*block_size_]),
48 rowPointers(new int[Nb_+1]),
51 block_size(block_size_),
59 : nnzValues(new double[M.nnzbs*M.block_size*M.block_size]),
60 colIndices(M.colIndices),
61 rowPointers(M.rowPointers),
64 block_size(M.block_size),
76 BlockedMatrix(
int Nb_,
int nnzbs_,
unsigned int block_size_,
double *nnzValues_,
int *colIndices_,
int *rowPointers_)
77 : nnzValues(nnzValues_),
78 colIndices(colIndices_),
79 rowPointers(rowPointers_),
82 block_size(block_size_),
98 constexpr
static double nnzThreshold = 1e-80;
100 int countUnblockedNnzs();
102 void unblock(Matrix *mat,
bool isUMatrix);
106 int toRDF(
int numColors,
int *nodesPerColor,
bool isUMatrix,
107 std::vector<std::vector<int> >& colIndicesInColor,
int nnzsPerRowLimit,
int *nnzValsSizes,
108 std::vector<std::vector<double> >& nnzValues,
short int *colIndices,
unsigned char *NROffsets,
int *colorSizes,
int *valSize);
112 int findPartitionColumns(
int numColors,
int *nodesPerColor,
113 int rowsPerColorLimit,
int columnsPerColorLimit,
114 std::vector<std::vector<int> >& colIndicesInColor,
int *PIndicesAddr,
int *colorSizes,
115 std::vector<std::vector<int> >& LColIndicesInColor,
int *LPIndicesAddr,
int *LColorSizes,
116 std::vector<std::vector<int> >& UColIndicesInColor,
int *UPIndicesAddr,
int *UColorSizes);
124 unsigned int block_size;
136 void sortBlockedRow(
int *colIndices,
double *data,
int left,
int right,
unsigned block_size);
144 void blockMultSub(
double *a,
double *b,
double *c,
unsigned int block_size);
152 void blockMult(
double *mat1,
double *mat2,
double *resMat,
unsigned int block_size);
162 void blockSub(
double *mat1,
double *mat2,
double *resMat,
unsigned int block_size);
173 void blockVectMult(
double *mat,
double *vect,
double scale,
double *resVect,
bool resetRes,
unsigned int block_size);
185 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:37
BlockedMatrix(const BlockedMatrix &M)
Allocate BlockedMatrix, but copy sparsity pattern instead of allocating new memory.
Definition: BlockedMatrix.hpp:58
BlockedMatrix(int Nb_, int nnzbs_, unsigned int block_size_, double *nnzValues_, int *colIndices_, int *rowPointers_)
Allocate BlockedMatrix, but let data arrays point to existing arrays.
Definition: BlockedMatrix.hpp:76
BlockedMatrix(int Nb_, int nnzbs_, unsigned int block_size_)
Allocate BlockedMatrix and data arrays with given sizes.
Definition: BlockedMatrix.hpp:45
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27