16#ifndef dealii_particles_particle_h
17#define dealii_particles_particle_h
93 template <
int dim,
int spacedim = dim>
390 template <
class Archive>
392 save(Archive &ar,
const unsigned int version)
const;
403 template <
class Archive>
405 load(Archive &ar,
const unsigned int version);
419 template <
class Archive>
421 serialize(Archive &archive,
const unsigned int version);
425 BOOST_SERIALIZATION_SPLIT_MEMBER()
451 template <
int dim,
int spacedim>
452 template <
class Archive>
456 unsigned int n_properties = 0;
461 ar &location &reference_location &
id &n_properties;
463 set_location(location);
464 set_reference_location(reference_location);
467 if (n_properties > 0)
471 properties.
size() == n_properties,
473 "This particle was serialized with " +
475 " properties, but the new property handler provides space for " +
477 " properties. Deserializing a particle only works for matching property sizes."));
479 ar &boost::serialization::make_array(properties.
data(), n_properties);
485 template <
int dim,
int spacedim>
486 template <
class Archive>
490 unsigned int n_properties = 0;
491 if ((property_pool !=
nullptr) &&
493 n_properties = get_properties().size();
496 Point<dim> reference_location = get_reference_location();
499 ar &location &reference_location &
id &n_properties;
501 if (n_properties > 0)
502 ar &boost::serialization::make_array(get_properties().data(),
508 template <
int dim,
int spacedim>
512 property_pool->
set_location(property_pool_handle, new_loc);
517 template <
int dim,
int spacedim>
521 return property_pool->
get_location(property_pool_handle);
526 template <
int dim,
int spacedim>
535 template <
int dim,
int spacedim>
544 template <
int dim,
int spacedim>
548 return property_pool->
get_id(property_pool_handle);
553 template <
int dim,
int spacedim>
557 property_pool->
set_id(property_pool_handle, new_id);
562 template <
int dim,
int spacedim>
582 const Point<dim> reference_location = get_reference_location();
585 if ( has_properties())
591 old_properties.
cend(),
592 new_properties.
begin());
596 property_pool->deregister_particle(property_pool_handle);
601 property_pool = &new_property_pool;
602 property_pool_handle = new_handle;
605 set_location(location);
606 set_reference_location(reference_location);
612 template <
int dim,
int spacedim>
616 if (has_properties() ==
false)
624 template <
int dim,
int spacedim>
633 Assert((property_pool_handle !=
636 return (property_pool->n_properties_per_slot() > 0);
657 template <
int dim,
int spacedim>
668 const ::Particles::Particle<dim, spacedim> &particle)
const
670 return particle.get_location();
const_iterator cend() const
const_iterator cbegin() const
value_type * data() const noexcept
PropertyPool< dim, spacedim > * property_pool
void set_property_pool(PropertyPool< dim, spacedim > &property_pool)
const Point< dim > & get_reference_location() const
const Point< spacedim > & get_location() const
bool has_properties() const
static PropertyPool< dim, spacedim > global_property_pool
void set_reference_location(const Point< dim > &new_reference_location)
std::size_t serialized_size_in_bytes() const
void save(Archive &ar, const unsigned int version) const
Particle< dim, spacedim > & operator=(const Particle< dim, spacedim > &particle)
const ArrayView< double > get_properties()
void set_properties(const ArrayView< const double > &new_properties)
const void * read_particle_data_from_memory(const void *data)
const ArrayView< const double > get_properties() const
void * write_particle_data_to_memory(void *data) const
types::particle_index get_id() const
PropertyPool< dim, spacedim >::Handle property_pool_handle
void load(Archive &ar, const unsigned int version)
void set_id(const types::particle_index &new_id)
void serialize(Archive &archive, const unsigned int version)
void set_location(const Point< spacedim > &new_location)
ArrayView< double > get_properties(const Handle handle)
Handle register_particle()
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
std::string to_string(const T &t)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
std::pair< int, int > LevelInd
void copy(const T *begin, const T *end, U *dest)
result_type operator()(const ::Particles::Particle< dim, spacedim > &particle) const