From 2cc66cb63684c047f9af98feadb8918476c74b5d Mon Sep 17 00:00:00 2001 From: Roland Schulz Date: Sun, 20 Apr 2014 20:57:32 -0400 Subject: [PATCH] Reduced usage of typdefs.h Preliminary step to move types out of legacyheader. Renamed parameter called "matrix" because cppcheck gets confused if a parameter is called the same as a type. Part of #1415 Change-Id: I9207a7b8de7f092bab890da128abbb48a8d97b79 --- src/gromacs/fft/parallel_3dfft.h | 2 +- src/gromacs/fileio/confio.h | 11 +++- src/gromacs/fileio/enxio.h | 7 +- src/gromacs/fileio/filenm.h | 3 +- src/gromacs/fileio/gmxfio.h | 3 +- src/gromacs/fileio/matio.cpp | 66 +++++++++---------- src/gromacs/fileio/matio.h | 20 +++--- src/gromacs/fileio/pdbio.h | 4 +- src/gromacs/fileio/tpxio.h | 8 ++- src/gromacs/fileio/trajectory_writing.c | 1 + src/gromacs/fileio/trajectory_writing.h | 7 +- src/gromacs/fileio/trnio.h | 5 +- src/gromacs/fileio/trxio.h | 7 +- src/gromacs/fileio/xvgr.cpp | 1 + src/gromacs/gmxana/edittop.c | 3 +- src/gromacs/gmxana/nsfactor.h | 7 +- src/gromacs/gmxlib/atomprop.c | 16 ++--- .../gmxpreprocess/read-conformation.cpp | 8 +-- src/gromacs/imd/imd.h | 1 + src/gromacs/legacyheaders/domdec.h | 2 + src/gromacs/legacyheaders/force.h | 1 + src/gromacs/legacyheaders/index.h | 5 +- src/gromacs/legacyheaders/md_support.h | 4 +- src/gromacs/legacyheaders/mdrun.h | 4 +- src/gromacs/legacyheaders/pme.h | 1 + src/gromacs/legacyheaders/shellfc.h | 2 + src/gromacs/legacyheaders/sim_util.h | 1 + src/gromacs/legacyheaders/symtab.h | 4 +- src/gromacs/legacyheaders/typedefs.h | 8 +-- src/gromacs/legacyheaders/types/commrec_fwd.h | 45 +++++++++++++ src/gromacs/legacyheaders/types/energy.h | 7 +- src/gromacs/legacyheaders/types/matrix.h | 3 +- src/gromacs/legacyheaders/types/nrnb.h | 2 - src/gromacs/legacyheaders/update.h | 2 + src/gromacs/mdlib/force.c | 1 + src/gromacs/mdlib/md_support.c | 1 + src/gromacs/mdlib/minimize.c | 1 + src/gromacs/mdlib/pme.c | 1 + src/gromacs/mdlib/sim_util.c | 1 + src/gromacs/mdlib/tpi.c | 1 + src/gromacs/timing/CMakeLists.txt | 2 + src/gromacs/timing/wallcycle.c | 7 +- src/gromacs/timing/wallcycle.h | 8 ++- 43 files changed, 193 insertions(+), 101 deletions(-) create mode 100644 src/gromacs/legacyheaders/types/commrec_fwd.h diff --git a/src/gromacs/fft/parallel_3dfft.h b/src/gromacs/fft/parallel_3dfft.h index 0af3b8221f..2a3fe97d5f 100644 --- a/src/gromacs/fft/parallel_3dfft.h +++ b/src/gromacs/fft/parallel_3dfft.h @@ -37,8 +37,8 @@ #ifndef GMX_FFT_PARALLEL_3DFFT_H #define GMX_FFT_PARALLEL_3DFFT_H -#include "../legacyheaders/types/nrnb.h" #include "../math/gmxcomplex.h" +#include "../timing/wallcycle.h" #include "../utility/basedefinitions.h" #include "../utility/gmxmpi.h" #include "../utility/real.h" diff --git a/src/gromacs/fileio/confio.h b/src/gromacs/fileio/confio.h index b1d37770d8..85b6f9f552 100644 --- a/src/gromacs/fileio/confio.h +++ b/src/gromacs/fileio/confio.h @@ -2,8 +2,8 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2004, The GROMACS development team, - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2001-2004, The GROMACS development team. + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -38,8 +38,13 @@ #ifndef GMX_FILEIO_CONFIO_H #define GMX_FILEIO_CONFIO_H +#include -#include "../legacyheaders/typedefs.h" +#include "../legacyheaders/types/atoms.h" +#include "../legacyheaders/types/simple.h" +#include "../legacyheaders/types/topology.h" + +#include "trx.h" /* For reading coordinate files it is assumed that enough memory * has been allocated beforehand. diff --git a/src/gromacs/fileio/enxio.h b/src/gromacs/fileio/enxio.h index 922467a0cc..e7421fb8aa 100644 --- a/src/gromacs/fileio/enxio.h +++ b/src/gromacs/fileio/enxio.h @@ -2,8 +2,8 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2004, The GROMACS development team, - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2001-2004, The GROMACS development team. + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -37,8 +37,9 @@ #ifndef GMX_FILEIO_ENXIO_H #define GMX_FILEIO_ENXIO_H -#include "../legacyheaders/typedefs.h" #include "../legacyheaders/pbc.h" +#include "../legacyheaders/types/energy.h" +#include "../legacyheaders/types/topology.h" #include "gmxfio.h" #include "xdr_datatype.h" diff --git a/src/gromacs/fileio/filenm.h b/src/gromacs/fileio/filenm.h index 12933f6315..0463c54a34 100644 --- a/src/gromacs/fileio/filenm.h +++ b/src/gromacs/fileio/filenm.h @@ -38,7 +38,8 @@ #ifndef GMX_FILEIO_FILENM_H #define GMX_FILEIO_FILENM_H -#include "../legacyheaders/typedefs.h" +#include "../legacyheaders/types/commrec_fwd.h" +#include "../utility/basedefinitions.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/fileio/gmxfio.h b/src/gromacs/fileio/gmxfio.h index 93f0d7bf76..076d0c3341 100644 --- a/src/gromacs/fileio/gmxfio.h +++ b/src/gromacs/fileio/gmxfio.h @@ -40,9 +40,10 @@ #include -#include "../legacyheaders/typedefs.h" #include "../utility/cstringutil.h" #include "../utility/futil.h" +#include "../utility/real.h" +#include "../math/vectypes.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/fileio/matio.cpp b/src/gromacs/fileio/matio.cpp index 04625c4070..e77a48758c 100644 --- a/src/gromacs/fileio/matio.cpp +++ b/src/gromacs/fileio/matio.cpp @@ -564,7 +564,7 @@ void read_xpm_entry(FILE *in, t_matrix *mm) sfree(line_buf); } -int read_xpm_matrix(const char *fnm, t_matrix **matrix) +int read_xpm_matrix(const char *fnm, t_matrix **mat) { FILE *in; char *line = NULL; @@ -578,8 +578,8 @@ int read_xpm_matrix(const char *fnm, t_matrix **matrix) { if (strstr(line, "/* XPM */")) { - srenew(*matrix, nmat+1); - read_xpm_entry(in, &(*matrix)[nmat]); + srenew(*mat, nmat+1); + read_xpm_entry(in, &(*mat)[nmat]); nmat++; } } @@ -595,15 +595,15 @@ int read_xpm_matrix(const char *fnm, t_matrix **matrix) return nmat; } -real **matrix2real(t_matrix *matrix, real **mat) +real **matrix2real(t_matrix *in, real **out) { t_mapping *map; double tmp; real *rmap; int i, j, nmap; - nmap = matrix->nmap; - map = matrix->map; + nmap = in->nmap; + map = in->map; snew(rmap, nmap); for (i = 0; i < nmap; i++) @@ -619,28 +619,28 @@ real **matrix2real(t_matrix *matrix, real **mat) rmap[i] = tmp; } - if (mat == NULL) + if (out == NULL) { - snew(mat, matrix->nx); - for (i = 0; i < matrix->nx; i++) + snew(out, in->nx); + for (i = 0; i < in->nx; i++) { - snew(mat[i], matrix->ny); + snew(out[i], in->ny); } } - for (i = 0; i < matrix->nx; i++) + for (i = 0; i < in->nx; i++) { - for (j = 0; j < matrix->ny; j++) + for (j = 0; j < in->ny; j++) { - mat[i][j] = rmap[matrix->matrix[i][j]]; + out[i][j] = rmap[in->matrix[i][j]]; } } sfree(rmap); fprintf(stderr, "Converted a %dx%d matrix with %d levels to reals\n", - matrix->nx, matrix->ny, nmap); + in->nx, in->ny, nmap); - return mat; + return out; } void write_xpm_header(FILE *out, @@ -894,7 +894,7 @@ void write_xpm_axis(FILE *out, const char *axis, gmx_bool bSpatial, int n, } } -void write_xpm_data(FILE *out, int n_x, int n_y, real **matrix, +void write_xpm_data(FILE *out, int n_x, int n_y, real **mat, real lo, real hi, int nlevels) { int i, j, c; @@ -910,7 +910,7 @@ void write_xpm_data(FILE *out, int n_x, int n_y, real **matrix, fprintf(out, "\""); for (i = 0; (i < n_x); i++) { - c = gmx_nint((matrix[i][j]-lo)*invlevel); + c = gmx_nint((mat[i][j]-lo)*invlevel); if (c < 0) { c = 0; @@ -939,7 +939,7 @@ void write_xpm_data(FILE *out, int n_x, int n_y, real **matrix, } } -void write_xpm_data3(FILE *out, int n_x, int n_y, real **matrix, +void write_xpm_data3(FILE *out, int n_x, int n_y, real **mat, real lo, real mid, real hi, int nlevels) { int i, j, c = 0, nmid; @@ -958,13 +958,13 @@ void write_xpm_data3(FILE *out, int n_x, int n_y, real **matrix, fprintf(out, "\""); for (i = 0; (i < n_x); i++) { - if (matrix[i][j] >= mid) + if (mat[i][j] >= mid) { - c = nmid+gmx_nint((matrix[i][j]-mid)*invlev_hi); + c = nmid+gmx_nint((mat[i][j]-mid)*invlev_hi); } - else if (matrix[i][j] >= lo) + else if (mat[i][j] >= lo) { - c = gmx_nint((matrix[i][j]-lo)*invlev_lo); + c = gmx_nint((mat[i][j]-lo)*invlev_lo); } else { @@ -999,7 +999,7 @@ void write_xpm_data3(FILE *out, int n_x, int n_y, real **matrix, } } -void write_xpm_data_split(FILE *out, int n_x, int n_y, real **matrix, +void write_xpm_data_split(FILE *out, int n_x, int n_y, real **mat, real lo_top, real hi_top, int nlevel_top, real lo_bot, real hi_bot, int nlevel_bot) { @@ -1020,18 +1020,18 @@ void write_xpm_data_split(FILE *out, int n_x, int n_y, real **matrix, { if (i < j) { - c = nlevel_bot+round((matrix[i][j]-lo_top)*invlev_top); + c = nlevel_bot+round((mat[i][j]-lo_top)*invlev_top); if ((c < nlevel_bot) || (c >= nlevel_bot+nlevel_top)) { - gmx_fatal(FARGS, "Range checking i = %d, j = %d, c = %d, bot = %d, top = %d matrix[i,j] = %f", i, j, c, nlevel_bot, nlevel_top, matrix[i][j]); + gmx_fatal(FARGS, "Range checking i = %d, j = %d, c = %d, bot = %d, top = %d matrix[i,j] = %f", i, j, c, nlevel_bot, nlevel_top, mat[i][j]); } } else if (i > j) { - c = round((matrix[i][j]-lo_bot)*invlev_bot); + c = round((mat[i][j]-lo_bot)*invlev_bot); if ((c < 0) || (c >= nlevel_bot+nlevel_bot)) { - gmx_fatal(FARGS, "Range checking i = %d, j = %d, c = %d, bot = %d, top = %d matrix[i,j] = %f", i, j, c, nlevel_bot, nlevel_top, matrix[i][j]); + gmx_fatal(FARGS, "Range checking i = %d, j = %d, c = %d, bot = %d, top = %d matrix[i,j] = %f", i, j, c, nlevel_bot, nlevel_top, mat[i][j]); } } else @@ -1113,7 +1113,7 @@ void write_xpm3(FILE *out, unsigned int flags, const char *title, const char *legend, const char *label_x, const char *label_y, int n_x, int n_y, real axis_x[], real axis_y[], - real *matrix[], real lo, real mid, real hi, + real *mat[], real lo, real mid, real hi, t_rgb rlo, t_rgb rmid, t_rgb rhi, int *nlevels) { /* See write_xpm. @@ -1129,14 +1129,14 @@ void write_xpm3(FILE *out, unsigned int flags, write_xpm_map3(out, n_x, n_y, nlevels, lo, mid, hi, rlo, rmid, rhi); write_xpm_axis(out, "x", flags & MAT_SPATIAL_X, n_x, axis_x); write_xpm_axis(out, "y", flags & MAT_SPATIAL_Y, n_y, axis_y); - write_xpm_data3(out, n_x, n_y, matrix, lo, mid, hi, *nlevels); + write_xpm_data3(out, n_x, n_y, mat, lo, mid, hi, *nlevels); } void write_xpm_split(FILE *out, unsigned int flags, const char *title, const char *legend, const char *label_x, const char *label_y, int n_x, int n_y, real axis_x[], real axis_y[], - real *matrix[], + real *mat[], real lo_top, real hi_top, int *nlevel_top, t_rgb rlo_top, t_rgb rhi_top, real lo_bot, real hi_bot, int *nlevel_bot, @@ -1165,7 +1165,7 @@ void write_xpm_split(FILE *out, unsigned int flags, bDiscreteColor, nlevel_bot, lo_bot, hi_bot, rlo_bot, rhi_bot); write_xpm_axis(out, "x", flags & MAT_SPATIAL_X, n_x, axis_x); write_xpm_axis(out, "y", flags & MAT_SPATIAL_Y, n_y, axis_y); - write_xpm_data_split(out, n_x, n_y, matrix, lo_top, hi_top, *nlevel_top, + write_xpm_data_split(out, n_x, n_y, mat, lo_top, hi_top, *nlevel_top, lo_bot, hi_bot, *nlevel_bot); } @@ -1173,7 +1173,7 @@ void write_xpm(FILE *out, unsigned int flags, const char *title, const char *legend, const char *label_x, const char *label_y, int n_x, int n_y, real axis_x[], real axis_y[], - real *matrix[], real lo, real hi, + real *mat[], real lo, real hi, t_rgb rlo, t_rgb rhi, int *nlevels) { /* out xpm file @@ -1201,5 +1201,5 @@ void write_xpm(FILE *out, unsigned int flags, write_xpm_map(out, n_x, n_y, nlevels, lo, hi, rlo, rhi); write_xpm_axis(out, "x", flags & MAT_SPATIAL_X, n_x, axis_x); write_xpm_axis(out, "y", flags & MAT_SPATIAL_Y, n_y, axis_y); - write_xpm_data(out, n_x, n_y, matrix, lo, hi, *nlevels); + write_xpm_data(out, n_x, n_y, mat, lo, hi, *nlevels); } diff --git a/src/gromacs/fileio/matio.h b/src/gromacs/fileio/matio.h index b2547c229d..da96073b9e 100644 --- a/src/gromacs/fileio/matio.h +++ b/src/gromacs/fileio/matio.h @@ -2,8 +2,8 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2004, The GROMACS development team, - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2001-2004, The GROMACS development team. + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -38,7 +38,9 @@ #ifndef GMX_FILEIO_MATIO_H #define GMX_FILEIO_MATIO_H -#include "../legacyheaders/typedefs.h" +#include + +#include "../legacyheaders/types/matrix.h" #ifdef __cplusplus extern "C" { @@ -63,10 +65,10 @@ void printcmap(FILE *out, int n, t_mapping map[]); void writecmap(const char *fn, int n, t_mapping map[]); /* print mapping table to fn */ -int read_xpm_matrix(const char *fnm, t_matrix **matrix); +int read_xpm_matrix(const char *fnm, t_matrix **mat); /* Reads a number of matrices from .xpm file fnm and returns this number */ -real **matrix2real(t_matrix *matrix, real **mat); +real **matrix2real(t_matrix *in, real **out); /* Converts an matrix in a t_matrix struct to a matrix of reals * When mat==NULL memory will be allocated * Returns NULL when something went wrong @@ -79,7 +81,7 @@ void write_xpm3(FILE *out, unsigned int flags, const char *title, const char *legend, const char *label_x, const char *label_y, int n_x, int n_y, real axis_x[], real axis_y[], - real *matrix[], real lo, real mid, real hi, + real *mat[], real lo, real mid, real hi, t_rgb rlo, t_rgb rmid, t_rgb rhi, int *nlevels); /* See write_xpm. * Writes a colormap varying as rlo -> rmid -> rhi. @@ -88,7 +90,7 @@ void write_xpm_split(FILE *out, unsigned int flags, const char *title, const char *legend, const char *label_x, const char *label_y, int n_x, int n_y, real axis_x[], real axis_y[], - real *matrix[], + real *mat[], real lo_top, real hi_top, int *nlevel_top, t_rgb rlo_top, t_rgb rhi_top, real lo_bot, real hi_bot, int *nlevel_bot, @@ -104,7 +106,7 @@ void write_xpm(FILE *out, unsigned int flags, const char *title, const char *legend, const char *label_x, const char *label_y, int n_x, int n_y, real t_x[], real t_y[], - real *matrix[], real lo, real hi, + real *mat[], real lo, real hi, t_rgb rlo, t_rgb rhi, int *nlevels); /* out xpm file * flags flags, defined types/matrix.h @@ -120,7 +122,7 @@ void write_xpm(FILE *out, unsigned int flags, * n_x, n_y size of the matrix * axis_x[] the x-ticklabels (n_x or n_x+1) * axis_y[] the y-ticklables (n_y or n_y+1) - * *matrix[] element x,y is matrix[x][y] + * *mat[] element x,y is mat[x][y] * lo output lower than lo is set to lo * hi output higher than hi is set to hi * rlo rgb value for level lo diff --git a/src/gromacs/fileio/pdbio.h b/src/gromacs/fileio/pdbio.h index 7b152c6b35..0808808f72 100644 --- a/src/gromacs/fileio/pdbio.h +++ b/src/gromacs/fileio/pdbio.h @@ -40,9 +40,9 @@ #include -#include "../legacyheaders/typedefs.h" -#include "../legacyheaders/symtab.h" #include "../legacyheaders/atomprop.h" +#include "../legacyheaders/symtab.h" +#include "../legacyheaders/types/topology.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/fileio/tpxio.h b/src/gromacs/fileio/tpxio.h index 0e64f3b070..50f6a7b7a7 100644 --- a/src/gromacs/fileio/tpxio.h +++ b/src/gromacs/fileio/tpxio.h @@ -2,8 +2,8 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2004, The GROMACS development team, - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2001-2004, The GROMACS development team. + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -47,7 +47,9 @@ * can also be used with the routines in gmxfio.h * **************************************************************/ -#include "../legacyheaders/typedefs.h" +#include "../legacyheaders/types/inputrec.h" +#include "../legacyheaders/types/state.h" +#include "../legacyheaders/types/topology.h" #include "gmxfio.h" #ifdef __cplusplus diff --git a/src/gromacs/fileio/trajectory_writing.c b/src/gromacs/fileio/trajectory_writing.c index 5a55f88331..5e8c3602ca 100644 --- a/src/gromacs/fileio/trajectory_writing.c +++ b/src/gromacs/fileio/trajectory_writing.c @@ -45,6 +45,7 @@ #include "trajectory_writing.h" #include "mdoutf.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/timing/wallcycle.h" void diff --git a/src/gromacs/fileio/trajectory_writing.h b/src/gromacs/fileio/trajectory_writing.h index 65e8e067ea..07cb6f4afe 100644 --- a/src/gromacs/fileio/trajectory_writing.h +++ b/src/gromacs/fileio/trajectory_writing.h @@ -39,10 +39,13 @@ #define GMX_FILEIO_TRAJECTORY_WRITING_H #include + +#include "../legacyheaders/types/commrec_fwd.h" +#include "../legacyheaders/mdebin.h" +#include "../timing/wallcycle.h" + #include "filenm.h" #include "mdoutf.h" -#include "../legacyheaders/typedefs.h" -#include "../legacyheaders/mdebin.h" /*! \brief Wrapper routine for writing trajectories during mdrun * diff --git a/src/gromacs/fileio/trnio.h b/src/gromacs/fileio/trnio.h index c5ae63e453..8fd25d14d0 100644 --- a/src/gromacs/fileio/trnio.h +++ b/src/gromacs/fileio/trnio.h @@ -2,8 +2,8 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2004, The GROMACS development team, - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2001-2004, The GROMACS development team. + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -53,7 +53,6 @@ * **************************************************************/ -#include "../legacyheaders/typedefs.h" #include "gmxfio.h" #ifdef __cplusplus diff --git a/src/gromacs/fileio/trxio.h b/src/gromacs/fileio/trxio.h index d3b64a91c8..175e64fbcc 100644 --- a/src/gromacs/fileio/trxio.h +++ b/src/gromacs/fileio/trxio.h @@ -38,12 +38,13 @@ #ifndef GMX_FILEIO_TRXIO_H #define GMX_FILEIO_TRXIO_H -#include "../legacyheaders/typedefs.h" -#include "filenm.h" +#include "../legacyheaders/types/topology.h" #include "../legacyheaders/readinp.h" -#include "pdbio.h" #include "../legacyheaders/oenv.h" + +#include "filenm.h" #include "gmxfio.h" +#include "pdbio.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/fileio/xvgr.cpp b/src/gromacs/fileio/xvgr.cpp index 49081481fa..0027b30cca 100644 --- a/src/gromacs/fileio/xvgr.cpp +++ b/src/gromacs/fileio/xvgr.cpp @@ -50,6 +50,7 @@ #include "gromacs/legacyheaders/copyrite.h" #include "gromacs/legacyheaders/oenv.h" +#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/fileio/gmxfio.h" #include "gromacs/math/vec.h" diff --git a/src/gromacs/gmxana/edittop.c b/src/gromacs/gmxana/edittop.c index 9295f8c70e..736aea2559 100644 --- a/src/gromacs/gmxana/edittop.c +++ b/src/gromacs/gmxana/edittop.c @@ -38,9 +38,10 @@ #include #endif +#include "gromacs/legacyheaders/symtab.h" +#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/utility/smalloc.h" #include "gromacs/utility/fatalerror.h" -#include "symtab.h" void replace_atom(t_topology *top, int inr, char *anm, char *resnm, real q, real m, int type) diff --git a/src/gromacs/gmxana/nsfactor.h b/src/gromacs/gmxana/nsfactor.h index 8d3a388cf1..367aaa1836 100644 --- a/src/gromacs/gmxana/nsfactor.h +++ b/src/gromacs/gmxana/nsfactor.h @@ -36,9 +36,10 @@ #ifndef _nsfactor_h #define _nsfactor_h -#include "index.h" -#include "types/simple.h" -#include "oenv.h" +#include "gromacs/legacyheaders/index.h" +#include "gromacs/legacyheaders/oenv.h" +#include "gromacs/legacyheaders/types/simple.h" +#include "gromacs/legacyheaders/types/topology.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/gmxlib/atomprop.c b/src/gromacs/gmxlib/atomprop.c index aeba61ce9b..0b359886e5 100644 --- a/src/gromacs/gmxlib/atomprop.c +++ b/src/gromacs/gmxlib/atomprop.c @@ -41,17 +41,17 @@ #include #include -#include "gromacs/utility/smalloc.h" +#include "gromacs/fileio/strdb.h" +#include "gromacs/legacyheaders/atomprop.h" +#include "gromacs/legacyheaders/copyrite.h" +#include "gromacs/legacyheaders/index.h" +#include "gromacs/legacyheaders/macros.h" +#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/math/utilities.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" -#include "atomprop.h" -#include "macros.h" -#include "index.h" -#include "copyrite.h" - #include "gromacs/utility/futil.h" -#include "gromacs/fileio/strdb.h" -#include "gromacs/math/utilities.h" +#include "gromacs/utility/smalloc.h" typedef struct { gmx_bool bSet; diff --git a/src/gromacs/gmxpreprocess/read-conformation.cpp b/src/gromacs/gmxpreprocess/read-conformation.cpp index ca9e5248c8..5007a540fc 100644 --- a/src/gromacs/gmxpreprocess/read-conformation.cpp +++ b/src/gromacs/gmxpreprocess/read-conformation.cpp @@ -34,11 +34,11 @@ */ #include "read-conformation.h" -#include "atomprop.h" -#include "types/simple.h" -#include "types/atoms.h" - #include "gromacs/fileio/confio.h" +#include "gromacs/legacyheaders/atomprop.h" +#include "gromacs/legacyheaders/types/simple.h" +#include "gromacs/legacyheaders/types/atoms.h" +#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/smalloc.h" diff --git a/src/gromacs/imd/imd.h b/src/gromacs/imd/imd.h index ea6685c406..67bb76281b 100644 --- a/src/gromacs/imd/imd.h +++ b/src/gromacs/imd/imd.h @@ -62,6 +62,7 @@ #include "typedefs.h" #include "../fileio/filenm.h" +#include "../timing/wallcycle.h" #ifdef GMX_NATIVE_WINDOWS #include diff --git a/src/gromacs/legacyheaders/domdec.h b/src/gromacs/legacyheaders/domdec.h index efeef40614..56635e20a4 100644 --- a/src/gromacs/legacyheaders/domdec.h +++ b/src/gromacs/legacyheaders/domdec.h @@ -40,6 +40,8 @@ #include "vsite.h" #include "genborn.h" +#include "../timing/wallcycle.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/gromacs/legacyheaders/force.h b/src/gromacs/legacyheaders/force.h index e053a0de33..214fcc9a22 100644 --- a/src/gromacs/legacyheaders/force.h +++ b/src/gromacs/legacyheaders/force.h @@ -47,6 +47,7 @@ #include "vsite.h" #include "genborn.h" +#include "../timing/wallcycle.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/legacyheaders/index.h b/src/gromacs/legacyheaders/index.h index b472675936..8d449f1840 100644 --- a/src/gromacs/legacyheaders/index.h +++ b/src/gromacs/legacyheaders/index.h @@ -38,7 +38,10 @@ #ifndef _index_h #define _index_h -#include "typedefs.h" +#include + +#include "types/atoms.h" +#include "types/block.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/legacyheaders/md_support.h b/src/gromacs/legacyheaders/md_support.h index 3561cce533..25b32fd9dc 100644 --- a/src/gromacs/legacyheaders/md_support.h +++ b/src/gromacs/legacyheaders/md_support.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -43,6 +43,8 @@ #include "sim_util.h" #include "vcm.h" +#include "../timing/wallcycle.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/gromacs/legacyheaders/mdrun.h b/src/gromacs/legacyheaders/mdrun.h index e8cb420bd9..eee859aeab 100644 --- a/src/gromacs/legacyheaders/mdrun.h +++ b/src/gromacs/legacyheaders/mdrun.h @@ -44,7 +44,6 @@ #include "network.h" #include "sim_util.h" #include "tgroup.h" -#include "../fileio/filenm.h" #include "mshift.h" #include "mdebin.h" #include "vcm.h" @@ -53,6 +52,9 @@ #include "types/membedt.h" #include "types/globsig.h" +#include "../fileio/filenm.h" +#include "../timing/wallcycle.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/gromacs/legacyheaders/pme.h b/src/gromacs/legacyheaders/pme.h index 5f985fe29b..88a8cd3aec 100644 --- a/src/gromacs/legacyheaders/pme.h +++ b/src/gromacs/legacyheaders/pme.h @@ -41,6 +41,7 @@ #include #include "typedefs.h" #include "../math/gmxcomplex.h" +#include "../timing/wallcycle.h" #include "../timing/walltime_accounting.h" #include "../legacyheaders/network.h" diff --git a/src/gromacs/legacyheaders/shellfc.h b/src/gromacs/legacyheaders/shellfc.h index 22cd489e4b..257b0eebbc 100644 --- a/src/gromacs/legacyheaders/shellfc.h +++ b/src/gromacs/legacyheaders/shellfc.h @@ -35,6 +35,8 @@ * the research papers on the package. Check out http://www.gromacs.org. */ +#include "../timing/wallcycle.h" + #include "typedefs.h" #include "vsite.h" diff --git a/src/gromacs/legacyheaders/sim_util.h b/src/gromacs/legacyheaders/sim_util.h index 546038479e..3eb05b8cf1 100644 --- a/src/gromacs/legacyheaders/sim_util.h +++ b/src/gromacs/legacyheaders/sim_util.h @@ -44,6 +44,7 @@ #include "vcm.h" #include "../fileio/enxio.h" #include "../fileio/mdoutf.h" +#include "../timing/wallcycle.h" #include "../timing/walltime_accounting.h" #ifdef __cplusplus diff --git a/src/gromacs/legacyheaders/symtab.h b/src/gromacs/legacyheaders/symtab.h index d0561340c2..0c93cc3353 100644 --- a/src/gromacs/legacyheaders/symtab.h +++ b/src/gromacs/legacyheaders/symtab.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2010, by the GROMACS development team, led by + * Copyright (c) 2010,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -39,7 +39,7 @@ #define _symtab_h #include -#include "typedefs.h" +#include "types/symtab.h" #ifdef __cplusplus extern "C" { diff --git a/src/gromacs/legacyheaders/typedefs.h b/src/gromacs/legacyheaders/typedefs.h index 92f883b1b6..c201ff6ac1 100644 --- a/src/gromacs/legacyheaders/typedefs.h +++ b/src/gromacs/legacyheaders/typedefs.h @@ -71,6 +71,7 @@ #include "types/constr.h" #include "types/matrix.h" #include "types/oenv.h" +#include "types/commrec_fwd.h" #ifdef __cplusplus extern "C" { @@ -200,13 +201,6 @@ t_atoms *mtop2atoms(gmx_mtop_t *mtop); real max_cutoff(real cutoff1, real cutoff2); /* Returns the maximum of the cut-off's, taking into account that 0=inf. */ -/* Following are forward declarations for structures in commrec.h */ -typedef struct t_commrec t_commrec; -typedef struct gmx_domdec_t gmx_domdec_t; -typedef struct gmx_multisim_t gmx_multisim_t; -typedef struct gmx_domdec_zones_t gmx_domdec_zones_t; -typedef struct gmx_ddbox_t gmx_ddbox_t; - #ifdef __cplusplus } #endif diff --git a/src/gromacs/legacyheaders/types/commrec_fwd.h b/src/gromacs/legacyheaders/types/commrec_fwd.h new file mode 100644 index 0000000000..2a0d88b20d --- /dev/null +++ b/src/gromacs/legacyheaders/types/commrec_fwd.h @@ -0,0 +1,45 @@ +/* + * This file is part of the GROMACS molecular simulation package. + * + * Copyright (c) 2014, by the GROMACS development team, led by + * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, + * and including many others, as listed in the AUTHORS file in the + * top-level source directory and at http://www.gromacs.org. + * + * GROMACS is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * GROMACS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GROMACS; if not, see + * http://www.gnu.org/licenses, or write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * If you want to redistribute modifications to GROMACS, please + * consider that scientific software is very special. Version + * control is crucial - bugs must be traceable. We will be happy to + * consider code for inclusion in the official distribution, but + * derived work must not be called official GROMACS. Details are found + * in the README & COPYING files - if they are missing, get the + * official version at http://www.gromacs.org. + * + * To help us fund GROMACS development, we humbly ask that you cite + * the research papers on the package. Check out http://www.gromacs.org. + */ + +#ifndef GMX_TYPES_COMMREC_FWD_H +#define GMX_TYPES_COMMREC_FWD_H + +typedef struct t_commrec t_commrec; +typedef struct gmx_domdec_t gmx_domdec_t; +typedef struct gmx_multisim_t gmx_multisim_t; +typedef struct gmx_domdec_zones_t gmx_domdec_zones_t; +typedef struct gmx_ddbox_t gmx_ddbox_t; + +#endif diff --git a/src/gromacs/legacyheaders/types/energy.h b/src/gromacs/legacyheaders/types/energy.h index 8fce52bb48..f12d8e6eae 100644 --- a/src/gromacs/legacyheaders/types/energy.h +++ b/src/gromacs/legacyheaders/types/energy.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2010, by the GROMACS development team, led by + * Copyright (c) 2010,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -35,6 +35,9 @@ * the research papers on the package. Check out http://www.gromacs.org. */ +#ifndef GMX_TYPES_ENERGY_H +#define GMX_TYPES_ENERGY_H + #include "simple.h" #ifdef __cplusplus @@ -50,3 +53,5 @@ typedef struct { #ifdef __cplusplus } #endif + +#endif diff --git a/src/gromacs/legacyheaders/types/matrix.h b/src/gromacs/legacyheaders/types/matrix.h index 9a9aec7a8a..9e2e82bec7 100644 --- a/src/gromacs/legacyheaders/types/matrix.h +++ b/src/gromacs/legacyheaders/types/matrix.h @@ -41,7 +41,8 @@ extern "C" { #endif -#include "simple.h" +#include "../../utility/basedefinitions.h" +#include "../../utility/real.h" typedef struct { real r, g, b; diff --git a/src/gromacs/legacyheaders/types/nrnb.h b/src/gromacs/legacyheaders/types/nrnb.h index f0a8fb9e17..af83fa4214 100644 --- a/src/gromacs/legacyheaders/types/nrnb.h +++ b/src/gromacs/legacyheaders/types/nrnb.h @@ -133,8 +133,6 @@ typedef struct t_nrnb; -typedef struct gmx_wallcycle *gmx_wallcycle_t; - #ifdef __cplusplus } #endif diff --git a/src/gromacs/legacyheaders/update.h b/src/gromacs/legacyheaders/update.h index 6a4679f4f7..69237e26a1 100644 --- a/src/gromacs/legacyheaders/update.h +++ b/src/gromacs/legacyheaders/update.h @@ -43,6 +43,8 @@ #include "tgroup.h" #include "network.h" +#include "../timing/wallcycle.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/gromacs/mdlib/force.c b/src/gromacs/mdlib/force.c index e01c27ee2c..e3e6d4ab72 100644 --- a/src/gromacs/mdlib/force.c +++ b/src/gromacs/mdlib/force.c @@ -63,6 +63,7 @@ #include "qmmm.h" #include "gmx_omp_nthreads.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/math/vec.h" #include "gromacs/timing/wallcycle.h" #include "gromacs/utility/fatalerror.h" diff --git a/src/gromacs/mdlib/md_support.c b/src/gromacs/mdlib/md_support.c index 720a8a8ace..c8ce7a9532 100644 --- a/src/gromacs/mdlib/md_support.c +++ b/src/gromacs/mdlib/md_support.c @@ -48,6 +48,7 @@ #include "md_logging.h" #include "md_support.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/math/vec.h" #include "gromacs/timing/wallcycle.h" #include "gromacs/utility/cstringutil.h" diff --git a/src/gromacs/mdlib/minimize.c b/src/gromacs/mdlib/minimize.c index af9116e52d..1cdf3d2c53 100644 --- a/src/gromacs/mdlib/minimize.c +++ b/src/gromacs/mdlib/minimize.c @@ -72,6 +72,7 @@ #include "gromacs/fileio/confio.h" #include "gromacs/fileio/trajectory_writing.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/linearalgebra/mtxio.h" #include "gromacs/linearalgebra/sparsematrix.h" #include "gromacs/timing/wallcycle.h" diff --git a/src/gromacs/mdlib/pme.c b/src/gromacs/mdlib/pme.c index 2c22d4b762..d56b2a41e5 100644 --- a/src/gromacs/mdlib/pme.c +++ b/src/gromacs/mdlib/pme.c @@ -79,6 +79,7 @@ #include "nrnb.h" #include "macros.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/fft/parallel_3dfft.h" #include "gromacs/utility/futil.h" #include "gromacs/fileio/pdbio.h" diff --git a/src/gromacs/mdlib/sim_util.c b/src/gromacs/mdlib/sim_util.c index a9bcc6878c..5897b0d3cf 100644 --- a/src/gromacs/mdlib/sim_util.c +++ b/src/gromacs/mdlib/sim_util.c @@ -82,6 +82,7 @@ #include "../gmxlib/nonbonded/nb_kernel.h" #include "../gmxlib/nonbonded/nb_free_energy.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/timing/wallcycle.h" #include "gromacs/timing/walltime_accounting.h" #include "gromacs/utility/gmxmpi.h" diff --git a/src/gromacs/mdlib/tpi.c b/src/gromacs/mdlib/tpi.c index 0bd1e9fddb..976dc02d48 100644 --- a/src/gromacs/mdlib/tpi.c +++ b/src/gromacs/mdlib/tpi.c @@ -71,6 +71,7 @@ #include "pme.h" #include "gromacs/gmxlib/conformation-utilities.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/fileio/confio.h" #include "gromacs/fileio/gmxfio.h" #include "gromacs/fileio/trxio.h" diff --git a/src/gromacs/timing/CMakeLists.txt b/src/gromacs/timing/CMakeLists.txt index e73a1115a9..094cb6f298 100644 --- a/src/gromacs/timing/CMakeLists.txt +++ b/src/gromacs/timing/CMakeLists.txt @@ -36,7 +36,9 @@ file(GLOB TIMING_SOURCES *.cpp *.c) set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TIMING_SOURCES} PARENT_SCOPE) set(TIMING_PUBLIC_HEADERS + wallcycle.h walltime_accounting.h) + gmx_install_headers(timing ${TIMING_PUBLIC_HEADERS}) if (BUILD_TESTING) diff --git a/src/gromacs/timing/wallcycle.c b/src/gromacs/timing/wallcycle.c index ca6e0a88fb..58986118be 100644 --- a/src/gromacs/timing/wallcycle.c +++ b/src/gromacs/timing/wallcycle.c @@ -43,14 +43,15 @@ #include #include -#include "md_logging.h" - -#include "gromacs/timing/cyclecounter.h" +#include "gromacs/legacyheaders/md_logging.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/gmxmpi.h" #include "gromacs/utility/smalloc.h" +#include "cyclecounter.h" + /* DEBUG_WCYCLE adds consistency checking for the counters. * It checks if you stop a counter different from the last * one that was opened and if you do nest too deep. diff --git a/src/gromacs/timing/wallcycle.h b/src/gromacs/timing/wallcycle.h index 45930f4412..8cb131f839 100644 --- a/src/gromacs/timing/wallcycle.h +++ b/src/gromacs/timing/wallcycle.h @@ -38,13 +38,17 @@ #define GMX_TIMING_WALLCYCLE_H #include -#include "gromacs/legacyheaders/typedefs.h" -#include "gromacs/legacyheaders/types/commrec.h" + +#include "../legacyheaders/types/commrec_fwd.h" +#include "../legacyheaders/types/nbnxn_cuda_types_ext.h" +#include "../utility/basedefinitions.h" #ifdef __cplusplus extern "C" { #endif +typedef struct gmx_wallcycle *gmx_wallcycle_t; + enum { ewcRUN, ewcSTEP, ewcPPDURINGPME, ewcDOMDEC, ewcDDCOMMLOAD, ewcDDCOMMBOUND, ewcVSITECONSTR, ewcPP_PMESENDX, ewcNS, ewcLAUNCH_GPU_NB, -- 2.22.0