Skip to content
Snippets Groups Projects
Commit 4ecbfff3 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

use FFTW(complex) explicitly instead of C

one more step towards avoiding stupid problems...
parent e001cb9d
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ void fluid_solver<rnumber>::impose_zero_modes()
/*****************************************************************************/
/* macro for specializations to numeric types compatible with FFTW */
#define FLUID_SOLVER_DEFINITIONS(FFTW, R, C, MPI_RNUM, MPI_CNUM) \
#define FLUID_SOLVER_DEFINITIONS(FFTW, R, MPI_RNUM, MPI_CNUM) \
\
template<> \
fluid_solver<R>::fluid_solver( \
......@@ -186,7 +186,7 @@ void fluid_solver<R>::compute_vorticity() \
} \
\
template<> \
void fluid_solver<R>::compute_velocity(C *vorticity) \
void fluid_solver<R>::compute_velocity(FFTW(complex) *vorticity) \
{ \
double k2; \
std::fill_n((R*)this->cu, this->cd->local_size*2, 0.0); \
......@@ -239,7 +239,7 @@ void fluid_solver<R>::dft_vorticity() \
\
template<> \
void fluid_solver<R>::add_forcing(\
C *field, R factor) \
FFTW(complex) *field, R factor) \
{ \
if (strcmp(this->forcing_type, "none") == 0) \
return; \
......@@ -451,13 +451,11 @@ int fluid_solver<R>::write(char field, char representation) \
FLUID_SOLVER_DEFINITIONS(
FFTW_MANGLE_FLOAT,
float,
fftwf_complex,
MPI_FLOAT,
MPI_COMPLEX)
FLUID_SOLVER_DEFINITIONS(
FFTW_MANGLE_DOUBLE,
double,
fftw_complex,
MPI_DOUBLE,
BFPS_MPICXX_DOUBLE_COMPLEX)
/*****************************************************************************/
......
......@@ -106,7 +106,7 @@ void fluid_solver_base<rnumber>::write_spectrum(const char *fname, cnumber *a, c
/*****************************************************************************/
/* macro for specializations to numeric types compatible with FFTW */
#define FLUID_SOLVER_BASE_DEFINITIONS(FFTW, R, C, MPI_RNUM, MPI_CNUM) \
#define FLUID_SOLVER_BASE_DEFINITIONS(FFTW, R, MPI_RNUM, MPI_CNUM) \
\
template<> \
fluid_solver_base<R>::fluid_solver_base( \
......@@ -246,7 +246,7 @@ fluid_solver_base<R>::~fluid_solver_base() \
} \
\
template<> \
R fluid_solver_base<R>::correl_vec(C *a, C *b) \
R fluid_solver_base<R>::correl_vec(FFTW(complex) *a, FFTW(complex) *b) \
{ \
double val_process = 0.0, val; \
double k2; \
......@@ -275,7 +275,7 @@ R fluid_solver_base<R>::correl_vec(C *a, C *b) \
} \
\
template<> \
void fluid_solver_base<R>::low_pass_Fourier(C *a, const int howmany, const double kmax) \
void fluid_solver_base<R>::low_pass_Fourier(FFTW(complex) *a, const int howmany, const double kmax) \
{ \
double k2; \
const double km2 = kmax*kmax; \
......@@ -303,7 +303,7 @@ void fluid_solver_base<R>::low_pass_Fourier(C *a, const int howmany, const doubl
} \
\
template<> \
void fluid_solver_base<R>::dealias(C *a, const int howmany) \
void fluid_solver_base<R>::dealias(FFTW(complex) *a, const int howmany) \
{ \
if (this->dealias_type == 0) \
{ \
......@@ -326,10 +326,10 @@ void fluid_solver_base<R>::dealias(C *a, const int howmany) \
} \
\
template<> \
void fluid_solver_base<R>::force_divfree(C *a) \
void fluid_solver_base<R>::force_divfree(FFTW(complex) *a) \
{ \
double k2; \
C tval; \
FFTW(complex) tval; \
CLOOP( \
k2 = (this->kx[xindex]*this->kx[xindex] + \
this->ky[yindex]*this->ky[yindex] + \
......@@ -354,7 +354,7 @@ void fluid_solver_base<R>::force_divfree(C *a) \
} \
\
template<> \
void fluid_solver_base<R>::symmetrize(C *data, const int howmany) \
void fluid_solver_base<R>::symmetrize(FFTW(complex) *data, const int howmany) \
{ \
ptrdiff_t ii, cc; \
MPI_Status *mpistatus = new MPI_Status[1]; \
......@@ -370,7 +370,7 @@ void fluid_solver_base<R>::symmetrize(C *data, const int howmany) \
-(*(data + cc + howmany*( ii)*this->cd->sizes[2]))[1]; \
} \
} \
C *buffer; \
FFTW(complex) *buffer; \
buffer = FFTW(alloc_complex)(howmany*this->cd->sizes[1]); \
ptrdiff_t yy; \
/*ptrdiff_t tindex;*/ \
......@@ -439,7 +439,7 @@ int fluid_solver_base<R>::read_base(const char *fname, R *data) \
} \
\
template<> \
int fluid_solver_base<R>::read_base(const char *fname, C *data) \
int fluid_solver_base<R>::read_base(const char *fname, FFTW(complex) *data) \
{ \
char full_name[512]; \
sprintf(full_name, "%s_%s_i%.5x", this->name, fname, this->iteration); \
......@@ -455,7 +455,7 @@ int fluid_solver_base<R>::write_base(const char *fname, R *data) \
} \
\
template<> \
int fluid_solver_base<R>::write_base(const char *fname, C *data) \
int fluid_solver_base<R>::write_base(const char *fname, FFTW(complex) *data) \
{ \
char full_name[512]; \
sprintf(full_name, "%s_%s_i%.5x", this->name, fname, this->iteration); \
......@@ -471,13 +471,11 @@ int fluid_solver_base<R>::write_base(const char *fname, C *data) \
FLUID_SOLVER_BASE_DEFINITIONS(
FFTW_MANGLE_FLOAT,
float,
fftwf_complex,
MPI_FLOAT,
MPI_COMPLEX)
FLUID_SOLVER_BASE_DEFINITIONS(
FFTW_MANGLE_DOUBLE,
double,
fftw_complex,
MPI_DOUBLE,
BFPS_MPICXX_DOUBLE_COMPLEX)
/*****************************************************************************/
......
......@@ -104,7 +104,7 @@ void tracers<rnumber>::update_field(bool clip_on)
/*****************************************************************************/
/* macro for specializations to numeric types compatible with FFTW */
#define TRACERS_DEFINITIONS(FFTW, R, C, MPI_RNUM, MPI_CNUM) \
#define TRACERS_DEFINITIONS(FFTW, R, MPI_RNUM, MPI_CNUM) \
\
template <> \
tracers<R>::tracers( \
......@@ -143,13 +143,11 @@ tracers<R>::~tracers() \
TRACERS_DEFINITIONS(
FFTW_MANGLE_FLOAT,
float,
fftwf_complex,
MPI_FLOAT,
MPI_COMPLEX)
TRACERS_DEFINITIONS(
FFTW_MANGLE_DOUBLE,
double,
fftw_complex,
MPI_DOUBLE,
BFPS_MPICXX_DOUBLE_COMPLEX)
/*****************************************************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment