27#ifndef EXCLUDED_PARTICLE
35 #define EXCLUDED_PARTICLE(index) imove[index] <= 0
38#if defined(LOCAL_MEM_SIZE) && defined(NO_LOCAL_MEM)
39 #error NO_LOCAL_MEM has been set.
62__kernel
void lapp(
const __global
int* imove,
63 const __global
vec* r,
64 const __global
float* rho,
65 const __global
float* m,
66 const __global
float* p,
67 const __global
float* h_var,
68 __global
float* lap_p,
72 const usize i = get_global_id(0);
73 const usize it = get_local_id(0);
81 const float h_i = h_var[i];
82 const float p_i = p[i];
84 const float conf_i = 1.f / (h_i * h_i * h_i * h_i);
86 const float conf_i = 1.f / (h_i * h_i * h_i * h_i * h_i);
90 #ifndef LOCAL_MEM_SIZE
91 #define _LAPP_ lap_p[i]
93 #define _LAPP_ lap_p_l[it]
94 __local
float lap_p_l[LOCAL_MEM_SIZE];
98 const usize c_i = icell[i];
104 const vec_xyz r_ij = r[j].XYZ - r_i;
105 const float h_j = h_var[j];
106 const float l_ij = length(r_ij);
107 const float q_i = min(l_ij / h_i, SUPPORT);
108 const float q_j = min(l_ij / h_j, SUPPORT);
109 if((q_i == SUPPORT) && (q_j == SUPPORT))
116 const float conf_j = 1.f / (h_j * h_j * h_j * h_j);
118 const float conf_j = 1.f / (h_j * h_j * h_j * h_j * h_j);
120 const float fi_ij = conf_i *
kernelF(q_i);
121 const float fj_ij = conf_j *
kernelF(q_j);
122 _LAPP_ += (p[j] - p_i) * 0.5f * (fi_ij + fj_ij) * m[j] / rho[j];
126 #ifdef LOCAL_MEM_SIZE
#define BEGIN_NEIGHS(CELL, NPARTS, NCELLS, ICELL, IHOC)
Loop over the neighbours to compute the interactions.
Definition 2D.h:174
#define vec_xyz
Vectors with the minimum number of components.
Definition 2D.h:86
#define END_NEIGHS()
End of the loop over the neighs to compute the interactions.
Definition 2D.h:189
float kernelF(float q)
The kernel gradient factor .
Definition CubicSpline2D.hcl:67
Generic/automatic kernel header file.
#define vec
Definition LinkList.hcl.in:57
__kernel void lapp(const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, const __global float *p, __global float *lap_p, usize N, LINKLIST_LOCAL_PARAMS)
Laplacian of the pressure computation.
Definition deltaSPH.cl:191
#define EXCLUDED_PARTICLE(index)
Condition to exclude a particle from the delta-SPH model.
Definition deltaSPH.cl:35
Generic types definition file.
#define LINKLIST_LOCAL_PARAMS
Macro to easily add the parameters to run BEGIN_NEIGHS macro, interacting with the local set of parti...
Definition types.h:106