diff --git a/src/Particle.c b/src/Particle.c index 0741d0e..0d28853 100644 --- a/src/Particle.c +++ b/src/Particle.c @@ -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]; @@ -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, @@ -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, @@ -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; } @@ -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; diff --git a/src/StraightVortFil.c b/src/StraightVortFil.c index 3281f6e..8613d4c 100644 --- a/src/StraightVortFil.c +++ b/src/StraightVortFil.c @@ -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( @@ -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) @@ -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)