From 1a067d9a3f2b7852b3ac061d0a7b33d5e6101091 Mon Sep 17 00:00:00 2001 From: Bert Vandenbroucke Date: Sat, 14 May 2016 16:06:10 +0200 Subject: [PATCH] Fixed multi particle type bug in ParticleVector::sort --- src/utilities/ParticleVector.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utilities/ParticleVector.cpp b/src/utilities/ParticleVector.cpp index 972c819..64454cc 100644 --- a/src/utilities/ParticleVector.cpp +++ b/src/utilities/ParticleVector.cpp @@ -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 @@ -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 glo_min(MPIGlobal::size); vector glo_max(MPIGlobal::size); MyMPI_Allgather(&loc_min, 1, MPI_UNSIGNED_LONG, &glo_min[0], 1,