FFTCompute Class Reference

#include <PmeSolverUtil.h>

Inheritance diagram for FFTCompute:

CudaFFTCompute List of all members.

Public Member Functions

 FFTCompute ()
void init (float *dataSrc_in, int dataSrcSize_in, float *dataDst_in, int dataDstSize_in, int permutation, PmeGrid pmeGrid, int pmePencilType, int jblock, int kblock, int flags)
virtual ~FFTCompute ()
virtual void forward ()=0
virtual void backward ()=0
float * getDataSrc ()
float * getDataDst ()

Protected Attributes

int jblock
int kblock
int isize
int jsize
int ksize
float * dataSrc
float * dataDst
int dataSrcSize
int dataDstSize
bool dataSrcAllocated
bool dataDstAllocated

Detailed Description

Definition at line 125 of file PmeSolverUtil.h.


Constructor & Destructor Documentation

FFTCompute::FFTCompute (  )  [inline]

Definition at line 127 of file PmeSolverUtil.h.

References dataDst, dataDstAllocated, dataDstSize, dataSrc, dataSrcAllocated, and dataSrcSize.

00127                {
00128     dataSrc = NULL;
00129     dataSrcSize = 0;
00130     dataSrcAllocated = false;
00131     dataDst = NULL;
00132     dataDstSize = 0;
00133     dataDstAllocated = false;
00134   }

virtual FFTCompute::~FFTCompute (  )  [inline, virtual]

Definition at line 213 of file PmeSolverUtil.h.

00213 {}


Member Function Documentation

virtual void FFTCompute::backward (  )  [pure virtual]

Implemented in CudaFFTCompute.

virtual void FFTCompute::forward (  )  [pure virtual]

Implemented in CudaFFTCompute.

float* FFTCompute::getDataDst (  )  [inline]

Definition at line 217 of file PmeSolverUtil.h.

References dataDst.

00217 {return dataDst;}

float* FFTCompute::getDataSrc (  )  [inline]

Definition at line 216 of file PmeSolverUtil.h.

References dataSrc.

00216 {return dataSrc;}

void FFTCompute::init ( float *  dataSrc_in,
int  dataSrcSize_in,
float *  dataDst_in,
int  dataDstSize_in,
int  permutation,
PmeGrid  pmeGrid,
int  pmePencilType,
int  jblock,
int  kblock,
int  flags 
) [inline]

Definition at line 135 of file PmeSolverUtil.h.

References dataDst, dataDstAllocated, dataDstSize, dataSrc, dataSrcAllocated, dataSrcSize, getPencilDim(), PmeGrid::K1, PmeGrid::K2, PmeGrid::K3, NAMD_bug(), Perm_cX_Y_Z, Perm_X_Y_Z, Perm_Y_Z_cX, Perm_Z_cX_Y, PmeGrid::xBlocks, PmeGrid::yBlocks, and PmeGrid::zBlocks.

00139                                                           {
00140 
00141     if (dataSrc_in != NULL && dataSrc_in == dataDst_in)
00142       NAMD_bug("FFTCompute::init, only out-of-place FFTs supported");
00143 
00144     int permutationDst = permutation;
00145     if (permutation == Perm_X_Y_Z) {
00146       permutationDst = Perm_cX_Y_Z;
00147     }
00148 
00149     if (dataSrc_in == NULL) {
00150       // Sets data and dataSize
00151       dataSrcSize = getDataSizeRequired(permutation, pmeGrid, jblock, kblock);
00152       dataSrc = allocateData(dataSrcSize);
00153       dataSrcAllocated = true;
00154     } else {
00155       if (dataSrcSize_in < getDataSizeRequired(permutation, pmeGrid, jblock, kblock))
00156         NAMD_bug("FFTCompute::init, invalid dataSrcSize_in");
00157       dataSrcSize = dataSrcSize_in;
00158       dataSrc = dataSrc_in;
00159       dataSrcAllocated = false;
00160     }
00161 
00162     if (dataDst_in == NULL) {
00163       // Sets data and dataSize
00164       dataDstSize = getDataSizeRequired(permutationDst, pmeGrid, jblock, kblock);
00165       dataDst = allocateData(dataDstSize);
00166       dataDstAllocated = true;
00167     } else {
00168       if (dataDstSize_in < getDataSizeRequired(permutationDst, pmeGrid, jblock, kblock))
00169         NAMD_bug("FFTCompute::init, invalid dataDstSize_in");
00170       dataDstSize = dataDstSize_in;
00171       dataDst = dataDst_in;
00172       dataDstAllocated = false;
00173     }
00174 
00175     // Final sanity check
00176     if (dataDst == NULL || dataSrc == NULL ||
00177       dataDstSize < getDataSizeRequired(permutationDst, pmeGrid, jblock, kblock) ||
00178       dataSrcSize < getDataSizeRequired(permutation, pmeGrid, jblock, kblock))
00179       NAMD_bug("FFTCompute::init, error setting up data buffers");
00180 
00181     // Now "data" is pointer to grid data with at least size getDataSizeRequired(...)
00182     if (pmePencilType == 3) {
00183       // 3D FFT
00184       if (pmeGrid.xBlocks != 1 || pmeGrid.yBlocks != 1 || pmeGrid.zBlocks != 1)
00185         NAMD_bug("FFTCompute::init, 3D FFT requires a single pencil");
00186       int n[3] = {pmeGrid.K1, pmeGrid.K2, pmeGrid.K3};
00187       plan3D(n, flags);
00188     } else if (pmePencilType == 1) {
00189       int i0, i1, j0, j1, k0, k1;
00190       getPencilDim(pmeGrid, permutation, jblock, kblock, i0, i1, j0, j1, k0, k1);
00191       int n[1] = {i1-i0+1};
00192       int howmany = (j1-j0+1)*(k1-k0+1);
00193       if (permutation == Perm_X_Y_Z) {
00194         plan1DX(n, howmany, flags);
00195       } else if (permutation == Perm_Y_Z_cX) {
00196         plan1DY(n, howmany, flags);
00197       } else if (permutation == Perm_Z_cX_Y) {
00198         plan1DZ(n, howmany, flags);
00199       } else {
00200         NAMD_bug("FFTCompute::init, invalid permutation");
00201       }
00202     } else if (pmePencilType == 2) {
00203       // 2D FFTs of xy planes
00204       int i0, i1, j0, j1, k0, k1;
00205       getPencilDim(pmeGrid, permutation, 0, kblock, i0, i1, j0, j1, k0, k1);
00206       int n[2] = {pmeGrid.K1, pmeGrid.K2};
00207       int howmany = k1-k0+1;
00208       plan2D(n, howmany, flags);
00209     } else {
00210       NAMD_bug("FFTCompute::init, invalid pmePencilType");
00211     }       
00212   }


Member Data Documentation

float* FFTCompute::dataDst [protected]

Definition at line 223 of file PmeSolverUtil.h.

Referenced by CudaFFTCompute::backward(), FFTCompute(), CudaFFTCompute::forward(), getDataDst(), init(), and CudaFFTCompute::~CudaFFTCompute().

bool FFTCompute::dataDstAllocated [protected]

Definition at line 229 of file PmeSolverUtil.h.

Referenced by FFTCompute(), init(), and CudaFFTCompute::~CudaFFTCompute().

int FFTCompute::dataDstSize [protected]

Definition at line 226 of file PmeSolverUtil.h.

Referenced by FFTCompute(), and init().

float* FFTCompute::dataSrc [protected]

Definition at line 222 of file PmeSolverUtil.h.

Referenced by CudaFFTCompute::backward(), FFTCompute(), CudaFFTCompute::forward(), getDataSrc(), init(), and CudaFFTCompute::~CudaFFTCompute().

bool FFTCompute::dataSrcAllocated [protected]

Definition at line 228 of file PmeSolverUtil.h.

Referenced by FFTCompute(), init(), and CudaFFTCompute::~CudaFFTCompute().

int FFTCompute::dataSrcSize [protected]

Definition at line 225 of file PmeSolverUtil.h.

Referenced by FFTCompute(), and init().

int FFTCompute::isize [protected]

Definition at line 220 of file PmeSolverUtil.h.

int FFTCompute::jblock [protected]

Definition at line 219 of file PmeSolverUtil.h.

int FFTCompute::jsize [protected]

Definition at line 220 of file PmeSolverUtil.h.

int FFTCompute::kblock [protected]

Definition at line 219 of file PmeSolverUtil.h.

int FFTCompute::ksize [protected]

Definition at line 220 of file PmeSolverUtil.h.


The documentation for this class was generated from the following file:
Generated on Tue Nov 21 01:17:18 2017 for NAMD by  doxygen 1.4.7