/**
* A handle to all particle properties
*/
- typename PropertyPool<dim, spacedim>::Handle properties;
+ typename PropertyPool<dim, spacedim>::Handle property_pool_handle;
};
/* ---------------------- inline and template functions ------------------ */
{
unsigned int n_properties = 0;
if ((property_pool != nullptr) &&
- (properties != PropertyPool<dim, spacedim>::invalid_handle))
+ (property_pool_handle != PropertyPool<dim, spacedim>::invalid_handle))
n_properties = get_properties().size();
ar &location &reference_location &id &n_properties;
typename PropertyPool<dim, spacedim>::Handle new_handle =
PropertyPool<dim, spacedim>::invalid_handle;
if (property_pool != nullptr &&
- properties != PropertyPool<dim, spacedim>::invalid_handle)
+ property_pool_handle != PropertyPool<dim, spacedim>::invalid_handle)
{
new_handle = new_property_pool.register_particle();
// If the particle currently has a reference to properties, then
// release those.
if (property_pool != nullptr &&
- properties != PropertyPool<dim, spacedim>::invalid_handle)
- property_pool->deregister_particle(properties);
+ property_pool_handle != PropertyPool<dim, spacedim>::invalid_handle)
+ property_pool->deregister_particle(property_pool_handle);
// Then set the pointer to the property pool we want to use. Also set the
// handle to any properties, if we have copied any above.
- property_pool = &new_property_pool;
- properties = new_handle;
+ property_pool = &new_property_pool;
+ property_pool_handle = new_handle;
}
{
Assert(has_properties(), ExcInternalError());
- return property_pool->get_properties(properties);
+ return property_pool->get_properties(property_pool_handle);
}
Particle<dim, spacedim>::has_properties() const
{
return (property_pool != nullptr) &&
- (properties != PropertyPool<dim, spacedim>::invalid_handle);
+ (property_pool_handle !=
+ PropertyPool<dim, spacedim>::invalid_handle);
}
} // namespace Particles
, reference_location(numbers::signaling_nan<Point<dim>>())
, id(0)
, property_pool(nullptr)
- , properties(PropertyPool<dim, spacedim>::invalid_handle)
+ , property_pool_handle(PropertyPool<dim, spacedim>::invalid_handle)
{}
, reference_location(reference_location)
, id(id)
, property_pool(nullptr)
- , properties(PropertyPool<dim, spacedim>::invalid_handle)
+ , property_pool_handle(PropertyPool<dim, spacedim>::invalid_handle)
{}
, reference_location(particle.get_reference_location())
, id(particle.get_id())
, property_pool(particle.property_pool)
- , properties(PropertyPool<dim, spacedim>::invalid_handle)
+ , property_pool_handle(PropertyPool<dim, spacedim>::invalid_handle)
{
if (particle.has_properties())
{
- properties = property_pool->register_particle();
+ property_pool_handle = property_pool->register_particle();
const ArrayView<double> my_properties =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
const ArrayView<const double> their_properties =
particle.get_properties();
property_pool = new_property_pool;
if (property_pool != nullptr)
- properties = property_pool->register_particle();
+ property_pool_handle = property_pool->register_particle();
else
- properties = PropertyPool<dim, spacedim>::invalid_handle;
+ property_pool_handle = PropertyPool<dim, spacedim>::invalid_handle;
// See if there are properties to load
if (has_properties())
{
const ArrayView<double> particle_properties =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
const unsigned int size = particle_properties.size();
for (unsigned int i = 0; i < size; ++i)
particle_properties[i] = *pdata++;
, reference_location(std::move(particle.reference_location))
, id(std::move(particle.id))
, property_pool(std::move(particle.property_pool))
- , properties(std::move(particle.properties))
+ , property_pool_handle(std::move(particle.property_pool_handle))
{
- particle.properties = PropertyPool<dim, spacedim>::invalid_handle;
+ particle.property_pool_handle = PropertyPool<dim, spacedim>::invalid_handle;
}
if (particle.has_properties())
{
- properties = property_pool->register_particle();
+ property_pool_handle = property_pool->register_particle();
const ArrayView<const double> their_properties =
particle.get_properties();
const ArrayView<double> my_properties =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
std::copy(their_properties.begin(),
their_properties.end(),
my_properties.begin());
}
else
- properties = PropertyPool<dim, spacedim>::invalid_handle;
+ property_pool_handle = PropertyPool<dim, spacedim>::invalid_handle;
}
return *this;
}
{
if (this != &particle)
{
- location = particle.location;
- reference_location = particle.reference_location;
- id = particle.id;
- property_pool = particle.property_pool;
- properties = particle.properties;
+ location = particle.location;
+ reference_location = particle.reference_location;
+ id = particle.id;
+ property_pool = particle.property_pool;
+ property_pool_handle = particle.property_pool_handle;
// We stole the rhs's properties, so we need to invalidate
// the handle the rhs holds lest it releases the memory that
// we still reference here.
- particle.properties = PropertyPool<dim, spacedim>::invalid_handle;
+ particle.property_pool_handle =
+ PropertyPool<dim, spacedim>::invalid_handle;
}
return *this;
}
Particle<dim, spacedim>::~Particle()
{
if (property_pool != nullptr &&
- properties != PropertyPool<dim, spacedim>::invalid_handle)
- property_pool->deregister_particle(properties);
+ property_pool_handle != PropertyPool<dim, spacedim>::invalid_handle)
+ property_pool->deregister_particle(property_pool_handle);
}
+
+
template <int dim, int spacedim>
void
Particle<dim, spacedim>::free_properties()
{
if (property_pool != nullptr &&
- properties != PropertyPool<dim, spacedim>::invalid_handle)
- property_pool->deregister_particle(properties);
+ property_pool_handle != PropertyPool<dim, spacedim>::invalid_handle)
+ property_pool->deregister_particle(property_pool_handle);
}
if (has_properties())
{
const ArrayView<double> particle_properties =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
for (unsigned int i = 0; i < particle_properties.size(); ++i, ++pdata)
*pdata = particle_properties[i];
}
if (has_properties())
{
const ArrayView<double> particle_properties =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
const unsigned int size = particle_properties.size();
for (unsigned int i = 0; i < size; ++i)
particle_properties[i] = *pdata++;
if (has_properties())
{
const ArrayView<double> particle_properties =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
size += sizeof(double) * particle_properties.size();
}
return size;
Assert(property_pool != nullptr, ExcInternalError());
// If we haven't allocated memory yet, do so now
- if (properties == PropertyPool<dim, spacedim>::invalid_handle)
- properties = property_pool->register_particle();
+ if (property_pool_handle == PropertyPool<dim, spacedim>::invalid_handle)
+ property_pool_handle = property_pool->register_particle();
const ArrayView<double> property_values =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
Assert(new_properties.size() == property_values.size(),
ExcMessage(
Assert(property_pool != nullptr, ExcInternalError());
// If this particle has no properties yet, allocate and initialize them.
- if (properties == PropertyPool<dim, spacedim>::invalid_handle)
+ if (property_pool_handle == PropertyPool<dim, spacedim>::invalid_handle)
{
- properties = property_pool->register_particle();
+ property_pool_handle = property_pool->register_particle();
ArrayView<double> my_properties =
- property_pool->get_properties(properties);
+ property_pool->get_properties(property_pool_handle);
std::fill(my_properties.begin(), my_properties.end(), 0.0);
}
- return property_pool->get_properties(properties);
+ return property_pool->get_properties(property_pool_handle);
}
} // namespace Particles