Skip to content
Snippets Groups Projects
Commit 8bc80f20 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

fixes cylinder ghost collision counter

applies same tweaks that were needed for the spherical ghost collision
counter.
parent 2af6f9c6
Branches time_freq_avg
No related tags found
1 merge request!24Feature/collisions
...@@ -20,20 +20,20 @@ ...@@ -20,20 +20,20 @@
* Contact: Cristian.Lalescu@ds.mpg.de * * Contact: Cristian.Lalescu@ds.mpg.de *
* * * *
******************************************************************************/ ******************************************************************************/
#ifndef P2P_CYLINDER_COLLISIONS_HPP #ifndef P2P_CYLINDER_GHOST_COLLISIONS_HPP
#define P2P_CYLINDER_COLLISIONS_HPP #define P2P_CYLINDER_GHOST_COLLISIONS_HPP
#include <cstring> #include <cstring>
template <class real_number, class partsize_t> template <class real_number, class partsize_t>
class p2p_cylinder_collisions{ class p2p_cylinder_ghost_collisions{
long int collision_counter; long int collision_counter;
public: public:
p2p_cylinder_collisions() : collision_counter(0){} p2p_cylinder_ghost_collisions() : collision_counter(0){}
// Copy constructor use a counter set to zero // Copy constructor use a counter set to zero
p2p_cylinder_collisions(const p2p_cylinder_collisions&) : collision_counter(0){} p2p_cylinder_ghost_collisions(const p2p_cylinder_ghost_collisions&) : collision_counter(0){}
template <int size_particle_rhs> template <int size_particle_rhs>
void init_result_array(real_number /*rhs*/[], const partsize_t /*nbParticles*/) const{ void init_result_array(real_number /*rhs*/[], const partsize_t /*nbParticles*/) const{
...@@ -47,29 +47,31 @@ public: ...@@ -47,29 +47,31 @@ public:
void compute_interaction(const real_number /*pos_part1*/[], real_number /*rhs_part1*/[], void compute_interaction(const real_number /*pos_part1*/[], real_number /*rhs_part1*/[],
const real_number /*pos_part2*/[], real_number /*rhs_part2*/[], const real_number /*pos_part2*/[], real_number /*rhs_part2*/[],
const real_number /*dist_pow2*/, const real_number /*cutoff*/, const real_number /*dist_pow2*/, const real_number /*cutoff*/,
const real_number /*xshift_coef*/, const real_number /*yshift_coef*/, const real_number /*zshift_coef*/) const{ const real_number /*xshift_coef*/, const real_number /*yshift_coef*/, const real_number /*zshift_coef*/){
// TODO check the orientation, etc.... bool cylinders_overlap = false;
if(check the test here){
/* TODO: check if cylinders overlap or not, set `cylinders_overlap` accordingly */
if(cylinders_overlap)
collision_counter += 1; collision_counter += 1;
} }
}
void merge(const p2p_cylinder_collisions& other){ void merge(const p2p_cylinder_ghost_collisions& other){
collision_counter += other.collision_counter; collision_counter += other.collision_counter;
} }
constexpr static bool isEnable() { constexpr static bool isEnable() {
return false; return true;
} }
long int get_collision_counter() const{ long int get_collision_counter() const{
return collision_counter; return collision_counter;
} }
void reset_collision_counter() const{ void reset_collision_counter(){
collision_counter = 0; collision_counter = 0;
} }
}; };
#endif // P2P_CYLINDER_COLLISIONS_HPP #endif // P2P_CYLINDER_GHOST_COLLISIONS_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment