Skip to content

Commit

Permalink
GPU threshold (#4), Strength exchange bug (#3), Untracked bug.
Browse files Browse the repository at this point in the history
-Changed GPU usage threshold to 256 for all methods
-Fixed incorrect ordering of arguments in viscous vortex partice
strength exchange method. (The viscous code is still unverified)
-Fixed issue with CPU filament induced velocity implementation
where if a measurement point was on the axis of a vortex filament
a division by zero would suggest infinite induced velocity.
  • Loading branch information
hjabird committed May 12, 2019
1 parent 28906bf commit dcf994d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/Particle.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ CVTX_EXPORT bsv_V3f cvtx_ParticleArr_visc_ind_dvort(
assert(num_particles >= 0);
for (i = 0; i < num_particles; ++i) {
dvort = cvtx_Particle_visc_ind_dvort(array_start[i],
induced_particle, kernel, kinematic_visc, regularisation_radius);
induced_particle, kernel, regularisation_radius, kinematic_visc);
rx += dvort.x[0];
ry += dvort.x[1];
rz += dvort.x[2];
Expand Down Expand Up @@ -216,8 +216,8 @@ CVTX_EXPORT void cvtx_ParticleArr_Arr_ind_vel(
float regularisation_radius)
{
#ifdef CVTX_USING_OPENCL
if (num_particles < 1024
|| num_mes < 512
if (num_particles < 256
|| num_mes < 256
|| kernel->cl_kernel_name_ext == ""
|| opencl_brute_force_ParticleArr_Arr_ind_vel(
array_start, num_particles, mes_start,
Expand Down Expand Up @@ -260,8 +260,8 @@ CVTX_EXPORT void cvtx_ParticleArr_Arr_ind_dvort(
float regularisation_radius)
{
#ifdef CVTX_USING_OPENCL
if ( num_particles < 1024
|| num_induced < 512
if ( num_particles < 256
|| num_induced < 256
|| kernel->cl_kernel_name_ext == ""
|| opencl_brute_force_ParticleArr_Arr_ind_dvort(
array_start, num_particles, induced_start,
Expand Down Expand Up @@ -290,7 +290,7 @@ void cpu_brute_force_ParticleArr_Arr_visc_ind_dvort(
for (i = 0; i < num_induced; ++i) {
result_array[i] = cvtx_ParticleArr_visc_ind_dvort(
array_start, num_particles, induced_start[i],
kernel, kinematic_visc, regularisation_radius);
kernel, regularisation_radius, kinematic_visc);
}
return;
}
Expand All @@ -306,17 +306,17 @@ CVTX_EXPORT void cvtx_ParticleArr_Arr_visc_ind_dvort(
float kinematic_visc)
{
#ifdef CVTX_USING_OPENCL
if ( num_particles < 1024
|| num_induced < 512
if ( num_particles < 256
|| num_induced < 256
|| kernel->cl_kernel_name_ext == ""
|| opencl_brute_force_ParticleArr_Arr_visc_ind_dvort(
array_start, num_particles, induced_start,
num_induced, result_array, kernel, kinematic_visc, regularisation_radius) != 0)
num_induced, result_array, kernel, regularisation_radius, kinematic_visc) != 0)
#endif
{
cpu_brute_force_ParticleArr_Arr_visc_ind_dvort(
array_start, num_particles, induced_start,
num_induced, result_array, kernel, kinematic_visc, regularisation_radius);
num_induced, result_array, kernel, regularisation_radius, kinematic_visc);
}
return;

Expand Down
10 changes: 5 additions & 5 deletions src/StraightVortFil.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CVTX_EXPORT bsv_V3f cvtx_StraightVortFil_ind_vel(
t22 = bsv_V3f_dot(r2, r0) / bsv_V3f_abs(r2);
t2 = t21 - t22;
/* (NaN != NaN) == TRUE*/
return t1 * t2 != t1 * t2 ? bsv_V3f_zero() : bsv_V3f_mult(crosstmp, t1 * t2);
return fabs(t1 * t2) <= 3.40282346e38 ? bsv_V3f_mult(crosstmp, t1 * t2) : bsv_V3f_zero();
}

CVTX_EXPORT bsv_V3f cvtx_StraightVortFil_ind_dvort(
Expand Down Expand Up @@ -161,8 +161,8 @@ CVTX_EXPORT void cvtx_StraightVortFilArr_Arr_ind_vel(
bsv_V3f *result_array)
{
#ifdef CVTX_USING_OPENCL
if (num_filaments < 1024
|| num_mes < 512
if (num_filaments < 256
|| num_mes < 256
|| opencl_brute_force_StraightVortFilArr_Arr_ind_vel(
array_start, num_filaments, mes_start,
num_mes, result_array) != 0)
Expand All @@ -183,8 +183,8 @@ CVTX_EXPORT void cvtx_StraightVortFilArr_Arr_ind_dvort(
bsv_V3f *result_array)
{
#ifdef CVTX_USING_OPENCL
if (num_fil < 1024
|| num_induced < 512
if (num_fil < 256
|| num_induced < 256
|| opencl_brute_force_StraightVortFilArr_Arr_ind_dvort(
array_start, num_fil, induced_start,
num_induced, result_array) != 0)
Expand Down

0 comments on commit dcf994d

Please sign in to comment.