1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Base class for GPU based solvers
34 Dominik Christ, Wikki Ltd.
35 Based on Cufflink library by Daniel P. Combest
37 \*---------------------------------------------------------------------------*/
43 # define MPI_SCALAR MPI_FLOAT
44 typedef float ValueType;
48 # define MPI_SCALAR MPI_DOUBLE
49 typedef double ValueType;
53 # error Long double not supported in CUDA
57 #include <cusp/coo_matrix.h>
58 #include <cusp/memory.h>
59 #include <thrust/host_vector.h>
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 typedef cusp::device_memory MemorySpace;
64 typedef cusp::host_memory hostMemorySpace;
65 typedef int IndexType;
67 // used to prevent floating point exception
68 const ValueType SMALL = 1e-20;
71 struct cuspEquationSystem
73 cusp::coo_matrix<IndexType,ValueType,hostMemorySpace> A;
74 cusp::array1d< ValueType, hostMemorySpace> X;
75 cusp::array1d< ValueType, hostMemorySpace> B;
81 struct cudaSolverPerformance
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 // ************************************************************************* //