Commit 96af454a authored by Pierre Augier's avatar Pierre Augier
Browse files

No more complex.h

parent 69cfde3de7c8
......@@ -209,8 +209,8 @@ for base_name in base_names:
if not on_rtd:
make_extensions(
ext_modules, include_dirs=include_dirs,
lib_flags_dict=lib_flags_dict, lib_dirs_dict=lib_dirs_dict,
CFLAGS='-std=c++03')
lib_flags_dict=lib_flags_dict, lib_dirs_dict=lib_dirs_dict)
# CFLAGS='-std=c++03')
# Clear all purepymake.Extension objects after build is done.
ext_modules = []
......
......@@ -139,7 +139,7 @@ myreal FFT2DWithCUFFT::compute_energy_from_K(mycomplex* fieldK)
// modes i1_seq = iKx = last = nK1 - 1
i1 = nK1 - 1;
for (i0=0; i0<nK0; i0++)
energy += (double) pow(cabs(fieldK[i1 + i0*nK1]), 2);//we must divide by 2 ==> after
energy += (double) pow(abs(fieldK[i1 + i0*nK1]), 2);//we must divide by 2 ==> after
if (nK1%2 != 0)
energy *= 0.5;//divide by 2!!!
......@@ -147,12 +147,12 @@ myreal FFT2DWithCUFFT::compute_energy_from_K(mycomplex* fieldK)
// other modes
for (i0=0; i0<nK0; i0++)
for (i1=1; i1<nK1-1; i1++)
energy += (double) pow(cabs(fieldK[i1 + i0*nK1]), 2);
energy += (double) pow(abs(fieldK[i1 + i0*nK1]), 2);
// modes i1_seq = iKx = 0
i1 = 0;
for (i0=0; i0<nK0; i0++)
energy0 += (double) pow(cabs(fieldK[i0*nK1]), 2);//we must divide by 2 ==> after
energy0 += (double) pow(abs(fieldK[i0*nK1]), 2);//we must divide by 2 ==> after
energy += energy0*0.5;
......@@ -216,7 +216,7 @@ myreal FFT2DWithCUFFT::compute_mean_from_X(myreal* fieldX)
myreal FFT2DWithCUFFT::compute_mean_from_K(mycomplex* fieldK)
{
myreal mean;
mean = creal(fieldK[0]);
mean = real(fieldK[0]);
return mean;
}
......
/* #include <stdio.h> */
#include <complex.h>
#include <cuda_runtime.h>
#include <cufft.h>
#include <base_fft2d.h>
......@@ -35,7 +34,7 @@ class FFT2DWithCUFFT: public BaseFFT2D
private:
int nX1loc, nK1loc, nXxloc, nXyloc, nXx, nXy, nKyloc;
int coef_norm;
myreal coef_norm;
int mem_size;//equivalent à la taille de arrayK?
int mem_sizer;//equivalent à la taille de arrayK?
......
......@@ -105,13 +105,13 @@ FFT2DWithFFTW1D::FFT2DWithFFTW1D(int argN0, int argN1):
1, &N1, howmany,
arrayX, NULL,
istride, N1,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
ostride, nKx+1,
flags);
plan_c2r = fftw_plan_many_dft_c2r(
1, &N1, howmany,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
istride, nKx+1,
arrayX, NULL,
ostride, N1,
......@@ -121,18 +121,18 @@ FFT2DWithFFTW1D::FFT2DWithFFTW1D(int argN0, int argN1):
sign = FFTW_FORWARD;
plan_c2c_fwd = fftw_plan_many_dft(
1, &N0, howmany,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
istride, N0,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
ostride, N0,
sign, flags);
sign = FFTW_BACKWARD;
plan_c2c_bwd = fftw_plan_many_dft(
1, &N0, howmany,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
istride, N0,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
ostride, N0,
sign, flags);
#endif
......@@ -201,14 +201,14 @@ myreal FFT2DWithFFTW1D::compute_energy_from_K(mycomplex* fieldK)
// modes i0 = iKx = 0
i0 = 0;
for (i1=0; i1<nK1; i1++)
energy_tmp += pow(cabs(fieldK[i1]), 2);
energy_tmp += pow(abs(fieldK[i1]), 2);
energy = energy_tmp/2;
// other modes
for (i0=1; i0<nK0loc; i0++)
for (i1=0; i1<nK1; i1++)
energy += pow(cabs(fieldK[i1 + i0*nK1]), 2);
energy += pow(abs(fieldK[i1 + i0*nK1]), 2);
return energy;
}
......@@ -247,7 +247,7 @@ myreal FFT2DWithFFTW1D::compute_mean_from_X(myreal* fieldX)
}
myreal FFT2DWithFFTW1D::compute_mean_from_K(mycomplex* fieldK)
{
myreal mean = creal(fieldK[0]);
myreal mean = fieldK[0].real();
return mean;
}
void FFT2DWithFFTW1D::fft(myreal *fieldX, mycomplex *fieldK)
......
......@@ -21,7 +21,7 @@ class FFT2DWithFFTW1D: public BaseFFT2D
void init_array_X_random(myreal* &fieldX);
private:
int coef_norm;
myreal coef_norm;
myreal *arrayX;
mycomplex *arrayK_pR, *arrayK_pC;
myfftw_plan plan_r2c, plan_c2c_fwd, plan_c2r, plan_c2c_bwd;
......
......@@ -46,14 +46,14 @@ FFT2DWithFFTW2D::FFT2DWithFFTW2D(int argN0, int argN1):
N0, N1, arrayK, arrayX, flags);
#else
arrayX = fftw_alloc_real(nX0 * nX1);
arrayK = fftw_alloc_complex(nK0 * nK1);
arrayK = reinterpret_cast<mycomplex*>(fftw_alloc_complex(nK0 * nK1));
gettimeofday(&start_time, NULL);
plan_r2c = fftw_plan_dft_r2c_2d(
N0, N1, arrayX, arrayK, flags);
N0, N1, arrayX, reinterpret_cast<mycomplex_fftw*>(arrayK), flags);
plan_c2r = fftw_plan_dft_c2r_2d(
N0, N1, arrayK, arrayX, flags);
N0, N1, reinterpret_cast<mycomplex_fftw*>(arrayK), arrayX, flags);
#endif
gettimeofday(&end_time, NULL);
......@@ -113,7 +113,7 @@ myreal FFT2DWithFFTW2D::compute_energy_from_K(mycomplex* fieldK)
// modes i1 = iKx = 0
i1 = 0;
for (i0=0; i0<nK0; i0++)
energy_tmp += pow(cabs(fieldK[i0 * nK1]), 2);
energy_tmp += pow(abs(fieldK[i0 * nK1]), 2);
energy = energy_tmp/2;
......@@ -121,7 +121,7 @@ myreal FFT2DWithFFTW2D::compute_energy_from_K(mycomplex* fieldK)
i1 = nK1 - 1;
energy_tmp = 0.;
for (i0=0; i0<nK0; i0++)
energy_tmp += pow(cabs(fieldK[i1 + i0 * nK1]), 2);
energy_tmp += pow(abs(fieldK[i1 + i0 * nK1]), 2);
if (nX1 % 2 == 0)
energy_tmp = energy_tmp/2;
......@@ -131,7 +131,7 @@ myreal FFT2DWithFFTW2D::compute_energy_from_K(mycomplex* fieldK)
// other modes
for (i0=0; i0<nK0loc; i0++)
for (i1=1; i1<nK1-1; i1++)
energy += pow(cabs(fieldK[i1 + i0 * nK1]), 2);
energy += pow(abs(fieldK[i1 + i0 * nK1]), 2);
return energy;
}
......@@ -184,7 +184,7 @@ myreal FFT2DWithFFTW2D::compute_mean_from_X(myreal* fieldX)
myreal FFT2DWithFFTW2D::compute_mean_from_K(mycomplex* fieldK)
{
myreal mean = creal(fieldK[0]);
myreal mean = real(fieldK[0]);
return mean;
}
......
......@@ -22,7 +22,7 @@ class FFT2DWithFFTW2D: public BaseFFT2D
void init_array_X_random(myreal* &fieldX);
private:
int coef_norm;
myreal coef_norm;
myfftw_plan plan_r2c, plan_c2r;
myreal *arrayX;
mycomplex *arrayK;
......
......@@ -57,13 +57,13 @@ FFT2DMPIWithFFTW1D::FFT2DMPIWithFFTW1D(int argN0, int argN1):
1, &N1, howmany,
arrayX, NULL,
istride, N1,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
ostride, nKx+1,
flags);
plan_c2r = fftw_plan_many_dft_c2r(
1, &N1, howmany,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
istride, nKx+1,
arrayX, NULL,
ostride, N1,
......@@ -73,18 +73,18 @@ FFT2DMPIWithFFTW1D::FFT2DMPIWithFFTW1D(int argN0, int argN1):
sign = FFTW_FORWARD;
plan_c2c_fwd = fftw_plan_many_dft(
1, &N0, howmany,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
istride, N0,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
ostride, N0,
sign, flags);
sign = FFTW_BACKWARD;
plan_c2c_bwd = fftw_plan_many_dft(
1, &N0, howmany,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
istride, N0,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
ostride, N0,
sign, flags);
......@@ -187,7 +187,7 @@ myreal FFT2DMPIWithFFTW1D::compute_energy_from_K(mycomplex* fieldK)
// modes i0 = iKx = 0
i0 = 0;
for (i1=0; i1<nK1; i1++)
energy_tmp += pow(cabs(fieldK[i1]), 2);
energy_tmp += pow(abs(fieldK[i1]), 2);
if (rank == 0) // i.e. if iKx == 0
energy_loc = energy_tmp/2;
......@@ -197,7 +197,7 @@ myreal FFT2DMPIWithFFTW1D::compute_energy_from_K(mycomplex* fieldK)
// other modes
for (i0=1; i0<nK0loc; i0++)
for (i1=0; i1<nK1; i1++)
energy_loc += pow(cabs(fieldK[i1 + i0*nK1]), 2);
energy_loc += pow(abs(fieldK[i1 + i0*nK1]), 2);
MPI_Allreduce(&energy_loc, &energy, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
......@@ -254,7 +254,7 @@ myreal FFT2DMPIWithFFTW1D::compute_mean_from_K(mycomplex* fieldK)
{
myreal mean;
if (rank == 0)
mean = creal(fieldK[0]);
mean = real(fieldK[0]);
MPI_Bcast(&mean, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
......
......@@ -24,7 +24,7 @@ class FFT2DMPIWithFFTW1D: public BaseFFT2DMPI
void init_array_X_random(myreal* &fieldX);
private:
int coef_norm;
myreal coef_norm;
fftw_plan plan_r2c, plan_c2c_fwd, plan_c2r, plan_c2c_bwd;
myreal *arrayX;
mycomplex *arrayK_pR, *arrayK_pC;
......
......@@ -69,18 +69,18 @@ FFT2DMPIWithFFTWMPI2D::FFT2DMPIWithFFTWMPI2D(int argN0, int argN1):
flags|FFTW_MPI_TRANSPOSED_IN);
#else
arrayX = fftw_alloc_real(2 * alloc_local);
arrayK = fftw_alloc_complex(alloc_local);
arrayK = reinterpret_cast<mycomplex*>(fftw_alloc_complex(alloc_local));
gettimeofday(&start_time, NULL);
plan_r2c = fftw_mpi_plan_dft_r2c_2d(
N0, N1, arrayX,
arrayK, MPI_COMM_WORLD,
reinterpret_cast<mycomplex_fftw*>(arrayK), MPI_COMM_WORLD,
flags|FFTW_MPI_TRANSPOSED_OUT);
plan_c2r = fftw_mpi_plan_dft_c2r_2d(
N0, N1,
arrayK, arrayX,
reinterpret_cast<mycomplex_fftw*>(arrayK), arrayX,
MPI_COMM_WORLD,
flags|FFTW_MPI_TRANSPOSED_IN);
#endif
......@@ -149,7 +149,7 @@ myreal FFT2DMPIWithFFTWMPI2D::compute_energy_from_K(mycomplex* fieldK)
// modes i0 = iKx = 0
i0 = 0;
for (i1=0; i1<nK1; i1++)
energy_tmp += pow(cabs(fieldK[i1]), 2);
energy_tmp += pow(abs(fieldK[i1]), 2);
if (local_K0_start == 0) // i.e. if iKx == 0
energy_loc = energy_tmp/2;
......@@ -161,7 +161,7 @@ myreal FFT2DMPIWithFFTWMPI2D::compute_energy_from_K(mycomplex* fieldK)
energy_tmp = 0.;
i_tmp = i0 * nK1;
for (i1=0; i1<nK1; i1++)
energy_tmp += pow(cabs(fieldK[i1 + i_tmp]), 2);
energy_tmp += pow(abs(fieldK[i1 + i_tmp]), 2);
if (rank == nb_proc - 1)
energy_loc += energy_tmp/2;
......@@ -171,7 +171,7 @@ myreal FFT2DMPIWithFFTWMPI2D::compute_energy_from_K(mycomplex* fieldK)
// other modes
for (i0=1; i0<nK0loc-1; i0++)
for (i1=0; i1<nK1; i1++)
energy_loc += pow(cabs(fieldK[i1 + i0*nK1]), 2);
energy_loc += pow(abs(fieldK[i1 + i0*nK1]), 2);
#ifdef SINGLE_PREC
MPI_Allreduce(&energy_loc, &energy, 1, MPI_FLOAT, MPI_SUM, MPI_COMM_WORLD);
#else
......@@ -244,7 +244,7 @@ myreal FFT2DMPIWithFFTWMPI2D::compute_mean_from_K(mycomplex* fieldK)
{
myreal mean, local_mean;
if (local_K0_start == 0)
local_mean = creal(fieldK[0]);
local_mean = real(fieldK[0]);
else
local_mean = 0.;
#ifdef SINGLE_PREC
......
#include <complex.h>
#include <fftw3-mpi.h>
#include <base_fft2dmpi.h>
......@@ -30,7 +29,7 @@ class FFT2DMPIWithFFTWMPI2D: public BaseFFT2DMPI
private:
int nX1_pad;
int coef_norm;
myreal coef_norm;
myfftw_plan plan_r2c, plan_c2r;
myreal *arrayX;
mycomplex *arrayK;
......
SINGLE_PREC:=no
OMP:=yes
CUDA:=yes
PFFT:=yes
P3DFFT:=yes
OMP:=no
CUDA:=no
PFFT:=no
P3DFFT:=no
LD:=mpic++
CC:=mpic++
......
......@@ -66,7 +66,6 @@ FFT3DWithCUFFT::FFT3DWithCUFFT(int argN0, int argN1, int argN2):
coef_norm = N0*N1*N2;
mem_sizer = sizeof(myreal) * N0 * N1 * N2 ;//taille de arrayX
int new_size = nK0 * nK1 * nK2 ;
mem_size = 2 * sizeof(myreal) * new_size ;//taille de arrayK
......@@ -149,7 +148,7 @@ myreal FFT3DWithCUFFT::compute_energy_from_K(mycomplex* fieldK)
i2 = nK2 - 1;
for (i0=0; i0<nK0; i0++)
for (i1=0; i1<nK1; i1++)
energy += (double) pow(cabs(fieldK[i2 + (i1 + i0*nK1)*nK2]), 2);
energy += (double) pow(abs(fieldK[i2 + (i1 + i0*nK1)*nK2]), 2);
// we must divide by 2 ==> after
energy *= 0.5; //divide by 2!!!
......@@ -158,13 +157,13 @@ myreal FFT3DWithCUFFT::compute_energy_from_K(mycomplex* fieldK)
for (i0=0; i0<nK0; i0++)
for (i1=0; i1<nK1; i1++)
for (i2=1; i2<nK2-1; i2++)
energy += (double) pow(cabs(fieldK[i2 + (i1 + i0*nK1)*nK2]), 2);
energy += (double) pow(abs(fieldK[i2 + (i1 + i0*nK1)*nK2]), 2);
// modes i1_seq = iKx = 0
i2 = 0;
for (i0=0; i0<nK0; i0++)
for (i1=0; i1<nK1; i1++)
energy0 += (double) pow(cabs(fieldK[(i1 + i0*nK1)*nK2]), 2);
energy0 += (double) pow(abs(fieldK[(i1 + i0*nK1)*nK2]), 2);
// we must divide by 2 ==> after
energy += energy0/2.;
......@@ -267,7 +266,7 @@ myreal FFT3DWithCUFFT::compute_mean_from_X(myreal* fieldX)
myreal FFT3DWithCUFFT::compute_mean_from_K(mycomplex* fieldK)
{
myreal mean;
mean = creal(fieldK[0]);
mean = real(fieldK[0]);
return mean;
}
......
#include <stdio.h>
#include <complex.h>
#include <cuda_runtime.h>
#include <cufft.h>
#include <base_fft3d.h>
......@@ -39,7 +38,7 @@ class FFT3DWithCUFFT: public BaseFFT3D
private:
int nX2loc, nK2loc, nXxloc, nXyloc, nXzloc, nKzloc, nXx, nXy, nXz, nKyloc;
int coef_norm;
myreal coef_norm;
int mem_size;//equivalent à la taille de arrayK?
int mem_sizer;//equivalent à la taille de arrayK?
......
......@@ -51,7 +51,7 @@ FFT3DWithFFTW3D::FFT3DWithFFTW3D(int argN0, int argN1, int argN2):
arrayK = fftwf_alloc_complex(nK0 * nK1 * nK2);
#else
arrayX = fftw_alloc_real(nX0 * nX1 * nX2);
arrayK = fftw_alloc_complex(nK0 * nK1 * nK2);
arrayK = reinterpret_cast<mycomplex*>(fftw_alloc_complex(nK0 * nK1 * nK2));
#endif
gettimeofday(&start_time, NULL);
......@@ -65,16 +65,16 @@ FFT3DWithFFTW3D::FFT3DWithFFTW3D(int argN0, int argN1, int argN2):
#ifdef SINGLE_PREC
plan_r2c = fftwf_plan_dft_r2c_3d(
N0, N1, N2, arrayX, arrayK, flags);
N0, N1, N2, arrayX, reinterpret_cast<mycomplex_fftw*>(arrayK), flags);
plan_c2r = fftwf_plan_dft_c2r_3d(
N0, N1, N2, arrayK, arrayX, flags);
N0, N1, N2, reinterpret_cast<mycomplex_fftw*>(arrayK), arrayX, flags);
#else
plan_r2c = fftw_plan_dft_r2c_3d(
N0, N1, N2, arrayX, arrayK, flags);
N0, N1, N2, arrayX, reinterpret_cast<mycomplex_fftw*>(arrayK), flags);
plan_c2r = fftw_plan_dft_c2r_3d(
N0, N1, N2, arrayK, arrayX, flags);
N0, N1, N2, reinterpret_cast<mycomplex_fftw*>(arrayK), arrayX, flags);
#endif
gettimeofday(&end_time, NULL);
......@@ -152,7 +152,7 @@ myreal FFT3DWithFFTW3D::compute_energy_from_K(mycomplex* fieldK)
i2 = 0;
for (i0=0; i0<nK0; i0++)
for (i1=0; i1<nK1; i1++)
energy_tmp += (double) pow(cabs(fieldK[(i1 + i0 * nK1) * nK2]), 2);
energy_tmp += (double) pow(abs(fieldK[(i1 + i0 * nK1) * nK2]), 2);
energy = energy_tmp/2;
......@@ -161,7 +161,7 @@ myreal FFT3DWithFFTW3D::compute_energy_from_K(mycomplex* fieldK)
energy_tmp = 0.;
for (i0=0; i0<nK0; i0++)
for (i1=0; i1<nK1; i1++)
energy_tmp += (double) pow(cabs(fieldK[i2 + (i1 + i0 * nK1) * nK2]), 2);
energy_tmp += (double) pow(abs(fieldK[i2 + (i1 + i0 * nK1) * nK2]), 2);
if (N2%2 == 0)
energy += energy_tmp/2;
......@@ -172,7 +172,7 @@ myreal FFT3DWithFFTW3D::compute_energy_from_K(mycomplex* fieldK)
for (i0=0; i0<nK0loc; i0++)
for (i1=0; i1<nK1; i1++)
for (i2=1; i2<nK2-1; i2++)
energy += (double) pow(cabs(fieldK[i2 + (i1 + i0 * nK1) * nK2]), 2);
energy += (double) pow(abs(fieldK[i2 + (i1 + i0 * nK1) * nK2]), 2);
return (myreal) energy;
}
......@@ -225,7 +225,7 @@ void FFT3DWithFFTW3D::sum_wavenumbers_complex(mycomplex* fieldK, mycomplex* resu
for (i1=0; i1<nK1; i1++)
sum_tmp += fieldK[(i1 + i0 * nK1) * nK2];
sum = sum_tmp/2;
sum = sum_tmp/2.;
// modes i2 = iKx = last = nK2 - 1
i2 = nK2 - 1;
......@@ -235,7 +235,7 @@ void FFT3DWithFFTW3D::sum_wavenumbers_complex(mycomplex* fieldK, mycomplex* resu
sum_tmp += fieldK[i2 + (i1 + i0 * nK1) * nK2];
if (N2%2 == 0)
sum += sum_tmp/2;
sum += sum_tmp/2.;
else
sum += sum_tmp;
......@@ -272,7 +272,7 @@ myreal FFT3DWithFFTW3D::compute_mean_from_X(myreal* fieldX)
myreal FFT3DWithFFTW3D::compute_mean_from_K(mycomplex* fieldK)
{
myreal mean = creal(fieldK[0]);
myreal mean = real(fieldK[0]);
return mean;
}
......
......@@ -24,7 +24,7 @@ class FFT3DWithFFTW3D: public BaseFFT3D
void init_array_X_random(myreal* &fieldX);
private:
int coef_norm;
myreal coef_norm;
myreal *arrayX;
myfftw_plan plan_r2c, plan_c2r;
......
......@@ -69,13 +69,13 @@ FFT3DMPIWithFFTW1D::FFT3DMPIWithFFTW1D(int argN0, int argN1, int argN2):
1, &N2, howmany,
arrayX, NULL,
1, N2,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
N1*nX0loc, 1,
flags);
plan_c2r = fftw_plan_many_dft_c2r(
1, &N2, howmany,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
N1*nX0loc, 1,
arrayX, NULL,
1, N2,
......@@ -84,18 +84,18 @@ FFT3DMPIWithFFTW1D::FFT3DMPIWithFFTW1D(int argN0, int argN1, int argN2):
sign = FFTW_FORWARD;
plan_c2c1_fwd = fftw_plan_many_dft(
1, &N1, howmany,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
1, N1,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
1, N1,
sign, flags);
sign = FFTW_BACKWARD;
plan_c2c1_bwd = fftw_plan_many_dft(
1, &N1, howmany,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
1, N1,
arrayK_pR, NULL,
reinterpret_cast<mycomplex_fftw*>(arrayK_pR), NULL,
1, N1,
sign, flags);
......@@ -103,18 +103,18 @@ FFT3DMPIWithFFTW1D::FFT3DMPIWithFFTW1D(int argN0, int argN1, int argN2):
sign = FFTW_FORWARD;
plan_c2c_fwd = fftw_plan_many_dft(
1, &N0, howmany,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
istride, N0,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
ostride, N0,
sign, flags);
sign = FFTW_BACKWARD;
plan_c2c_bwd = fftw_plan_many_dft(
1, &N0, howmany,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
istride, N0,
arrayK_pC, &N0,
reinterpret_cast<mycomplex_fftw*>(arrayK_pC), &N0,
ostride, N0,
sign, flags);
......@@ -208,10 +208,10 @@ myreal FFT3DMPIWithFFTW1D::compute_energy_from_K(mycomplex* fieldK)
i0 = 0;
for (i1=0; i1<nK1; i1++)
for (i2=0; i2<nK2; i2++)
energy_tmp += pow(cabs(fieldK[i1*nK2 + i2]), 2);
energy_tmp += pow(abs(fieldK[i1*nK2 + i2]), 2);
if (rank == 0) // i.e. if iKx == 0
energy_loc = energy_tmp/2;
energy_loc = energy_tmp/2.;
else
energy_loc = energy_tmp;
......@@ -219,7 +219,7 @@ myreal FFT3DMPIWithFFTW1D::compute_energy_from_K(mycomplex* fieldK)
for (i0=1; i0<nK0loc; i0++)
for (i1=0; i1<nK1; i1++)
for (i2=0; i2<nK2; i2++)
energy_loc += pow(cabs(fieldK[i2 + i1*nK2 + i0*nK1*nK2]), 2);
energy_loc += pow(abs(fieldK[i2 + i1*nK2 + i0*nK1*nK2]), 2);
MPI_Allreduce(&energy_loc, &energy, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
// cout << "energy" << energy << endl;
......@@ -242,7 +242,7 @@ myreal FFT3DMPIWithFFTW1D::sum_wavenumbers_double(myreal* fieldK)
sum_tmp += fieldK[i2 + i1*nK2];
if (rank == 0) // i.e. if iKx == 0
sum_loc = sum_tmp/2;
sum_loc = sum_tmp/2.;
else
sum_loc = sum_tmp;
......@@ -274,7 +274,7 @@ void FFT3DMPIWithFFTW1D::sum_wavenumbers_complex(
sum_tmp += fieldK[i2 + i1*nK2];