]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixes
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Mon, 16 Oct 2017 16:25:46 +0000 (10:25 -0600)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 9 Nov 2017 16:47:22 +0000 (09:47 -0700)
include/deal.II/particles/particle_handler.h
source/particles/particle_accessor.cc
source/particles/particle_handler.cc

index 094e3b879814077edb5d852b22e2c7b7e8b600bc..271fd2fea495d39d55005751df234c84f5434f25 100644 (file)
@@ -105,7 +105,7 @@ namespace Particles
      * (e.g. insert_particle). This is done because the update is
      * expensive compared to single operations.
      */
-    void update_cache();
+    void update_cached_numbers();
 
     /**
      * Return an iterator to the first particle.
@@ -217,6 +217,12 @@ namespace Particles
      */
     types::particle_index n_locally_owned_particles() const;
 
+    /**
+     * Return the number of particles in the local part of the
+     * triangulation.
+     */
+    types::particle_index get_next_free_particle_index() const;
+
     /**
      * Return the number of properties each particle has.
      */
@@ -258,6 +264,22 @@ namespace Particles
     void
     exchange_ghost_particles();
 
+    /**
+     * Callback function that should be called before every
+     * refinement and when writing checkpoints.
+     * Allows registering store_particles() in the triangulation.
+     */
+    void
+    register_store_callback_function(const bool serialization);
+
+    /**
+     * Callback function that should be called after every
+     * refinement and after resuming from a checkpoint.
+     * Allows registering load_particles() in the triangulation.
+     */
+    void
+    register_load_callback_function(const bool serialization);
+
     /**
      * Serialize the contents of this class.
      */
@@ -388,24 +410,6 @@ namespace Particles
                         std::multimap<types::LevelInd,Particle <dim,spacedim> > &received_particles,
                         const std::vector<std::vector<typename Triangulation<dim,spacedim>::active_cell_iterator> > &new_cells_for_particles = std::vector<std::vector<typename Triangulation<dim,spacedim>::active_cell_iterator> > ());
 
-
-
-    /**
-     * Callback function that should be called before every
-     * refinement and when writing checkpoints.
-     * Allows registering store_particles() in the triangulation.
-     */
-    void
-    register_store_callback_function(const bool serialization);
-
-    /**
-     * Callback function that should be called after every
-     * refinement and after resuming from a checkpoint.
-     * Allows registering load_particles() in the triangulation.
-     */
-    void
-    register_load_callback_function(const bool serialization);
-
     /**
      * Called by listener functions from Triangulation for every cell
      * before a refinement step. All particles have to be attached to their
index 42fabc146982ff20062785c992f655f6c0ee0410..92c0026e6bb2b6af38d152bea62e6a5755c7e92c 100644 (file)
@@ -122,6 +122,18 @@ namespace Particles
 
 
 
+  template <int dim, int spacedim>
+  bool
+  ParticleAccessor<dim,spacedim>::has_properties () const
+  {
+    Assert(particle != map->end(),
+           ExcInternalError());
+
+    return particle->second.has_properties();
+  }
+
+
+
   template <int dim, int spacedim>
   void
   ParticleAccessor<dim,spacedim>::set_properties (const std::vector<double> &new_properties)
index 13839888cc55b8f5e745bfc5f995187f24424f78..e57a824e8ff2e4ec86458ed4ec5debb5008671b1 100644 (file)
@@ -105,7 +105,7 @@ namespace Particles
 
   template <int dim,int spacedim>
   void
-  ParticleHandler<dim,spacedim>::update_cache()
+  ParticleHandler<dim,spacedim>::update_cached_numbers()
   {
 
     types::particle_index locally_highest_index = 0;
@@ -232,7 +232,7 @@ namespace Particles
   ParticleHandler<dim,spacedim>::insert_particles(const std::multimap<types::LevelInd, Particle<dim,spacedim> > &new_particles)
   {
     particles.insert(new_particles.begin(),new_particles.end());
-    update_cache();
+    update_cached_numbers();
   }
 
 
@@ -282,6 +282,15 @@ namespace Particles
 
 
 
+  template <int dim,int spacedim>
+  types::particle_index
+  ParticleHandler<dim,spacedim>::get_next_free_particle_index() const
+  {
+    return next_free_particle_index;
+  }
+
+
+
   template <int dim, int spacedim>
   PropertyPool &
   ParticleHandler<dim,spacedim>::get_property_pool () const
@@ -526,7 +535,7 @@ namespace Particles
       remove_particle(particles_out_of_cell[i]);
 
     particles.insert(sorted_particles_map.begin(),sorted_particles_map.end());
-    update_cache();
+    update_cached_numbers();
   }
 
 
@@ -756,7 +765,7 @@ namespace Particles
 
     // Only save and load particles if there are any, we might get here for
     // example if somebody created a ParticleHandler but generated 0 particles.
-    update_cache();
+    update_cached_numbers();
 
     if (global_max_particles_per_cell > 0)
       {
@@ -856,7 +865,7 @@ namespace Particles
         // Reset offset and update global number of particles. The number
         // can change because of discarded or newly generated particles
         data_offset = numbers::invalid_unsigned_int;
-        update_cache();
+        update_cached_numbers();
       }
   }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.