NAMD
Public Member Functions | Protected Attributes | List of all members
PmeAtomStorage Class Referenceabstract

#include <ComputePmeCUDAMgr.h>

Inheritance diagram for PmeAtomStorage:
CpuPmeAtomStorage CudaPmeAtomStorage

Public Member Functions

 PmeAtomStorage (const bool useIndex)
 
virtual ~PmeAtomStorage ()
 
int addAtoms (const int natom, const CudaAtom *src)
 
int addAtomsWithIndex (const int natom, const CudaAtom *src, const int *index)
 
void finish ()
 
void clear ()
 
CudaAtomgetAtoms ()
 
int * getPatchPos ()
 
int getNumPatches ()
 
int getNumAtoms ()
 
int * getAtomIndex ()
 

Protected Attributes

CudaAtomatom
 
int * atomIndex
 
CudaAtomoverflowAtom
 
int * overflowAtomIndex
 

Detailed Description

Definition at line 20 of file ComputePmeCUDAMgr.h.

Constructor & Destructor Documentation

PmeAtomStorage::PmeAtomStorage ( const bool  useIndex)
inline

Definition at line 22 of file ComputePmeCUDAMgr.h.

References atom, atomIndex, overflowAtom, and overflowAtomIndex.

22  : useIndex(useIndex) {
23  numAtoms = 0;
24  atomCapacity = 0;
25  atom = NULL;
26  atomIndexCapacity = 0;
27  atomIndex = NULL;
28  overflowStart = 0;
29  overflowEnd = 0;
30  overflowAtomCapacity = 0;
31  overflowAtom = NULL;
32  overflowAtomIndexCapacity = 0;
33  overflowAtomIndex = NULL;
34  lock_ = CmiCreateLock();
35  }
CudaAtom * overflowAtom
virtual PmeAtomStorage::~PmeAtomStorage ( )
inlinevirtual

Definition at line 36 of file ComputePmeCUDAMgr.h.

36  {
37  CmiDestroyLock(lock_);
38  }

Member Function Documentation

int PmeAtomStorage::addAtoms ( const int  natom,
const CudaAtom src 
)
inline

Definition at line 40 of file ComputePmeCUDAMgr.h.

40  {
41  return addAtoms_(natom, src, NULL);
42  }
int PmeAtomStorage::addAtomsWithIndex ( const int  natom,
const CudaAtom src,
const int *  index 
)
inline

Definition at line 44 of file ComputePmeCUDAMgr.h.

44  {
45  return addAtoms_(natom, src, index);
46  }
Index index
Definition: Parameters.C:148
void PmeAtomStorage::clear ( )
inline

Definition at line 63 of file ComputePmeCUDAMgr.h.

63  {
64  patchPos.clear();
65  numAtoms = 0;
66  }
void PmeAtomStorage::finish ( )
inline

Definition at line 50 of file ComputePmeCUDAMgr.h.

References atom, atomIndex, overflowAtom, and overflowAtomIndex.

50  {
51  if (overflowEnd-overflowStart > 0) {
52  resize_((void **)&atom, numAtoms, atomCapacity, sizeof(CudaAtom));
53  if (useIndex) resize_((void **)&atomIndex, numAtoms, atomIndexCapacity, sizeof(int));
54  memcpy_(atom+overflowStart, overflowAtom, (overflowEnd - overflowStart)*sizeof(CudaAtom));
55  if (useIndex) memcpy_(atomIndex+overflowStart, overflowAtomIndex, (overflowEnd - overflowStart)*sizeof(int));
56  overflowStart = 0;
57  overflowEnd = 0;
58  }
59  }
CudaAtom * overflowAtom
int* PmeAtomStorage::getAtomIndex ( )
inline

Definition at line 86 of file ComputePmeCUDAMgr.h.

References atomIndex, and NAMD_bug().

86  {
87  if (!useIndex)
88  NAMD_bug("PmeAtomStorage::getAtomIndex, no indexing enabled");
89  return atomIndex;
90  }
void NAMD_bug(const char *err_msg)
Definition: common.C:123
CudaAtom* PmeAtomStorage::getAtoms ( )
inline

Definition at line 69 of file ComputePmeCUDAMgr.h.

References atom.

69  {
70  return atom;
71  }
int PmeAtomStorage::getNumAtoms ( )
inline

Definition at line 82 of file ComputePmeCUDAMgr.h.

82  {
83  return numAtoms;
84  }
int PmeAtomStorage::getNumPatches ( )
inline

Definition at line 78 of file ComputePmeCUDAMgr.h.

78  {
79  return patchPos.size();
80  }
int* PmeAtomStorage::getPatchPos ( )
inline

Definition at line 74 of file ComputePmeCUDAMgr.h.

74  {
75  return patchPos.data();
76  }

Member Data Documentation

CudaAtom* PmeAtomStorage::atom
protected
int* PmeAtomStorage::atomIndex
protected
CudaAtom* PmeAtomStorage::overflowAtom
protected
int* PmeAtomStorage::overflowAtomIndex
protected

The documentation for this class was generated from the following file: