Skip to content

Commit

Permalink
Fixed multi particle type bug in ParticleVector::sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Bert Vandenbroucke committed May 14, 2016
1 parent 279909d commit 1a067d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utilities/ParticleVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ void ParticleVector::sort() {
}
}

// save the local min and max keys before sorting on type
unsigned long loc_min = _particles[0]->get_key();
unsigned long loc_max = _particles.back()->get_key();
// make sure the particles are ordered per type
// particles of the same type should keep their relative ordering if we use
// stable_sort
Expand Down Expand Up @@ -248,8 +251,6 @@ void ParticleVector::sort() {

unsigned long maxkey = 1;
maxkey <<= 61;
unsigned long loc_min = _particles[0]->get_key();
unsigned long loc_max = _particles.back()->get_key();
vector<unsigned long> glo_min(MPIGlobal::size);
vector<unsigned long> glo_max(MPIGlobal::size);
MyMPI_Allgather(&loc_min, 1, MPI_UNSIGNED_LONG, &glo_min[0], 1,
Expand Down

0 comments on commit 1a067d9

Please sign in to comment.