Changeset 0e2190 for molecuilder/src/linkedcell.cpp
- Timestamp:
- Aug 3, 2009, 6:58:46 PM (16 years ago)
- Children:
- f4a346
- Parents:
- 4e4940 (diff), e8de2e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/linkedcell.cpp
r4e4940 r0e2190 129 129 130 130 /** Calculates the index for a given atom *Walker. 131 * \param *Walker atom to set index to131 * \param Walker atom to set index to 132 132 * \return if the atom is also found in this cell - true, else - false 133 133 */ 134 bool LinkedCell::SetIndexToAtom( atom *Walker)134 bool LinkedCell::SetIndexToAtom(const atom &Walker) 135 135 { 136 136 bool status = false; 137 137 for (int i=0;i<NDIM;i++) { 138 n[i] = (int)floor((Walker ->x.x[i] - min.x[i])/RADIUS);138 n[i] = (int)floor((Walker.x.x[i] - min.x[i])/RADIUS); 139 139 } 140 140 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 141 141 if (CheckBounds()) { 142 142 for (LinkedAtoms::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++) 143 status = status || ((*Runner) == Walker);143 status = status || ((*Runner) == &Walker); 144 144 return status; 145 145 } else { 146 cerr << Verbose(1) << "ERROR: Atom "<< *Walker << " at " << Walker->x << " is out of bounds." << endl;146 cerr << Verbose(1) << "ERROR: Atom "<< Walker << " at " << Walker.x << " is out of bounds." << endl; 147 147 return false; 148 } 149 }; 150 151 /** Calculates the interval bounds of the linked cell grid. 152 * \param *lower lower bounds 153 * \param *upper upper bounds 154 */ 155 void LinkedCell::GetNeighbourBounds(int lower[NDIM], int upper[NDIM]) 156 { 157 for (int i=0;i<NDIM;i++) { 158 lower[i] = ((n[i]-1) >= 0) ? n[i]-1 : 0; 159 upper[i] = ((n[i]+1) < N[i]) ? n[i]+1 : N[i]-1; 160 //cout << " [" << Nlower[i] << "," << Nupper[i] << "] "; 161 // check for this axis whether the point is outside of our grid 162 if (n[i] < 0) 163 upper[i] = lower[i]; 164 if (n[i] > N[i]) 165 lower[i] = upper[i]; 166 167 //cout << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl; 148 168 } 149 169 }; … … 153 173 * \return Vector is inside bounding box - true, else - false 154 174 */ 155 bool LinkedCell::SetIndexToVector( Vector *x)175 bool LinkedCell::SetIndexToVector(const Vector *x) 156 176 { 157 177 bool status = true;
Note:
See TracChangeset
for help on using the changeset viewer.