16 #include <deal.II/particles/particle.h> 18 DEAL_II_NAMESPACE_OPEN
22 template <
int dim,
int spacedim>
25 , reference_location()
27 , property_pool(nullptr)
33 template <
int dim,
int spacedim>
38 , reference_location(reference_location)
46 template <
int dim,
int spacedim>
63 std::copy(their_properties.
begin(),
64 their_properties.
end(),
65 my_properties.
begin());
71 template <
int dim,
int spacedim>
78 const double *pdata =
reinterpret_cast<const double *
>(id_data);
80 for (
unsigned int i = 0; i < spacedim; ++i)
83 for (
unsigned int i = 0; i < dim; ++i)
97 const unsigned int size = particle_properties.
size();
98 for (
unsigned int i = 0; i < size; ++i)
99 particle_properties[i] = *pdata++;
102 data =
static_cast<const void *
>(pdata);
107 template <
int dim,
int spacedim>
111 ,
id(
std::move(particle.
id))
120 template <
int dim,
int spacedim>
124 if (
this != &particle)
139 std::copy(their_properties.
begin(),
140 their_properties.
end(),
141 my_properties.
begin());
151 template <
int dim,
int spacedim>
156 if (
this != &particle)
170 template <
int dim,
int spacedim>
179 template <
int dim,
int spacedim>
186 double *pdata =
reinterpret_cast<double *
>(id_data);
189 for (
unsigned int i = 0; i < spacedim; ++i, ++pdata)
193 for (
unsigned int i = 0; i < dim; ++i, ++pdata)
201 for (
unsigned int i = 0; i < particle_properties.
size(); ++i, ++pdata)
202 *pdata = particle_properties[i];
205 data =
static_cast<void *
>(pdata);
210 template <
int dim,
int spacedim>
221 size +=
sizeof(double) * particle_properties.
size();
228 template <
int dim,
int spacedim>
237 template <
int dim,
int spacedim>
246 template <
int dim,
int spacedim>
255 template <
int dim,
int spacedim>
264 template <
int dim,
int spacedim>
273 template <
int dim,
int spacedim>
282 template <
int dim,
int spacedim>
294 new_properties.
size() == old_properties.
size(),
297 "You are trying to assign properties with an incompatible length. ") +
298 "The particle has space to store " +
300 "and this function tries to assign" +
302 "This is not allowed."));
304 if (old_properties.
size() > 0)
305 std::copy(new_properties.
begin(),
306 new_properties.
end(),
307 old_properties.
begin());
312 template <
int dim,
int spacedim>
323 template <
int dim,
int spacedim>
334 template <
int dim,
int spacedim>
343 DEAL_II_NAMESPACE_CLOSE
345 DEAL_II_NAMESPACE_OPEN
347 #include "particle.inst" 349 DEAL_II_NAMESPACE_CLOSE
PropertyPool::Handle properties
Point< spacedim > location
void set_property_pool(PropertyPool &property_pool)
Particle< dim, spacedim > & operator=(const Particle< dim, spacedim > &particle)
ArrayView< double > get_properties(const Handle handle)
types::particle_index get_id() const
std::size_t serialized_size_in_bytes() const
void write_data(void *&data) const
unsigned long long int particle_index
void set_properties(const ArrayView< const double > &new_properties)
void deallocate_properties_array(const Handle handle)
const ArrayView< double > get_properties()
void set_reference_location(const Point< dim > &new_reference_location)
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
static::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
static const Handle invalid_handle
Point< dim > reference_location
const Point< spacedim > & get_location() const
const Point< dim > & get_reference_location() const
void set_location(const Point< spacedim > &new_location)
bool has_properties() const
PropertyPool * property_pool
Handle allocate_properties_array()
static::ExceptionBase & ExcInternalError()