cuIBM
A GPU-based Immersed Boundary Method code
generateM.inl
Go to the documentation of this file.
1 
8 
9 
17 template<>
19 {
20  int nx = domInfo->nx,
21  ny = domInfo->ny;
22 
23  real dt = (*paramDB)["simulation"]["dt"].get<real>();
24 
25  real *dxD = thrust::raw_pointer_cast(&(domInfo->dxD[0])),
26  *dyD = thrust::raw_pointer_cast(&(domInfo->dyD[0]));
27 
28  int numU = (nx-1)*ny;
29  int numUV = numU + nx*(ny-1);
30  M.resize(numUV, numUV, numUV);
31  Minv.resize(numUV, numUV, numUV);
32 
33  int *MRows = thrust::raw_pointer_cast(&(M.row_indices[0])),
34  *MCols = thrust::raw_pointer_cast(&(M.column_indices[0])),
35  *MinvRows = thrust::raw_pointer_cast(&(Minv.row_indices[0])),
36  *MinvCols = thrust::raw_pointer_cast(&(Minv.column_indices[0]));
37 
38  real *MVals = thrust::raw_pointer_cast(&(M.values[0])),
39  *MinvVals = thrust::raw_pointer_cast(&(Minv.values[0]));
40 
41  const int blockSize = 256;
42  dim3 dimGrid( int((nx*ny-0.5)/blockSize) + 1, 1);
43  dim3 dimBlock(blockSize, 1);
44  kernels::fillM_u <<<dimGrid, dimBlock>>> (MRows, MCols, MVals, MinvRows, MinvCols, MinvVals, nx, ny, dxD, dyD, dt);
45  kernels::fillM_v <<<dimGrid, dimBlock>>> (MRows, MCols, MVals, MinvRows, MinvCols, MinvVals, nx, ny, dxD, dyD, dt);
46 } // generateM
double real
Is a float or a double depending on the machine precision.
Definition: types.h:116
Declaration of the kernels to generate the mass matrix and its inverse.