const Point<spacedim> &
get_location() const;
+ /**
+ * Get the location of this particle.
+ *
+ * @return The location of this particle.
+ */
+ Point<spacedim> &
+ get_location();
+
/**
* Set the reference location of this particle.
*
const Point<dim> &
get_reference_location() const;
+ /**
+ * Return the reference location of this particle in its current cell.
+ */
+ Point<dim> &
+ get_reference_location();
+
/**
* Return the ID number of this particle. The ID of a particle is intended
* to be a property that is globally unique even in parallel computations
+ template <int dim, int spacedim>
+ inline Point<spacedim> &
+ Particle<dim, spacedim>::get_location()
+ {
+ return property_pool->get_location(property_pool_handle);
+ }
+
+
+
template <int dim, int spacedim>
inline void
Particle<dim, spacedim>::set_reference_location(const Point<dim> &new_loc)
+ template <int dim, int spacedim>
+ inline Point<dim> &
+ Particle<dim, spacedim>::get_reference_location()
+ {
+ return property_pool->get_reference_location(property_pool_handle);
+ }
+
+
+
template <int dim, int spacedim>
inline types::particle_index
Particle<dim, spacedim>::get_id() const
const Point<spacedim> &
get_location() const;
+ /**
+ * Get the location of this particle.
+ *
+ * @return The location of this particle.
+ */
+ Point<spacedim> &
+ get_location();
+
/**
* Set the reference location of this particle.
*
const Point<dim> &
get_reference_location() const;
+ /**
+ * Return the reference location of this particle in its current cell.
+ */
+ Point<dim> &
+ get_reference_location();
+
/**
* Set the ID number of this particle.
*/
+ template <int dim, int spacedim>
+ inline Point<spacedim> &
+ ParticleAccessor<dim, spacedim>::get_location()
+ {
+ Assert(state() == IteratorState::valid, ExcInternalError());
+
+ return property_pool->get_location(get_handle());
+ }
+
+
+
template <int dim, int spacedim>
inline void
ParticleAccessor<dim, spacedim>::set_reference_location(
+ template <int dim, int spacedim>
+ inline Point<dim> &
+ ParticleAccessor<dim, spacedim>::get_reference_location()
+ {
+ Assert(state() == IteratorState::valid, ExcInternalError());
+
+ return property_pool->get_reference_location(get_handle());
+ }
+
+
+
template <int dim, int spacedim>
inline types::particle_index
ParticleAccessor<dim, spacedim>::get_id() const
deregister_particle(Handle &handle);
/**
- * Return the location of a particle identified by the given `handle`.
+ * Return a read-only reference to the location of a particle
+ * identified by the given `handle`.
*/
const Point<spacedim> &
get_location(const Handle handle) const;
+ /**
+ * Return a writeable reference to the location of a particle
+ * identified by the given `handle`.
+ */
+ Point<spacedim> &
+ get_location(const Handle handle);
+
/**
* Set the location of a particle identified by the given `handle`.
*/
set_location(const Handle handle, const Point<spacedim> &new_location);
/**
- * Return the reference_location of a particle identified by the given
- * `handle`.
+ * Return a read-only reference to the reference location of a particle
+ * identified by the given `handle`.
*/
const Point<dim> &
get_reference_location(const Handle handle) const;
+ /**
+ * Return a writeable reference to the reference location of a particle
+ * identified by the given `handle`.
+ */
+ Point<dim> &
+ get_reference_location(const Handle handle);
+
/**
* Set the reference location of a particle identified by the given
* `handle`.
+ template <int dim, int spacedim>
+ inline Point<spacedim> &
+ PropertyPool<dim, spacedim>::get_location(const Handle handle)
+ {
+ const std::vector<double>::size_type data_index =
+ (handle != invalid_handle) ? handle : 0;
+
+ // Ideally we would need to assert that 'handle' has not been deallocated
+ // by searching through 'currently_available_handles'. However, this
+ // is expensive and this function is performance critical, so instead
+ // just check against the array range, and rely on the fact
+ // that handles are invalidated when handed over to
+ // deallocate_properties_array().
+ Assert(data_index <= locations.size() - 1,
+ ExcMessage("Invalid location handle. This can happen if the "
+ "handle was duplicated and then one copy was deallocated "
+ "before trying to access the properties."));
+
+ return locations[data_index];
+ }
+
+
+
template <int dim, int spacedim>
inline void
PropertyPool<dim, spacedim>::set_location(const Handle handle,
+ template <int dim, int spacedim>
+ inline Point<dim> &
+ PropertyPool<dim, spacedim>::get_reference_location(const Handle handle)
+ {
+ const std::vector<double>::size_type data_index =
+ (handle != invalid_handle) ? handle : 0;
+
+ // Ideally we would need to assert that 'handle' has not been deallocated
+ // by searching through 'currently_available_handles'. However, this
+ // is expensive and this function is performance critical, so instead
+ // just check against the array range, and rely on the fact
+ // that handles are invalidated when handed over to
+ // deallocate_properties_array().
+ Assert(data_index <= reference_locations.size() - 1,
+ ExcMessage("Invalid location handle. This can happen if the "
+ "handle was duplicated and then one copy was deallocated "
+ "before trying to access the properties."));
+
+ return reference_locations[data_index];
+ }
+
+
+
template <int dim, int spacedim>
inline void
PropertyPool<dim, spacedim>::set_reference_location(