#include "gmxpre.h"
+#include <algorithm>
#include <assert.h>
#include "gromacs/legacyheaders/constr.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
typedef struct {
void dd_clear_local_vsite_indices(gmx_domdec_t *dd)
{
- int i;
-
if (dd->vsite_comm)
{
gmx_hash_clear_and_optimize(dd->ga2la_vsite);
int nsend[2], nlast, nsend_zero[2] = {0, 0}, *nsend_ptr;
int d, dim, ndir, dir, nr, ns, i, nrecv_local, n0, start, indr, ind, buf[2];
int nat_tot_specat, nat_tot_prev, nalloc_old;
- gmx_bool bPBC, bFirst;
+ gmx_bool bPBC;
gmx_specatsend_t *spas;
if (debug)
nrecv_local = 0;
for (d = 0; d < dd->ndim; d++)
{
- bFirst = (d == 0);
/* Pulse the grid forward and backward */
if (dd->dim[d] >= dd->npbcdim || dd->nc[dd->dim[d]] > 2)
{
int at_end, i, j;
t_iatom *iap;
+ // This code should not be called unless this condition is true,
+ // because that's the only time init_domdec_constraints is
+ // called...
+ GMX_RELEASE_ASSERT(dd->bInterCGcons || dd->bInterCGsettles, "dd_make_local_constraints called when there are no local constraints");
+ // ... and init_domdec_constraints always sets
+ // dd->constraint_comm...
+ GMX_RELEASE_ASSERT(dd->constraint_comm, "Invalid use of dd_make_local_constraints before construction of constraint_comm");
+ // ... which static analysis needs to be reassured about, because
+ // otherwise, when dd->bInterCGsettles is
+ // true. dd->constraint_comm is unilaterally dereferenced before
+ // the call to atoms_to_settles.
+
dc = dd->constraints;
ilc_local = &il_local[F_CONSTR];
}
else
{
+ // Currently unreachable
at2con_mt = NULL;
ireq = NULL;
}
}
else
{
+ // Currently unreachable
at_end = at_start;
}
gmx_domdec_specat_comm_t *spac;
ind_req_t *ireq;
gmx_hash_t ga2la_specat;
- int ftype, nral, i, j, gat, a;
+ int ftype, nral, i, j, a;
t_ilist *lilf;
t_iatom *iatoms;
int at_end;
{
gmx_domdec_constraints_t *dc;
gmx_molblock_t *molb;
- int mb, ncon, c, a;
+ int mb, ncon, c;
if (debug)
{
/* Use a hash table for the global to local index.
* The number of keys is a rough estimate, it will be optimized later.
*/
- dc->ga2la = gmx_hash_init(min(mtop->natoms/20,
- mtop->natoms/(2*dd->nnodes)));
+ dc->ga2la = gmx_hash_init(std::min(mtop->natoms/20,
+ mtop->natoms/(2*dd->nnodes)));
dc->nthread = gmx_omp_nthreads_get(emntDomdec);
snew(dc->ils, dc->nthread);
void init_domdec_vsites(gmx_domdec_t *dd, int n_intercg_vsite)
{
- int i;
- gmx_domdec_constraints_t *dc;
-
if (debug)
{
fprintf(debug, "Begin init_domdec_vsites\n");
/* Use a hash table for the global to local index.
* The number of keys is a rough estimate, it will be optimized later.
*/
- dd->ga2la_vsite = gmx_hash_init(min(n_intercg_vsite/20,
- n_intercg_vsite/(2*dd->nnodes)));
+ dd->ga2la_vsite = gmx_hash_init(std::min(n_intercg_vsite/20,
+ n_intercg_vsite/(2*dd->nnodes)));
dd->vsite_comm = specat_comm_init(1);
}