NAMD
Classes | Enumerations | Functions
PmeSolverUtil.h File Reference
#include "PmeBase.h"
#include "NamdTypes.h"
#include "Lattice.h"

Go to the source code of this file.

Classes

struct  PatchInfo
 
class  FFTCompute
 
class  PmeKSpaceCompute
 
class  PmeRealSpaceCompute
 
class  PmeTranspose
 

Enumerations

enum  { Perm_X_Y_Z, Perm_cX_Y_Z, Perm_Y_Z_cX, Perm_Z_cX_Y }
 

Functions

static int getPencilIndexY (const PmeGrid &pmeGrid, const int y)
 
static int getPencilIndexZ (const PmeGrid &pmeGrid, const int z)
 
static void getPencilDim (const PmeGrid &pmeGrid, const int permutation, const int jblock, const int kblock, int &i0, int &i1, int &j0, int &j1, int &k0, int &k1)
 
static void getBlockDim (const PmeGrid &pmeGrid, const int permutation, const int iblock, const int jblock, const int kblock, int &i0, int &i1, int &j0, int &j1, int &k0, int &k1)
 

Enumeration Type Documentation

anonymous enum
Enumerator
Perm_X_Y_Z 
Perm_cX_Y_Z 
Perm_Y_Z_cX 
Perm_Z_cX_Y 

Definition at line 17 of file PmeSolverUtil.h.

Function Documentation

static void getBlockDim ( const PmeGrid pmeGrid,
const int  permutation,
const int  iblock,
const int  jblock,
const int  kblock,
int &  i0,
int &  i1,
int &  j0,
int &  j1,
int &  k0,
int &  k1 
)
static

Definition at line 86 of file PmeSolverUtil.h.

References getPencilDim(), 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.

Referenced by CudaPmeTranspose::copyDataDeviceToDevice(), CudaPmeTranspose::copyDataHostToDevice(), CudaPmeTranspose::getBuffer(), PmePencilXY::initBlockSizes(), PmePencilX::initBlockSizes(), PmePencilY::initBlockSizes(), PmePencilZ::initBlockSizes(), and PmeTranspose::PmeTranspose().

88  {
89 
90  getPencilDim(pmeGrid, permutation, jblock, kblock, i0, i1, j0, j1, k0, k1);
91 
92  int iblocks;
93 
94  switch(permutation) {
95  case Perm_X_Y_Z:
96  iblocks = pmeGrid.xBlocks;
97  break;
98  case Perm_cX_Y_Z:
99  iblocks = pmeGrid.xBlocks;
100  break;
101  case Perm_Y_Z_cX:
102  iblocks = pmeGrid.yBlocks;
103  break;
104  case Perm_Z_cX_Y:
105  iblocks = pmeGrid.zBlocks;
106  break;
107  default:
108  NAMD_bug("getBlockDim, invalid permutation");
109  break;
110  }
111 
112  if (iblock < 0 || iblock >= iblocks)
113  NAMD_bug("getBlockDim, invalid block index");
114 
115  int isize = i1-i0+1;
116 
117  i0 = isize*iblock/iblocks;
118  i1 = isize*(iblock+1)/iblocks - 1;
119 }
int zBlocks
Definition: PmeBase.h:22
static void getPencilDim(const PmeGrid &pmeGrid, const int permutation, const int jblock, const int kblock, int &i0, int &i1, int &j0, int &j1, int &k0, int &k1)
Definition: PmeSolverUtil.h:29
int yBlocks
Definition: PmeBase.h:22
void NAMD_bug(const char *err_msg)
Definition: common.C:123
int xBlocks
Definition: PmeBase.h:22
static void getPencilDim ( const PmeGrid pmeGrid,
const int  permutation,
const int  jblock,
const int  kblock,
int &  i0,
int &  i1,
int &  j0,
int &  j1,
int &  k0,
int &  k1 
)
static

Definition at line 29 of file PmeSolverUtil.h.

References 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.

Referenced by getBlockDim(), ComputePmeCUDAMgr::getHomePencil(), FFTCompute::init(), PmeKSpaceCompute::PmeKSpaceCompute(), PmeRealSpaceCompute::PmeRealSpaceCompute(), and PmeTranspose::PmeTranspose().

31  {
32 
33  int isize, jsize, ksize;
34  int jblocks, kblocks;
35 
36  switch(permutation) {
37  case Perm_X_Y_Z:
38  isize = pmeGrid.K1;
39  jsize = pmeGrid.K2;
40  ksize = pmeGrid.K3;
41  jblocks = pmeGrid.yBlocks;
42  kblocks = pmeGrid.zBlocks;
43  break;
44  case Perm_cX_Y_Z:
45  isize = pmeGrid.K1/2+1;
46  jsize = pmeGrid.K2;
47  ksize = pmeGrid.K3;
48  jblocks = pmeGrid.yBlocks;
49  kblocks = pmeGrid.zBlocks;
50  break;
51  case Perm_Y_Z_cX:
52  isize = pmeGrid.K2;
53  jsize = pmeGrid.K3;
54  ksize = pmeGrid.K1/2+1;
55  jblocks = pmeGrid.zBlocks;
56  kblocks = pmeGrid.xBlocks;
57  break;
58  case Perm_Z_cX_Y:
59  isize = pmeGrid.K3;
60  jsize = pmeGrid.K1/2+1;
61  ksize = pmeGrid.K2;
62  jblocks = pmeGrid.xBlocks;
63  kblocks = pmeGrid.yBlocks;
64  break;
65  default:
66  NAMD_bug("getPencilDim, invalid permutation");
67  break;
68  }
69 
70  if (jblock < 0 || jblock >= jblocks || kblock < 0 || kblock >= kblocks)
71  NAMD_bug("getPencilDim, invalid block indices");
72 
73  i0 = 0;
74  i1 = isize - 1;
75 
76  j0 = jsize*jblock/jblocks;
77  j1 = jsize*(jblock+1)/jblocks - 1;
78 
79  k0 = ksize*kblock/kblocks;
80  k1 = ksize*(kblock+1)/kblocks - 1;
81 }
int zBlocks
Definition: PmeBase.h:22
int K2
Definition: PmeBase.h:18
int K1
Definition: PmeBase.h:18
int yBlocks
Definition: PmeBase.h:22
void NAMD_bug(const char *err_msg)
Definition: common.C:123
int K3
Definition: PmeBase.h:18
int xBlocks
Definition: PmeBase.h:22
static int getPencilIndexY ( const PmeGrid pmeGrid,
const int  y 
)
inlinestatic

Definition at line 20 of file PmeSolverUtil.h.

References PmeGrid::K2, and PmeGrid::yBlocks.

Referenced by PmeAtomFiler::fileAtoms().

20  {
21  return (y*pmeGrid.yBlocks + pmeGrid.yBlocks - 1)/pmeGrid.K2;
22 }
int K2
Definition: PmeBase.h:18
int yBlocks
Definition: PmeBase.h:22
gridSize y
static int getPencilIndexZ ( const PmeGrid pmeGrid,
const int  z 
)
inlinestatic

Definition at line 25 of file PmeSolverUtil.h.

References PmeGrid::K3, and PmeGrid::zBlocks.

Referenced by PmeAtomFiler::fileAtoms().

25  {
26  return (z*pmeGrid.zBlocks + pmeGrid.zBlocks - 1)/pmeGrid.K3;
27 }
int zBlocks
Definition: PmeBase.h:22
gridSize z
int K3
Definition: PmeBase.h:18