Bridge++  Version 1.6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fft_3d.h
Go to the documentation of this file.
1 
13 #ifndef FFT_3D_INCLUDED
14 #define FFT_3D_INCLUDED
15 
16 #ifdef USE_FFTWLIB
17 
18 // implementations
19 #include "fft.h"
20 #include "fft_3d_local.h"
21 #ifdef USE_MPI
22 #include "fft_3d_parallel1d.h"
23 #include "fft_3d_parallel3d.h"
24 #endif
25 
27 
28 #include "IO/bridgeIO.h"
29 using Bridge::vout;
30 
31 #ifdef USE_FACTORY
32 #include "factory.h"
33 #endif
34 
35 
37 
46 class FFT_3d
47 {
48 #ifdef USE_FACTORY
49  private:
50  static FFT *create_object()
51  {
52  // auto-select
53 
54  int npe_x = Communicator::npe(0);
55  int npe_y = Communicator::npe(1);
56  int npe_z = Communicator::npe(2);
57  int npe_t = Communicator::npe(3);
58 
59  if ((npe_x == 1) && (npe_y == 1) && (npe_z == 1)) {
60  // no parallelization in xyz-directions
61  return new FFT_3d_local;
62 
63 #ifdef USE_MPI
64  } else if ((npe_x == 1) && (npe_y == 1)) {
65  // parallelization only in z-direction
66  return new FFT_3d_parallel1d;
67  } else {
68  // most general case
69  return new FFT_3d_parallel3d;
70 #endif
71  }
72 
73  // default
74  return NULL;
75  }
76 
77  public:
78  static bool register_factory()
79  {
80  return FFT::Factory::Register("auto", create_object);
81  }
82 #endif
83 };
84 
85 //- #endif of #ifdef USE_FFTWLIB
86 #endif
87 #endif
BridgeIO vout
Definition: bridgeIO.cpp:503
static int npe(const int dir)
logical grid extent