cuWellContributions.hpp
Go to the documentation of this file.
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 WELLCONTRIBUTIONS_CUDA_HEADER_INCLUDED
21#define WELLCONTRIBUTIONS_CUDA_HEADER_INCLUDED
22
24
25#include <cuda_runtime.h>
26
27
28namespace Opm {
29
30template<class Scalar>
32{
33public:
35
38 void setCudaStream(cudaStream_t stream);
39
44 void apply(Scalar* d_x, Scalar* d_y);
45
46protected:
48 void APIalloc() override;
49
51
57 void APIaddMatrix(MatrixType type, int* colIndices,
58 Scalar* values, unsigned int val_size) override;
59
60 cudaStream_t stream;
61
62 // data for StandardWells, could remain nullptrs if not used
63 Scalar* d_Cnnzs = nullptr;
64 Scalar* d_Dnnzs = nullptr;
65 Scalar* d_Bnnzs = nullptr;
66 int* d_Ccols = nullptr;
67 int* d_Bcols = nullptr;
68 Scalar* d_z1 = nullptr;
69 Scalar* d_z2 = nullptr;
70 unsigned int *d_val_pointers = nullptr;
71 Scalar* h_x = nullptr;
72 Scalar* h_y = nullptr;
73};
74
75} //namespace Opm
76
77#endif
Definition: cuWellContributions.hpp:32
void setCudaStream(cudaStream_t stream)
void apply(Scalar *d_x, Scalar *d_y)
cudaStream_t stream
Definition: cuWellContributions.hpp:60
void APIalloc() override
Allocate memory for the StandardWells.
Scalar * d_z2
Definition: cuWellContributions.hpp:69
void APIaddMatrix(MatrixType type, int *colIndices, Scalar *values, unsigned int val_size) override
Scalar * h_y
Definition: cuWellContributions.hpp:72
Scalar * d_Cnnzs
Definition: cuWellContributions.hpp:63
unsigned int * d_val_pointers
Definition: cuWellContributions.hpp:70
Scalar * d_z1
Definition: cuWellContributions.hpp:68
Scalar * d_Bnnzs
Definition: cuWellContributions.hpp:65
int * d_Ccols
Definition: cuWellContributions.hpp:66
Scalar * h_x
Definition: cuWellContributions.hpp:71
int * d_Bcols
Definition: cuWellContributions.hpp:67
Scalar * d_Dnnzs
Definition: cuWellContributions.hpp:64
Definition: WellContributions.hpp:53
MatrixType
StandardWell has C, D and B matrices that need to be copied.
Definition: WellContributions.hpp:59
Definition: blackoilboundaryratevector.hh:37