/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2017,2019, 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.
GMX_RELEASE_ASSERT(!isAllocated(),
"Cannot change row count after data has been allocated");
GMX_RELEASE_ASSERT(bUniformX_ || xvalue_.empty()
- || rowCount == static_cast<int>(xvalue_.size()),
+ || rowCount == ssize(xvalue_),
"X axis set with setXAxisValue() does not match the row count");
xvalue_.resize(rowCount);
if (bUniformX_ && rowCount > rowCount_)
{
GMX_RELEASE_ASSERT(row >= 0 && row < rowCount(), "Row index out of range");
}
- else if (row >= static_cast<int>(xvalue_.size()))
+ else if (row >= ssize(xvalue_))
{
xvalue_.resize(row + 1);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2017,2019, 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.
GMX_ASSERT(columnCount >= 0, "Invalid column count");
GMX_ASSERT(pointSets_.size() == 1U,
"Subsets of frames only supported with simple data");
- GMX_ASSERT(firstColumn + columnCount <= static_cast<int>(values_.size()),
+ GMX_ASSERT(firstColumn + columnCount <= ssize(values_),
"Invalid last column");
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2017,2019, 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.
GMX_ASSERT(isValid(), "Invalid data frame accessed");
GMX_ASSERT(pointSets_.size() == 1U && pointSets_[0].firstColumn() == 0,
"Convenience method not available for multiple point sets");
- GMX_ASSERT(i >= 0 && i < static_cast<int>(values_.size()),
+ GMX_ASSERT(i >= 0 && i < ssize(values_),
"Out of range data access");
return values_[i];
}
status_ = eFinished;
if (!bMultipoint)
{
- GMX_RELEASE_ASSERT(static_cast<int>(pointSets_.size()) == baseData().dataSetCount(),
+ GMX_RELEASE_ASSERT(ssize(pointSets_) == baseData().dataSetCount(),
"Point sets created for non-multipoint data");
values_ = builder_->values_;
builder_->clearValues();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017,2019, 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.
//! Accesses a single value in the data set.
ValueType &value(int column)
{
- GMX_ASSERT(column >= 0 && column < static_cast<int>(values_.size()),
+ GMX_ASSERT(column >= 0 && column < ssize(values_),
"Invalid column index");
return values_[column];
}
{
GMX_RELEASE_ASSERT(!isInitialized(),
"Cannot change value count after init()");
- GMX_RELEASE_ASSERT(dataSet >= 0 && dataSet < static_cast<int>(dataSetColumns_.size()) - 1,
+ GMX_RELEASE_ASSERT(dataSet >= 0 && dataSet < ssize(dataSetColumns_) - 1,
"Invalid data set index");
GMX_RELEASE_ASSERT(columnCount >= 0,
"Invalid column count");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019, 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.
*/
int sampleCount(int index) const
{
- GMX_ASSERT(index >= 0 && index <= static_cast<int>(values_.size()),
+ GMX_ASSERT(index >= 0 && index <= ssize(values_),
"Invalid column index");
GMX_ASSERT(bFinished_,
"Values available only after finished() has been called");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018,2019, 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.
// This assumption is strictly not necessary, but this is how the
// framework works currently, and makes the code below simpler.
GMX_ASSERT(points.firstColumn() == 0
- && points.lastColumn() == static_cast<int>(impl_->currentLifetimes_[dataSet].size()) - 1,
+ && points.lastColumn() == ssize(impl_->currentLifetimes_[dataSet]) - 1,
"Point set should cover all columns");
for (int i = 0; i < points.columnCount(); ++i)
{
/* Get the position restraint coordinates from the molblock */
a_molb = mol*numAtomsInMolecule + a_mol;
- GMX_ASSERT(a_molb < static_cast<int>(molb->posres_xA.size()), "We need a sufficient number of position restraint coordinates");
+ GMX_ASSERT(a_molb < ssize(molb->posres_xA), "We need a sufficient number of position restraint coordinates");
ip->posres.pos0A[XX] = molb->posres_xA[a_molb][XX];
ip->posres.pos0A[YY] = molb->posres_xA[a_molb][YY];
ip->posres.pos0A[ZZ] = molb->posres_xA[a_molb][ZZ];
/* Get the position restraint coordinats from the molblock */
a_molb = mol*numAtomsInMolecule + a_mol;
- GMX_ASSERT(a_molb < static_cast<int>(molb->posres_xA.size()), "We need a sufficient number of position restraint coordinates");
+ GMX_ASSERT(a_molb < ssize(molb->posres_xA), "We need a sufficient number of position restraint coordinates");
/* Take reference positions from A position of normal posres */
ip->fbposres.pos0[XX] = molb->posres_xA[a_molb][XX];
ip->fbposres.pos0[YY] = molb->posres_xA[a_molb][YY];
cg0 = cg1 - cd->ind[p-1].nrecv[zone];
}
- const int numThreads = static_cast<int>(comm->dth.size());
+ const int numThreads = gmx::ssize(comm->dth);
#pragma omp parallel for num_threads(numThreads) schedule(static)
for (int th = 0; th < numThreads; th++)
{
}
}
- if (static_cast<int>(ed.edpar.size()) != EDstate->nED)
+ if (gmx::ssize(ed.edpar) != EDstate->nED)
{
gmx_fatal(FARGS, "The number of essential dynamics / flooding groups is not consistent.\n"
"There are %d ED groups in the .cpt file, but %zu in the .edi file!\n"
* maxRelativeSlowdownAccepted times the fastest setup.
*/
pme_lb->start = pme_lb->lower_limit;
- while (pme_lb->start + 1 < static_cast<int>(pme_lb->setup.size()) &&
+ while (pme_lb->start + 1 < gmx::ssize(pme_lb->setup) &&
(pme_lb->setup[pme_lb->start].count == 0 ||
pme_lb->setup[pme_lb->start].cycles >
pme_lb->setup[pme_lb->fastest].cycles*maxRelativeSlowdownAccepted))
do
{
- if (pme_lb->cur+1 < static_cast<int>(pme_lb->setup.size()))
+ if (pme_lb->cur+1 < gmx::ssize(pme_lb->setup))
{
/* We had already generated the next setup */
OK = TRUE;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
gmx_fatal(FARGS, "No input files!" );
}
- if (bDeMux && static_cast<int>(inFiles.size()) != nset)
+ if (bDeMux && ssize(inFiles) != nset)
{
gmx_fatal(FARGS, "You have specified %td files and %d entries in the demux table", inFiles.size(), nset);
}
{
gmx_fatal(FARGS, "Don't know what to do with more than 1 output file if not demultiplexing");
}
- else if (bDeMux && static_cast<int>(outFiles.size()) != nset && outFiles.size() != 1)
+ else if (bDeMux && ssize(outFiles) != nset && outFiles.size() != 1)
{
gmx_fatal(FARGS, "Number of output files should be 1 or %d (#input files), not %td", nset, outFiles.size());
}
if (bDeMux)
{
auto outFilesDemux = gmx::copyOf(outFiles);
- if (static_cast<int>(outFilesDemux.size()) != nset)
+ if (gmx::ssize(outFilesDemux) != nset)
{
std::string name = outFilesDemux[0];
outFilesDemux.resize(nset);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019, 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.
double evcorr = NANO*NANO*AMU;
if (debug)
{
- fprintf(debug, "n = %d, kteh = %g evcorr = %g\n",
- static_cast<int>(eigval.size()), kteh, evcorr);
+ fprintf(debug, "n = %td, kteh = %g evcorr = %g\n",
+ ssize(eigval), kteh, evcorr);
}
double deter = 0;
for (gmx::index i = nskip; i < eigval.size(); i++)
char *ffdir, int ffdir_maxlen)
{
std::vector<gmx::DataFileInfo> ffdirs = fflib_enumerate_forcefields();
- const int nff = static_cast<int>(ffdirs.size());
+ const int nff = ssize(ffdirs);
/* Replace with unix path separators */
#if DIR_SEPARATOR != '/'
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, 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_cast<std::size_t>(cache->attr->cache.size),
static_cast<int>(cache->attr->cache.linesize),
static_cast<int>(cache->attr->cache.associativity),
- std::max(static_cast<int>(hwThreads.size()), 1)
+ std::max<int>(hwThreads.size(), 1)
} );
}
}
int i1 = (b+1)*NBNXN_BUFFERFLAG_SIZE*nbat->fstride;
nfptr = 0;
- for (int out = 1; out < static_cast<gmx::index>(nbat->out.size()); out++)
+ for (int out = 1; out < gmx::ssize(nbat->out); out++)
{
if (bitmask_is_set(flags->flag[b], out))
{
{
nbat->natoms_local = nbat->numAtoms();
}
- if (ddZone == static_cast<int>(nbs->grid.size()) - 1)
+ if (ddZone == gmx::ssize(nbs->grid) - 1)
{
/* We are done setting up all grids, we can resize the force buffers */
nbat->resizeForceBuffers();
gmx_bitmask_t *gridj_flag,
const int th)
{
- if (static_cast<gmx::index>(nbl.cj.size()) > ncj_old_j)
+ if (gmx::ssize(nbl.cj) > ncj_old_j)
{
int cbFirst = nbl.cj[ncj_old_j].cj >> gridj_flag_shift;
int cbLast = nbl.cj.back().cj >> gridj_flag_shift;
if (cjGlobal + src->ncjInUse > cjStart)
{
- for (gmx::index i = 0; i < static_cast<gmx::index>(src->ci.size()) && cjGlobal < cjEnd; i++)
+ for (gmx::index i = 0; i < gmx::ssize(src->ci) && cjGlobal < cjEnd; i++)
{
const nbnxn_ci_t *srcCi = &src->ci[i];
int ncj = srcCi->cj_ind_end - srcCi->cj_ind_start;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018,2019, 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.
}
if (!parse_common_args(&argc, argv, PCA_Flags,
- static_cast<int>(filenames.size()), filenames.data(), asize(pa), pa,
- static_cast<int>(desc.size()), desc.data(), 0, nullptr, &oenv))
+ ssize(filenames), filenames.data(), asize(pa), pa,
+ ssize(desc), desc.data(), 0, nullptr, &oenv))
{
return 0;
}
// now check for a multi-simulation
ArrayRef<const std::string> multidir = opt2fnsIfOptionSet("-multidir",
- static_cast<int>(filenames.size()),
+ ssize(filenames),
filenames.data());
if (replExParams.exchangeInterval != 0 && multidir.size() < 2)
#endif
if (!opt2bSet("-cpi",
- static_cast<int>(filenames.size()), filenames.data()))
+ ssize(filenames), filenames.data()))
{
// If we are not starting from a checkpoint we never allow files to be appended
// to, since that has caused a ton of strange behaviour and bugs in the past.
continuationOptions.appendFilesOptionSet = opt2parg_bSet("-append", asize(pa), pa);
handleRestart(cr, ms, bTryToAppendFiles,
- static_cast<int>(filenames.size()),
+ ssize(filenames),
filenames.data(),
&continuationOptions.appendFiles,
&continuationOptions.startedFromCheckpoint);
mdrunOptions.rerun = opt2bSet("-rerun",
- static_cast<int>(filenames.size()),
+ ssize(filenames),
filenames.data());
mdrunOptions.ntompOptionIsSet = opt2parg_bSet("-ntomp", asize(pa), pa);
/* OpenMP does not supported unsigned loop variables */
#pragma omp for schedule(static) nowait
- for (int i = 0; i < static_cast<int>(s2->cg_gl.size()); i++)
+ for (int i = 0; i < gmx::ssize(s2->cg_gl); i++)
{
s2->cg_gl[i] = s1->cg_gl[i];
}
/* write progress */
if (bIsMaster && mdrunOptions.verbose)
{
- fprintf(stderr, "\rFinished step %d out of %d",
- static_cast<int>(std::min(atom+nnodes, atom_index.size())),
- static_cast<int>(atom_index.size()));
+ fprintf(stderr, "\rFinished step %d out of %td",
+ std::min<int>(atom+nnodes, atom_index.size()),
+ ssize(atom_index));
fflush(stderr);
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016,2017,2019, 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.
//! Whether there are lines remaining for textForNextLine().
bool hasLinesRemaining() const
{
- return nextLineIndex_ < static_cast<int>(lines_.size());
+ return nextLineIndex_ < ssize(lines_);
}
/*! \brief
* Returns the text for the next line.
*/
ColumnData &columnData(int index)
{
- GMX_ASSERT(index >= 0 && index < static_cast<int>(columns_.size()),
+ GMX_ASSERT(index >= 0 && index < ssize(columns_),
"Invalid column index");
return columns_[index];
}
std::string EnumOptionStorage::formatSingleValue(const int &value) const
{
- if (value < 0 || value >= static_cast<int>(allowed_.size()))
+ if (value < 0 || value >= ssize(allowed_))
{
return std::string();
}
}
}
- int valueCount() override { return static_cast<int>(intStore_.size()); }
+ int valueCount() override { return ssize(intStore_); }
ArrayRef<int> values() override { return intStore_; }
void clear() override
{
GMX_RELEASE_ASSERT(pull != nullptr, "register_external_pull_potential called before init_pull");
GMX_RELEASE_ASSERT(provider != nullptr, "register_external_pull_potential called with NULL as provider name");
- if (coord_index < 0 || coord_index >= static_cast<int>(pull->coord.size()))
+ if (coord_index < 0 || coord_index >= gmx::ssize(pull->coord))
{
gmx_fatal(FARGS, "Module '%s' attempted to register an external potential for pull coordinate %d which is out of the pull coordinate range %d - %zu\n",
provider, coord_index + 1, 1, pull->coord.size());
{
pull_coord_work_t *pcrd;
- GMX_ASSERT(coord_index >= 0 && coord_index < static_cast<int>(pull->coord.size()), "apply_external_pull_coord_force called with coord_index out of range");
+ GMX_ASSERT(coord_index >= 0 && coord_index < gmx::ssize(pull->coord), "apply_external_pull_coord_force called with coord_index out of range");
if (pull->comm.bParticipate)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
{
return true;
}
- GMX_ASSERT(groupNr < static_cast<int>(pull.group.size()), "groupNr is out of range");
+ GMX_ASSERT(groupNr < gmx::ssize(pull.group), "groupNr is out of range");
/* Check PBC if the group uses a PBC reference atom treatment. */
const pull_group_work_t &group = pull.group[groupNr];
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, 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.
{
continue;
}
- const int cellSize = static_cast<int>(search_.cells_[ci].size());
+ const int cellSize = ssize(search_.cells_[ci]);
for (; cai < cellSize; ++cai)
{
const int i = search_.cells_[ci][cai];
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2017,2018,2019, 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.
AnalysisNeighborhoodPositions &
exclusionIds(ArrayRef<const int> ids)
{
- GMX_ASSERT(static_cast<int>(ids.size()) == count_,
+ GMX_ASSERT(ssize(ids) == count_,
"Exclusion id array should match the number of positions");
exclusionIds_ = ids.data();
return *this;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, 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.
param->flags &= ~SPAR_DYNAMIC;
/* Compute number of values, considering also integer ranges. */
- int valueCount = static_cast<int>(values.size());
+ int valueCount = ssize(values);
if (param->val.type == INT_VALUE)
{
SelectionParserValueList::const_iterator value;
_gmx_sel_parser_should_finish(yyscan_t scanner)
{
gmx_ana_selcollection_t *sc = _gmx_sel_lexer_selcollection(scanner);
- return static_cast<int>(sc->sel.size()) == _gmx_sel_lexer_exp_selcount(scanner);
+ return gmx::ssize(sc->sel) == _gmx_sel_lexer_exp_selcount(scanner);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, 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.
for (int i = 0; i < size; ++i)
{
const int ii = index[i];
- GMX_ASSERT(ii >= 0 && ii <= static_cast<int>(mapToFrameAtoms_.size())
+ GMX_ASSERT(ii >= 0 && ii <= ssize(mapToFrameAtoms_)
&& mapToFrameAtoms_[ii] != -1,
"Invalid input atom index");
tmpFrameAtoms_[i] = mapToFrameAtoms_[ii];
state->sc = sc;
state->bGroups = bGroups;
state->grps = grps;
- state->nexpsel = (maxnr > 0 ? static_cast<int>(sc->sel.size()) + maxnr : -1);
+ state->nexpsel = (maxnr > 0 ? gmx::ssize(sc->sel) + maxnr : -1);
state->statusWriter = statusWriter;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019, 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.
/* nonbondedOnGpu might be false e.g. because this simulation uses
* the group scheme, or is a rerun with energy groups. */
- ngpu = (nonbondedOnGpu ? static_cast<int>(gpuIdsToUse.size()) : 0);
+ ngpu = (nonbondedOnGpu ? gmx::ssize(gpuIdsToUse) : 0);
if (inputrec->cutoff_scheme == ecutsGROUP)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018,2019, 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.
{
fprintf(fp, "%s\n", title);
- for (i = 0; i < static_cast<int>(cmap_grid->cmapdata.size()); i++)
+ for (i = 0; i < gmx::ssize(cmap_grid->cmapdata); i++)
{
idx = -180.0;
fprintf(fp, "%8s %8s %8s %8s\n", "V", "dVdx", "dVdy", "d2dV");
/* Create a Non-Protein group */
aid = mk_aid(atoms, restype, "Protein", FALSE);
- if ((!aid.empty()) && (static_cast<int>(aid.size()) < atoms->nr))
+ if ((!aid.empty()) && (gmx::ssize(aid) < atoms->nr))
{
add_grp(gb, gn, aid, "non-Protein");
}
/* Solvent, create a negated group too */
aid = mk_aid(atoms, restype, "Water", FALSE);
- if ((!aid.empty()) && (static_cast<int>(aid.size()) < atoms->nr))
+ if ((!aid.empty()) && (gmx::ssize(aid) < atoms->nr))
{
add_grp(gb, gn, aid, "non-Water");
}
{
GMX_ASSERT(globalAtomIndex >= 0 && globalAtomIndex < mtop->natoms, "The atom index to look up should be within range");
GMX_ASSERT(moleculeBlock != nullptr, "molBlock can not be NULL");
- GMX_ASSERT(*moleculeBlock >= 0 && *moleculeBlock < static_cast<int>(mtop->moleculeBlockIndices.size()), "The starting molecule block index for the search should be within range and moleculeBlockIndices should not be empty");
+ GMX_ASSERT(*moleculeBlock >= 0 && *moleculeBlock < gmx::ssize(mtop->moleculeBlockIndices), "The starting molecule block index for the search should be within range and moleculeBlockIndices should not be empty");
/* Search the molecule block index using bisection */
int molBlock0 = -1;
}
iloop->mblock++;
- if (iloop->mblock >= static_cast<int>(iloop->mtop->molblock.size()))
+ if (iloop->mblock >= gmx::ssize(iloop->mtop->molblock))
{
- if (iloop->mblock == static_cast<int>(iloop->mtop->molblock.size()) &&
+ if (iloop->mblock == gmx::ssize(iloop->mtop->molblock) &&
iloop->mtop->bIntermolecularInteractions)
{
*nmol = 1;
const std::string ResidueType::nameFromResidueIndex(int index) const
{
- if (index >= 0 && index < static_cast<int>(impl_->entry.size()))
+ if (index >= 0 && index < gmx::ssize(impl_->entry))
{
return impl_->entry[index].residueName;
}
//! Returns the currently active selection.
const Selection ¤tSelection() const
{
- GMX_ASSERT(currentSelection_ < static_cast<int>(selections_.size()),
+ GMX_ASSERT(currentSelection_ < ssize(selections_),
"Accessing an invalid selection");
return selections_[currentSelection_];
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, 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.
if (points.firstColumn() == 0)
{
++currentGroup_;
- GMX_RELEASE_ASSERT(currentGroup_ < static_cast<int>(groups_.size()),
+ GMX_RELEASE_ASSERT(currentGroup_ < ssize(groups_),
"Too few groups initialized");
if (bFirstFrame || groups_[currentGroup_].bDynamic)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2007, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018,2019, 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.
GMX_RELEASE_ASSERT(false, "Invalid unit sphere mode");
}
- const int ndot = static_cast<int>(xus.size())/3;
+ const int ndot = ssize(xus)/3;
/* determine distribution of points in elementary cubes */
if (cubus)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
* Same as ptrdiff_t.
*/
using index = std::ptrdiff_t;
-}
+
+//! Return signed size of container
+template<typename T>
+index ssize(const T &t) { return t.size(); }
+} // namespace gmx
/* ICC, GCC, MSVC, Pathscale, PGI, XLC support __restrict.
* Any other compiler can be added here. */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, 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.
{
args_.reserve(cmdline.size());
argv_.reserve(cmdline.size() + 1);
- argc_ = static_cast<int>(cmdline.size());
+ argc_ = ssize(cmdline);
for (const auto &arg : cmdline)
{
char *argCopy = strdup(arg);
void CommandLine::append(const char *arg)
{
- GMX_RELEASE_ASSERT(impl_->argc_ == static_cast<int>(impl_->args_.size()),
+ GMX_RELEASE_ASSERT(impl_->argc_ == ssize(impl_->args_),
"Command-line has been modified externally");
size_t newSize = impl_->args_.size() + 1;
impl_->args_.reserve(newSize);