NAMD
Public Member Functions | List of all members
Pairlists Class Reference

#include <ComputeNonbondedUtil.h>

Public Member Functions

 Pairlists ()
 
 ~Pairlists ()
 
plintnewlist (int max_size)
 
plintnewlist ()
 
void newsize (int list_size)
 
void reset ()
 
void nextlist (plint **list, int *list_size)
 
int getSize ()
 
void addIndex ()
 
void setIndexValue (plint i)
 
plint getIndexValue ()
 

Detailed Description

Definition at line 35 of file ComputeNonbondedUtil.h.

Constructor & Destructor Documentation

Pairlists::Pairlists ( )
inline

Definition at line 43 of file ComputeNonbondedUtil.h.

43 : size(initsize) { data = new plint[initsize]; }
unsigned short plint
Pairlists::~Pairlists ( )
inline

Definition at line 44 of file ComputeNonbondedUtil.h.

44 { delete [] data; }

Member Function Documentation

void Pairlists::addIndex ( )
inline

Definition at line 75 of file ComputeNonbondedUtil.h.

75  { // assume space for index already allocated
76  curpos++;
77  }
plint Pairlists::getIndexValue ( )
inline

Definition at line 82 of file ComputeNonbondedUtil.h.

82  {
83  return data[curpos++];
84  }
int Pairlists::getSize ( )
inline

Definition at line 73 of file ComputeNonbondedUtil.h.

73 { return size; }
plint* Pairlists::newlist ( int  max_size)
inline

Definition at line 45 of file ComputeNonbondedUtil.h.

References newsize().

Referenced by ComputeLCPO::doForce().

45  { // get a new list w/ room for max_size
46  int reqnewsize = curpos + max_size + 1;
47  int newsize = size;
48  while ( newsize < reqnewsize ) { newsize += newsize >> 1; }
49  if ( newsize > size ) {
50  plint *newdata = new plint[newsize];
51  CmiMemcpy(newdata,data,curpos*sizeof(plint));
52  delete [] data;
53  data = newdata;
54  size = newsize;
55  }
56  return &data[curpos+1];
57  }
unsigned short plint
void newsize(int list_size)
plint* Pairlists::newlist ( )
inline

Definition at line 60 of file ComputeNonbondedUtil.h.

60  { // get a new list assuming already allocated
61  return &data[curpos+1];
62  }
void Pairlists::newsize ( int  list_size)
inline

Definition at line 64 of file ComputeNonbondedUtil.h.

Referenced by ComputeLCPO::doForce(), newlist(), and pairlistFromAll().

64  { // set the size of the last list gotten
65  data[curpos] = list_size;
66  curpos += list_size + 1;
67  }
void Pairlists::nextlist ( plint **  list,
int *  list_size 
)
inline

Definition at line 69 of file ComputeNonbondedUtil.h.

Referenced by ComputeNonbondedUtil::calcGBIS(), and ComputeLCPO::doForce().

69  { // get next list and size
70  *list = &data[curpos+1];
71  curpos += ( *list_size = data[curpos] ) + 1;
72  }
void Pairlists::reset ( )
inline

Definition at line 68 of file ComputeNonbondedUtil.h.

Referenced by ComputeNonbondedUtil::calcGBIS(), ComputeLCPO::doForce(), and pairlistFromAll().

68 { curpos = 0; } // go back to the beginning
void Pairlists::setIndexValue ( plint  i)
inline

Definition at line 78 of file ComputeNonbondedUtil.h.

78  { // assume no newsize since addIndex
79  data[curpos-1] = i;
80  }

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