59 #include <AMReX_Config.H>
62 #include <fftw3_essl.h>
83 #define FFTW_ADDR(X) reinterpret_cast<fftw_complex*>(&(X)[0])
144 double tdist=0.0, tdfft=0.0;
248 void forward(
float const *in,
size_t ghost0,
size_t ghost1) {
253 double start = MPI_Wtime();
259 int indexf = ghost0*(ghost0 + local_dim_r[2] + ghost1)*(ghost0 + local_dim_r[1] + ghost1);
260 for(
int local_r0=0; local_r0 < local_dim_r[0]; ++local_r0) {
261 indexf += ghost0*(ghost0 + local_dim_r[2] + ghost1);
262 for(
int local_r1=0; local_r1 < local_dim_r[1]; ++local_r1) {
264 for(
int local_r2=0; local_r2 < local_dim_r[2]; ++local_r2) {
265 m_fo[indexc] = in[indexf];
271 indexf += ghost1*(ghost0 + local_dim_r[2] + ghost1);
275 double stop = MPI_Wtime();
286 return forward(in, ghost, ghost+1);
297 double tdist=0.0, tdfft=0.0;
401 void backward(
float *out,
size_t ghost0,
size_t ghost1) {
407 double start = MPI_Wtime();
413 int indexf = ghost0*(ghost0 + local_dim_r[2] + ghost1)*(ghost0 + local_dim_r[1] + ghost1);
414 for(
int local_r0=0; local_r0 < local_dim_r[0]; ++local_r0) {
415 indexf += ghost0*(ghost0 + local_dim_r[2] + ghost1);
416 for(
int local_r1=0; local_r1 < local_dim_r[1]; ++local_r1) {
418 for(
int local_r2=0; local_r2 < local_dim_r[2]; ++local_r2) {
425 indexf += ghost1*(ghost0 + local_dim_r[2] + ghost1);
429 double stop = MPI_Wtime();
438 return backward(out, ghost, ghost+1);
455 unsigned int flags = FFTW_MEASURE)
482 unsigned int flags = FFTW_MEASURE)
484 if(forward_output == forward_scratch)
485 Error() <<
"Dfft::setBuffers() forward_output == forward_scratch";
486 if(backward_input == backward_scratch)
487 Error() <<
"Dfft::setBuffers() backward_input == backward_scratch";
489 m_fo = forward_output;
490 m_fs = forward_scratch;
491 m_bi = backward_input;
492 m_bs = backward_scratch;
495 double start = MPI_Wtime();
589 double stop = MPI_Wtime();
int MPI_Comm
Definition: AMReX_ccse-mpi.H:47
#define FFTW_ADDR(X)
Definition: Dfft.H:83
void printTimingStats(MPI_Comm comm, const char *preamble, double dt)
Definition: TimingStats.h:73
int global_ng(int i) const
Definition: Dfft.H:92
size_t local_size() const
Definition: Dfft.H:100
MPI_Comm parent_comm() const
Definition: Dfft.H:95
int const (& local_ng_kspace() const)[3]
Definition: Dfft.H:131
MPI_Comm cartcomm_rspace() const
Definition: Dfft.H:117
complex_t * m_fo
Definition: Dfft.H:617
int const (& global_ng() const)[3]
Definition: Dfft.H:93
complex_t * m_bs
Definition: Dfft.H:620
complex_t * m_fs
Definition: Dfft.H:618
int const (& nproc_rspace() const)[3]
Definition: Dfft.H:110
Distribution & d
Definition: Dfft.H:615
fftw_plan m_plan_b_x
Definition: Dfft.H:626
void forward(complex_t const *in)
Definition: Dfft.H:138
fftw_plan m_plan_f_z
Definition: Dfft.H:623
void backward(complex_t *out)
Definition: Dfft.H:291
Dfft(Distribution &dist)
Definition: Dfft.H:443
int nproc_kspace(int i) const
Definition: Dfft.H:126
int local_ng_rspace(int i) const
Definition: Dfft.H:113
void backward(float *out, size_t ghost)
Definition: Dfft.H:437
void forward(float const *in, size_t ghost0, size_t ghost1)
Definition: Dfft.H:248
int local_ng_kspace(int i) const
Definition: Dfft.H:130
void makePlans(complex_t *forward_output, complex_t *forward_scratch, complex_t *backward_input, complex_t *backward_scratch, unsigned int flags=FFTW_MEASURE)
Definition: Dfft.H:478
fftw_plan m_plan_f_x
Definition: Dfft.H:621
fftw_plan m_plan_f_y
Definition: Dfft.H:622
~Dfft()
Definition: Dfft.H:598
void backward(float *out, size_t ghost0, size_t ghost1)
Definition: Dfft.H:401
complex_t * m_bi
Definition: Dfft.H:619
fftw_plan m_plan_b_y
Definition: Dfft.H:625
int const (& self_kspace() const)[3]
Definition: Dfft.H:123
size_t global_size() const
Definition: Dfft.H:94
int const (& self_rspace() const)[3]
Definition: Dfft.H:106
Dfft(Distribution &dist, complex_t *forward_output, complex_t *forward_scratch, complex_t *backward_input, complex_t *backward_scratch, unsigned int flags=FFTW_MEASURE)
Definition: Dfft.H:450
int const (& nproc_kspace() const)[3]
Definition: Dfft.H:127
int nproc_rspace(int i) const
Definition: Dfft.H:109
fftw_plan m_plan_b_z
Definition: Dfft.H:624
int self_kspace(int i) const
Definition: Dfft.H:122
int self_rspace(int i) const
Definition: Dfft.H:105
int const (& local_ng_rspace() const)[3]
Definition: Dfft.H:114
bool PlansMade
Definition: Dfft.H:616
void forward(float const *in, size_t ghost)
Definition: Dfft.H:285
Distribution & get_d()
Definition: Dfft.H:611
MPI_Comm cartcomm_kspace() const
Definition: Dfft.H:134
Definition: Distribution.H:73
size_t global_size() const
Definition: Distribution.H:178
MPI_Comm parent_comm() const
Definition: Distribution.H:243
MPI_Comm cart_3d() const
Definition: Distribution.H:241
int local_ng_3d(int i) const
Definition: Distribution.H:191
int global_ng(int i) const
Definition: Distribution.H:186
int self_2d_z(int i) const
Definition: Distribution.H:225
MPI_Comm cart_2d_z() const
Definition: Distribution.H:240
int self_3d(int i) const
Definition: Distribution.H:226
distribution_t m_d
Definition: Distribution.H:277
int nproc_2d_z(int i) const
Definition: Distribution.H:208
int local_ng_2d_z(int i) const
Definition: Distribution.H:190
size_t local_size() const
Definition: Distribution.H:170
int nproc_3d(int i) const
Definition: Distribution.H:209
double complex complex_t
Definition: complex-type.h:79
#define real(x)
Definition: complex-type.h:83
void distribution_3_to_2(const complex_t *a, complex_t *b, distribution_t *d, int z_dim)
Definition: distribution.c:1509
void distribution_2_to_3(const complex_t *a, complex_t *b, distribution_t *d, int z_dim)
Definition: distribution.c:1495
void Error(const std::string &msg)
Print out message to cerr and exit via amrex::Abort().
Definition: AMReX.cpp:215
Definition: AlignedAllocator.h:63
process_topology_t process_topology_2_y
Definition: distribution_c.h:98
process_topology_t process_topology_2_z
Definition: distribution_c.h:97
process_topology_t process_topology_2_x
Definition: distribution_c.h:99
int n[3]
Definition: distribution_c.h:81