opm-simulators
Matrix.hpp
1 /*
2  Copyright 2020 Equinor ASA
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_MATRIX_HEADER_INCLUDED
21 #define OPM_MATRIX_HEADER_INCLUDED
22 
23 #include <vector>
24 
25 namespace Opm
26 {
27 namespace Accelerator
28 {
29 
32 template<class Scalar>
33 class Matrix
34 {
35 public:
39  Matrix(int N_, int nnzs_)
40  : N(N_)
41  , M(N_)
42  , nnzs(nnzs_)
43  {
44  nnzValues.resize(nnzs);
45  colIndices.resize(nnzs);
46  rowPointers.resize(N+1);
47  }
48 
53  Matrix(int N_, int M_, int nnzs_)
54  : Matrix(N_, nnzs_)
55  {
56  M = M_;
57  }
58 
59  std::vector<Scalar> nnzValues;
60  std::vector<int> colIndices;
61  std::vector<int> rowPointers;
62  int N, M;
63  int nnzs;
64 };
65 
66 } // namespace Accelerator
67 } // namespace Opm
68 
69 #endif // OPM_MATRIX_HEADER_INCLUDED
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Matrix(int N_, int M_, int nnzs_)
Allocate rectangular Matrix and data arrays with given sizes.
Definition: Matrix.hpp:53
Matrix(int N_, int nnzs_)
Allocate square Matrix and data arrays with given sizes.
Definition: Matrix.hpp:39
This struct resembles a csr matrix, only doubles are supported The data is stored in contiguous memor...
Definition: Matrix.hpp:33