LCPONeighborList Class Reference

#include <ComputeLCPO.h>

List of all members.

Public Member Functions

 LCPONeighborList ()
 ~LCPONeighborList ()
LCPOAtomnewlist (int max_size)
LCPOAtomnewlist ()
void newsize (int list_size)
void reset ()
void nextlist (LCPOAtom **list, int *list_size)
int getSize ()


Detailed Description

Definition at line 27 of file ComputeLCPO.h.


Constructor & Destructor Documentation

LCPONeighborList::LCPONeighborList (  )  [inline]

Definition at line 38 of file ComputeLCPO.h.

00038                      :
00039       maxNeighbors(initsize), maxAtoms(initsize),
00040       curNeighbor(0), curAtom(0) {
00041     neighbors = new LCPOAtom[initsize];
00042     nnfa = new int[initsize];
00043   }
  ~LCPONeighborList() {

LCPONeighborList::~LCPONeighborList (  )  [inline]

Definition at line 44 of file ComputeLCPO.h.

00044                       {
00045     delete [] neighbors;
00046     delete [] nnfa;
00047   }


Member Function Documentation

int LCPONeighborList::getSize (  )  [inline]

Definition at line 90 of file ComputeLCPO.h.

00090 { return maxNeighbors; }

LCPOAtom* LCPONeighborList::newlist (  )  [inline]

Definition at line 72 of file ComputeLCPO.h.

00072                       {  // get a new list assuming already allocated
00073     return &neighbors[curNeighbor];
00074   }

LCPOAtom* LCPONeighborList::newlist ( int  max_size  )  [inline]

Definition at line 48 of file ComputeLCPO.h.

Referenced by ComputeLCPO::doForce().

00048                                   {  // get a new list w/ room for max_size
00049     //do we need to make room for more neighbors
00050     int reqNewSize = curNeighbor + max_size;
00051     int newSize = maxNeighbors;
00052     while ( newSize < reqNewSize ) { newSize += newSize >> 1; }
00053     if ( newSize > maxNeighbors ) {
00054       LCPOAtom *newNeighbors = new LCPOAtom[newSize];
00055       CmiMemcpy(newNeighbors,neighbors,curNeighbor*sizeof(LCPOAtom));
00056       delete [] neighbors;
00057       neighbors = newNeighbors;
00058       maxNeighbors = newSize;
00059     }
00060     //do we need to make room for more atoms
00061     if (curAtom == maxAtoms) {
00062       newSize = maxAtoms + (maxAtoms >> 1);
00063       int *newNnfa = new int[newSize];
00064       CmiMemcpy(newNnfa,nnfa,curAtom*sizeof(int));
00065       delete [] nnfa;
00066       nnfa = newNnfa;
00067       maxAtoms = newSize;
00068     }
00069     return &neighbors[curNeighbor];
00070   }

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

Definition at line 75 of file ComputeLCPO.h.

Referenced by ComputeLCPO::doForce().

00075                               {  // set the size of the last list gotten
00076     nnfa[curAtom] = list_size;
00077     curAtom++;
00078     curNeighbor += list_size;
00079   }

void LCPONeighborList::nextlist ( LCPOAtom **  list,
int *  list_size 
) [inline]

Definition at line 84 of file ComputeLCPO.h.

00084                                                  {  // get next list and size
00085     *list = &neighbors[curNeighbor];
00086     *list_size = nnfa[curAtom];
00087     curNeighbor += nnfa[curAtom];
00088     curAtom ++;
00089   }

void LCPONeighborList::reset (  )  [inline]

Definition at line 80 of file ComputeLCPO.h.

Referenced by ComputeLCPO::doForce().

00080                {  // go back to the beginning
00081     curNeighbor = 0;
00082     curAtom = 0;
00083   }


The documentation for this class was generated from the following file:
Generated on Mon Sep 25 01:17:18 2017 for NAMD by  doxygen 1.4.7