OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
FFTBase.hpp
Go to the documentation of this file.
1 //
2 // IPPL FFT
3 //
4 // Copyright (c) 2008-2018
5 // Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved.
7 //
8 // OPAL is licensed under GNU GPL version 3.
9 //
10 
11 #include "FFT/FFTBase.h"
12 #include "Utility/PAssert.h"
13 
14 /***************************************************************************
15  FFTBase.cpp: constructors and write() member function for FFTBase class
16 ***************************************************************************/
17 
18 // instantiate static null GC object
19 template <unsigned Dim, class T>
21 
22 //=============================================================================
23 // FFTBase Constructors
24 //=============================================================================
25 
26 template <unsigned Dim, class T>
28  const FFTBase<Dim,T>::Domain_t& domain,
29  const bool transformTheseDims[Dim], bool compressTemps)
30 : transformType_m(transform), // transform type
31  Domain_m(domain), // field domain
32  compressTempFields_m(compressTemps) // compress temp fields?
33 {
34 
35  // Tau profiling
36 
37  // Store which dims are transformed, and count up how many there are
38  nTransformDims_m = 0;
39  unsigned d;
40  for (d=0; d<Dim; ++d) {
41  transformDims_m[d] = transformTheseDims[d];
42  if (transformTheseDims[d]) ++nTransformDims_m;
43  }
44 
45  // check that at least one dimension is being transformed
46  PInsist(nTransformDims_m>0,"Must transform at least one axis!!");
47 
48  // Store the "names" (0,1,2) of these dims in an array of computed size
49  activeDims_m = new unsigned[nTransformDims_m];
50  int icount = 0;
51  for (d=0; d<Dim; ++d)
52  if (transformDims_m[d]) activeDims_m[icount++] = d;
53 
54 }
55 
56 template <unsigned Dim, class T>
58  const FFTBase<Dim,T>::Domain_t& domain,
59  bool compressTemps)
60 : transformType_m(transform), // transform type
61  Domain_m(domain), // field domain
62  compressTempFields_m(compressTemps) // compress temp fields?
63 {
64 
65  // Tau profiling
66 
67  // Default, transform all dims:
69  activeDims_m = new unsigned[Dim];
70  for (unsigned d=0; d<Dim; d++) {
71  transformDims_m[d] = true;
72  activeDims_m[d] = d;
73  }
74 
75 }
76 
77 //-----------------------------------------------------------------------------
78 // I/O: write out information about FFT object:
79 //-----------------------------------------------------------------------------
80 
81 template <unsigned Dim, class T>
82 void FFTBase<Dim,T>::write(std::ostream& out) const {
83 
84  // Tau profiling
85 
86  // Dump contents of FFT object
87  out << "---------------FFT Object Dump Begin-------------------" << std::endl;
88  // Output the user-defined names for transform directions:
89  out << "Map of transform direction names:" << std::endl;
90  std::map<char*,unsigned>::const_iterator mi, m_end = directions_m.end();
91  for (mi = directions_m.begin(); mi != m_end; ++mi)
92  out << "[" << (*mi).first << "," << (*mi).second << "]" << std::endl;
93  // Output type of transform
94  out << "Transform type = " << getTransformType(transformType_m) << std::endl;
95  // Output which dims are transformed:
96  out << "Transform dimensions: ";
97  for (unsigned d=0; d<Dim; ++d) {
98  out << "dim " << d << " = ";
99  if (transformDims_m[d])
100  out << "true" << std::endl;
101  else
102  out << "false" << std::endl;
103  }
104  out << std::endl;
105  out << "Input Field domain = " << Domain_m << std::endl; // Output the domain.
106  out << "---------------FFT Object Dump End---------------------" << std::endl;
107 
108  return;
109 }
110 
111 // vi: set et ts=4 sw=4 sts=4:
112 // Local Variables:
113 // mode:c
114 // c-basic-offset: 4
115 // indent-tabs-mode:nil
116 // End:
FFTBase()
Definition: FFTBase.h:68
bool transformDims_m[Dim]
Indicates which dimensions are transformed.
Definition: FFTBase.h:174
std::string getTransformType(unsigned int i)
character strings for transform types
Definition: FFTBase.h:35
unsigned nTransformDims_m
Stores the number of dims to be transformed.
Definition: FFTBase.h:175
#define PInsist(c, m)
Definition: PAssert.h:135
const unsigned Dim
unsigned * activeDims_m
Stores the numbers of these dims (0,1,2).
Definition: FFTBase.h:176
void write(std::ostream &out) const
Definition: FFTBase.hpp:82
Inform & endl(Inform &inf)
Definition: Inform.cpp:42