Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Extras / sph / fluids / fluid_system_host.cuh
1 /*
2   FLUIDS v.1 - SPH Fluid Simulator for CPU and GPU
3   Copyright (C) 2008. Rama Hoetzlein, http://www.rchoetzlein.com
4
5   ZLib license
6   This software is provided 'as-is', without any express or implied
7   warranty.  In no event will the authors be held liable for any damages
8   arising from the use of this software.
9
10   Permission is granted to anyone to use this software for any purpose,
11   including commercial applications, and to alter it and redistribute it
12   freely, subject to the following restrictions:
13
14   1. The origin of this software must not be misrepresented; you must not
15      claim that you wrote the original software. If you use this software
16      in a product, an acknowledgment in the product documentation would be
17      appreciated but is not required.
18   2. Altered source versions must be plainly marked as such, and must not be
19      misrepresented as being the original software.
20   3. This notice may not be removed or altered from any source distribution.
21 */
22
23
24 #include <vector_types.h>       
25 #include <driver_types.h>                       // for cudaStream_t
26
27 typedef unsigned int            uint;           // should be 4-bytes on CUDA
28 typedef unsigned char           uchar;          // should be 1-bytes on CUDA
29
30 struct FluidParams {
31         int                             numThreads, numBlocks;
32         int                             gridThreads, gridBlocks;        
33         int                             szPnts, szHash, szGrid;
34         int                             stride, pnts, cells;
35         int                             chk;
36         float                   smooth_rad, r2, sim_scale, visc;
37         float3                  min, max, res, size, delta;
38         
39         float                   pdist, pmass, rest_dens, stiffness;
40         float                   poly6kern, spikykern, lapkern;
41
42 };
43
44 extern "C"
45 {
46
47 void cudaInit(int argc, char **argv);
48
49 void FluidClearCUDA ();
50 void FluidSetupCUDA ( int num, int stride, float3 min, float3 max, float3 res, float3 size, int chk );
51 void FluidParamCUDA ( float sim_scale, float smooth_rad, float mass, float rest, float stiff, float visc );
52
53 void TransferToCUDA ( char* data, int* grid, int numPoints );
54 void TransferFromCUDA ( char* data, int* grid, int numPoints );
55
56 void Grid_InsertParticlesCUDA ();
57 void SPH_ComputePressureCUDA ();
58 void SPH_ComputeForceCUDA ();
59 void SPH_AdvanceCUDA ( float dt, float ss );
60
61 }
62
63