opm-simulators
rocsparseWellContributions.hpp
1 /*
2  Copyright 2023 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 WELLCONTRIBUTIONS_ROCSPARSE_HEADER_INCLUDED
21 #define WELLCONTRIBUTIONS_ROCSPARSE_HEADER_INCLUDED
22 
23 #include <opm/simulators/linalg/gpubridge/WellContributions.hpp>
24 
25 #include <hip/hip_runtime_api.h>
26 
27 #include <vector>
28 
29 namespace Opm {
30 
31 template<class Scalar>
33 {
34 private:
35  hipStream_t stream;
36 
37 public:
38  void apply_stdwells(Scalar* d_x, Scalar* d_y);
39  void apply_mswells(Scalar* d_x, Scalar* d_y);
40  void apply(Scalar* d_x, Scalar* d_y);
41  void setStream(hipStream_t stream);
42 
43 protected:
45  void APIalloc() override;
46 
48 
49  void APIaddMatrix(MatrixType type, int* colIndices,
50  Scalar* values, unsigned int val_size) override;
51 
52  Scalar *d_Cnnzs_hip, *d_Dnnzs_hip, *d_Bnnzs_hip;
53  unsigned *d_Ccols_hip, *d_Bcols_hip;
54  unsigned *d_val_pointers_hip;
55 
56  std::vector<Scalar> h_x;
57  std::vector<Scalar> h_y;
58 };
59 
60 } //namespace Opm
61 
62 #endif
void APIalloc() override
Allocate memory for the StandardWells.
Definition: rocsparseWellContributions.cpp:253
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
This class serves to eliminate the need to include the WellContributions into the matrix (with –matr...
Definition: GpuBridge.hpp:30
MatrixType
StandardWell has C, D and B matrices that need to be copied.
Definition: WellContributions.hpp:57
void APIaddMatrix(MatrixType type, int *colIndices, Scalar *values, unsigned int val_size) override
Api specific upload of matrix.
Definition: rocsparseWellContributions.cpp:204
Definition: rocsparseWellContributions.hpp:32