Changeset a87d5e6 for molecuilder/src/linkedcell.cpp
- Timestamp:
- Aug 3, 2009, 4:45:38 PM (16 years ago)
- Children:
- dc162d
- Parents:
- 3219a0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/linkedcell.cpp
r3219a0 ra87d5e6 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 141 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 141 142 if (CheckBounds()) { 142 143 for (LinkedAtoms::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++) 143 status = status || ((*Runner) == Walker);144 status = status || ((*Runner) == &Walker); 144 145 return status; 145 146 } else { 146 cerr << Verbose(1) << " ERROR: Atom "<< *Walker << " at " << Walker->x << " is out of bounds." << endl;147 cerr << Verbose(1) << "WARN: Atom "<< Walker << " at " << Walker.x << " is out of bounds." << endl; 147 148 return false; 148 149 } 150 }; 151 152 /** Calculates the interval bounds of the linked cell grid. 153 * \param *lower lower bounds 154 * \param *upper upper bounds 155 */ 156 void LinkedCell::GetNeighbourBounds(int lower[NDIM], int upper[NDIM]) 157 { 158 for (int i=0;i<NDIM;i++) { 159 lower[i] = ((n[i]-1) >= 0) ? n[i]-1 : 0; 160 upper[i] = ((n[i]+1) < N[i]) ? n[i]+1 : N[i]-1; 161 //cout << " [" << Nlower[i] << "," << Nupper[i] << "] "; 162 // check for this axis whether the point is outside of our grid 163 if (n[i] < 0) 164 upper[i] = lower[i]; 165 if (n[i] > N[i]) 166 lower[i] = upper[i]; 167 168 //cout << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl; 169 } 149 170 }; 150 171 … … 153 174 * \return Vector is inside bounding box - true, else - false 154 175 */ 155 bool LinkedCell::SetIndexToVector( Vector *x)176 bool LinkedCell::SetIndexToVector(const Vector *x) 156 177 { 157 178 bool status = true;
Note:
See TracChangeset
for help on using the changeset viewer.