target_include_directories(${_build_target} PRIVATE
$<BUILD_INTERFACE:${TNG_ROOT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${TNG_ROOT_BINARY_DIR}/include>)
- target_include_directories(${NAME} INTERFACE
+ target_include_directories(${NAME} SYSTEM INTERFACE
$<BUILD_INTERFACE:${TNG_ROOT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${TNG_ROOT_BINARY_DIR}/include>)
/* File plugin symbolic constants for better code readability */
#define MOLFILE_SUCCESS 0 /**< succeeded in reading file */
-#define MOLFILE_EOF -1 /**< end of file */
-#define MOLFILE_ERROR -1 /**< error reading/opening a file */
-#define MOLFILE_NOSTRUCTUREDATA -2 /**< no structure data in this file */
+#define MOLFILE_EOF (-1) /**< end of file */
+#define MOLFILE_ERROR (-1) /**< error reading/opening a file */
+#define MOLFILE_NOSTRUCTUREDATA (-2) /**< no structure data in this file */
-#define MOLFILE_NUMATOMS_UNKNOWN -1 /**< unknown number of atoms */
+#define MOLFILE_NUMATOMS_UNKNOWN (-1) /**< unknown number of atoms */
#define MOLFILE_NUMATOMS_NONE 0 /**< no atoms in this file type */
/**
#define MOLFILE_MAXWAVEPERTS 25 /**< maximum number of wavefunctions
* per timestep */
-#define MOLFILE_QM_STATUS_UNKNOWN -1
+#define MOLFILE_QM_STATUS_UNKNOWN (-1)
#define MOLFILE_QM_OPT_CONVERGED 0
#define MOLFILE_QM_SCF_NOT_CONV 1
#define MOLFILE_QM_OPT_NOT_CONV 2
/*@{*/
/** Error return code for use in the plugin registration and init functions */
#define VMDPLUGIN_SUCCESS 0
-#define VMDPLUGIN_ERROR -1
+#define VMDPLUGIN_ERROR (-1)
/*@}*/
/**
"-readability-implicit-bool-conversion" #TODO: Remove gmx_bool
"modernize-use-nullptr" "modernize-use-emplace"
"modernize-make-unique" "modernize-make-shared"
+ "cppcoreguidelines-*" "-cppcoreguidelines-pro-*"
+ "-cppcoreguidelines-owning-memory"
+ "-cppcoreguidelines-no-malloc"
+ "-cppcoreguidelines-special-member-functions" #in conflict with Wunused-member-function
)
string(REPLACE ";" "," CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS}")
set_target_properties(libgromacs PROPERTIES CXX_CLANG_TIDY
- "${CLANG_TIDY_EXE};--checks=${CLANG_TIDY_CHECKS};-warnings-as-errors=*;-fix")
+ "${CLANG_TIDY_EXE};--checks=${CLANG_TIDY_CHECKS};-warnings-as-errors=*;-header-filter=.*")
endif()
gmx_write_installed_header_list()
t_state *stateGlobal,
const t_commrec *commRecord,
const gmx_multisim_t *multiSimRecord,
- const bool startingFromCheckpoint,
- const bool usingShellParticles,
+ bool startingFromCheckpoint,
+ bool usingShellParticles,
const std::string &biasInitFilename,
pull_t *pull_work);
{
GMX_RELEASE_ASSERT(forceCorrelationGrid_ != nullptr, "forceCorrelationGrid() should only be called with a valid force correlation object");
- return *forceCorrelationGrid_.get();
+ return *forceCorrelationGrid_;
}
/*! \brief Return the number of data blocks that have been prepared for writing.
double pointBias,
const awh_dvec value)
{
- double logWeight = c_largeNegativeExponent;
+ double logWeight = detail::c_largeNegativeExponent;
/* Only points in the target reigon have non-zero weight */
if (points[pointIndex].inTargetRegion())
the free energy values grow less than 0.5*c_largePositiveExponent in a return time to this
neighborhood. For reasonable update sizes it's unlikely that this requirement would be
broken. */
- if (std::abs(points_[globalIndex].freeEnergy()) > 0.5*c_largePositiveExponent)
+ if (std::abs(points_[globalIndex].freeEnergy()) > 0.5*detail::c_largePositiveExponent)
{
needToNormalizeFreeEnergy = true;
break;
else
{
/* Pad with values that don't affect the result */
- (*weight)[n] = c_largeNegativeExponent;
+ (*weight)[n] = detail::c_largeNegativeExponent;
}
}
PackType weightPack = load<PackType>(weightData + i);
*
* \param[out] pmf Array(ref) to be filled with the PMF values, should have the same size as the bias grid.
*/
- void getPmf(gmx::ArrayRef<float>) const;
+ void getPmf(gmx::ArrayRef<float> /*pmf*/) const;
/*! \brief Returns the current coordinate state.
*/
*/
int tensorSize() const
{
- GMX_RELEASE_ASSERT(tensors_.size() > 0, "Should only call tensorSize on a valid grid");
+ GMX_RELEASE_ASSERT(!tensors_.empty(), "Should only call tensorSize on a valid grid");
return tensors_[0].blockDataList()[0].correlationIntegral().size();
}
*/
int blockDataListSize() const
{
- GMX_RELEASE_ASSERT(tensors_.size() > 0, "Should only call tensorSize on a valid grid");
+ GMX_RELEASE_ASSERT(!tensors_.empty(), "Should only call tensorSize on a valid grid");
return tensors_[0].blockDataList().size();
}
namespace gmx
{
-namespace
+namespace detail
{
//! A value that can be passed to exp() with result 0, also with SIMD
-static constexpr double c_largeNegativeExponent = -10000.0;
+constexpr double c_largeNegativeExponent = -10000.0;
//! The largest acceptable positive exponent for variables that are passed to exp().
-static constexpr double c_largePositiveExponent = 700.0;
+constexpr double c_largePositiveExponent = 700.0;
-} // namepace
+} // namepace detail
/*! \internal
* \brief The state of a coordinate point.
{
target_ = 0;
/* the bias = log(target) + const = -infty */
- bias_ = c_largeNegativeExponent;
+ bias_ = detail::c_largeNegativeExponent;
}
/*! \brief Return the free energy. */
double df = -std::log(weighthistSampled/weighthistTarget);
freeEnergy_ += df;
- GMX_RELEASE_ASSERT(std::abs(freeEnergy_) < c_largePositiveExponent,
+ GMX_RELEASE_ASSERT(std::abs(freeEnergy_) < detail::c_largePositiveExponent,
"Very large free energy differences or badly normalized free energy in AWH update.");
}
* \param[in] x The value of x
* \return the value of the fit
*/
-double fit_function(const int eFitFn, const double parm[], const double x);
+double fit_function(int eFitFn, const double parm[], double x);
/*! \brief
* Use Levenberg-Marquardt method to fit to a nfitparm parameter exponential
* All arrays are indexed with 0 to dd->ndim (not Cartesian indexing),
* unless stated otherwise.
*/
-struct gmx_domdec_comm_t
+struct gmx_domdec_comm_t // NOLINT (clang-analyzer-optin.performance.Padding)
{
/* PME and Cartesian communicator stuff */
int npmedecompdim; /**< The number of decomposition dimensions for PME, 0: no PME */
};
-struct gmx_domdec_t {
+struct gmx_domdec_t { //NOLINT(clang-analyzer-optin.performance.Padding)
/* The DD particle-particle nodes only */
/* The communication setup within the communicator all
* defined in dd->comm in domdec.c
ind = ga2la->lal[ind].next;
}
while (ind >= 0);
-
- return;
}
/*! \brief Change the local atom for present ga2la entry for global atom a_gl
ind = ga2la->lal[ind].next;
}
while (ind >= 0);
-
- return;
}
/*! \brief Returns if the global atom a_gl available locally
#include <cstdio>
//! Forward declation
-static void gmx_hash_resize(gmx_hash_t *, int);
+static void gmx_hash_resize(gmx_hash_t * /*hash*/, int /*nkey_used_estimate*/);
/*! \internal \brief Hashing key-generation helper struct */
struct gmx_hash_e_t
*/
void pme_gpu_3dfft(const PmeGpu *pmeGpu,
enum gmx_fft_direction direction,
- const int gridIndex);
+ int gridIndex);
/*! \libinternal \brief
* A GPU Fourier space solving function.
/*! \brief
* Factory function used to build persistent PME GPU program for the device at once.
*/
-PmeGpuProgramStorage buildPmeGpuProgram(const gmx_device_info_t *);
+PmeGpuProgramStorage buildPmeGpuProgram(const gmx_device_info_t * /*deviceInfo*/);
#endif
struct pme_solve_work_t;
/*! \brief Master PME data structure */
-struct gmx_pme_t {
+struct gmx_pme_t { //NOLINT(clang-analyzer-optin.performance.Padding)
int ndecompdim; /* The number of decomposition dimensions */
int nodeid; /* Our nodeid in mpi->mpi_comm */
int nodeid_major;
* \param[in] nAtoms The number of particles.
* \param[in] charges The pointer to the array of particle charges.
*/
-void gmx_pme_reinit_atoms(const gmx_pme_t *pme, const int nAtoms, const real *charges);
+void gmx_pme_reinit_atoms(const gmx_pme_t *pme, int nAtoms, const real *charges);
/* A block of PME GPU functions */
/* convenience macros */
#define gmx_fio_write_string(fio, item) gmx_fio_writee_string(fio, item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_real(fio, item) gmx_fio_doe_real(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_float(fio, item) gmx_fio_doe_float(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_double(fio, item) gmx_fio_doe_double(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_gmx_bool(fio, item) gmx_fio_doe_gmx_bool(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_int(fio, item) gmx_fio_doe_int(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_int64(fio, item) gmx_fio_doe_int64(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_uchar(fio, item) gmx_fio_doe_uchar(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_ushort(fio, item) gmx_fio_doe_ushort(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_rvec(fio, item) gmx_fio_doe_rvec(fio, &item, (#item), __FILE__, __LINE__)
-#define gmx_fio_do_ivec(fio, item) gmx_fio_doe_ivec(fio, &item, (#item), __FILE__, __LINE__)
+#define gmx_fio_do_real(fio, item) gmx_fio_doe_real(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_float(fio, item) gmx_fio_doe_float(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_double(fio, item) gmx_fio_doe_double(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_gmx_bool(fio, item) gmx_fio_doe_gmx_bool(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_int(fio, item) gmx_fio_doe_int(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_int64(fio, item) gmx_fio_doe_int64(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_uchar(fio, item) gmx_fio_doe_uchar(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_ushort(fio, item) gmx_fio_doe_ushort(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_rvec(fio, item) gmx_fio_doe_rvec(fio, &(item), (#item), __FILE__, __LINE__)
+#define gmx_fio_do_ivec(fio, item) gmx_fio_doe_ivec(fio, &(item), (#item), __FILE__, __LINE__)
#define gmx_fio_do_string(fio, item) gmx_fio_doe_string(fio, item, (#item), __FILE__, __LINE__)
#include <cstring>
#include <string>
+#include <utility>
#include <vector>
#include "gromacs/utility/arrayref.h"
bObsolete_(bObsolete),
bSet_(bSet),
bHandledAsKeyValueTree_(bHandledAsKeyValueTree),
- name_(name),
- value_(value),
+ name_(std::move(name)),
+ value_(std::move(value)),
inp_count_(inp_count)
{
}
int64_t get_eint64(std::vector<t_inpfile> *inp,
const char *name, int64_t def,
- warninp_t);
+ warninp_t /*wi*/);
double get_ereal(std::vector<t_inpfile> *inp, const char *name, double def,
warninp_t wi);
* The pointers tng, x, v, f may be NULL, which triggers not writing
* (that component). box can only be NULL if x is also NULL. */
void gmx_fwrite_tng(gmx_tng_trajectory_t tng,
- const gmx_bool bUseLossyCompression,
+ gmx_bool bUseLossyCompression,
int64_t step,
real elapsedPicoSeconds,
real lambda,
* the number of all other molecules to 0. Works similar to a
* selection group. */
void gmx_tng_setup_atom_subgroup(gmx_tng_trajectory_t tng,
- const int nind,
+ int nind,
const int *ind,
const char *name);
char filemode,
t_trxstatus *in,
const char *infile,
- const int natoms,
+ int natoms,
const struct gmx_mtop_t *mtop,
const int *index,
const char *index_group_name);
#define NHISTO 360
#define NONCHI 3
-#define MAXCHI edMax-NONCHI
+#define MAXCHI (edMax-NONCHI)
#define NROT 4 /* number of rotamers: 1=g(-), 2=t, 3=g(+), 0=other */
typedef struct {
#include "gromacs/utility/basedefinitions.h"
-#define eNR_NBKERNEL_NONE -1
+#define eNR_NBKERNEL_NONE (-1)
enum
{
real &c2() { return c[2]; }
} t_param;
-typedef struct {
+typedef struct { // NOLINT (clang-analyzer-optin.performance.Padding)
int nr; /* The number of bonds in this record */
int maxnr; /* The amount of elements in the array */
t_param *param; /* Array of parameters (dim: nr or nr*nr) */
#define REAL_FUNC_TERM_WITH_RETURN(arg) ;
#define NULL_FUNC_QUALIFIER gmx_unused static
-#define NULL_FUNC_ARGUMENT(arg) /*arg*/
+#define NULL_FUNC_ARGUMENT(arg) arg gmx_unused
#define NULL_FUNC_TERM {}
#define NULL_FUNC_TERM_WITH_RETURN(arg) { return (arg); }
const rvec x[], rvec4 f[], rvec fshift[],
const struct t_pbc *pbc, const struct t_graph *g,
const real *lambda, real *dvdl, const t_mdatoms *md, const t_forcerec *fr,
- const gmx_bool computeForcesOnly, gmx_grppairener_t *grppener,
+ gmx_bool computeForcesOnly, gmx_grppairener_t *grppener,
int *global_atom_index);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2018, 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.
#define EPSILON0_SI (8.854187817e-12) /* F/m, NIST 2010 CODATA */
/* Epsilon in our MD units: (e^2 / Na (kJ nm)) == (e^2 mol/(kJ nm)) */
-#define EPSILON0 (EPSILON0_SI*NANO*KILO)/(E_CHARGE*E_CHARGE*AVOGADRO)
+#define EPSILON0 ((EPSILON0_SI*NANO*KILO)/(E_CHARGE*E_CHARGE*AVOGADRO))
#define SPEED_OF_LIGHT (2.99792458E05) /* nm/ps, NIST 2010 CODATA */
#define ATOMICMASS_keV (931494.061) /* Atomic mass in keV, NIST 2010 CODATA */
#define RYDBERG (1.0973731568539e-02) /* nm^-1, NIST 2010 CODATA */
#define ONE_4PI_EPS0 (1.0/(4.0*M_PI*EPSILON0))
-#define FACEL 10.0*ONE_4PI_EPS0
+#define FACEL (10.0*ONE_4PI_EPS0)
/* Pressure in MD units is:
* 1 bar = 1e5 Pa = 1e5 kg m^-1 s^-2 = 1e-28 kg nm^-1 ps^-2 = 1e-28 / AMU amu nm^1 ps ^2
//! Default copy assignment operator.
BasicVector &operator=(const BasicVector &v) = default;
//! Default move constructor.
- BasicVector(BasicVector &&src) = default;
+ BasicVector(BasicVector &&src) noexcept = default;
//! Default move assignment operator.
- BasicVector &operator=(BasicVector &&v) = default;
+ BasicVector &operator=(BasicVector &&v) noexcept = default;
//! Indexing operator to make the class work as the raw array.
ValueType &operator[](int i) { return x_[i]; }
//! Indexing operator to make the class work as the raw array.
/*! \brief Macro for getting the constraint iatoms for a constraint number con
* which comes from a list where F_CONSTR and F_CONSTRNC constraints
* are concatenated. */
-#define constr_iatomptr(nconstr, iatom_constr, iatom_constrnc, con) ((con) < (nconstr) ? (iatom_constr)+(con)*3 : (iatom_constrnc)+(con-nconstr)*3)
+#define constr_iatomptr(nconstr, iatom_constr, iatom_constrnc, con) ((con) < (nconstr) ? (iatom_constr)+(con)*3 : (iatom_constrnc)+((con)-(nconstr))*3)
/*! \brief Returns whether there are inter charge group constraints */
bool inter_charge_group_constraints(const gmx_mtop_t &mtop);
*/
extern void dd_make_local_group_indices(gmx_ga2la_t *ga2la,
- const int nr, int anrs[], int *nr_loc,
+ int nr, int anrs[], int *nr_loc,
int *anrs_loc[], int *nalloc_loc,
int coll_ind[]);
* the group becomes whole (optional).
*/
extern void communicate_group_positions(const t_commrec *cr, rvec *xcoll, ivec *shifts,
- ivec *extra_shifts, const gmx_bool bNS,
- const rvec *x_loc, const int nr, const int nr_loc,
+ ivec *extra_shifts, gmx_bool bNS,
+ const rvec *x_loc, int nr, int nr_loc,
const int *anrs_loc, const int *coll_ind, rvec *xcoll_old,
matrix box);
* \param[out] center The (weighted) center of the positions.
*
*/
-extern void get_center(rvec x[], real weight[], const int nr, rvec center);
+extern void get_center(rvec x[], real weight[], int nr, rvec center);
/*! \brief Calculates the sum of the positions x locally.
* \return Sum of weights.
*
*/
-extern double get_sum_of_positions(rvec x[], real weight[], const int nr, dvec dsumvec);
+extern double get_sum_of_positions(rvec x[], real weight[], int nr, dvec dsumvec);
/*! \brief Calculates the global center of all local arrays x.
* \param[in] transvec Translation vector to be added to all positions.
*
*/
-extern void translate_x(rvec x[], const int nr, const rvec transvec);
+extern void translate_x(rvec x[], int nr, const rvec transvec);
/*! \brief Rotate positions.
* \param[in] rmat Rotation matrix to operate on all positions.
*
*/
-extern void rotate_x(rvec x[], const int nr, matrix rmat);
+extern void rotate_x(rvec x[], int nr, matrix rmat);
#ifdef __cplusplus
}
struct t_filenm;
void gmx_log_open(const char *fn, const t_commrec *cr,
- gmx_bool bAppendFiles, FILE**);
+ gmx_bool bAppendFiles, FILE** /*fplog*/);
/* Open the log file, if necessary (nprocs > 1) the logfile name is
* communicated around the ring.
*/
//! Builder function.
friend std::unique_ptr<MDAtoms>
makeMDAtoms(FILE *fp, const gmx_mtop_t &mtop, const t_inputrec &ir,
- const bool rankHasPmeGpuTask);
+ bool rankHasPmeGpuTask);
};
//! Builder function for MdAtomsWrapper.
globalCommunicationInterval(-1),
reproducible(FALSE),
writeConfout(TRUE),
- continuationOptions(),
- checkpointOptions(),
numStepsCommandline(-2),
maximumHoursToRun(-1),
- timingOptions(),
tunePme(TRUE),
ntompOptionIsSet(FALSE),
- imdOptions(),
verbose(FALSE),
verboseStepPrintInterval(100)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017,2018, 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.
void
#ifndef CALC_ENERGIES
-NBK_FUNC_NAME(_F)
+NBK_FUNC_NAME(_F) // NOLINT(misc-definitions-in-headers)
#else
#ifndef ENERGY_GROUPS
-NBK_FUNC_NAME(_VF)
+NBK_FUNC_NAME(_VF) // NOLINT(misc-definitions-in-headers)
#else
-NBK_FUNC_NAME(_VgrpF)
+NBK_FUNC_NAME(_VgrpF) // NOLINT(misc-definitions-in-headers)
#endif
#endif
#undef NBK_FUNC_NAME
#endif /* LJ_CUT */
#ifdef LJ_FORCE_SWITCH
-#define v_fswitch_r(rsw, rsw2, c0, c3, c4) fma(fma(c4, rsw, c3), (rsw2 * rsw), c0)
+#define v_fswitch_r(rsw, rsw2, c0, c3, c4) fma(fma((c4), (rsw), (c3)), ((rsw2) * (rsw)), (c0))
SimdReal VLJ6_S0 = c6_S0 * fma(sixth_S, rinvsix_S0, v_fswitch_r(rsw_S0, rsw2_S0, p6_6cpot_S, p6_vc3_S, p6_vc4_S));
SimdReal VLJ6_S1 = c6_S1 * fma(sixth_S, rinvsix_S1, v_fswitch_r(rsw_S1, rsw2_S1, p6_6cpot_S, p6_vc3_S, p6_vc4_S));
SimdReal sw_S3, dsw_S3;
#endif
-#define switch_r(rsw, rsw2, c3, c4, c5) fma(fma(fma(c5, rsw, c4), rsw, c3), (rsw2 * rsw), one_S)
-#define dswitch_r(rsw, rsw2, c2, c3, c4) (fma(fma(c4, rsw, c3), rsw, c2) * rsw2)
+#define switch_r(rsw, rsw2, c3, c4, c5) fma(fma(fma(c5, rsw, c4), rsw, c3), ((rsw2) * (rsw)), one_S)
+#define dswitch_r(rsw, rsw2, c2, c3, c4) (fma(fma(c4, rsw, c3), rsw, c2) * (rsw2))
sw_S0 = switch_r(rsw_S0, rsw2_S0, swV3_S, swV4_S, swV5_S);
dsw_S0 = dswitch_r(rsw_S0, rsw2_S0, swF2_S, swF3_S, swF4_S);
ljcrGEOM, ljcrLB, ljcrNONE, ljcrNR
};
-typedef struct nbnxn_atomdata_t {
+typedef struct nbnxn_atomdata_t { //NOLINT(clang-analyzer-optin.performance.Padding)
nbnxn_alloc_t *alloc;
nbnxn_free_t *free;
int ntype; /* The number of different atom types */
* for the number of equally sized lists is below min_ci_balanced.
* With perturbed particles, also a group scheme style nbl_fep list is made.
*/
-void nbnxn_make_pairlist(const nbnxn_search_t nbs,
+void nbnxn_make_pairlist(nbnxn_search_t nbs,
nbnxn_atomdata_t *nbat,
const t_blocka *excl,
real rlist,
void handleRestart(t_commrec *cr,
const gmx_multisim_t *ms,
gmx_bool bTryToAppendFiles,
- const int NFILE,
+ int NFILE,
t_filenm fnm[],
bool *bDoAppendFiles,
bool *bStartFromCpt);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
struct CorrelationGridHistory
{
/* These counts here since we curently need them for initializing the correlation grid when reading a checkpoint */
- int numCorrelationTensors; /**< Number correlation tensors in the grid (equal to the number of points). */
- int tensorSize; /**< The number of stored correlation matrix elements. */
- int blockDataListSize; /**< To be able to increase the block length later on, data is saved for several block lengths for each element. */
+ int numCorrelationTensors = 0; /**< Number correlation tensors in the grid (equal to the number of points). */
+ int tensorSize = 0; /**< The number of stored correlation matrix elements. */
+ int blockDataListSize = 0; /**< To be able to increase the block length later on, data is saved for several block lengths for each element. */
/* We store all tensor sequentially in a buffer */
std::vector<CorrelationBlockDataHistory> blockDataBuffer; /**< Buffer that contains the correlation data. */
AwhBiasStateHistory state; /**< The global state of the AWH bias. */
CorrelationGridHistory forceCorrelationGrid; /**< History for force correlation statistics. */
-
- /*! \brief Constructor. */
- AwhBiasHistory() : pointState(),
- state(),
- forceCorrelationGrid()
- {
- }
};
//! A collection of AWH bias history data. */
double potentialOffset; /**< The offset of the bias potential due to bias updates. */
/*! \brief Constructor. */
- AwhHistory() : bias(),
- potentialOffset(0)
+ AwhHistory() :
+ potentialOffset(0)
{
}
};
gmx_bool start_lambda_set;
//! Constructor
- delta_h_history_t() : dh(),
- start_time(0),
- start_lambda(0),
- start_lambda_set(false)
+ delta_h_history_t() :
+ start_time(0),
+ start_lambda(0),
+ start_lambda_set(false)
{
}
};
//! Constructor
energyhistory_t() : nsteps(0),
nsum(0),
- ener_ave(),
- ener_sum(),
+
nsteps_sim(0),
nsum_sim(0),
ener_sum_sim(0)
struct ewald_corr_thread_t;
-struct t_forcerec {
+struct t_forcerec { // NOLINT (clang-analyzer-optin.performance.Padding)
struct interaction_const_t *ic;
/* PBC stuff */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018, 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.
t_cos_acc cosacc; /* Cosine acceleration data */
} gmx_ekindata_t;
-#define GID(igid, jgid, gnr) ((igid < jgid) ? (igid*gnr+jgid) : (jgid*gnr+igid))
+#define GID(igid, jgid, gnr) (((igid) < (jgid)) ? ((igid)*(gnr)+(jgid)) : ((jgid)*(gnr)+(igid)))
#endif
gmx_swapcoords_t si_priv;
};
-struct t_inputrec
+struct t_inputrec // NOLINT (clang-analyzer-optin.performance.Padding)
{
t_inputrec();
explicit t_inputrec(const t_inputrec &) = delete;
template <size_t count>
MyClass &enumValue(const char *const (&values)[count])
{
- GMX_ASSERT(enumValues_ == NULL,
+ GMX_ASSERT(enumValues_ == nullptr,
"Multiple sets of enumerated values specified");
enumValues_ = values;
enumValuesCount_ = count;
*/
MyClass &enumValueFromNullTerminatedArray(const char *const *values)
{
- GMX_ASSERT(enumValues_ == NULL,
+ GMX_ASSERT(enumValues_ == nullptr,
"Multiple sets of enumerated values specified");
enumValues_ = values;
enumValuesCount_ = -1;
template <size_t count>
EnumOption &enumValue(const char *const (&values)[count])
{
- GMX_ASSERT(enumValues_ == NULL,
+ GMX_ASSERT(enumValues_ == nullptr,
"Multiple sets of enumerated values specified");
enumValues_ = values;
enumValuesCount_ = count;
*/
EnumOption &enumValueFromNullTerminatedArray(const char *const *values)
{
- GMX_ASSERT(enumValues_ == NULL,
+ GMX_ASSERT(enumValues_ == nullptr,
"Multiple sets of enumerated values specified");
enumValues_ = values;
enumValuesCount_ = -1;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017,2018, 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.
{
const_cast<MyBase *>(this)->ensureConverterInitialized();
std::vector<Variant> result;
+ result.reserve(values.size());
for (const auto &value : values)
{
result.push_back(normalizeValue(converter_.convert(value)));
template <typename T>
std::unique_ptr<IOptionValueStore<T> > OptionStorageTemplate<T>::createStore(
- ValueList *storeVector, T *store, int *storeCount, int initialCount)
+ ValueList *storeVector, T *store,
+ int *storeCount, // NOLINT(readability-non-const-parameter) passed non-const to OptionValueStorePlain
+ int initialCount)
{
if (storeVector != nullptr)
{
if (result.empty() || (result.size() == 1 && result[0].empty()))
{
result.clear();
- if (defaultValueIfSet_.get() != nullptr)
+ if (defaultValueIfSet_ != nullptr)
{
result.push_back(formatSingleValue(*defaultValueIfSet_));
}
void OptionStorageTemplate<T>::processSet()
{
processSetValues(&setValues_);
- if (setValues_.empty() && defaultValueIfSet_.get() != nullptr)
+ if (setValues_.empty() && defaultValueIfSet_ != nullptr)
{
addValue(*defaultValueIfSet_);
setFlag(efOption_HasDefaultValue);
setValues_.push_back(value);
}
-
template <typename T>
void OptionStorageTemplate<T>::commitValues()
{
store_->clear();
}
store_->reserve(setValues_.size());
- for (T value : setValues_)
+ // For bool the loop variable isn't a reference (it's its special reference type)
+ CLANG_DIAGNOSTIC_IGNORE(-Wrange-loop-analysis)
+ for (const auto &value : setValues_)
{
store_->append(value);
}
+ DIAGNOSTIC_RESET;
clearSet();
}
-
template <typename T>
void OptionStorageTemplate<T>::setDefaultValue(const T &value)
{
rvec tric_vec[MAX_NTRICVEC];
} t_pbc;
-#define TRICLINIC(box) (box[YY][XX] != 0 || box[ZZ][XX] != 0 || box[ZZ][YY] != 0)
+#define TRICLINIC(box) ((box)[YY][XX] != 0 || (box)[ZZ][XX] != 0 || (box)[ZZ][YY] != 0)
#define NTRICIMG 14
#define NCUCVERT 24
// the table in all files using it, unless the user has requested a different
// precision or resolution.
template<>
-const std::array<real, 1<<c_TabulatedNormalDistributionDefaultBits>
-TabulatedNormalDistribution<real, c_TabulatedNormalDistributionDefaultBits>::c_table_ =
- TabulatedNormalDistribution<real, c_TabulatedNormalDistributionDefaultBits>::makeTable();
+const std::array<real, 1<<detail::c_TabulatedNormalDistributionDefaultBits>
+TabulatedNormalDistribution<>::c_table_ = TabulatedNormalDistribution<>::makeTable();
#else
// Avoid compiler warnings about no public symbols
void TabulatedNormalDistributionDummy(){}
namespace gmx
{
-namespace
+namespace detail
{
//! Number of bits that determines the resolution of the lookup table for the normal distribution.
-const int c_TabulatedNormalDistributionDefaultBits = 14;
+constexpr int c_TabulatedNormalDistributionDefaultBits = 14;
}
* return arbitrarily small/large values, but with e.g. 14 bits
* the results are limited to roughly +/- 4 standard deviations.
*/
-template<class RealType = real, unsigned int tableBits = c_TabulatedNormalDistributionDefaultBits>
+template<class RealType = real, unsigned int tableBits = detail::c_TabulatedNormalDistributionDefaultBits>
class TabulatedNormalDistribution
{
static_assert(tableBits <= 24, "Normal distribution table is limited to 24bits (64MB in single precision)");
#if !defined(_MSC_VER) && !defined(DOXYGEN)
// Declaration of template specialization
template<>
-const std::array<real, 1<<c_TabulatedNormalDistributionDefaultBits> TabulatedNormalDistribution<real, c_TabulatedNormalDistributionDefaultBits>::c_table_;
+const std::array<real, 1<<detail::c_TabulatedNormalDistributionDefaultBits> TabulatedNormalDistribution<>::c_table_;
extern template
-const std::array<real, 1<<c_TabulatedNormalDistributionDefaultBits> TabulatedNormalDistribution<real, c_TabulatedNormalDistributionDefaultBits>::c_table_;
+const std::array<real, 1<<detail::c_TabulatedNormalDistributionDefaultBits> TabulatedNormalDistribution<>::c_table_;
#endif
// Instantiation for all tables without specialization
{
GMX_THROW(InternalError("Random engine stream ran out of internal counter space."));
}
- return;
}
/*! \brief Increment the internal counter in highBits by a value.
{
GMX_THROW(InternalError("Random engine stream ran out of internal counter space."));
}
- return;
}
};
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2018, 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.
#include <memory>
#include <string>
+#include "gromacs/compat/make_unique.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/gmxassert.h"
//! Allocates and initializes an empty value list.
static SelectionParserValueListPointer createList()
{
- return SelectionParserValueListPointer(new SelectionParserValueList);
+ return compat::make_unique<SelectionParserValueList>();
}
/*! \brief
* Allocates and initializes a value list with a single value.
public:
// Default move constructor and assignment. Only needed for old compilers.
//! \cond
- SelectionParserParameter(SelectionParserParameter &&o)
- : name_(std::move(o.name_)), location_(std::move(o.location_)),
+ SelectionParserParameter(SelectionParserParameter &&o) noexcept
+ : name_(std::move(o.name_)), location_(o.location_),
values_(std::move(o.values_))
{
}
- SelectionParserParameter &operator=(SelectionParserParameter &&o)
+ SelectionParserParameter &operator=(SelectionParserParameter &&o) noexcept
{
name_ = std::move(o.name_);
- location_ = std::move(o.location_);
+ location_ = o.location_;
values_ = std::move(o.values_);
return *this;
}
//! Allocates and initializes an empty parameter list.
static SelectionParserParameterListPointer createList()
{
- return SelectionParserParameterListPointer(
- new SelectionParserParameterList);
+ return compat::make_unique<SelectionParserParameterList>();
}
/*! \brief
* Allocates and initializes a parsed method parameter.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2014,2015,2016,2018, 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.
* we cannot have them here as parameter names... */
/** Internal function for cases where several tokens need to be returned. */
int
-_gmx_sel_lexer_process_pending(YYSTYPE *, YYLTYPE *, gmx_sel_lexer_t *state);
+_gmx_sel_lexer_process_pending(YYSTYPE * /*yylval*/, YYLTYPE *, gmx_sel_lexer_t *state);
/** Internal function that processes identifier tokens. */
int
- _gmx_sel_lexer_process_identifier(YYSTYPE *, YYLTYPE *, char *, size_t,
+ _gmx_sel_lexer_process_identifier(YYSTYPE * /*yylval*/, YYLTYPE *, char * /*yytext*/, size_t /*yyleng*/,
gmx_sel_lexer_t *state);
/** Internal function to add a token to the pretty-printed selection text. */
void
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, 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.
private:
internal::SelectionData &data()
{
- GMX_ASSERT(sel_ != NULL,
+ GMX_ASSERT(sel_ != nullptr,
"Attempted to access uninitialized selection");
return *sel_;
}
const internal::SelectionData &data() const
{
- GMX_ASSERT(sel_ != NULL,
+ GMX_ASSERT(sel_ != nullptr,
"Attempted to access uninitialized selection");
return *sel_;
}
*/
const rvec &v() const
{
- GMX_ASSERT(sel_->rawPositions_.v != NULL,
+ GMX_ASSERT(sel_->rawPositions_.v != nullptr,
"Velocities accessed, but unavailable");
return sel_->rawPositions_.v[i_];
}
*/
const rvec &f() const
{
- GMX_ASSERT(sel_->rawPositions_.f != NULL,
+ GMX_ASSERT(sel_->rawPositions_.f != nullptr,
"Velocities accessed, but unavailable");
return sel_->rawPositions_.f[i_];
}
gmx_ana_selmethod_t *method;
} t_register_method;
-/** Array of selection methods defined in the library. */
-static const t_register_method smtable_def[] = {
- {nullptr, &sm_cog},
- {nullptr, &sm_com},
-
- {nullptr, &sm_all},
- {nullptr, &sm_none},
- {nullptr, &sm_atomnr},
- {nullptr, &sm_resnr},
- {"resid", &sm_resnr},
- {nullptr, &sm_resindex},
- {"residue", &sm_resindex},
- {nullptr, &sm_molindex},
- {"mol", &sm_molindex},
- {"molecule", &sm_molindex},
- {nullptr, &sm_atomname},
- {"name", &sm_atomname},
- {nullptr, &sm_pdbatomname},
- {"pdbname", &sm_pdbatomname},
- {nullptr, &sm_atomtype},
- {"type", &sm_atomtype},
- {nullptr, &sm_resname},
- {nullptr, &sm_insertcode},
- {nullptr, &sm_chain},
- {nullptr, &sm_mass},
- {nullptr, &sm_charge},
- {nullptr, &sm_altloc},
- {nullptr, &sm_occupancy},
- {nullptr, &sm_betafactor},
- {"beta", &sm_betafactor},
- {nullptr, &sm_x},
- {nullptr, &sm_y},
- {nullptr, &sm_z},
-
- {nullptr, &sm_distance},
- {"dist", &sm_distance},
- {nullptr, &sm_mindistance},
- {"mindist", &sm_mindistance},
- {nullptr, &sm_within},
- {nullptr, &sm_insolidangle},
- {nullptr, &sm_same},
-
- {nullptr, &sm_merge},
- {nullptr, &sm_plus},
- {nullptr, &sm_permute},
-};
-
/*! \brief
* Convenience function for reporting errors found in selection methods.
*/
int
gmx_ana_selmethod_register_defaults(gmx::SelectionParserSymbolTable *symtab)
{
- size_t i;
- int rc;
- bool bOk;
+ /* Array of selection methods defined in the library. */
+ const t_register_method smtable_def[] = {
+ {nullptr, &sm_cog},
+ {nullptr, &sm_com},
+
+ {nullptr, &sm_all},
+ {nullptr, &sm_none},
+ {nullptr, &sm_atomnr},
+ {nullptr, &sm_resnr},
+ {"resid", &sm_resnr},
+ {nullptr, &sm_resindex},
+ {"residue", &sm_resindex},
+ {nullptr, &sm_molindex},
+ {"mol", &sm_molindex},
+ {"molecule", &sm_molindex},
+ {nullptr, &sm_atomname},
+ {"name", &sm_atomname},
+ {nullptr, &sm_pdbatomname},
+ {"pdbname", &sm_pdbatomname},
+ {nullptr, &sm_atomtype},
+ {"type", &sm_atomtype},
+ {nullptr, &sm_resname},
+ {nullptr, &sm_insertcode},
+ {nullptr, &sm_chain},
+ {nullptr, &sm_mass},
+ {nullptr, &sm_charge},
+ {nullptr, &sm_altloc},
+ {nullptr, &sm_occupancy},
+ {nullptr, &sm_betafactor},
+ {"beta", &sm_betafactor},
+ {nullptr, &sm_x},
+ {nullptr, &sm_y},
+ {nullptr, &sm_z},
+
+ {nullptr, &sm_distance},
+ {"dist", &sm_distance},
+ {nullptr, &sm_mindistance},
+ {"mindist", &sm_mindistance},
+ {nullptr, &sm_within},
+ {nullptr, &sm_insolidangle},
+ {nullptr, &sm_same},
+
+ {nullptr, &sm_merge},
+ {nullptr, &sm_plus},
+ {nullptr, &sm_permute},
+ };
+
+ size_t i;
+ int rc;
+ bool bOk;
bOk = true;
for (i = 0; i < asize(smtable_def); ++i)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018, 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.
static inline SimdDouble gmx_simdcall
-simdLoad(const double *m, SimdDoubleTag = {})
+simdLoad(const double *m, SimdDoubleTag /*unused*/ = {})
{
assert(std::size_t(m) % 32 == 0);
return {
}
static inline SimdDouble gmx_simdcall
-simdLoadU(const double *m, SimdDoubleTag = {})
+simdLoadU(const double *m, SimdDoubleTag /*unused*/ = {})
{
return {
_mm256_loadu_pd(m)
}
static inline SimdDInt32 gmx_simdcall
-simdLoad(const std::int32_t * m, SimdDInt32Tag)
+simdLoad(const std::int32_t * m, SimdDInt32Tag /*unused*/)
{
assert(std::size_t(m) % 16 == 0);
return {
}
static inline SimdDInt32 gmx_simdcall
-simdLoadU(const std::int32_t *m, SimdDInt32Tag)
+simdLoadU(const std::int32_t *m, SimdDInt32Tag /*unused*/)
{
return {
_mm_loadu_si128(reinterpret_cast<const __m128i *>(m))
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018, 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.
};
static inline SimdFloat gmx_simdcall
-simdLoad(const float *m, SimdFloatTag = {})
+simdLoad(const float *m, SimdFloatTag /*unused*/ = {})
{
assert(std::size_t(m) % 32 == 0);
return {
}
static inline SimdFloat gmx_simdcall
-simdLoadU(const float *m, SimdFloatTag = {})
+simdLoadU(const float *m, SimdFloatTag /*unused*/ = {})
{
return {
_mm256_loadu_ps(m)
}
static inline SimdFInt32 gmx_simdcall
-simdLoad(const std::int32_t * m, SimdFInt32Tag)
+simdLoad(const std::int32_t * m, SimdFInt32Tag /*unused*/)
{
assert(std::size_t(m) % 32 == 0);
return {
}
static inline SimdFInt32 gmx_simdcall
-simdLoadU(const std::int32_t *m, SimdFInt32Tag)
+simdLoadU(const std::int32_t *m, SimdFInt32Tag /*unused*/)
{
return {
_mm256_loadu_si256(reinterpret_cast<const __m256i *>(m))
return load<Simd4NDouble>(f);
}
static inline Simd4NDouble gmx_simdcall
-loadU4NOffset(const double* f, int)
+loadU4NOffset(const double* f, int /*unused*/)
{
return loadU<Simd4NDouble>(f);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, 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.
//! \brief Conversion method that will execute load
operator non_const_T() const { return load<non_const_T>(m_); }
//! \brief Assignment operator that will execute store
- SimdReference operator=(T o)
+ SimdReference operator=(T o) // NOLINT(misc-unconventional-assign-operator,cppcoreguidelines-c-copy-assignment-signature)
{
store(m_, o);
return *this;
"Size of ArrayRef needs to be divisible by type size");
}
//! \copydoc ArrayRef::ArrayRef(const EmptyArrayRef&)
- SimdArrayRef(const EmptyArrayRef &) : begin_(nullptr), end_(nullptr) {}
+ SimdArrayRef(const EmptyArrayRef & /*unused*/) : begin_(nullptr), end_(nullptr) {}
//! \copydoc ArrayRef::ArrayRef(U)
template<typename U,
typename = typename std::enable_if<
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
std::size_t numTables,
std::size_t thisTableIndex)
{
- if (multiplexedOutputData->size() == 0)
+ if (multiplexedOutputData->empty())
{
multiplexedOutputData->resize( inputData.size() * numTables );
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, 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.
*
* \throws std::bad_alloc If out of memory
* InconsistentInputError If the user requirements are inconsistent. */
-bool decideWhetherToUseGpusForNonbondedWithThreadMpi(const TaskTarget nonbondedTarget,
+bool decideWhetherToUseGpusForNonbondedWithThreadMpi(TaskTarget nonbondedTarget,
const std::vector<int> &gpuIdsToUse,
const std::vector<int> &userGpuTaskAssignment,
- const EmulateGpuNonbonded emulateGpuNonbonded,
- const bool usingVerletScheme,
- const bool nonbondedOnGpuIsUseful,
- const int numRanksPerSimulation);
+ EmulateGpuNonbonded emulateGpuNonbonded,
+ bool usingVerletScheme,
+ bool nonbondedOnGpuIsUseful,
+ int numRanksPerSimulation);
/*! \brief Decide whether this thread-MPI simulation will run
* PME tasks on GPUs.
*
* \throws std::bad_alloc If out of memory
* InconsistentInputError If the user requirements are inconsistent. */
-bool decideWhetherToUseGpusForPmeWithThreadMpi(const bool useGpuForNonbonded,
- const TaskTarget pmeTarget,
+bool decideWhetherToUseGpusForPmeWithThreadMpi(bool useGpuForNonbonded,
+ TaskTarget pmeTarget,
const std::vector<int> &gpuIdsToUse,
const std::vector<int> &userGpuTaskAssignment,
- const bool canUseGpuForPme,
- const int numRanksPerSimulation,
- const int numPmeRanksPerSimulation);
+ bool canUseGpuForPme,
+ int numRanksPerSimulation,
+ int numPmeRanksPerSimulation);
/*! \brief Decide whether the simulation will try to run nonbonded
* tasks on GPUs.
*
* \throws std::bad_alloc If out of memory
* InconsistentInputError If the user requirements are inconsistent. */
-bool decideWhetherToUseGpusForNonbonded(const TaskTarget nonbondedTarget,
+bool decideWhetherToUseGpusForNonbonded(TaskTarget nonbondedTarget,
const std::vector<int> &userGpuTaskAssignment,
- const EmulateGpuNonbonded emulateGpuNonbonded,
- const bool usingVerletScheme,
- const bool nonbondedOnGpuIsUseful,
- const bool gpusWereDetected);
+ EmulateGpuNonbonded emulateGpuNonbonded,
+ bool usingVerletScheme,
+ bool nonbondedOnGpuIsUseful,
+ bool gpusWereDetected);
/*! \brief Decide whether the simulation will try to run tasks of
* different types on GPUs.
*
* \throws std::bad_alloc If out of memory
* InconsistentInputError If the user requirements are inconsistent. */
-bool decideWhetherToUseGpusForPme(const bool useGpuForNonbonded,
- const TaskTarget pmeTarget,
+bool decideWhetherToUseGpusForPme(bool useGpuForNonbonded,
+ TaskTarget pmeTarget,
const std::vector<int> &userGpuTaskAssignment,
- const bool canUseGpuForPme,
- const int numRanksPerSimulation,
- const int numPmeRanksPerSimulation,
- const bool gpusWereDetected);
+ bool canUseGpuForPme,
+ int numRanksPerSimulation,
+ int numPmeRanksPerSimulation,
+ bool gpusWereDetected);
}
typedef struct gmx_wallcycle *gmx_wallcycle_t;
struct t_commrec;
-const gmx_wallcycle_t nullWallcycle = nullptr;
+static constexpr gmx_wallcycle* nullWallcycle = nullptr;
enum {
ewcRUN, ewcSTEP, ewcPPDURINGPME, ewcDOMDEC, ewcDDCOMMLOAD,
F_NRE /* This number is for the total number of energies */
};
-#define IS_RESTRAINT_TYPE(ifunc) (((ifunc == F_POSRES) || (ifunc == F_FBPOSRES) || (ifunc == F_DISRES) || (ifunc == F_RESTRBONDS) || (ifunc == F_DISRESVIOL) || (ifunc == F_ORIRES) || (ifunc == F_ORIRESDEV) || (ifunc == F_ANGRES) || (ifunc == F_ANGRESZ) || (ifunc == F_DIHRES)))
+#define IS_RESTRAINT_TYPE(ifunc) ((((ifunc) == F_POSRES) || ((ifunc) == F_FBPOSRES) || ((ifunc) == F_DISRES) || ((ifunc) == F_RESTRBONDS) || ((ifunc) == F_DISRESVIOL) || ((ifunc) == F_ORIRES) || ((ifunc) == F_ORIRESDEV) || ((ifunc) == F_ANGRES) || ((ifunc) == F_ANGRESZ) || ((ifunc) == F_DIHRES)))
typedef union t_iparams
{
* it not assigned to any node by the domain decompostion, the simulation
* still continue, if mdrun has been told so.
*/
-typedef struct
+typedef struct // NOLINT (clang-analyzer-optin.performance.Padding)
{
const char *name; /* the name of this function */
const char *longname; /* The name for printing etc. */
* TODO: Find a solution for ensuring that the derived data is in sync
* with the primary data, possibly by converting to a class.
*/
-struct gmx_mtop_t
+struct gmx_mtop_t //NOLINT(clang-analyzer-optin.performance.Padding)
{
/* Constructor */
gmx_mtop_t();
using MapConstIterator = MapType::const_iterator;
//! Constructor
EnergyFrame(const t_enxframe &enxframe,
- const std::map<std::string, int> indicesOfEnergyFields);
+ std::map<std::string, int> indicesOfEnergyFields);
/*! \brief Return string that helps users identify this frame, containing time and step number.
*
* \throws std::bad_alloc when out of memory */
struct t_atoms;
-typedef struct t_trxframe
+typedef struct t_trxframe // NOLINT (clang-analyzer-optin.performance.Padding)
{
int not_ok; /* integrity flags */
gmx_bool bDouble; /* Double precision? */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, 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.
* it in debug mode, presumably to implement some checks.
*/
template <class U>
- explicit Allocator(const Allocator<U, AllocationPolicy> &) {}
+ explicit Allocator(const Allocator<U, AllocationPolicy> & /*unused*/) {}
/*! \brief Constructor
*
*/
template<class T2>
bool
- operator==(const Allocator<T2, AllocationPolicy> &) const { return std::is_same<T, T2>::value; }
+ operator==(const Allocator<T2, AllocationPolicy> & /*unused*/) const { return std::is_same<T, T2>::value; }
/*! \brief Return true if two allocators are different
*
* used to initialize any ArrayRef, without specifying the template
* type. It is not explicit to enable that usage.
*/
- ArrayRef(const EmptyArrayRef &) : begin_(nullptr), end_(nullptr) {}
+ ArrayRef(const EmptyArrayRef & /*unused*/) : begin_(nullptr), end_(nullptr) {}
/*! \brief
* Constructs a reference to a container or reference
*
* \ingroup module_utility
*/
template <typename T, int N>
-constexpr int asize(T(&)[N])
+constexpr int asize(T(&/*unused*/)[N])
{
static_assert(N >= 0, "Do negative size arrays exist?");
return N;
*/
#define GMX_UNUSED_VALUE(value) (void)value
+#ifdef __clang__
+#define DO_PRAGMA(x) _Pragma (#x)
+#define CLANG_DIAGNOSTIC_IGNORE(warning) _Pragma("clang diagnostic push") \
+ DO_PRAGMA(clang diagnostic ignored #warning)
+#define DIAGNOSTIC_RESET _Pragma("clang diagnostic pop")
+#else
+//! Ignore specified clang warning until DIAGNOSTIC_RESET
+#define CLANG_DIAGNOSTIC_IGNORE(warning)
+//! Reset all diagnostics to default
+#define DIAGNOSTIC_RESET
+#endif
+
#ifdef __cplusplus
namespace gmx
{
* \ingroup module_utility
*/
template <typename T>
-static inline void ignoreValueHelper(const T &)
+static inline void ignoreValueHelper(const T & /*unused*/)
{
}
//! \endcond
#else
#define GMX_DEFAULT_CONSTRUCTORS(ClassName) \
ClassName() = default; \
- ClassName &operator=(const ClassName &) = default; \
+ ClassName &operator=(const ClassName &) = default; /* NOLINT(misc-macro-parentheses) */ \
ClassName(const ClassName &) = default; \
- ClassName &operator=(ClassName &&) = default; \
- ClassName(ClassName &&) = default
+ ClassName &operator=(ClassName &&) = default; /* NOLINT(misc-macro-parentheses) */ \
+ ClassName(ClassName &&) = default /* NOLINT(misc-macro-parentheses) */
#endif
/*! \brief
* For command line programs, gmx::CommandLineModuleManager takes care
* of this if the user requests debugging.
*/
-void gmx_init_debug(const int dbglevel, const char *dbgfile);
+void gmx_init_debug(int dbglevel, const char *dbgfile);
/** Returns TRUE when the program was started in debug mode */
gmx_bool bDebugMode(void);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
}
}
//! Assigns a deep copy of an object.
- KeyValueTreeObject &operator=(KeyValueTreeObject &other)
+ KeyValueTreeObject &operator=(const KeyValueTreeObject &other)
{
KeyValueTreeObject tmp(other);
std::swap(tmp.valueMap_, valueMap_);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
* technique for implementing macros that allow streming information to
* them (see, e.g., Google Test).
*/
- void operator=(const LogEntryWriter &entryWriter)
+ LogWriteHelper &operator=(const LogEntryWriter &entryWriter)
{
target_->writeEntry(entryWriter.entry_);
+ return *this;
}
private:
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018, 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.
struct no_delete
{
//! Deleter that does nothing.
- void operator()(T *) {}
+ void operator()(T * /*unused*/) {}
};
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
* method avoids copying when move-construction is possible.
*/
template <typename T>
- static Variant create(T &&value) { return Variant(std::move(value)); }
+ static Variant create(T &&value) { return Variant(std::forward<T>(value)); }
//! Creates an empty variant value.
Variant() {}
*
* \throws std::bad_alloc if out of memory.
*/
- template <typename T>
- explicit Variant(const T &value)
- : content_(new Content<typename std::decay<T>::type>(value))
- {
- }
- /*! \brief
- * Creates a variant that holds the given value.
- *
- * \throws std::bad_alloc if out of memory.
- */
- template <typename T>
+ template <typename T, typename = typename std::enable_if<!std::is_same<T, Variant>::value>::type>
explicit Variant(T &&value)
- : content_(new Content<typename std::decay<T>::type>(std::move(value)))
+ : content_(new Content<typename std::decay<T>::type>(std::forward<T>(value)))
{
}
/*! \brief