Pairlists Class Reference

#include <ComputeNonbondedUtil.h>

List of all members.

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.

00043 : size(initsize) { data = new plint[initsize]; }

Pairlists::~Pairlists (  )  [inline]

Definition at line 44 of file ComputeNonbondedUtil.h.

00044 { delete [] data; }


Member Function Documentation

void Pairlists::addIndex (  )  [inline]

Definition at line 75 of file ComputeNonbondedUtil.h.

00075                   {  // assume space for index already allocated
00076     curpos++;
00077   }

plint Pairlists::getIndexValue (  )  [inline]

Definition at line 82 of file ComputeNonbondedUtil.h.

00082                         {
00083     return data[curpos++];
00084   }

int Pairlists::getSize (  )  [inline]

Definition at line 73 of file ComputeNonbondedUtil.h.

00073 { return size; }

plint* Pairlists::newlist (  )  [inline]

Definition at line 60 of file ComputeNonbondedUtil.h.

00060                    {  // get a new list assuming already allocated
00061     return &data[curpos+1];
00062   }

plint* Pairlists::newlist ( int  max_size  )  [inline]

Definition at line 45 of file ComputeNonbondedUtil.h.

References newsize().

Referenced by ComputeLCPO::doForce().

00045                                {  // get a new list w/ room for max_size
00046     int reqnewsize = curpos + max_size + 1;
00047     int newsize = size;
00048     while ( newsize < reqnewsize ) { newsize += newsize >> 1; }
00049     if ( newsize > size ) {
00050       plint *newdata = new plint[newsize];
00051       CmiMemcpy(newdata,data,curpos*sizeof(plint));
00052       delete [] data;
00053       data = newdata;
00054       size = newsize;
00055     }
00056     return &data[curpos+1];
00057   }

void Pairlists::newsize ( int  list_size  )  [inline]

Definition at line 64 of file ComputeNonbondedUtil.h.

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

00064                               {  // set the size of the last list gotten
00065     data[curpos] = list_size;
00066     curpos += list_size + 1;
00067   }

void Pairlists::nextlist ( plint **  list,
int *  list_size 
) [inline]

Definition at line 69 of file ComputeNonbondedUtil.h.

Referenced by ComputeNonbondedUtil::calcGBIS().

00069                                               {  // get next list and size
00070     *list = &data[curpos+1];
00071     curpos += ( *list_size = data[curpos] ) + 1;
00072   }

void Pairlists::reset (  )  [inline]

Definition at line 68 of file ComputeNonbondedUtil.h.

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

00068 { curpos = 0; }  // go back to the beginning

void Pairlists::setIndexValue ( plint  i  )  [inline]

Definition at line 78 of file ComputeNonbondedUtil.h.

00078                               {  // assume no newsize since addIndex
00079     data[curpos-1] = i;
00080   }


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