Re-use gmx_greatest_common_divisor()
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 31 Mar 2014 16:11:33 +0000 (18:11 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 2 Apr 2014 07:52:55 +0000 (09:52 +0200)
Change-Id: Iee3a7b3bc339639360eed3498769efe64dd7dbf8

src/gromacs/gmxana/gmx_tune_pme.c

index 631c94c8269cdd30cfe421eaa21e5af30cf8c405..681a99033db1d362ecd39ebe499cfe3151ad9a9a 100644 (file)
@@ -61,6 +61,7 @@
 #include "perf_est.h"
 #include "inputrec.h"
 #include "gromacs/timing/walltime_accounting.h"
+#include "gromacs/math/utilities.h"
 
 
 /* Enum for situations that can occur during log file parsing, the
@@ -1170,22 +1171,6 @@ static void cleanup(const t_filenm *fnm, int nfile, int k, int nnodes,
 }
 
 
-/* Returns the largest common factor of n1 and n2 */
-static int largest_common_factor(int n1, int n2)
-{
-    int factor, nmax;
-
-    nmax = min(n1, n2);
-    for (factor = nmax; factor > 0; factor--)
-    {
-        if (0 == (n1 % factor) && 0 == (n2 % factor) )
-        {
-            return(factor);
-        }
-    }
-    return 0; /* one for the compiler */
-}
-
 enum {
     eNpmeAuto, eNpmeAll, eNpmeReduced, eNpmeSubset, eNpmeNr
 };
@@ -1272,7 +1257,7 @@ static void make_npme_list(
                 gmx_fatal(FARGS, "Unknown option for eNPME in make_npme_list");
                 break;
         }
-        if (largest_common_factor(npp, npme) >= min_factor)
+        if (gmx_greatest_common_divisor(npp, npme) >= min_factor)
         {
             (*nPMEnodes)[nlist] = npme;
             nlist++;