* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2003 David van der Spoel, Erik Lindahl, University of Groningen.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,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.
}
*pfft = nullptr;
- if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr)
+ if ( (fft = static_cast<struct gmx_fft *>(malloc(sizeof(struct gmx_fft)))) == nullptr)
{
return ENOMEM;
}
fft->n = nx;
/* Need 4*n storage for 1D complex FFT */
- if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx))) == nullptr)
+ if ( (fft->work = static_cast<real *>(malloc(sizeof(real)*(4*nx)))) == nullptr)
{
free(fft);
return ENOMEM;
}
*pfft = nullptr;
- if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr)
+ if ( (fft = static_cast<struct gmx_fft *>(malloc(sizeof(struct gmx_fft)))) == nullptr)
{
return ENOMEM;
}
fft->n = nx;
/* Need 2*n storage for 1D real FFT */
- if ((fft->work = (real *)malloc(sizeof(real)*(2*nx))) == nullptr)
+ if ((fft->work = static_cast<real *>(malloc(sizeof(real)*(2*nx)))) == nullptr)
{
free(fft);
return ENOMEM;
*pfft = nullptr;
/* Create the X transform */
- if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr)
+ if ( (fft = static_cast<struct gmx_fft *>(malloc(sizeof(struct gmx_fft)))) == nullptr)
{
return ENOMEM;
}
/* Need 4*nx storage for 1D complex FFT, and another
* 2*nx*nyc elements for complex-to-real storage in our high-level routine.
*/
- if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx+2*nx*nyc))) == nullptr)
+ if ( (fft->work = static_cast<real *>(malloc(sizeof(real)*(4*nx+2*nx*nyc)))) == nullptr)
{
free(fft);
return ENOMEM;
if (n == 1)
{
- p1 = (real *)in_data;
- p2 = (real *)out_data;
+ p1 = static_cast<real *>(in_data);
+ p2 = static_cast<real *>(out_data);
p2[0] = p1[0];
p2[1] = p1[1];
}
*/
if (in_data != out_data)
{
- p1 = (real *)in_data;
- p2 = (real *)out_data;
+ p1 = static_cast<real *>(in_data);
+ p2 = static_cast<real *>(out_data);
/* n complex = 2*n real elements */
for (i = 0; i < 2*n; i++)
if (dir == GMX_FFT_FORWARD)
{
- fftpack_cfftf1(n, (real *)out_data, fft->work+2*n, fft->work, fft->ifac, -1);
+ fftpack_cfftf1(n, static_cast<real *>(out_data), fft->work+2*n, fft->work, fft->ifac, -1);
}
else if (dir == GMX_FFT_BACKWARD)
{
- fftpack_cfftf1(n, (real *)out_data, fft->work+2*n, fft->work, fft->ifac, 1);
+ fftpack_cfftf1(n, static_cast<real *>(out_data), fft->work+2*n, fft->work, fft->ifac, 1);
}
else
{
if (n == 1)
{
- p1 = (real *)in_data;
- p2 = (real *)out_data;
+ p1 = static_cast<real *>(in_data);
+ p2 = static_cast<real *>(out_data);
p2[0] = p1[0];
if (dir == GMX_FFT_REAL_TO_COMPLEX)
{
*/
if (in_data != out_data)
{
- p1 = (real *)in_data;
- p2 = (real *)out_data;
+ p1 = static_cast<real *>(in_data);
+ p2 = static_cast<real *>(out_data);
for (i = 0; i < 2*(n/2+1); i++)
{
/* Elements 0 .. n-1 in work are used for ffac values,
* Elements n .. 2*n-1 are internal FFTPACK work space.
*/
- fftpack_rfftf1(n, (real *)out_data, fft->work+n, fft->work, fft->ifac);
+ fftpack_rfftf1(n, static_cast<real *>(out_data), fft->work+n, fft->work, fft->ifac);
/*
* FFTPACK has a slightly more compact storage than we, time to
* convert it: ove most of the array one step up to make room for
* zero imaginary parts.
*/
- p2 = (real *)out_data;
+ p2 = static_cast<real *>(out_data);
for (i = n-1; i > 0; i--)
{
p2[i+1] = p2[i];
* is more compact than ours (2 reals) it will fit, so compact it
* and copy on-the-fly to the output array.
*/
- p1 = (real *) in_data;
- p2 = (real *)out_data;
+ p1 = static_cast<real *>(in_data);
+ p2 = static_cast<real *>(out_data);
p2[0] = p1[0];
for (i = 1; i < n; i++)
{
p2[i] = p1[i+1];
}
- fftpack_rfftb1(n, (real *)out_data, fft->work+n, fft->work, fft->ifac);
+ fftpack_rfftb1(n, static_cast<real *>(out_data), fft->work+n, fft->work, fft->ifac);
}
else
{
*/
if (in_data != out_data)
{
- p1 = (real *)in_data;
- p2 = (real *)out_data;
+ p1 = static_cast<real *>(in_data);
+ p2 = static_cast<real *>(out_data);
for (i = 0; i < nx; i++)
{
/* Output (pointed to by data) is now in padded format.
* Pack it into out_data if we were doing an out-of-place transform.
*/
- p1 = (real *)data;
- p2 = (real *)out_data;
+ p1 = reinterpret_cast<real *>(data);
+ p2 = static_cast<real *>(out_data);
for (i = 0; i < nx; i++)
{