From 7b9f942630f19cca2ac48e1f60ab0093527105a6 Mon Sep 17 00:00:00 2001 From: Roland Schulz Date: Sun, 20 Apr 2014 13:56:55 -0400 Subject: [PATCH] Move part of macros.h to grompp-impl.h Part of #1415. Change-Id: I360ae1f220b6c51e90edbbe136053fd2e1c0ad5b --- src/gromacs/gmxpreprocess/gen_vsite.c | 1 - src/gromacs/gmxpreprocess/genhydro.c | 1 - src/gromacs/gmxpreprocess/gpp_atomtype.c | 1 - src/gromacs/gmxpreprocess/gpp_nextnb.c | 1 - src/gromacs/gmxpreprocess/grompp-impl.h | 22 ++++++++++++++++++++++ src/gromacs/gmxpreprocess/hackblock.c | 1 - src/gromacs/gmxpreprocess/tomorse.c | 1 - src/gromacs/gmxpreprocess/topshake.c | 1 - src/gromacs/legacyheaders/macros.h | 16 ---------------- 9 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/gromacs/gmxpreprocess/gen_vsite.c b/src/gromacs/gmxpreprocess/gen_vsite.c index 98414db3e9..a5f06b0c88 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.c +++ b/src/gromacs/gmxpreprocess/gen_vsite.c @@ -54,7 +54,6 @@ #include "gromacs/utility/futil.h" #include "gpp_atomtype.h" #include "fflibutil.h" -#include "macros.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" diff --git a/src/gromacs/gmxpreprocess/genhydro.c b/src/gromacs/gmxpreprocess/genhydro.c index b5a8e831b2..34ff0fc82a 100644 --- a/src/gromacs/gmxpreprocess/genhydro.c +++ b/src/gromacs/gmxpreprocess/genhydro.c @@ -56,7 +56,6 @@ #include "resall.h" #include "pgutil.h" #include "network.h" -#include "macros.h" static void copy_atom(t_atoms *atoms1, int a1, t_atoms *atoms2, int a2) { diff --git a/src/gromacs/gmxpreprocess/gpp_atomtype.c b/src/gromacs/gmxpreprocess/gpp_atomtype.c index a44dcb95c1..ca66a1f85c 100644 --- a/src/gromacs/gmxpreprocess/gpp_atomtype.c +++ b/src/gromacs/gmxpreprocess/gpp_atomtype.c @@ -42,7 +42,6 @@ #include #include "gromacs/utility/smalloc.h" -#include "macros.h" #include "topdirs.h" #include "toputil.h" #include "topdirs.h" diff --git a/src/gromacs/gmxpreprocess/gpp_nextnb.c b/src/gromacs/gmxpreprocess/gpp_nextnb.c index 41a026d072..b2dcf122e6 100644 --- a/src/gromacs/gmxpreprocess/gpp_nextnb.c +++ b/src/gromacs/gmxpreprocess/gpp_nextnb.c @@ -41,7 +41,6 @@ #include -#include "macros.h" /* #define DEBUG_NNB */ #include "gpp_nextnb.h" #include "toputil.h" diff --git a/src/gromacs/gmxpreprocess/grompp-impl.h b/src/gromacs/gmxpreprocess/grompp-impl.h index 8e0cef6d7e..da1f4d9bb1 100644 --- a/src/gromacs/gmxpreprocess/grompp-impl.h +++ b/src/gromacs/gmxpreprocess/grompp-impl.h @@ -54,6 +54,28 @@ typedef struct { * non-bonded parameter combinations, which will be copied to t_params. */ +#ifndef __cplusplus +/* + * With the macros below you don't + * have to use an index if you don't wan't to. You can eg. use + * param.C0 instead of param.c[0]. + * In a similar fashion, you can use param.AI instead of + * param.a[0] + * + * For C++ those should be replaced with member functions. + */ + +#define AI a[0] +#define AJ a[1] +#define AK a[2] +#define AL a[3] +#define AM a[4] + +#define C0 c[0] +#define C1 c[1] +#define C2 c[2] +#endif + typedef struct { atom_id a[MAXATOMLIST]; /* The atom list (eg. bonds: particle */ /* i = a[0] (AI), j = a[1] (AJ)) */ diff --git a/src/gromacs/gmxpreprocess/hackblock.c b/src/gromacs/gmxpreprocess/hackblock.c index 4d576a1651..e65a8d9b80 100644 --- a/src/gromacs/gmxpreprocess/hackblock.c +++ b/src/gromacs/gmxpreprocess/hackblock.c @@ -43,7 +43,6 @@ #include "hackblock.h" #include "gromacs/utility/smalloc.h" #include "gromacs/math/vec.h" -#include "macros.h" /* these MUST correspond to the enum in hackblock.h */ const char *btsNames[ebtsNR] = { "bonds", "angles", "dihedrals", "impropers", "exclusions", "cmap" }; diff --git a/src/gromacs/gmxpreprocess/tomorse.c b/src/gromacs/gmxpreprocess/tomorse.c index 330616115f..abab6f87fe 100644 --- a/src/gromacs/gmxpreprocess/tomorse.c +++ b/src/gromacs/gmxpreprocess/tomorse.c @@ -52,7 +52,6 @@ #include "toputil.h" #include "gromacs/utility/fatalerror.h" #include "gpp_atomtype.h" -#include "macros.h" #include "tomorse.h" diff --git a/src/gromacs/gmxpreprocess/topshake.c b/src/gromacs/gmxpreprocess/topshake.c index 56bc0c55bf..b19f76e45f 100644 --- a/src/gromacs/gmxpreprocess/topshake.c +++ b/src/gromacs/gmxpreprocess/topshake.c @@ -43,7 +43,6 @@ #include #include "physics.h" -#include "macros.h" #include "readir.h" #include "typedefs.h" #include "topshake.h" diff --git a/src/gromacs/legacyheaders/macros.h b/src/gromacs/legacyheaders/macros.h index fb8f022ec0..4d7a04763a 100644 --- a/src/gromacs/legacyheaders/macros.h +++ b/src/gromacs/legacyheaders/macros.h @@ -40,25 +40,9 @@ /* no extern "C" for this header because it only defines Macros */ -/* - * With the macros below you don't - * have to use an index if you don't wan't to. You can eg. use - * angle.C0[23] instead if angle.c[0][23]. - * In a similar fashion, you can use angle.AI[3] instead of - * angle.a[0][3] - */ #ifndef __cplusplus #include -#define AI a[0] -#define AJ a[1] -#define AK a[2] -#define AL a[3] -#define AM a[4] -#define C0 c[0] -#define C1 c[1] -#define C2 c[2] - #ifndef min #define min(a, b) (((a) < (b)) ? (a) : (b) ) #endif -- 2.22.0