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