diff --git a/cpp/particles/interpolation/particles_field_computer.hpp b/cpp/particles/interpolation/particles_field_computer.hpp index 9b9a5e7645d8c331cf47e71257da981f0935a3cd..1a7b3d1816189aeefa018d378e5362bf9f3d1240 100644 --- a/cpp/particles/interpolation/particles_field_computer.hpp +++ b/cpp/particles/interpolation/particles_field_computer.hpp @@ -123,15 +123,15 @@ public: real_number get_norm_pos_in_cell(const real_number in_pos, const int idx_pos) const { const real_number shifted_pos = in_pos - spatial_box_offset[idx_pos]; - DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, shifted_pos = %g\n", shifted_pos); + //DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, shifted_pos = %g\n", shifted_pos); const int nb_box_repeat = int(floor(shifted_pos/spatial_box_width[idx_pos])); - DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, nb_box_repeat = %d\n", nb_box_repeat); + //DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, nb_box_repeat = %d\n", nb_box_repeat); const real_number pos_in_box = shifted_pos - nb_box_repeat*spatial_box_width[idx_pos]; - DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, pos_in_box = %g\n", pos_in_box); + //DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, pos_in_box = %g\n", pos_in_box); const int cell_idx = int(floor(pos_in_box/box_step_width[idx_pos])); - DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, cell_idx = %d\n", cell_idx); + //DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, cell_idx = %d\n", cell_idx); const real_number pos_in_cell = (pos_in_box - cell_idx*box_step_width[idx_pos]) / box_step_width[idx_pos]; - DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, pos_in_cell = %g\n", pos_in_cell); + //DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, pos_in_cell = %g\n", pos_in_cell); assert(0 <= pos_in_cell && pos_in_cell < 1); return pos_in_cell; } diff --git a/cpp/particles/p2p/p2p_computer.hpp b/cpp/particles/p2p/p2p_computer.hpp index ec8b2bcd35d765939a04d178ed65e3b60888a245..49115bd2f5cc626fbae7758e45cf2ec6ef9d8344 100644 --- a/cpp/particles/p2p/p2p_computer.hpp +++ b/cpp/particles/p2p/p2p_computer.hpp @@ -69,6 +69,9 @@ public: } } + /** + * NOTE: this is called only ONCE for each pair of interacting particles. + */ template <int size_particle_positions, int size_particle_rhs> void compute_interaction(const partsize_t /*idx_part1*/, const real_number pos_part1[], diff --git a/cpp/particles/p2p/p2p_computer_empty.hpp b/cpp/particles/p2p/p2p_computer_empty.hpp index 03d8cd64995ed6a190f1d444d2846d230985dec8..5c43ef3c8a13d3095e3b172787bca8a8bdbe8c3b 100644 --- a/cpp/particles/p2p/p2p_computer_empty.hpp +++ b/cpp/particles/p2p/p2p_computer_empty.hpp @@ -39,6 +39,9 @@ public: void reduce_particles_rhs(real_number /*rhs_dst*/[], const real_number /*rhs_src*/[], const partsize_t /*nbParticles*/) const{ } + /** + * NOTE: this is called only ONCE for each pair of interacting particles. + */ template <int size_particle_positions, int size_particle_rhs> void compute_interaction(const partsize_t /*idx_part1*/, const real_number /*pos_part1*/[], real_number /*rhs_part1*/[], diff --git a/cpp/particles/p2p/p2p_ghost_collisions.hpp b/cpp/particles/p2p/p2p_ghost_collisions.hpp index df1e4327fe0e13ee3e0ceb31873458bebfe198df..da7efac13b75c38c080dab7015e910ca10119d8e 100644 --- a/cpp/particles/p2p/p2p_ghost_collisions.hpp +++ b/cpp/particles/p2p/p2p_ghost_collisions.hpp @@ -57,18 +57,17 @@ class p2p_ghost_collisions bool isActive; void add_colliding_pair(partsize_t idx_part1, partsize_t idx_part2) { - //DEBUG_MSG("thread %d, compute_interaction %ld, computer %ld, with collision_pairs_local size %d\n", - // omp_get_thread_num(), - // &this->collision_pairs_local, - // this, - // this->collision_pairs_local.size()); - if (idx_part1 < idx_part2) // only store unique pairs of colliding particles + // store colliding particle ids in order, to be able to identify pairs more easily + assert(idx_part1!=idx_part2); + partsize_t idx_part_small = idx_part1; + partsize_t idx_part_big = idx_part2; + if (idx_part1 > idx_part2) { - this->collision_pairs_local.push_back(idx_part1); - this->collision_pairs_local.push_back(idx_part2); + idx_part_small = idx_part2; + idx_part_big = idx_part1; } - //DEBUG_MSG("inside compute interaction idx_part1 = %ld and idx_part2 = %ld\n", idx_part1, idx_part2); - assert(idx_part1!=idx_part2); + this->collision_pairs_local.push_back(idx_part_small); + this->collision_pairs_local.push_back(idx_part_big); } protected: bool synchronisation; @@ -185,6 +184,9 @@ public: } + /** + * NOTE: this is called only ONCE for each pair of interacting particles. + */ template <int size_particle_positions, int size_particle_rhs> void compute_interaction(const partsize_t idx_part1, const real_number pos_part1[],