Skip to content

Commit 1a067d9

Browse files
author
Bert Vandenbroucke
committed
Fixed multi particle type bug in ParticleVector::sort
1 parent 279909d commit 1a067d9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utilities/ParticleVector.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ void ParticleVector::sort() {
214214
}
215215
}
216216

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

249252
unsigned long maxkey = 1;
250253
maxkey <<= 61;
251-
unsigned long loc_min = _particles[0]->get_key();
252-
unsigned long loc_max = _particles.back()->get_key();
253254
vector<unsigned long> glo_min(MPIGlobal::size);
254255
vector<unsigned long> glo_max(MPIGlobal::size);
255256
MyMPI_Allgather(&loc_min, 1, MPI_UNSIGNED_LONG, &glo_min[0], 1,

0 commit comments

Comments
 (0)