]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prepare for storing particle locations in the PropertyPool. 11391/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 17 Dec 2020 21:36:23 +0000 (14:36 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 17 Dec 2020 23:33:28 +0000 (16:33 -0700)
include/deal.II/particles/particle.h
source/particles/particle.cc

index eabe5a3df775c4c0a2f8933b8d5fb91669d742db..11ab8b7ada3d7c540d48e9194a0df8b2f7efac38 100644 (file)
@@ -486,6 +486,8 @@ namespace Particles
     typename PropertyPool<dim, spacedim>::Handle property_pool_handle;
   };
 
+
+
   /* ---------------------- inline and template functions ------------------ */
 
   template <int dim, int spacedim>
@@ -495,8 +497,13 @@ namespace Particles
   {
     unsigned int n_properties = 0;
 
+    Point<spacedim> location;
+    Point<dim>      reference_location;
     ar &location &reference_location &id &n_properties;
 
+    set_location(location);
+    set_reference_location(reference_location);
+
     if (n_properties > 0)
       {
         ArrayView<double> properties(get_properties());
@@ -526,6 +533,9 @@ namespace Particles
         (property_pool_handle != PropertyPool<dim, spacedim>::invalid_handle))
       n_properties = get_properties().size();
 
+    Point<spacedim> location           = get_location();
+    Point<dim>      reference_location = get_reference_location();
+
     ar &location &reference_location &id &n_properties;
 
     if (n_properties > 0)
index 933cc9a1c64804d8ef3c54d35b72a50f290beada..09038711d682272d5f06e6228473213f497a6ad5 100644 (file)
@@ -79,11 +79,15 @@ namespace Particles
     id                  = *id_data++;
     const double *pdata = reinterpret_cast<const double *>(id_data);
 
+    Point<spacedim> location;
     for (unsigned int i = 0; i < spacedim; ++i)
       location(i) = *pdata++;
+    set_location(location);
 
+    Point<dim> 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 <int dim, int spacedim>
   void
   Particle<dim, spacedim>::update_particle_data(const void *&data)
@@ -234,11 +239,15 @@ namespace Particles
     id                  = *id_data++;
     const double *pdata = reinterpret_cast<const double *>(id_data);
 
+    Point<spacedim> location;
     for (unsigned int i = 0; i < spacedim; ++i)
       location(i) = *pdata++;
+    set_location(location);
 
+    Point<dim> 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 <int dim, int spacedim>
   std::size_t
   Particle<dim, spacedim>::serialized_size_in_bytes() const

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.