1 template <typename T>
\r
2 __global__ void set_dirichlet_bc(T* u, int Nx)
\r
4 int i = blockDim.x*blockIdx.x+threadIdx.x;
\r
8 u[(Nx-1)*Nx+i] = 0.0;
\r
14 template <typename T>
\r
17 gpulab::FD::stencil_2d<T> m_stencil;
\r
19 laplacian(int alpha) : m_stencil(2,alpha) {}
\r
21 template <typename V>
\r
22 void operator()(T t, V const& u, V & rhs) const
\r
24 m_stencil.mult(u,rhs); // rhs = du/dxx + du/dyy
\r
26 // Make sure bc is correct
\r
27 dim3 block = BLOCK1D(rhs.Nx());
\r
28 dim3 grid = GRID1D(rhs.Nx());
\r
29 set_dirichlet_bc<<<grid,block>>>(RAW_PTR(rhs),rhs.Nx());
\r