From a208e69626f12cb2c82f4a85181351d69038f17a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 17 Dec 2020 14:36:23 -0700 Subject: [PATCH] Prepare for storing particle locations in the PropertyPool. --- include/deal.II/particles/particle.h | 10 ++++++++++ source/particles/particle.cc | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/deal.II/particles/particle.h b/include/deal.II/particles/particle.h index eabe5a3df7..11ab8b7ada 100644 --- a/include/deal.II/particles/particle.h +++ b/include/deal.II/particles/particle.h @@ -486,6 +486,8 @@ namespace Particles typename PropertyPool::Handle property_pool_handle; }; + + /* ---------------------- inline and template functions ------------------ */ template @@ -495,8 +497,13 @@ namespace Particles { unsigned int n_properties = 0; + Point location; + Point reference_location; ar &location &reference_location &id &n_properties; + set_location(location); + set_reference_location(reference_location); + if (n_properties > 0) { ArrayView properties(get_properties()); @@ -526,6 +533,9 @@ namespace Particles (property_pool_handle != PropertyPool::invalid_handle)) n_properties = get_properties().size(); + Point location = get_location(); + Point reference_location = get_reference_location(); + ar &location &reference_location &id &n_properties; if (n_properties > 0) diff --git a/source/particles/particle.cc b/source/particles/particle.cc index 933cc9a1c6..09038711d6 100644 --- a/source/particles/particle.cc +++ b/source/particles/particle.cc @@ -79,11 +79,15 @@ namespace Particles id = *id_data++; const double *pdata = reinterpret_cast(id_data); + Point location; for (unsigned int i = 0; i < spacedim; ++i) location(i) = *pdata++; + set_location(location); + Point reference_location; for (unsigned int i = 0; i < dim; ++i) reference_location(i) = *pdata++; + set_reference_location(reference_location); property_pool = new_property_pool; if (property_pool != nullptr) @@ -206,11 +210,11 @@ namespace Particles // Write location data for (unsigned int i = 0; i < spacedim; ++i, ++pdata) - *pdata = location(i); + *pdata = get_location()[i]; // Write reference location data for (unsigned int i = 0; i < dim; ++i, ++pdata) - *pdata = reference_location(i); + *pdata = get_reference_location()[i]; // Write property data if (has_properties()) @@ -225,6 +229,7 @@ namespace Particles } + template void Particle::update_particle_data(const void *&data) @@ -234,11 +239,15 @@ namespace Particles id = *id_data++; const double *pdata = reinterpret_cast(id_data); + Point location; for (unsigned int i = 0; i < spacedim; ++i) location(i) = *pdata++; + set_location(location); + Point reference_location; for (unsigned int i = 0; i < dim; ++i) reference_location(i) = *pdata++; + set_reference_location(reference_location); // See if there are properties to load if (has_properties()) @@ -254,6 +263,7 @@ namespace Particles } + template std::size_t Particle::serialized_size_in_bytes() const -- 2.39.5