src/FFT/FFTBase.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  * This program was prepared by PSI. 
00007  * All rights in the program are reserved by PSI.
00008  * Neither PSI nor the author(s)
00009  * makes any warranty, express or implied, or assumes any liability or
00010  * responsibility for the use of this software
00011  *
00012  * Visit http://www.acl.lanl.gov/POOMS for more details
00013  *
00014  ***************************************************************************/
00015 
00016 // -*- C++ -*-
00017 /***************************************************************************
00018  *
00019  * The IPPL Framework
00020  * 
00021  *
00022  * Visit http://people.web.psi.ch/adelmann/ for more details
00023  *
00024  ***************************************************************************/
00025 
00026 // include files
00027 #include "FFT/FFTBase.h"
00028 #include "Utility/PAssert.h"
00029 
00030 /***************************************************************************
00031   FFTBase.cpp:  constructors and write() member function for FFTBase class
00032  ***************************************************************************/
00033 
00034 
00035 // instantiate static null GC object
00036 template <unsigned Dim, class T>
00037 GuardCellSizes<Dim> FFTBase<Dim,T>::nullGC = GuardCellSizes<Dim>();
00038 
00039 //=============================================================================
00040 // FFTBase Constructors
00041 //=============================================================================
00042 
00043 template <unsigned Dim, class T>
00044 FFTBase<Dim,T>::FFTBase(FFTBase<Dim,T>::FFT_e transform,
00045                         const FFTBase<Dim,T>::Domain_t& domain, 
00046                         const bool transformTheseDims[Dim], bool compressTemps)
00047   : transformType_m(transform),               // transform type
00048     Domain_m(domain),                         // field domain
00049     compressTempFields_m(compressTemps)       // compress temp fields?
00050 {
00051 
00052   // Tau profiling
00053   TAU_TYPE_STRING(taustr, " (FFT_e, " + CT(domain) + ", bool [], bool)");
00054   TAU_PROFILE("FFTBase::FFTBase", taustr, TAU_FFT);
00055 
00056   // Store which dims are transformed, and count up how many there are
00057   nTransformDims_m = 0;
00058   unsigned d;
00059   for (d=0; d<Dim; ++d) {
00060     transformDims_m[d] = transformTheseDims[d];
00061     if (transformTheseDims[d]) ++nTransformDims_m;
00062   }
00063 
00064   // check that at least one dimension is being transformed
00065   PInsist(nTransformDims_m>0,"Must transform at least one axis!!");
00066 
00067   // Store the "names" (0,1,2) of these dims in an array of computed size
00068   activeDims_m = new unsigned[nTransformDims_m];
00069   int icount = 0;
00070   for (d=0; d<Dim; ++d)
00071     if (transformDims_m[d]) activeDims_m[icount++] = d;
00072 
00073 }
00074 
00075 template <unsigned Dim, class T>
00076 FFTBase<Dim,T>::FFTBase(FFTBase<Dim,T>::FFT_e transform,
00077                         const FFTBase<Dim,T>::Domain_t& domain,
00078                         bool compressTemps) 
00079   : transformType_m(transform),               // transform type
00080     Domain_m(domain),                         // field domain
00081     compressTempFields_m(compressTemps)       // compress temp fields?
00082 {
00083 
00084   // Tau profiling
00085   TAU_TYPE_STRING(taustr, " (FFT_e, " + CT(domain) + ", bool)");
00086   TAU_PROFILE("FFTBase::FFTBase", taustr, TAU_FFT); 
00087 
00088   // Default, transform all dims:
00089   nTransformDims_m = Dim;
00090   activeDims_m = new unsigned[Dim];
00091   for (unsigned d=0; d<Dim; d++) {
00092     transformDims_m[d] = true;
00093     activeDims_m[d] = d;
00094   }
00095 
00096 }
00097 
00098 //-----------------------------------------------------------------------------
00099 // I/O: write out information about FFT object:
00100 //-----------------------------------------------------------------------------
00101 
00102 template <unsigned Dim, class T>
00103 void FFTBase<Dim,T>::write(ostream& out) const {
00104 
00105   // Tau profiling
00106   TAU_TYPE_STRING(taustr, " (ostream&)");
00107   TAU_PROFILE("void " + CT(*this) + "::write", taustr, TAU_FFT | TAU_IO);
00108 
00109   // Dump contents of FFT object
00110   out << "---------------FFT Object Dump Begin-------------------" << endl;
00111   // Output the user-defined names for transform directions:
00112   out << "Map of transform direction names:" << endl;
00113   map<char*,unsigned>::const_iterator mi, m_end = directions_m.end();
00114   for (mi = directions_m.begin(); mi != m_end; ++mi)
00115     out << "[" << (*mi).first << "," << (*mi).second << "]" << endl;
00116   // Output type of transform
00117   out << "Transform type = " << transformTypeString_g[transformType_m] << endl;
00118   // Output which dims are transformed:
00119   out << "Transform dimensions: ";
00120   for (unsigned d=0; d<Dim; ++d) {
00121     out << "dim " << d << " = ";
00122     if (transformDims_m[d])
00123       out << "true" << endl;
00124     else
00125       out << "false" << endl;
00126   }
00127   out << endl;
00128   out << "Input Field domain = " << Domain_m << endl; // Output the domain.
00129   out << "---------------FFT Object Dump End---------------------" << endl;
00130 
00131   return;
00132 }
00133 
00134 
00135 /***************************************************************************
00136  * $RCSfile: FFTBase.cpp,v $   $Author: adelmann $
00137  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:25 $
00138  * IPPL_VERSION_ID: $Id: FFTBase.cpp,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $ 
00139  ***************************************************************************/

Generated on Mon Jan 16 13:23:42 2006 for IPPL by  doxygen 1.4.6