Merge branch release-2021 into master
[alexxy/gromacs.git] / src / gromacs / domdec / ga2la.h
index 1f6b92d0e3f7ee3b6c6b234d16aad8babbf41605..c073089e9c6a9a5a52c4d534fc545b285b126893 100644 (file)
@@ -149,8 +149,11 @@ public:
         }
     }
 
-    //! Clear all the entries in the list.
-    void clear()
+    /*! \brief Clear all the entries in the list.
+     *
+     * \param[in] resizeHashTable  When true the hash table is optimized based on the current number of entries stored
+     */
+    void clear(const bool resizeHashTable)
     {
         if (usingDirect_)
         {
@@ -159,6 +162,10 @@ public:
                 entry.cell = -1;
             }
         }
+        else if (resizeHashTable)
+        {
+            data_.hashed.clearAndResizeHashTable();
+        }
         else
         {
             data_.hashed.clear();