diff --git a/cpp/particles/rhs/tracer_with_collision_counter_rhs.hpp b/cpp/particles/rhs/tracer_with_collision_counter_rhs.hpp index 6688264d33ca02e00f4d5a26f97f8bcefc27b6ac..9ba41c3092fab1f5de5605e050e9a7facb670511 100644 --- a/cpp/particles/rhs/tracer_with_collision_counter_rhs.hpp +++ b/cpp/particles/rhs/tracer_with_collision_counter_rhs.hpp @@ -58,11 +58,13 @@ class tracer_with_collision_counter_rhs: public tracer_rhs<rnumber, be, tt> // interpolation adds on top of existing values, so result must be cleared. std::fill_n(result, pset.getLocalNumberOfParticles()*3, 0); int interpolation_result = (*(this->velocity))(t, pset, result); - additional_data.push_back(std::unique_ptr<abstract_particle_set::particle_rnumber[]>( - new abstract_particle_set::particle_rnumber[pset.getLocalNumberOfParticles()*pset.getStateSize()])); + additional_data.insert( + additional_data.begin(), + std::unique_ptr<abstract_particle_set::particle_rnumber[]>( + new abstract_particle_set::particle_rnumber[pset.getLocalNumberOfParticles()*pset.getStateSize()])); // copy rhs values to temporary array pset.copy_state_tofrom( - additional_data[additional_data.size()-1].get(), + additional_data[0].get(), result); this->p2p_gc.reset_collision_pairs(); pset.template applyP2PKernel< @@ -74,9 +76,9 @@ class tracer_with_collision_counter_rhs: public tracer_rhs<rnumber, be, tt> // copy shuffled rhs values pset.copy_state_tofrom( result, - additional_data[additional_data.size()-1].get()); + additional_data[0].get()); // clear temporary array - additional_data.pop_back(); + additional_data.erase(additional_data.begin()); return interpolation_result; }