From: Martin Kronbichler Date: Mon, 5 Oct 2020 07:48:35 +0000 (+0200) Subject: Make some more functions in ParticleHandler inline X-Git-Tag: v9.3.0-rc1~1035^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3d6defcdfe8674e987f486e1465a0e5edecd6b3;p=dealii.git Make some more functions in ParticleHandler inline --- diff --git a/include/deal.II/particles/particle_handler.h b/include/deal.II/particles/particle_handler.h index cf9432e1e5..fd0b345fd1 100644 --- a/include/deal.II/particles/particle_handler.h +++ b/include/deal.II/particles/particle_handler.h @@ -949,11 +949,81 @@ namespace Particles /* ---------------------- inline and template functions ------------------ */ + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::begin() const + { + return (const_cast *>(this))->begin(); + } + + + + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::begin() + { + return particle_iterator(particles, particles.begin()); + } + + + + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::end() const + { + return (const_cast *>(this))->end(); + } + + + + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::end() + { + return particle_iterator(particles, particles.end()); + } + + + + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::begin_ghost() const + { + return (const_cast *>(this))->begin_ghost(); + } + + + + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::begin_ghost() + { + return particle_iterator(ghost_particles, ghost_particles.begin()); + } + + + + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::end_ghost() const + { + return (const_cast *>(this))->end_ghost(); + } + + + + template + inline typename ParticleHandler::particle_iterator + ParticleHandler::end_ghost() + { + return particle_iterator(ghost_particles, ghost_particles.end()); + } + template template - void + inline void ParticleHandler::serialize(Archive &ar, const unsigned int) { // Note that we do not serialize the particle data itself. Instead we @@ -969,7 +1039,7 @@ namespace Particles template template - typename std::enable_if< + inline typename std::enable_if< std::is_convertible *>::value == false>::type ParticleHandler::set_particle_positions( @@ -994,7 +1064,7 @@ namespace Particles template template - void + inline void ParticleHandler::get_particle_positions( VectorType &output_vector, const bool add_to_output_vector) diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index 5191db3840..425541eac7 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -220,7 +220,8 @@ namespace Particles typename Triangulation::active_cell_iterator current_cell = triangulation->begin_active(); - for (particle_iterator particle = begin(); particle != end(); ++particle) + const particle_iterator end = this->end(); + for (particle_iterator particle = begin(); particle != end; ++particle) { locally_highest_index = std::max(locally_highest_index, particle->get_id()); @@ -264,78 +265,6 @@ namespace Particles - template - typename ParticleHandler::particle_iterator - ParticleHandler::begin() const - { - return (const_cast *>(this))->begin(); - } - - - - template - typename ParticleHandler::particle_iterator - ParticleHandler::begin() - { - return particle_iterator(particles, particles.begin()); - } - - - - template - typename ParticleHandler::particle_iterator - ParticleHandler::end() const - { - return (const_cast *>(this))->end(); - } - - - - template - typename ParticleHandler::particle_iterator - ParticleHandler::end() - { - return particle_iterator(particles, particles.end()); - } - - - - template - typename ParticleHandler::particle_iterator - ParticleHandler::begin_ghost() const - { - return (const_cast *>(this))->begin_ghost(); - } - - - - template - typename ParticleHandler::particle_iterator - ParticleHandler::begin_ghost() - { - return particle_iterator(ghost_particles, ghost_particles.begin()); - } - - - - template - typename ParticleHandler::particle_iterator - ParticleHandler::end_ghost() const - { - return (const_cast *>(this))->end_ghost(); - } - - - - template - typename ParticleHandler::particle_iterator - ParticleHandler::end_ghost() - { - return particle_iterator(ghost_particles, ghost_particles.end()); - } - - - template types::particle_index ParticleHandler::n_particles_in_cell(