OSDN Git Service

modified: utilsrc/src/Admin/Makefile
[eos/others.git] / utiltools / X86MAC64 / cuda / samples / 5_Simulations / fluidsGL / fluidsGL_kernels.h
1 /*
2  * Copyright 1993-2013 NVIDIA Corporation.  All rights reserved.
3  *
4  * Please refer to the NVIDIA end user license agreement (EULA) associated
5  * with this source code for terms and conditions that govern your use of
6  * this software. Any use, reproduction, disclosure, or distribution of
7  * this software and related documentation outside the terms of the EULA
8  * is strictly prohibited.
9  *
10  */
11 #ifndef __STABLEFLUIDS_KERNELS_CUH_
12 #define __STABLEFLUIDS_KERNELS_CUH_
13
14 // Vector data type used to velocity and force fields
15 typedef float2 cData;
16
17 void setupTexture(int x, int y);
18 void bindTexture(void);
19 void unbindTexture(void);
20 void updateTexture(cData *data, size_t w, size_t h, size_t pitch);
21 void deleteTexture(void);
22
23 // This method adds constant force vectors to the velocity field
24 // stored in 'v' according to v(x,t+1) = v(x,t) + dt * f.
25 __global__ void
26 addForces_k(cData *v, int dx, int dy, int spx, int spy, float fx, float fy, int r, size_t pitch);
27
28 // This method performs the velocity advection step, where we
29 // trace velocity vectors back in time to update each grid cell.
30 // That is, v(x,t+1) = v(p(x,-dt),t). Here we perform bilinear
31 // interpolation in the velocity space.
32 __global__ void
33 advectVelocity_k(cData *v, float *vx, float *vy,
34                  int dx, int pdx, int dy, float dt, int lb);
35
36 // This method performs velocity diffusion and forces mass conservation
37 // in the frequency domain. The inputs 'vx' and 'vy' are complex-valued
38 // arrays holding the Fourier coefficients of the velocity field in
39 // X and Y. Diffusion in this space takes a simple form described as:
40 // v(k,t) = v(k,t) / (1 + visc * dt * k^2), where visc is the viscosity,
41 // and k is the wavenumber. The projection step forces the Fourier
42 // velocity vectors to be orthogonal to the wave wave vectors for each
43 // wavenumber: v(k,t) = v(k,t) - ((k dot v(k,t) * k) / k^2.
44 __global__ void
45 diffuseProject_k(cData *vx, cData *vy, int dx, int dy, float dt,
46                  float visc, int lb);
47
48 // This method updates the velocity field 'v' using the two complex
49 // arrays from the previous step: 'vx' and 'vy'. Here we scale the
50 // real components by 1/(dx*dy) to account for an unnormalized FFT.
51 __global__ void
52 updateVelocity_k(cData *v, float *vx, float *vy,
53                  int dx, int pdx, int dy, int lb, size_t pitch);
54
55 // This method updates the particles by moving particle positions
56 // according to the velocity field and time step. That is, for each
57 // particle: p(t+1) = p(t) + dt * v(p(t)).
58 __global__ void
59 advectParticles_k(cData *part, cData *v, int dx, int dy,
60                   float dt, int lb, size_t pitch);
61
62 #endif
63