* (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.
*/
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.
*/
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.
*/
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
+ 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)
template <int dim,int spacedim>
void
- ParticleHandler<dim,spacedim>::update_cache()
+ ParticleHandler<dim,spacedim>::update_cached_numbers()
{
types::particle_index locally_highest_index = 0;
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();
}
+ 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
remove_particle(particles_out_of_cell[i]);
particles.insert(sorted_particles_map.begin(),sorted_particles_map.end());
- update_cache();
+ update_cached_numbers();
}
// 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)
{
// 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();
}
}