15#ifndef dealii_particles_property_pool_h
16#define dealii_particles_property_pool_h
30#ifdef DEAL_II_WITH_64BIT_INDICES
44# ifdef DEAL_II_WITH_MPI
49# define DEAL_II_PARTICLE_INDEX_MPI_TYPE MPI_UINT64_T
66# ifdef DEAL_II_WITH_MPI
71# define DEAL_II_PARTICLE_INDEX_MPI_TYPE MPI_UNSIGNED
100 template <
int dim,
int spacedim = dim>
213 reserve(
const std::size_t size);
270 std::vector<types::particle_index>
ids;
293 template <
int dim,
int spacedim>
297 const std::vector<double>::size_type data_index =
298 (handle != invalid_handle) ? handle : 0;
306 Assert(data_index <= locations.size() - 1,
307 ExcMessage(
"Invalid location handle. This can happen if the "
308 "handle was duplicated and then one copy was deallocated "
309 "before trying to access the properties."));
311 return locations[data_index];
316 template <
int dim,
int spacedim>
320 const std::vector<double>::size_type data_index =
321 (handle != invalid_handle) ? handle : 0;
329 Assert(data_index <= locations.size() - 1,
330 ExcMessage(
"Invalid location handle. This can happen if the "
331 "handle was duplicated and then one copy was deallocated "
332 "before trying to access the properties."));
334 return locations[data_index];
339 template <
int dim,
int spacedim>
344 const std::vector<double>::size_type data_index =
345 (handle != invalid_handle) ? handle : 0;
353 Assert(data_index <= locations.size() - 1,
354 ExcMessage(
"Invalid location handle. This can happen if the "
355 "handle was duplicated and then one copy was deallocated "
356 "before trying to access the properties."));
358 locations[data_index] = new_location;
363 template <
int dim,
int spacedim>
367 const std::vector<double>::size_type data_index =
368 (handle != invalid_handle) ? handle : 0;
376 Assert(data_index <= reference_locations.size() - 1,
377 ExcMessage(
"Invalid location handle. This can happen if the "
378 "handle was duplicated and then one copy was deallocated "
379 "before trying to access the properties."));
381 return reference_locations[data_index];
386 template <
int dim,
int spacedim>
392 const std::vector<double>::size_type data_index =
393 (handle != invalid_handle) ? handle : 0;
401 Assert(data_index <= reference_locations.size() - 1,
402 ExcMessage(
"Invalid location handle. This can happen if the "
403 "handle was duplicated and then one copy was deallocated "
404 "before trying to access the properties."));
406 reference_locations[data_index] = new_reference_location;
411 template <
int dim,
int spacedim>
415 const std::vector<double>::size_type data_index =
416 (handle != invalid_handle) ? handle : 0;
424 Assert(data_index <= ids.size() - 1,
425 ExcMessage(
"Invalid location handle. This can happen if the "
426 "handle was duplicated and then one copy was deallocated "
427 "before trying to access the properties."));
429 return ids[data_index];
434 template <
int dim,
int spacedim>
439 const std::vector<double>::size_type data_index =
440 (handle != invalid_handle) ? handle : 0;
448 Assert(data_index <= ids.size() - 1,
449 ExcMessage(
"Invalid location handle. This can happen if the "
450 "handle was duplicated and then one copy was deallocated "
451 "before trying to access the properties."));
453 ids[data_index] = new_id;
458 template <
int dim,
int spacedim>
462 const std::vector<double>::size_type data_index =
463 (handle != invalid_handle) ? handle * n_properties : 0;
471 Assert(data_index <= properties.size() - n_properties,
472 ExcMessage(
"Invalid property handle. This can happen if the "
473 "handle was duplicated and then one copy was deallocated "
474 "before trying to access the properties."));
481 template <
int dim,
int spacedim>
485 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)
Point< spacedim > & get_location(const Handle handle)
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