]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename some member functions of PropertyPool.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 12 Dec 2020 18:22:07 +0000 (11:22 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 12 Dec 2020 20:47:46 +0000 (13:47 -0700)
include/deal.II/particles/particle.h
include/deal.II/particles/property_pool.h
source/particles/particle.cc
source/particles/property_pool.cc
tests/particles/property_pool_01.cc
tests/particles/property_pool_02.cc

index 3b107b2fc5b82ed4e41a719b52513c29c59faa56..fb6b87e57100d144c34ffcef05bcd6ddf9b1a747 100644 (file)
@@ -602,7 +602,7 @@ namespace Particles
     if (property_pool != nullptr &&
         properties != PropertyPool<dim, spacedim>::invalid_handle)
       {
-        new_handle = new_property_pool.allocate_properties_array();
+        new_handle = new_property_pool.register_particle();
 
         ArrayView<double> old_properties = this->get_properties();
         ArrayView<double> new_properties =
@@ -616,7 +616,7 @@ namespace Particles
     // release those.
     if (property_pool != nullptr &&
         properties != PropertyPool<dim, spacedim>::invalid_handle)
-      property_pool->deallocate_properties_array(properties);
+      property_pool->deregister_particle(properties);
 
 
     // Then set the pointer to the property pool we want to use. Also set the
index f733b65128c65d3d3a989d176f18367e8dee4224..1ce02000a21ae84d8fd96e0381729a78e88ea4d7 100644 (file)
@@ -82,24 +82,19 @@ namespace Particles
     clear();
 
     /**
-     * Return a new handle that allows accessing the reserved particle
-     * properties. If the number of properties is zero this will return an
-     * invalid handle. Handles can be copied, but after deallocating one
-     * of the copied handles using any of the other copies will cause
-     * undefined behavior.
+     * Return a new handle that allows a particle to store information such as
+     * properties and locations. This also allocated memory in this PropertyPool
+     * variable.
      */
     Handle
-    allocate_properties_array();
+    register_particle();
 
     /**
-     * Mark the properties corresponding to the handle @p handle as
-     * deleted and invalidate the @p handle. Calling this function
-     * more than once for the same handle (e.g. by calling it again
-     * with a copy of the previously invalidated handle) causes
-     * undefined behavior.
+     * Return a handle obtained by register_particle() and mark the memory
+     * allocated for storing the particle's data as free for re-use.
      */
     void
-    deallocate_properties_array(Handle &handle);
+    deregister_particle(Handle &handle);
 
     /**
      * Return an ArrayView to the properties that correspond to the given
index 3a81b08718525edd0c3dff00091f5e78d633ba79..db9c53e6014c613c2dd5e3ec47dc6cd29b1d5d6b 100644 (file)
@@ -55,7 +55,7 @@ namespace Particles
   {
     if (particle.has_properties())
       {
-        properties = property_pool->allocate_properties_array();
+        properties = property_pool->register_particle();
         const ArrayView<double> my_properties =
           property_pool->get_properties(properties);
         const ArrayView<const double> their_properties =
@@ -87,7 +87,7 @@ namespace Particles
 
     property_pool = new_property_pool;
     if (property_pool != nullptr)
-      properties = property_pool->allocate_properties_array();
+      properties = property_pool->register_particle();
     else
       properties = PropertyPool<dim, spacedim>::invalid_handle;
 
@@ -132,7 +132,7 @@ namespace Particles
 
         if (particle.has_properties())
           {
-            properties = property_pool->allocate_properties_array();
+            properties = property_pool->register_particle();
             const ArrayView<const double> their_properties =
               particle.get_properties();
             const ArrayView<double> my_properties =
@@ -178,7 +178,7 @@ namespace Particles
   {
     if (property_pool != nullptr &&
         properties != PropertyPool<dim, spacedim>::invalid_handle)
-      property_pool->deallocate_properties_array(properties);
+      property_pool->deregister_particle(properties);
   }
 
   template <int dim, int spacedim>
@@ -187,7 +187,7 @@ namespace Particles
   {
     if (property_pool != nullptr &&
         properties != PropertyPool<dim, spacedim>::invalid_handle)
-      property_pool->deallocate_properties_array(properties);
+      property_pool->deregister_particle(properties);
   }
 
 
@@ -278,7 +278,7 @@ namespace Particles
 
     // If we haven't allocated memory yet, do so now
     if (properties == PropertyPool<dim, spacedim>::invalid_handle)
-      properties = property_pool->allocate_properties_array();
+      properties = property_pool->register_particle();
 
     const ArrayView<double> property_values =
       property_pool->get_properties(properties);
@@ -309,7 +309,7 @@ namespace Particles
     // If this particle has no properties yet, allocate and initialize them.
     if (properties == PropertyPool<dim, spacedim>::invalid_handle)
       {
-        properties = property_pool->allocate_properties_array();
+        properties = property_pool->register_particle();
 
         ArrayView<double> my_properties =
           property_pool->get_properties(properties);
index f204d83a018f1e56f731ffd36d9ef40a6cc64e9e..1637aafab22876856e8fd1d030b2959c85acab36 100644 (file)
@@ -72,7 +72,7 @@ namespace Particles
 
   template <int dim, int spacedim>
   typename PropertyPool<dim, spacedim>::Handle
-  PropertyPool<dim, spacedim>::allocate_properties_array()
+  PropertyPool<dim, spacedim>::register_particle()
   {
     Handle handle = invalid_handle;
     if (n_properties > 0)
@@ -96,7 +96,7 @@ namespace Particles
 
   template <int dim, int spacedim>
   void
-  PropertyPool<dim, spacedim>::deallocate_properties_array(Handle &handle)
+  PropertyPool<dim, spacedim>::deregister_particle(Handle &handle)
   {
     Assert(
       handle != invalid_handle,
index f34e8a3637b65c894c8241a2e32cf80733b53d61..e530324f94c05d84c7276312d15594d361ba98e8 100644 (file)
@@ -35,14 +35,14 @@ test()
     Particles::PropertyPool<dim, spacedim> pool(1);
 
     typename Particles::PropertyPool<dim, spacedim>::Handle handle =
-      pool.allocate_properties_array();
+      pool.register_particle();
 
     pool.get_properties(handle)[0] = 2.5;
 
     deallog << "Pool properties: " << pool.get_properties(handle)[0]
             << std::endl;
 
-    pool.deallocate_properties_array(handle);
+    pool.deregister_particle(handle);
   }
 
   deallog << "OK" << std::endl;
index 4cb2e9a9f74b151b36313de844920202711525ee..0b7e83e7c889659ada2cae73b90c2e75bbffb02e 100644 (file)
@@ -36,7 +36,7 @@ test()
     Particles::PropertyPool<dim, spacedim> pool(n_properties);
 
     typename Particles::PropertyPool<dim, spacedim>::Handle handle =
-      pool.allocate_properties_array();
+      pool.register_particle();
 
     pool.get_properties(handle)[0] = 1.2;
     pool.get_properties(handle)[1] = 2.5;
@@ -50,7 +50,7 @@ test()
 
     deallog << std::endl;
 
-    pool.deallocate_properties_array(handle);
+    pool.deregister_particle(handle);
   }
 
   deallog << "OK" << std::endl;

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.