Commit a3f2299f authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

adds sort to subset sample

parent 8cb4b0ef
......@@ -360,6 +360,11 @@ class particle_set: public abstract_particle_set
this->local_number_of_particles = 0;
this->total_number_of_particles = indices_to_copy.size();
DEBUG_MSG("particle_set::init_as_subset_of, desired subset_size = %ld, src_local_number = %ld, src_total_number = %ld\n",
this->total_number_of_particles,
src.getLocalNbParticles(),
src.getGlobalNbParticles());
// dumb selection of interesting particles
for (partsize_t ii = 0; ii < partsize_t(src.getLocalNbParticles()); ii++)
{
......@@ -391,6 +396,21 @@ class particle_set: public abstract_particle_set
this->local_index.get());
}
particles_utils::partition_extra_z<partsize_t, state_size>(
&this->local_state[0],
this->local_number_of_particles,
partition_interval_size,
this->number_particles_per_partition.get(),
this->offset_particles_for_partition.get(),
[&](const particle_rnumber& z_pos){
const int partition_level = this->pInterpolator.pbc_field_layer(z_pos, IDXC_Z);
assert(current_partition_interval.first <= partition_level && partition_level < current_partition_interval.second);
return partition_level - current_partition_interval.first;
},
[&](const partsize_t idx1, const partsize_t idx2){
std::swap(this->local_index[idx1], this->local_index[idx2]);
});
delete[] tmp_local_state;
delete[] tmp_local_index;
return EXIT_SUCCESS;
......
......@@ -283,6 +283,10 @@ public:
if(descriptor.nbParticlesToSend){
whatNext.emplace_back(std::pair<Action,int>{NOTHING_TODO, -1});
mpiRequests.emplace_back();
DEBUG_MSG("descriptor.nparticlestosend = %d, size_particle_positions = %d, std::numeric_limits = %d\n",
descriptor.nbParticlesToSend,
size_particle_positions,
std::numeric_limits<int>::max());
assert(descriptor.nbParticlesToSend*size_particle_positions < std::numeric_limits<int>::max());
AssertMpi(MPI_Isend(const_cast<real_number*>(&particles_positions[0]), int(descriptor.nbParticlesToSend*size_particle_positions), particles_utils::GetMpiType(real_number()), descriptor.destProc, TAG_SHIFT_OFFSET*counter_shift_tags + TAG_LOW_UP_PARTICLES,
current_com, &mpiRequests.back()));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment