]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move some inline function definitions down. 13419/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 18 Feb 2022 15:58:26 +0000 (10:58 -0500)
committerDavid Wells <drwells@email.unc.edu>
Fri, 18 Feb 2022 16:32:58 +0000 (11:32 -0500)
include/deal.II/base/mpi_compute_index_owner_internal.h

index 21eebfcfe7747e3f57de6f0d014aaaf69867c6db..2ae145bb36a6590d0ae874309be0832e20186741 100644 (file)
@@ -204,26 +204,14 @@ namespace Utilities
            * ensure a balance over the MPI ranks due to the grain size.
            */
           unsigned int
-          dof_to_dict_rank(const types::global_dof_index i)
-          {
-            // note: this formula is also explicitly used in
-            // get_index_offset(), so keep the two in sync
-            return (i / dofs_per_process) * stride_small_size;
-          }
+          dof_to_dict_rank(const types::global_dof_index i);
 
           /**
            * Given an MPI rank id of an arbitrary processor, return the index
            * offset where the local range of that processor begins.
            */
           types::global_dof_index
-          get_index_offset(const unsigned int rank)
-          {
-            return std::min(dofs_per_process *
-                              static_cast<types::global_dof_index>(
-                                (rank + stride_small_size - 1) /
-                                stride_small_size),
-                            size);
-          }
+          get_index_offset(const unsigned int rank);
 
           /**
            * Given the rank in the owned indices from `actually_owning_ranks`,
@@ -232,22 +220,7 @@ namespace Utilities
            */
           unsigned int
           get_owning_rank_index(const unsigned int rank_in_owned_indices,
-                                const unsigned int guess = 0)
-          {
-            AssertIndexRange(guess, actually_owning_rank_list.size());
-            if (actually_owning_rank_list[guess] == rank_in_owned_indices)
-              return guess;
-            else
-              {
-                auto it = std::lower_bound(actually_owning_rank_list.begin(),
-                                           actually_owning_rank_list.end(),
-                                           rank_in_owned_indices);
-                Assert(it != actually_owning_rank_list.end(),
-                       ExcInternalError());
-                Assert(*it == rank_in_owned_indices, ExcInternalError());
-                return it - actually_owning_rank_list.begin();
-              }
-          }
+                                const unsigned int guess = 0);
 
         private:
           /**
@@ -425,6 +398,49 @@ namespace Utilities
                               const unsigned int            rank_of_request);
         };
 
+        /* ------------------------- inline functions ----------------------- */
+
+        inline unsigned int
+        Dictionary::dof_to_dict_rank(const types::global_dof_index i)
+        {
+          // note: this formula is also explicitly used in
+          // get_index_offset(), so keep the two in sync
+          return (i / dofs_per_process) * stride_small_size;
+        }
+
+
+        inline types::global_dof_index
+        Dictionary::get_index_offset(const unsigned int rank)
+        {
+          return std::min(dofs_per_process *
+                            static_cast<types::global_dof_index>(
+                              (rank + stride_small_size - 1) /
+                              stride_small_size),
+                          size);
+        }
+
+
+
+        inline unsigned int
+        Dictionary::get_owning_rank_index(
+          const unsigned int rank_in_owned_indices,
+          const unsigned int guess)
+        {
+          AssertIndexRange(guess, actually_owning_rank_list.size());
+          if (actually_owning_rank_list[guess] == rank_in_owned_indices)
+            return guess;
+          else
+            {
+              auto it = std::lower_bound(actually_owning_rank_list.begin(),
+                                         actually_owning_rank_list.end(),
+                                         rank_in_owned_indices);
+              Assert(it != actually_owning_rank_list.end(), ExcInternalError());
+              Assert(*it == rank_in_owned_indices, ExcInternalError());
+              return it - actually_owning_rank_list.begin();
+            }
+        }
+
+
       } // namespace ComputeIndexOwner
     }   // namespace internal
   }     // namespace MPI

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.