Manual changes.
Change-Id: I5a9d1ab65498f70539dd1f28bb538781dd1021f8
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
in[2*j+0] = (*c)[i][j];
in[2*j+1] = 0;
}
- gmx_fft_1d(fft1, GMX_FFT_BACKWARD, (void *)in.data(), (void *)out.data());
+ gmx_fft_1d(fft1, GMX_FFT_BACKWARD, in.data(), out.data());
for (size_t j = 0; j < nfft; j++)
{
in[2*j+0] = (out[2*j+0]*out[2*j+0] + out[2*j+1]*out[2*j+1])/nfft;
in[2*j+1] = 0;
}
- gmx_fft_1d(fft1, GMX_FFT_FORWARD, (void *)in.data(), (void *)out.data());
+ gmx_fft_1d(fft1, GMX_FFT_FORWARD, in.data(), out.data());
for (size_t j = 0; (j < nfft); j++)
{
(*c)[i][j] = out[2*j+0];
{
gmx_fft_t fft;
FFTWPREFIX(complex) *p1, *p2, *up1, *up2;
- size_t pc;
+ char* pc;
int i, j, k;
int fftw_flags;
* In double precision the actual complex datatype will be 16 bytes,
* so go to a char pointer and force an offset of 8 bytes instead.
*/
- pc = (size_t)p1;
+ pc = reinterpret_cast<char*>(p1);
pc += 8;
- up1 = (FFTWPREFIX(complex) *)pc;
+ up1 = reinterpret_cast<FFTWPREFIX(complex) *>(pc);
- pc = (size_t)p2;
+ pc = reinterpret_cast<char*>(p2);
pc += 8;
- up2 = (FFTWPREFIX(complex) *)pc;
+ up2 = reinterpret_cast<FFTWPREFIX(complex) *>(pc);
/* int rank, const int *n, int howmany,
fftw_complex *in, const int *inembed,
{
gmx_fft_t fft;
real *p1, *p2, *up1, *up2;
- size_t pc;
+ char* pc;
int i, j, k;
int fftw_flags;
* In double precision the actual complex datatype will be 16 bytes,
* so go to a char pointer and force an offset of 8 bytes instead.
*/
- pc = (size_t)p1;
+ pc = reinterpret_cast<char*>(p1);
pc += 8;
- up1 = (real *)pc;
+ up1 = reinterpret_cast<real*>(pc);
- pc = (size_t)p2;
+ pc = reinterpret_cast<char*>(p2);
pc += 8;
- up2 = (real *)pc;
+ up2 = reinterpret_cast<real*>(pc);
/* int rank, const int *n, int howmany,
double *in, const int *inembed,
{
gmx_fft_t fft;
real *p1, *p2, *up1, *up2;
- size_t pc;
+ char* pc;
int i, j, k;
int fftw_flags;
* In double precision the actual complex datatype will be 16 bytes,
* so go to a char pointer and force an offset of 8 bytes instead.
*/
- pc = (size_t)p1;
+ pc = reinterpret_cast<char*>(p1);
pc += 8;
- up1 = (real *)pc;
+ up1 = reinterpret_cast<real*>(pc);
- pc = (size_t)p2;
+ pc = reinterpret_cast<char*>(p2);
pc += 8;
- up2 = (real *)pc;
+ up2 = reinterpret_cast<real*>(pc);
fft->plan[0][0][0] = FFTWPREFIX(plan_dft_c2r_2d)(nx, ny, reinterpret_cast<FFTWPREFIX(complex) *>(up1), up2, fftw_flags);
void * in_data,
void * out_data)
{
- int aligned = ((((size_t)in_data | (size_t)out_data) & 0xf) == 0);
+ int aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
int inplace = (in_data == out_data);
int isforward = (dir == GMX_FFT_FORWARD);
void * in_data,
void * out_data)
{
- int aligned = ((((size_t)in_data | (size_t)out_data) & 0xf) == 0);
+ int aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
int inplace = (in_data == out_data);
int isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
void * in_data,
void * out_data)
{
- int aligned = ((((size_t)in_data | (size_t)out_data) & 0xf) == 0);
+ int aligned = (((size_t(in_data) | size_t(out_data)) & 0xf) == 0);
int inplace = (in_data == out_data);
int isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
const char *desc, const char *srcfile, int line)
{
gmx_bool ret;
- void *it = (void*)item; /* ugh.. */
+ void *it = const_cast<char*>(item); /* ugh.. */
gmx_fio_lock(fio);
ret = do_xdr(fio, it, 1, eioSTRING, desc, srcfile, line);
gmx_fio_unlock(fio);
{
xvgr_legend(out, setNames.size(), setNames.data(), oenv);
}
-void xvgr_legend(FILE *out, int nsets, const char** setnames,
+void xvgr_legend(FILE *out, int nsets, const char*const* setnames,
const struct gmx_output_env_t *oenv)
{
- xvgr_legend<char const *>(out, nsets, setnames, oenv);
+ xvgr_legend<const char *>(out, nsets, setnames, oenv);
}
void xvgr_new_dataset(FILE *out, int nr_first, int nsets,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
const struct gmx_output_env_t *oenv);
/* Make a legend box, and also modifies the view to make room for the legend */
-void xvgr_legend(FILE *out, int nsets, const char** setnames,
+void xvgr_legend(FILE *out, int nsets, const char*const* setnames,
const struct gmx_output_env_t *oenv);
/* Make a legend box, and also modifies the view to make room for the legend */
static int real_comp(const void *a, const void *b)
{
- real dif = *(real *)a - *(real *)b;
+ real dif = *reinterpret_cast<const real*>(a) - *reinterpret_cast<const real*>(b);
if (dif < 0)
{
(n-1)*dt, n);
}
snew(leg, 2*nset);
- xvgr_legend(fp, 2*nset, (const char**)leg, oenv);
+ xvgr_legend(fp, 2*nset, leg, oenv);
sfree(leg);
spacing = std::pow(2.0, 1.0/resol);
real t, comp;
char *grpname[MAX_ENDS];
/* FIXME: The constness should not be cast away */
- char *anm = (char *)"CA", *rnm = (char *)"GLY";
+ char *anm = const_cast<char*>("CA"), *rnm = const_cast<char*>("GLY");
int i, gnx[MAX_ENDS];
int *index[MAX_ENDS];
t_bundle bun;
/* sort the list */
fprintf(stderr, "Sorting list..\n");
- qsort ((void*)*eltab, nr, sizeof(t_electron),
+ qsort (*eltab, nr, sizeof(t_electron),
reinterpret_cast<int(*)(const void*, const void*)>(compare));
return nr;
sought.atomname = gmx_strdup(*(top->atoms.atomname[index[n][i]]));
/* now find the number of electrons. This is not efficient. */
- found = static_cast<t_electron *>(bsearch((const void *)&sought,
- (const void *)eltab, nr, sizeof(t_electron),
+ found = static_cast<t_electron *>(bsearch(&sought,
+ eltab, nr, sizeof(t_electron),
reinterpret_cast<int(*)(const void*, const void*)>(compare)));
if (found == nullptr)
den = xvgropen(afile,
title, xlabel, ylabel, oenv);
- xvgr_legend(den, nr_grps, (const char**)grpname, oenv);
+ xvgr_legend(den, nr_grps, grpname, oenv);
for (slice = 0; (slice < nslices); slice++)
{
gmx_fatal(FARGS, "gmx_fft_init_1d_real returned %d", fftcode);
}
if ((fftcode = gmx_fft_1d_real(fft, GMX_FFT_COMPLEX_TO_REAL,
- (void *)tmp, (void *)tmp)) != 0)
+ tmp, tmp)) != 0)
{
gmx_fatal(FARGS, "gmx_fft_1d_real returned %d", fftcode);
}
}
}
-static int tpcomp(const void *a, const void *b)
-{
- t_toppop *tpa;
- t_toppop *tpb;
-
- tpa = (t_toppop *)a;
- tpb = (t_toppop *)b;
-
- return static_cast<int>(1e7*(tpb->v-tpa->v));
-}
-
static void add5(int ndr, real viol)
{
int i, mini;
{
int i;
- qsort(top, ntop, sizeof(top[0]), tpcomp);
+ std::sort(top, top+ntop, [](const t_toppop &a, const t_toppop &b) {return a.v > b.v; }); //reverse sort
fprintf(fp, "Index:");
for (i = 0; (i < ntop); i++)
{
(forceparams[forceatoms[i+n]].disres.label == label));
calc_disres_R_6(nullptr, nullptr, n, &forceatoms[i],
- (const rvec*)x, pbc, fcd, nullptr);
+ x, pbc, fcd, nullptr);
if (fcd->disres.Rt_6[label] <= 0)
{
gmx_fatal(FARGS, "gmx_fft_init_1d_real returned %d", fftcode);
}
if ((fftcode = gmx_fft_1d_real(fft, GMX_FFT_REAL_TO_COMPLEX,
- (void *)dos[MVACF], (void *)dos[DOS])) != 0)
+ dos[MVACF], dos[DOS])) != 0)
{
gmx_fatal(FARGS, "gmx_fft_1d_real returned %d", fftcode);
}
atoms.nr = nat;
snew(img, nat);
/* FIXME: Constness should not be cast away */
- c = (char *) "C";
- ala = (char *) "ALA";
+ c = const_cast<char*>("C");
+ ala = const_cast<char*>("ALA");
for (i = 0; i < nat; i++)
{
atoms.atomname[i] = &c;
sprintf(legend[2], "Mean");
sprintf(legend[3], "# atoms");
sprintf(legend[4], "Mean/# atoms");
- xvgr_legend(fp, 5, (const char**)legend, oenv);
+ xvgr_legend(fp, 5, legend, oenv);
for (i = 0; (i < nres); i++)
{
if (mean_n[i] == 0)
snew(leg, 1);
sprintf(buf, "Internal in %s", grpn[0]);
leg[0] = gmx_strdup(buf);
- xvgr_legend(dist, 0, (const char**)leg, oenv);
+ xvgr_legend(dist, 0, leg, oenv);
if (num)
{
- xvgr_legend(num, 0, (const char**)leg, oenv);
+ xvgr_legend(num, 0, leg, oenv);
}
}
else
leg[j] = gmx_strdup(buf);
}
}
- xvgr_legend(dist, j, (const char**)leg, oenv);
+ xvgr_legend(dist, j, leg, oenv);
if (num)
{
- xvgr_legend(num, j, (const char**)leg, oenv);
+ xvgr_legend(num, j, leg, oenv);
}
}
}
sprintf(buf, "%s-%s", grpn[0], grpn[i+1]);
leg[i] = gmx_strdup(buf);
}
- xvgr_legend(dist, ng-1, (const char**)leg, oenv);
+ xvgr_legend(dist, ng-1, leg, oenv);
if (num)
{
- xvgr_legend(num, ng-1, (const char**)leg, oenv);
+ xvgr_legend(num, ng-1, leg, oenv);
}
}
{
sprintf(buf, "%simum Distance", bMin ? "Min" : "Max");
respertime = xvgropen(rfile, buf, output_env_get_time_label(oenv), "Distance (nm)", oenv);
- xvgr_legend(respertime, ng-1, (const char**)leg, oenv);
+ xvgr_legend(respertime, ng-1, leg, oenv);
if (bPrintResName && output_env_get_print_xvgr_codes(oenv) )
{
fprintf(respertime, "# ");
sprintf(buf, "%simum Distance", bMin ? "Min" : "Max");
res = xvgropen(rfile, buf, "Residue (#)", "Distance (nm)", oenv);
- xvgr_legend(res, ng-1, (const char**)leg, oenv);
+ xvgr_legend(res, ng-1, leg, oenv);
for (j = 0; j < nres; j++)
{
fprintf(res, "%4d", j+1);
{
fprintf(fort, "%s", orinst_sub);
}
- xvgr_legend(fort, norsel, (const char**)odtleg, oenv);
+ xvgr_legend(fort, norsel, odtleg, oenv);
}
if (bODT)
{
{
fprintf(fodt, "%s", orinst_sub);
}
- xvgr_legend(fodt, norsel, (const char**)odtleg, oenv);
+ xvgr_legend(fodt, norsel, odtleg, oenv);
}
for (i = 0; i < norsel; i++)
{
}
}
}
- xvgr_legend(foten, bOvec ? nex*12 : nex*3, (const char**)otenleg, oenv);
+ xvgr_legend(foten, bOvec ? nex*12 : nex*3, otenleg, oenv);
for (j = 0; j < 3; j++)
{
sfree(otenleg[j]);
snew(leg[2*i+1], 32);
sprintf(leg[2*i+1], "i %s", pairleg[set[i]]);
}
- xvgr_legend(fp_pairs, 2*nset, (const char**)leg, oenv);
+ xvgr_legend(fp_pairs, 2*nset, leg, oenv);
}
/*
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
legp[d*DIM+d2] = gmx_strdup(buf);
}
}
- xvgr_legend(outv, DIM*DIM, (const char**)legp, oenv);
+ xvgr_legend(outv, DIM*DIM, legp, oenv);
}
else
{
static void plot_potential(double *potential[], double *charge[], double *field[],
const char *afile, const char *bfile, const char *cfile,
- int nslices, int nr_grps, const char *grpname[], double slWidth,
+ int nslices, int nr_grps, const char *const grpname[], double slWidth,
const gmx_output_env_t *oenv)
{
FILE *pot, /* xvgr file with potential */
plot_potential(potential, charge, field, opt2fn("-o", NFILE, fnm),
opt2fn("-oc", NFILE, fnm), opt2fn("-of", NFILE, fnm),
- nslices, ngrps, (const char**)grpname, slWidth, oenv);
+ nslices, ngrps, grpname, slWidth, oenv);
do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); /* view xvgr file */
do_view(oenv, opt2fn("-oc", NFILE, fnm), nullptr); /* view xvgr file */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
axis1 = xvgropen(opt2fn("-a1", NFILE, fnm), "Principal axis 1 (major axis)",
output_env_get_xvgr_tlabel(oenv), "Component (nm)", oenv);
- xvgr_legend(axis1, DIM, (const char **)legend, oenv);
+ xvgr_legend(axis1, DIM, legend, oenv);
axis2 = xvgropen(opt2fn("-a2", NFILE, fnm), "Principal axis 2 (middle axis)",
output_env_get_xvgr_tlabel(oenv), "Component (nm)", oenv);
- xvgr_legend(axis2, DIM, (const char **)legend, oenv);
+ xvgr_legend(axis2, DIM, legend, oenv);
axis3 = xvgropen(opt2fn("-a3", NFILE, fnm), "Principal axis 3 (minor axis)",
output_env_get_xvgr_tlabel(oenv), "Component (nm)", oenv);
- xvgr_legend(axis3, DIM, (const char **)legend, oenv);
+ xvgr_legend(axis3, DIM, legend, oenv);
sprintf(legend[XX], "Axis 1 (major)");
sprintf(legend[YY], "Axis 2 (middle)");
fmoi = xvgropen(opt2fn("-om", NFILE, fnm), "Moments of inertia around inertial axes",
output_env_get_xvgr_tlabel(oenv), "I (au nm\\S2\\N)", oenv);
- xvgr_legend(fmoi, DIM, (const char **)legend, oenv);
+ xvgr_legend(fmoi, DIM, legend, oenv);
for (i = 0; i < DIM; i++)
{
}
if (nrms != 1)
{
- xvgr_legend(fp, nrms, (const char**)gn_rms, oenv);
+ xvgr_legend(fp, nrms, gn_rms, oenv);
}
for (i = 0; (i < teller); i++)
{
{
fprintf(fp, "@ subtitle \"after lsq fit to mirror %s\"\n", bFit ? gn_fit : "");
}
- xvgr_legend(fp, nrms, (const char**)gn_rms, oenv);
+ xvgr_legend(fp, nrms, gn_rms, oenv);
}
for (i = 0; (i < teller); i++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (nset[nnn] == 0)
{
- xvgr_legend(out[nnn], 1, (const char**)&buf, oenv);
+ xvgr_legend(out[nnn], 1, &buf, oenv);
}
else
{
static int comp_minima(const void *a, const void *b)
{
- t_minimum *ma = (t_minimum *) a;
- t_minimum *mb = (t_minimum *) b;
+ const t_minimum *ma = reinterpret_cast<const t_minimum*>(a);
+ const t_minimum *mb = reinterpret_cast<const t_minimum*>(b);;
if (ma->ener < mb->ener)
{
}
}
}
- xvgr_legend(fp, j, (const char**)leg, oenv);
+ xvgr_legend(fp, j, leg, oenv);
for (i = 0; i < j; i++)
{
static int ocomp(const void *a, const void *b)
{
- t_order *oa, *ob;
+ const t_order *oa, *ob;
- oa = (t_order *)a;
- ob = (t_order *)b;
+ oa = reinterpret_cast<const t_order*>(a);
+ ob = reinterpret_cast<const t_order*>(b);
if (oa->d2 < ob->d2)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
sprintf(buf, "%g ps", (fbin + 1)*fshift*dt);
legend[fbin] = gmx_strdup(buf);
}
- xvgr_legend(fp, nr, (const char**)legend, oenv);
+ xvgr_legend(fp, nr, legend, oenv);
for (i = 0; i < nalloc; i++)
{
fprintf(fp, "%g", i*rbin);
set_p_string(p, s);
}
-static int int_comp(const void *a, const void *b)
-{
- return (*(int *)a) - (*(int *)b);
-}
-
static int idcomp(const void *a, const void *b)
{
const t_param *pa, *pb;
{
if (excls[a].nr > 1)
{
- qsort(excls[a].e, excls[a].nr, static_cast<size_t>(sizeof(int)), int_comp);
+ std::sort(excls[a].e, excls[a].e+excls[a].nr);
}
}
}
static int
bond_sort (const void *a, const void *b)
{
- sortable *sa, *sb;
+ const sortable *sa, *sb;
- sa = (sortable *) a;
- sb = (sortable *) b;
+ sa = reinterpret_cast<const sortable*>(a);
+ sb = reinterpret_cast<const sortable*>(b);
if (sa->ai == sb->ai)
{
static int
compare_int (const void * a, const void * b)
{
- return ( *(int*)a - *(int*)b );
+ return ( *reinterpret_cast<const int*>(a) - *reinterpret_cast<const int*>(b) );
}
prints("nnb2excl before qsort", nr_of_sortables, s);
if (nr_of_sortables > 1)
{
- qsort ((void *)s, nr_of_sortables, static_cast<size_t>(sizeof(s[0])), bond_sort);
+ qsort (s, nr_of_sortables, static_cast<size_t>(sizeof(s[0])), bond_sort);
prints("nnb2excl after qsort", nr_of_sortables, s);
}
prints("gen_excl before qsort", nrbonds, s);
if (nrbonds > 1)
{
- qsort((void *) s, nrbonds, static_cast<size_t>(sizeof(sortable)), bond_sort);
+ qsort(s, nrbonds, static_cast<size_t>(sizeof(sortable)), bond_sort);
prints("gen_excl after qsort", nrbonds, s);
}
sfree(eb->enm);
}
-int get_ebin_space(t_ebin *eb, int nener, const char *enm[], const char *unit)
+int get_ebin_space(t_ebin *eb, int nener, const char *const enm[], const char *unit)
{
int index;
int i, f;
//! Empty the contents of \c eb.
void done_ebin(t_ebin *eb);
-int get_ebin_space(t_ebin *eb, int nener, const char *enm[], const char *unit);
+int get_ebin_space(t_ebin *eb, int nener, const char *const enm[], const char *unit);
/* Create space in the energy bin and register names.
* The enm array must be static, because the contents are not copied,
}
do_force_listed(wcycle, box, ir->fepvals, cr, ms,
- idef, (const rvec *) x, hist,
+ idef, x, hist,
forceForUseWithShiftForces, forceWithVirial,
fr, &pbc, graph, enerd, nrnb, lambda, md, fcd,
DOMAINDECOMP(cr) ? cr->dd->globalAtomIndices.data() : nullptr,
}
}
md->igrp[n] = get_ebin_space(md->ebin, md->nEc,
- (const char **)gnm, unit_energy);
+ gnm, unit_energy);
n++;
}
}
sprintf(buf, "T-%s", *(groups->grpname[ni]));
grpnms[i] = gmx_strdup(buf);
}
- md->itemp = get_ebin_space(md->ebin, md->nTC, (const char **)grpnms,
+ md->itemp = get_ebin_space(md->ebin, md->nTC, grpnms,
unit_temp_K);
if (md->etc == etcNOSEHOOVER)
}
}
md->itc = get_ebin_space(md->ebin, md->mde_n,
- (const char **)grpnms, unit_invtime);
+ grpnms, unit_invtime);
if (md->bMTTK)
{
for (i = 0; (i < md->nTCP); i++)
}
}
md->itcb = get_ebin_space(md->ebin, md->mdeb_n,
- (const char **)grpnms, unit_invtime);
+ grpnms, unit_invtime);
}
}
else
grpnms[2*i+1] = gmx_strdup(buf);
}
md->itc = get_ebin_space(md->ebin, md->mde_n,
- (const char **)grpnms, unit_invtime);
+ grpnms, unit_invtime);
}
}
}
sprintf(buf, "Lamb-%s", *(groups->grpname[ni]));
grpnms[i] = gmx_strdup(buf);
}
- md->itc = get_ebin_space(md->ebin, md->mde_n, (const char **)grpnms, "");
+ md->itc = get_ebin_space(md->ebin, md->mde_n, grpnms, "");
}
for (i = 0; i < md->mde_n; i++)
sprintf(buf, "Uz-%s", *(groups->grpname[ni]));
grpnms[3*i+ZZ] = gmx_strdup(buf);
}
- md->iu = get_ebin_space(md->ebin, 3*md->nU, (const char **)grpnms, unit_vel);
+ md->iu = get_ebin_space(md->ebin, 3*md->nU, grpnms, unit_vel);
sfree(grpnms);
}
nsets */
}
- xvgr_legend(fp, nsetsextend, (const char **)setname, oenv);
+ xvgr_legend(fp, nsetsextend, setname, oenv);
for (s = 0; s < nsetsextend; s++)
{
//! Compares sort blocks.
static int pcomp(const void *p1, const void *p2)
{
- int db;
- int min1, min2, max1, max2;
- t_sortblock *a1 = (t_sortblock *)p1;
- t_sortblock *a2 = (t_sortblock *)p2;
+ int db;
+ int min1, min2, max1, max2;
+ const t_sortblock *a1 = reinterpret_cast<const t_sortblock*>(p1);
+ const t_sortblock *a2 = reinterpret_cast<const t_sortblock*>(p2);
db = a1->blocknr-a2->blocknr;
int atom, sid;
} t_sid;
-static int sid_comp(const void *a, const void *b)
+static bool sid_comp(const t_sid &sa, const t_sid &sb)
{
- t_sid *sa, *sb;
- int dd;
-
- sa = (t_sid *)a;
- sb = (t_sid *)b;
-
- dd = sa->sid-sb->sid;
- if (dd == 0)
+ if (sa.sid == sb.sid)
{
- return (sa->atom-sb->atom);
+ return sa.atom < sb.atom;
}
else
{
- return dd;
+ return sa.sid < sb.sid;
}
}
}
/* Now sort the shake blocks... */
- qsort(sid+at_start, at_end-at_start, static_cast<size_t>(sizeof(sid[0])), sid_comp);
+ std::sort(sid+at_start, sid+at_end, sid_comp);
if (debug)
{
leg[e++] = gmx_strdup(str);
}
}
- xvgr_legend(fp_tpi, 4+nener, (const char**)leg, oenv);
+ xvgr_legend(fp_tpi, 4+nener, leg, oenv);
for (i = 0; i < 4+nener; i++)
{
sfree(leg[i]);
"\\betaU - log(V/<V>)", "count", oenv);
sprintf(str, "number \\betaU > %g: %9.3e", bU_bin_limit, bin[0]);
xvgr_subtitle(fp_tpi, str, oenv);
- xvgr_legend(fp_tpi, 2, (const char **)tpid_leg, oenv);
+ xvgr_legend(fp_tpi, 2, tpid_leg, oenv);
for (i = nbin-1; i > 0; i--)
{
bUlogV = -i/invbinw + bU_logV_bin_limit - refvolshift + log(V_all/frame);
static int
cmp_int(const void *a, const void *b)
{
- if (*(int *)a < *(int *)b)
+ if (*reinterpret_cast<const int*>(a) < *reinterpret_cast<const int*>(b))
{
return -1;
}
- if (*(int *)a > *(int *)b)
+ if (*reinterpret_cast<const int*>(a) > *reinterpret_cast<const int*>(b))
{
return 1;
}