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 24 of file ComputePmeCUDAMgr.h.

Constructor & Destructor Documentation

PmeAtomStorage::PmeAtomStorage ( const bool  useIndex)
inline

Definition at line 26 of file ComputePmeCUDAMgr.h.

References atom, atomIndex, overflowAtom, and overflowAtomIndex.

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

Definition at line 40 of file ComputePmeCUDAMgr.h.

40  {
41  CmiDestroyLock(lock_);
42  }

Member Function Documentation

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

Definition at line 44 of file ComputePmeCUDAMgr.h.

44  {
45  return addAtoms_(natom, src, NULL);
46  }
int PmeAtomStorage::addAtomsWithIndex ( const int  natom,
const CudaAtom src,
const int *  index 
)
inline

Definition at line 48 of file ComputePmeCUDAMgr.h.

48  {
49  return addAtoms_(natom, src, index);
50  }
Index index
Definition: Parameters.C:148
void PmeAtomStorage::clear ( )
inline

Definition at line 67 of file ComputePmeCUDAMgr.h.

67  {
68  patchPos.clear();
69  numAtoms = 0;
70  }
void PmeAtomStorage::finish ( )
inline

Definition at line 54 of file ComputePmeCUDAMgr.h.

References atom, atomIndex, overflowAtom, and overflowAtomIndex.

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

Definition at line 90 of file ComputePmeCUDAMgr.h.

References atomIndex, and NAMD_bug().

90  {
91  if (!useIndex)
92  NAMD_bug("PmeAtomStorage::getAtomIndex, no indexing enabled");
93  return atomIndex;
94  }
void NAMD_bug(const char *err_msg)
Definition: common.C:129
CudaAtom* PmeAtomStorage::getAtoms ( )
inline

Definition at line 73 of file ComputePmeCUDAMgr.h.

References atom.

73  {
74  return atom;
75  }
int PmeAtomStorage::getNumAtoms ( )
inline

Definition at line 86 of file ComputePmeCUDAMgr.h.

86  {
87  return numAtoms;
88  }
int PmeAtomStorage::getNumPatches ( )
inline

Definition at line 82 of file ComputePmeCUDAMgr.h.

82  {
83  return patchPos.size();
84  }
int* PmeAtomStorage::getPatchPos ( )
inline

Definition at line 78 of file ComputePmeCUDAMgr.h.

78  {
79  return patchPos.data();
80  }

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: