deallog << "Particle number: " << particle_handler.n_global_particles()
<< std::endl;
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
+ for (const auto &particle : particle_handler)
{
- deallog << "Particle location: " << particle->get_location()
+ deallog << "Particle location: " << particle.get_location()
<< std::endl;
deallog << "Particle reference location: "
- << particle->get_reference_location() << std::endl;
+ << particle.get_reference_location() << std::endl;
}
}
deallog << "Max particles per cell: "
<< particle_handler.n_global_max_particles_per_cell() << std::endl;
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
+ for (const auto &particle : particle_handler)
{
- deallog << "Particle location: " << particle->get_location()
+ deallog << "Particle location: " << particle.get_location()
<< std::endl;
deallog << "Particle reference location: "
- << particle->get_reference_location() << std::endl;
+ << particle.get_reference_location() << std::endl;
}
}
particle_handler.insert_particle(particle1, cell1);
particle_handler.insert_particle(particle2, cell2);
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "Before sort particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "Before sort particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< std::endl;
particle_handler.sort_particles_into_subdomains_and_cells();
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "After sort particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "After sort particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< std::endl;
// Move all points up by 0.5. This will change cell for particle 1, and will
// coordinate dim-1 despite having a spacedim point.
Point<spacedim> shift;
shift(dim - 1) = 0.5;
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- particle->set_location(particle->get_location() + shift);
+ for (auto &particle : particle_handler)
+ particle.set_location(particle.get_location() + shift);
particle_handler.sort_particles_into_subdomains_and_cells();
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "After shift particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "After shift particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< std::endl;
}
particle_handler.insert_particle(particle1, cell1);
particle_handler.insert_particle(particle2, cell2);
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "Before sort particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "Before sort particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< " on process "
<< Utilities::MPI::this_mpi_process(tr.get_communicator())
<< std::flush << std::endl;
particle_handler.sort_particles_into_subdomains_and_cells();
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "After sort particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "After sort particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< " on process "
<< Utilities::MPI::this_mpi_process(tr.get_communicator())
<< std::flush << std::endl;
// coordinate dim-1 despite having a spacedim point.
Point<spacedim> shift;
shift(dim - 1) = 0.5;
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- particle->set_location(particle->get_location() + shift);
+ for (auto &particle : particle_handler)
+ particle.set_location(particle.get_location() + shift);
particle_handler.sort_particles_into_subdomains_and_cells();
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "After shift particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "After shift particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< " on process "
<< Utilities::MPI::this_mpi_process(tr.get_communicator())
<< std::flush << std::endl;
create_regular_particle_distribution(particle_handler, tr);
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "Before refinement particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "Before refinement particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< std::endl;
// Check that all particles are moved to children
tr.refine_global(1);
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "After refinement particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "After refinement particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< std::endl;
// Reverse the refinement and check again
tr.execute_coarsening_and_refinement();
- for (auto particle = particle_handler.begin();
- particle != particle_handler.end();
- ++particle)
- deallog << "After coarsening particle id " << particle->get_id()
- << " is in cell " << particle->get_surrounding_cell(tr)
+ for (const auto &particle : particle_handler)
+ deallog << "After coarsening particle id " << particle.get_id()
+ << " is in cell " << particle.get_surrounding_cell(tr)
<< std::endl;
}