From 8bfead0d85a655b5d367064b4b48cde4f357fb1d Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 30 Nov 2019 10:55:16 -0500 Subject: [PATCH] Fix numbering in ParticleHandler::insert_particles() --- doc/news/changes/minor/20191130DanielArndt | 6 ++ source/particles/particle_handler.cc | 14 +++-- ...handler_07.with_p4est=true.mpirun=1.output | 60 +++++++++---------- .../particle_handler_serial_07.output | 60 +++++++++---------- 4 files changed, 75 insertions(+), 65 deletions(-) create mode 100644 doc/news/changes/minor/20191130DanielArndt diff --git a/doc/news/changes/minor/20191130DanielArndt b/doc/news/changes/minor/20191130DanielArndt new file mode 100644 index 0000000000..93b2628a54 --- /dev/null +++ b/doc/news/changes/minor/20191130DanielArndt @@ -0,0 +1,6 @@ +Fixed: ParticleHandler::insert_particles() taking a std::vector of Point objects +starts numbering the particles with 0 instead of 1 to be consistent with the +other ParticleHandler::insert_particles() function and the +ParticleHandler::insert_particle() function. +
+(Daniel Arndt, 2019/11/30) diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index f64f192fcb..2d89491472 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -193,17 +193,21 @@ namespace Particles global_number_of_particles = dealii::Utilities::MPI::sum( particles.size(), parallel_triangulation->get_communicator()); next_free_particle_index = - dealii::Utilities::MPI::max( - locally_highest_index, parallel_triangulation->get_communicator()) + - 1; + global_number_of_particles == 0 ? + 0 : + dealii::Utilities::MPI::max( + locally_highest_index, + parallel_triangulation->get_communicator()) + + 1; global_max_particles_per_cell = dealii::Utilities::MPI::max( local_max_particles_per_cell, parallel_triangulation->get_communicator()); } else { - global_number_of_particles = particles.size(); - next_free_particle_index = locally_highest_index + 1; + global_number_of_particles = particles.size(); + next_free_particle_index = + global_number_of_particles == 0 ? 0 : locally_highest_index + 1; global_max_particles_per_cell = local_max_particles_per_cell; } } diff --git a/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output b/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output index 066bf60dcc..f60b28e24c 100644 --- a/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output +++ b/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output @@ -1,97 +1,97 @@ DEAL:2d/2d::Particle number: 10 -DEAL:2d/2d::Particle id 3 is in cell 2.0 +DEAL:2d/2d::Particle id 2 is in cell 2.0 DEAL:2d/2d:: at location 0.250000 0.250000 DEAL:2d/2d:: at reference location 1.00000 1.00000 -DEAL:2d/2d::Particle id 2 is in cell 2.0 +DEAL:2d/2d::Particle id 1 is in cell 2.0 DEAL:2d/2d:: at location 0.150000 0.150000 DEAL:2d/2d:: at reference location 0.600000 0.600000 -DEAL:2d/2d::Particle id 1 is in cell 2.0 +DEAL:2d/2d::Particle id 0 is in cell 2.0 DEAL:2d/2d:: at location 0.0500000 0.0500000 DEAL:2d/2d:: at reference location 0.200000 0.200000 -DEAL:2d/2d::Particle id 5 is in cell 2.3 +DEAL:2d/2d::Particle id 4 is in cell 2.3 DEAL:2d/2d:: at location 0.450000 0.450000 DEAL:2d/2d:: at reference location 0.800000 0.800000 -DEAL:2d/2d::Particle id 4 is in cell 2.3 +DEAL:2d/2d::Particle id 3 is in cell 2.3 DEAL:2d/2d:: at location 0.350000 0.350000 DEAL:2d/2d:: at reference location 0.400000 0.400000 -DEAL:2d/2d::Particle id 8 is in cell 2.12 +DEAL:2d/2d::Particle id 7 is in cell 2.12 DEAL:2d/2d:: at location 0.750000 0.750000 DEAL:2d/2d:: at reference location 1.00000 1.00000 -DEAL:2d/2d::Particle id 7 is in cell 2.12 +DEAL:2d/2d::Particle id 6 is in cell 2.12 DEAL:2d/2d:: at location 0.650000 0.650000 DEAL:2d/2d:: at reference location 0.600000 0.600000 -DEAL:2d/2d::Particle id 6 is in cell 2.12 +DEAL:2d/2d::Particle id 5 is in cell 2.12 DEAL:2d/2d:: at location 0.550000 0.550000 DEAL:2d/2d:: at reference location 0.200000 0.200000 -DEAL:2d/2d::Particle id 10 is in cell 2.15 +DEAL:2d/2d::Particle id 9 is in cell 2.15 DEAL:2d/2d:: at location 0.950000 0.950000 DEAL:2d/2d:: at reference location 0.800000 0.800000 -DEAL:2d/2d::Particle id 9 is in cell 2.15 +DEAL:2d/2d::Particle id 8 is in cell 2.15 DEAL:2d/2d:: at location 0.850000 0.850000 DEAL:2d/2d:: at reference location 0.400000 0.400000 DEAL:2d/2d::OK DEAL:2d/3d::Particle number: 10 -DEAL:2d/3d::Particle id 3 is in cell 2.0 +DEAL:2d/3d::Particle id 2 is in cell 2.0 DEAL:2d/3d:: at location 0.250000 0.250000 0.250000 DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 2 is in cell 2.0 +DEAL:2d/3d::Particle id 1 is in cell 2.0 DEAL:2d/3d:: at location 0.150000 0.150000 0.150000 DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 1 is in cell 2.0 +DEAL:2d/3d::Particle id 0 is in cell 2.0 DEAL:2d/3d:: at location 0.0500000 0.0500000 0.0500000 DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 5 is in cell 2.3 +DEAL:2d/3d::Particle id 4 is in cell 2.3 DEAL:2d/3d:: at location 0.450000 0.450000 0.450000 DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 4 is in cell 2.3 +DEAL:2d/3d::Particle id 3 is in cell 2.3 DEAL:2d/3d:: at location 0.350000 0.350000 0.350000 DEAL:2d/3d:: at reference location 0.400000 0.400000 -DEAL:2d/3d::Particle id 8 is in cell 2.12 +DEAL:2d/3d::Particle id 7 is in cell 2.12 DEAL:2d/3d:: at location 0.750000 0.750000 0.750000 DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 7 is in cell 2.12 +DEAL:2d/3d::Particle id 6 is in cell 2.12 DEAL:2d/3d:: at location 0.650000 0.650000 0.650000 DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 6 is in cell 2.12 +DEAL:2d/3d::Particle id 5 is in cell 2.12 DEAL:2d/3d:: at location 0.550000 0.550000 0.550000 DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 10 is in cell 2.15 +DEAL:2d/3d::Particle id 9 is in cell 2.15 DEAL:2d/3d:: at location 0.950000 0.950000 0.950000 DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 9 is in cell 2.15 +DEAL:2d/3d::Particle id 8 is in cell 2.15 DEAL:2d/3d:: at location 0.850000 0.850000 0.850000 DEAL:2d/3d:: at reference location 0.400000 0.400000 DEAL:2d/3d::OK DEAL:3d/3d::Particle number: 10 -DEAL:3d/3d::Particle id 3 is in cell 2.0 +DEAL:3d/3d::Particle id 2 is in cell 2.0 DEAL:3d/3d:: at location 0.250000 0.250000 0.250000 DEAL:3d/3d:: at reference location 1.00000 1.00000 1.00000 -DEAL:3d/3d::Particle id 2 is in cell 2.0 +DEAL:3d/3d::Particle id 1 is in cell 2.0 DEAL:3d/3d:: at location 0.150000 0.150000 0.150000 DEAL:3d/3d:: at reference location 0.600000 0.600000 0.600000 -DEAL:3d/3d::Particle id 1 is in cell 2.0 +DEAL:3d/3d::Particle id 0 is in cell 2.0 DEAL:3d/3d:: at location 0.0500000 0.0500000 0.0500000 DEAL:3d/3d:: at reference location 0.200000 0.200000 0.200000 -DEAL:3d/3d::Particle id 5 is in cell 2.7 +DEAL:3d/3d::Particle id 4 is in cell 2.7 DEAL:3d/3d:: at location 0.450000 0.450000 0.450000 DEAL:3d/3d:: at reference location 0.800000 0.800000 0.800000 -DEAL:3d/3d::Particle id 4 is in cell 2.7 +DEAL:3d/3d::Particle id 3 is in cell 2.7 DEAL:3d/3d:: at location 0.350000 0.350000 0.350000 DEAL:3d/3d:: at reference location 0.400000 0.400000 0.400000 -DEAL:3d/3d::Particle id 8 is in cell 2.56 +DEAL:3d/3d::Particle id 7 is in cell 2.56 DEAL:3d/3d:: at location 0.750000 0.750000 0.750000 DEAL:3d/3d:: at reference location 1.00000 1.00000 1.00000 -DEAL:3d/3d::Particle id 7 is in cell 2.56 +DEAL:3d/3d::Particle id 6 is in cell 2.56 DEAL:3d/3d:: at location 0.650000 0.650000 0.650000 DEAL:3d/3d:: at reference location 0.600000 0.600000 0.600000 -DEAL:3d/3d::Particle id 6 is in cell 2.56 +DEAL:3d/3d::Particle id 5 is in cell 2.56 DEAL:3d/3d:: at location 0.550000 0.550000 0.550000 DEAL:3d/3d:: at reference location 0.200000 0.200000 0.200000 -DEAL:3d/3d::Particle id 10 is in cell 2.63 +DEAL:3d/3d::Particle id 9 is in cell 2.63 DEAL:3d/3d:: at location 0.950000 0.950000 0.950000 DEAL:3d/3d:: at reference location 0.800000 0.800000 0.800000 -DEAL:3d/3d::Particle id 9 is in cell 2.63 +DEAL:3d/3d::Particle id 8 is in cell 2.63 DEAL:3d/3d:: at location 0.850000 0.850000 0.850000 DEAL:3d/3d:: at reference location 0.400000 0.400000 0.400000 DEAL:3d/3d::OK diff --git a/tests/particles/particle_handler_serial_07.output b/tests/particles/particle_handler_serial_07.output index 066bf60dcc..f60b28e24c 100644 --- a/tests/particles/particle_handler_serial_07.output +++ b/tests/particles/particle_handler_serial_07.output @@ -1,97 +1,97 @@ DEAL:2d/2d::Particle number: 10 -DEAL:2d/2d::Particle id 3 is in cell 2.0 +DEAL:2d/2d::Particle id 2 is in cell 2.0 DEAL:2d/2d:: at location 0.250000 0.250000 DEAL:2d/2d:: at reference location 1.00000 1.00000 -DEAL:2d/2d::Particle id 2 is in cell 2.0 +DEAL:2d/2d::Particle id 1 is in cell 2.0 DEAL:2d/2d:: at location 0.150000 0.150000 DEAL:2d/2d:: at reference location 0.600000 0.600000 -DEAL:2d/2d::Particle id 1 is in cell 2.0 +DEAL:2d/2d::Particle id 0 is in cell 2.0 DEAL:2d/2d:: at location 0.0500000 0.0500000 DEAL:2d/2d:: at reference location 0.200000 0.200000 -DEAL:2d/2d::Particle id 5 is in cell 2.3 +DEAL:2d/2d::Particle id 4 is in cell 2.3 DEAL:2d/2d:: at location 0.450000 0.450000 DEAL:2d/2d:: at reference location 0.800000 0.800000 -DEAL:2d/2d::Particle id 4 is in cell 2.3 +DEAL:2d/2d::Particle id 3 is in cell 2.3 DEAL:2d/2d:: at location 0.350000 0.350000 DEAL:2d/2d:: at reference location 0.400000 0.400000 -DEAL:2d/2d::Particle id 8 is in cell 2.12 +DEAL:2d/2d::Particle id 7 is in cell 2.12 DEAL:2d/2d:: at location 0.750000 0.750000 DEAL:2d/2d:: at reference location 1.00000 1.00000 -DEAL:2d/2d::Particle id 7 is in cell 2.12 +DEAL:2d/2d::Particle id 6 is in cell 2.12 DEAL:2d/2d:: at location 0.650000 0.650000 DEAL:2d/2d:: at reference location 0.600000 0.600000 -DEAL:2d/2d::Particle id 6 is in cell 2.12 +DEAL:2d/2d::Particle id 5 is in cell 2.12 DEAL:2d/2d:: at location 0.550000 0.550000 DEAL:2d/2d:: at reference location 0.200000 0.200000 -DEAL:2d/2d::Particle id 10 is in cell 2.15 +DEAL:2d/2d::Particle id 9 is in cell 2.15 DEAL:2d/2d:: at location 0.950000 0.950000 DEAL:2d/2d:: at reference location 0.800000 0.800000 -DEAL:2d/2d::Particle id 9 is in cell 2.15 +DEAL:2d/2d::Particle id 8 is in cell 2.15 DEAL:2d/2d:: at location 0.850000 0.850000 DEAL:2d/2d:: at reference location 0.400000 0.400000 DEAL:2d/2d::OK DEAL:2d/3d::Particle number: 10 -DEAL:2d/3d::Particle id 3 is in cell 2.0 +DEAL:2d/3d::Particle id 2 is in cell 2.0 DEAL:2d/3d:: at location 0.250000 0.250000 0.250000 DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 2 is in cell 2.0 +DEAL:2d/3d::Particle id 1 is in cell 2.0 DEAL:2d/3d:: at location 0.150000 0.150000 0.150000 DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 1 is in cell 2.0 +DEAL:2d/3d::Particle id 0 is in cell 2.0 DEAL:2d/3d:: at location 0.0500000 0.0500000 0.0500000 DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 5 is in cell 2.3 +DEAL:2d/3d::Particle id 4 is in cell 2.3 DEAL:2d/3d:: at location 0.450000 0.450000 0.450000 DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 4 is in cell 2.3 +DEAL:2d/3d::Particle id 3 is in cell 2.3 DEAL:2d/3d:: at location 0.350000 0.350000 0.350000 DEAL:2d/3d:: at reference location 0.400000 0.400000 -DEAL:2d/3d::Particle id 8 is in cell 2.12 +DEAL:2d/3d::Particle id 7 is in cell 2.12 DEAL:2d/3d:: at location 0.750000 0.750000 0.750000 DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 7 is in cell 2.12 +DEAL:2d/3d::Particle id 6 is in cell 2.12 DEAL:2d/3d:: at location 0.650000 0.650000 0.650000 DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 6 is in cell 2.12 +DEAL:2d/3d::Particle id 5 is in cell 2.12 DEAL:2d/3d:: at location 0.550000 0.550000 0.550000 DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 10 is in cell 2.15 +DEAL:2d/3d::Particle id 9 is in cell 2.15 DEAL:2d/3d:: at location 0.950000 0.950000 0.950000 DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 9 is in cell 2.15 +DEAL:2d/3d::Particle id 8 is in cell 2.15 DEAL:2d/3d:: at location 0.850000 0.850000 0.850000 DEAL:2d/3d:: at reference location 0.400000 0.400000 DEAL:2d/3d::OK DEAL:3d/3d::Particle number: 10 -DEAL:3d/3d::Particle id 3 is in cell 2.0 +DEAL:3d/3d::Particle id 2 is in cell 2.0 DEAL:3d/3d:: at location 0.250000 0.250000 0.250000 DEAL:3d/3d:: at reference location 1.00000 1.00000 1.00000 -DEAL:3d/3d::Particle id 2 is in cell 2.0 +DEAL:3d/3d::Particle id 1 is in cell 2.0 DEAL:3d/3d:: at location 0.150000 0.150000 0.150000 DEAL:3d/3d:: at reference location 0.600000 0.600000 0.600000 -DEAL:3d/3d::Particle id 1 is in cell 2.0 +DEAL:3d/3d::Particle id 0 is in cell 2.0 DEAL:3d/3d:: at location 0.0500000 0.0500000 0.0500000 DEAL:3d/3d:: at reference location 0.200000 0.200000 0.200000 -DEAL:3d/3d::Particle id 5 is in cell 2.7 +DEAL:3d/3d::Particle id 4 is in cell 2.7 DEAL:3d/3d:: at location 0.450000 0.450000 0.450000 DEAL:3d/3d:: at reference location 0.800000 0.800000 0.800000 -DEAL:3d/3d::Particle id 4 is in cell 2.7 +DEAL:3d/3d::Particle id 3 is in cell 2.7 DEAL:3d/3d:: at location 0.350000 0.350000 0.350000 DEAL:3d/3d:: at reference location 0.400000 0.400000 0.400000 -DEAL:3d/3d::Particle id 8 is in cell 2.56 +DEAL:3d/3d::Particle id 7 is in cell 2.56 DEAL:3d/3d:: at location 0.750000 0.750000 0.750000 DEAL:3d/3d:: at reference location 1.00000 1.00000 1.00000 -DEAL:3d/3d::Particle id 7 is in cell 2.56 +DEAL:3d/3d::Particle id 6 is in cell 2.56 DEAL:3d/3d:: at location 0.650000 0.650000 0.650000 DEAL:3d/3d:: at reference location 0.600000 0.600000 0.600000 -DEAL:3d/3d::Particle id 6 is in cell 2.56 +DEAL:3d/3d::Particle id 5 is in cell 2.56 DEAL:3d/3d:: at location 0.550000 0.550000 0.550000 DEAL:3d/3d:: at reference location 0.200000 0.200000 0.200000 -DEAL:3d/3d::Particle id 10 is in cell 2.63 +DEAL:3d/3d::Particle id 9 is in cell 2.63 DEAL:3d/3d:: at location 0.950000 0.950000 0.950000 DEAL:3d/3d:: at reference location 0.800000 0.800000 0.800000 -DEAL:3d/3d::Particle id 9 is in cell 2.63 +DEAL:3d/3d::Particle id 8 is in cell 2.63 DEAL:3d/3d:: at location 0.850000 0.850000 0.850000 DEAL:3d/3d:: at reference location 0.400000 0.400000 0.400000 DEAL:3d/3d::OK -- 2.39.5