]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename a member variable to more clearly express its purpose. 11363/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 12 Dec 2020 18:34:59 +0000 (11:34 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 12 Dec 2020 20:47:55 +0000 (13:47 -0700)
include/deal.II/particles/particle.h
source/particles/particle.cc

index fb6b87e57100d144c34ffcef05bcd6ddf9b1a747..eabe5a3df775c4c0a2f8933b8d5fb91669d742db 100644 (file)
@@ -483,7 +483,7 @@ namespace Particles
     /**
      * A handle to all particle properties
      */
-    typename PropertyPool<dim, spacedim>::Handle properties;
+    typename PropertyPool<dim, spacedim>::Handle property_pool_handle;
   };
 
   /* ---------------------- inline and template functions ------------------ */
@@ -523,7 +523,7 @@ namespace Particles
   {
     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;
@@ -600,7 +600,7 @@ namespace Particles
     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();
 
@@ -615,14 +615,14 @@ namespace Particles
     // 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;
   }
 
 
@@ -633,7 +633,7 @@ namespace Particles
   {
     Assert(has_properties(), ExcInternalError());
 
-    return property_pool->get_properties(properties);
+    return property_pool->get_properties(property_pool_handle);
   }
 
 
@@ -643,7 +643,8 @@ namespace Particles
   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
index db9c53e6014c613c2dd5e3ec47dc6cd29b1d5d6b..933cc9a1c64804d8ef3c54d35b72a50f290beada 100644 (file)
@@ -27,7 +27,7 @@ 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)
   {}
 
 
@@ -40,7 +40,7 @@ namespace Particles
     , reference_location(reference_location)
     , id(id)
     , property_pool(nullptr)
-    , properties(PropertyPool<dim, spacedim>::invalid_handle)
+    , property_pool_handle(PropertyPool<dim, spacedim>::invalid_handle)
   {}
 
 
@@ -51,13 +51,13 @@ namespace Particles
     , 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();
 
@@ -87,15 +87,15 @@ namespace Particles
 
     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++;
@@ -112,9 +112,9 @@ namespace Particles
     , 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;
   }
 
 
@@ -132,18 +132,18 @@ namespace Particles
 
         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;
   }
@@ -157,16 +157,17 @@ namespace Particles
   {
     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;
   }
@@ -177,17 +178,19 @@ namespace Particles
   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);
   }
 
 
@@ -213,7 +216,7 @@ namespace Particles
     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];
       }
@@ -241,7 +244,7 @@ namespace Particles
     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++;
@@ -261,7 +264,7 @@ namespace Particles
     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;
@@ -277,11 +280,11 @@ namespace Particles
     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(
@@ -307,17 +310,17 @@ namespace Particles
     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
 

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.