16#ifndef dealii_particles_property_pool_h
17#define dealii_particles_property_pool_h
31#ifdef DEAL_II_WITH_64BIT_INDICES
45# ifdef DEAL_II_WITH_MPI
50# define DEAL_II_PARTICLE_INDEX_MPI_TYPE MPI_UINT64_T
67# ifdef DEAL_II_WITH_MPI
72# define DEAL_II_PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED
101 template <
int dim,
int spacedim = dim>
206 reserve(
const std::size_t size);
263 std::vector<types::particle_index>
ids;
286 template <
int dim,
int spacedim>
290 const std::vector<double>::size_type data_index =
291 (handle != invalid_handle) ? handle : 0;
299 Assert(data_index <= locations.size() - 1,
300 ExcMessage(
"Invalid location handle. This can happen if the "
301 "handle was duplicated and then one copy was deallocated "
302 "before trying to access the properties."));
304 return locations[data_index];
309 template <
int dim,
int spacedim>
314 const std::vector<double>::size_type data_index =
315 (handle != invalid_handle) ? handle : 0;
323 Assert(data_index <= locations.size() - 1,
324 ExcMessage(
"Invalid location handle. This can happen if the "
325 "handle was duplicated and then one copy was deallocated "
326 "before trying to access the properties."));
328 locations[data_index] = new_location;
333 template <
int dim,
int spacedim>
337 const std::vector<double>::size_type data_index =
338 (handle != invalid_handle) ? handle : 0;
346 Assert(data_index <= reference_locations.size() - 1,
347 ExcMessage(
"Invalid location handle. This can happen if the "
348 "handle was duplicated and then one copy was deallocated "
349 "before trying to access the properties."));
351 return reference_locations[data_index];
356 template <
int dim,
int spacedim>
362 const std::vector<double>::size_type data_index =
363 (handle != invalid_handle) ? handle : 0;
371 Assert(data_index <= reference_locations.size() - 1,
372 ExcMessage(
"Invalid location handle. This can happen if the "
373 "handle was duplicated and then one copy was deallocated "
374 "before trying to access the properties."));
376 reference_locations[data_index] = new_reference_location;
381 template <
int dim,
int spacedim>
385 const std::vector<double>::size_type data_index =
386 (handle != invalid_handle) ? handle : 0;
394 Assert(data_index <= ids.size() - 1,
395 ExcMessage(
"Invalid location handle. This can happen if the "
396 "handle was duplicated and then one copy was deallocated "
397 "before trying to access the properties."));
399 return ids[data_index];
404 template <
int dim,
int spacedim>
409 const std::vector<double>::size_type data_index =
410 (handle != invalid_handle) ? handle : 0;
418 Assert(data_index <= ids.size() - 1,
419 ExcMessage(
"Invalid location handle. This can happen if the "
420 "handle was duplicated and then one copy was deallocated "
421 "before trying to access the properties."));
423 ids[data_index] = new_id;
428 template <
int dim,
int spacedim>
432 const std::vector<double>::size_type data_index =
433 (handle != invalid_handle) ? handle * n_properties : 0;
441 Assert(data_index <= properties.size() - n_properties,
442 ExcMessage(
"Invalid property handle. This can happen if the "
443 "handle was duplicated and then one copy was deallocated "
444 "before trying to access the properties."));
451 template <
int dim,
int spacedim>
455 return locations.size();
const Point< spacedim > & get_location(const Handle handle) const
std::vector< Point< dim > > reference_locations
unsigned int n_properties_per_slot() const
unsigned int n_registered_slots() const
ArrayView< double > get_properties(const Handle handle)
unsigned int n_slots() const
const unsigned int n_properties
void deregister_particle(Handle &handle)
void set_id(const Handle handle, const types::particle_index &new_id)
types::particle_index get_id(const Handle handle) const
void set_reference_location(const Handle handle, const Point< dim > &new_reference_location)
void reserve(const std::size_t size)
void set_location(const Handle handle, const Point< spacedim > &new_location)
const Point< dim > & get_reference_location(const Handle handle) const
void sort_memory_slots(const std::vector< Handle > &handles_to_sort)
std::vector< Point< spacedim > > locations
std::vector< types::particle_index > ids
static const Handle invalid_handle
Handle register_particle()
std::vector< Handle > currently_available_handles
std::vector< double > properties
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
unsigned int particle_index