82 grid.resizeAndPreserve(numLookupTimeSlices,_numParticles);
83 beadLabel.resizeAndPreserve(numLookupTimeSlices,_numParticles);
91 return all(grid(bead1)==grid(bead2));
95 int numLookupTimeSlices;
103 TinyVector<int,NDIM+1> nnIndex;
104 TinyVector<int,NDIM+1> nI;
105 TinyVector<int,NDIM+2> hI;
107 Array <iVec,NDIM+1> gridNN;
108 Array <iVec,NDIM+1> gridNNReduced;
112 Array <int,NDIM+2> hash;
114 Array <int,2> beadLabel;
115 Array <int,NDIM+1> numLabels;
117 TinyVector <int,NDIM+2> hashSize;
124 inline TinyVector <int,NDIM+1> numLabelIndex(
const beadLocator&);
125 inline TinyVector <int,NDIM+1> numLabelIndex(
const iVec&,
const int);
126 inline TinyVector <int,NDIM+2> hashIndex(
const beadLocator&,
const int);
127 inline TinyVector <int,NDIM+2> hashIndex(
const iVec&,
const int,
const int);
141 for (
int i = 0; i <
NDIM; i++) {
142 index[i] =
static_cast<int>( abs( pos[i] + 0.5 *
boxPtr->
side[i] -
EPS )
143 / (sizeNNGrid[i] +
EPS) );
156 for (
int i = 0; i <
NDIM; i++) {
158 for (
int j = i+1; j <
NDIM; j++)
159 scale *= numNNGrid[j];
161 static_cast<int>(abs( pos[i] + 0.5 *
boxPtr->
side[i] -
EPS ) / (sizeNNGrid[i] +
EPS));
173 for (
int i = 0; i <
NDIM; i++) {
175 for (
int j = i+1; j <
NDIM; j++)
176 scale *= numNNGrid[j];
177 _gridIndex[i] = (n/scale) % numNNGrid[i];
189 for (
int i = 0; i <
NDIM; i++) {
191 for (
int j = i+1; j <
NDIM; j++)
192 scale *= numNNGrid[j];
193 gNumber += index[i]*scale;
204 inline TinyVector <int,NDIM+1> LookupTable::numLabelIndex(
const beadLocator &beadIndex) {
205 TinyVector<int,NDIM+1> index;
206 for (
int i = 0; i <
NDIM; i++)
207 index[i] = grid(beadIndex)[i];
208 index[
NDIM] = beadIndex[0];
217 inline TinyVector <int,NDIM+1> LookupTable::numLabelIndex(
const iVec &gI,
const int slice) {
218 TinyVector<int,NDIM+1> index;
219 for (
int i = 0; i <
NDIM; i++)
230 inline TinyVector <int,NDIM+2> LookupTable::hashIndex(
const beadLocator &beadIndex,
232 TinyVector<int,NDIM+2> index;
233 for (
int i = 0; i <
NDIM; i++)
234 index[i] = grid(beadIndex)[i];
235 index[
NDIM] = beadIndex[0];
236 index[
NDIM+1] = label;
245 inline TinyVector <int,NDIM+2> LookupTable::hashIndex(
const iVec &gI,
const int slice,
247 TinyVector<int,NDIM+2> index;
248 for (
int i = 0; i <
NDIM; i++)
251 index[
NDIM+1] = label;
The base class which holds details on the generalized box that our system will be simulated inside of...
dVec side
The linear dimensions of the box.
The particle (bead) lookup table.
int fullNumBeads
The full number of active beads in beadList;.
int numUniqueNN
The number of unique nearest neighbors of each box.
int getTotNumGridBoxes()
Return the total number of grid boxes.
int numNN
The total number of nearest neighbors of each box.
iVec gridIndex(const dVec &)
Given a particle position, return the grid index for the nearest neighbor lookup table.
void updateGrid(const Path &)
We update the full nearest neighbor grid by filling up all data arrays at all time slices.
Array< beadLocator, 1 > beadList
The cutoff dynamic list of interacting beads.
void updateFullInteractionList(const beadLocator &, const int)
Fill up the fullBeadList array with a list of beads in the same grid box as the supplied beadIndex an...
void updateInteractionList(const Path &, const beadLocator &)
Update the NN lookup table and the array of beadLocators containing all beads which 'interact' with t...
void resizeList(int _numParticles)
Resize the bead and grid lists.
iVec getNumNNGrid()
Return the number of NN grid boxes.
LookupTable(const Container *, const int, const int)
Initilialize the nearest neighbor lookup table.
void addBead(const beadLocator &, const dVec &)
Add a single bead to the NN grid and position pos.
Array< dVec, 1 > beadSep
The separation between beads.
bool gridNeighbors(const beadLocator &, const beadLocator &)
Given two beadIndices, determine if the beads lie in neighboring grid boxes.
int numBeads
The cutoff number of active beads in beadList;.
~LookupTable()
Free all blitz arrays.
Array< beadLocator, 1 > fullBeadList
The full dynamic list of interacting beads.
const Container * boxPtr
The simulation cell.
bool gridShare(const beadLocator &bead1, const beadLocator &bead2)
Determine if two beads are in the same grid box.
void updateBead(const beadLocator &, const dVec &)
Update the NN grid with a new bead position.
void delBead(const beadLocator &)
Remove a single bead from the NN grid.
int gridNumber(const dVec &)
Given a particle position, return the grid number for the nearest neighbor lookup table.
void printGrid()
Print the NN Lookup table.
The space-time trajectories.
Global common header with shared dependencies and methods.
#define NDIM
Number of spatial dimnsions.
TinyVector< int, 2 > beadLocator
time-slice,bead-number world line index
#define EPS
A small number.
TinyVector< double, NDIM > dVec
A NDIM-vector of type double.
#define PIMC_ASSERT(X)
Rename assert method.
TinyVector< int, NDIM > iVec
A NDIM-vector of type integer.
ConstantParameters class definition.