Changeset aec775
- Timestamp:
- Oct 17, 2009, 7:46:28 PM (16 years ago)
- Children:
- b0ee98
- Parents:
- bee48d
- Location:
- molecuilder/src
- Files:
-
- 2 edited
-
linkedcell.cpp (modified) (2 diffs)
-
linkedcell.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/linkedcell.cpp
rbee48d raec775 202 202 }; 203 203 204 /** Checks whether LinkedCell::n[] plus relative offset is each within [0,N[]]. 205 * \param relative[NDIM] relative offset to current cell 206 * \return if all in intervals - true, else -false 207 */ 208 bool LinkedCell::CheckBounds(int relative[NDIM]) 209 { 210 bool status = true; 211 for(int i=0;i<NDIM;i++) 212 status = status && ((n[i]+relative[i] >=0) && (n[i]+relative[i] < N[i])); 213 if (!status) 214 cerr << "ERROR: indices are out of bounds!" << endl; 215 return status; 216 }; 217 204 218 205 219 /** Returns a pointer to the current cell. … … 210 224 if (CheckBounds()) { 211 225 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 226 return (&(LC[index])); 227 } else { 228 return NULL; 229 } 230 }; 231 232 /** Returns a pointer to the current cell. 233 * \param relative[NDIM] offset for each axis with respect to the current cell LinkedCell::n[NDIM] 234 * \return LinkedAtoms pointer to current cell, NULL if LinkedCell::n[]+relative[] are out of bounds. 235 */ 236 LinkedNodes* LinkedCell::GetRelativeToCurrentCell(int relative[NDIM]) 237 { 238 if (CheckBounds(relative)) { 239 index = (n[0]+relative[0]) * N[1] * N[2] + (n[1]+relative[1]) * N[2] + (n[2]+relative[2]); 212 240 return (&(LC[index])); 213 241 } else { -
molecuilder/src/linkedcell.hpp
rbee48d raec775 54 54 ~LinkedCell(); 55 55 LinkedNodes* GetCurrentCell(); 56 LinkedNodes* GetRelativeToCurrentCell(int relative[NDIM]); 56 57 bool SetIndexToNode(const TesselPoint *Walker); 57 58 bool SetIndexToVector(const Vector *x); 58 59 bool CheckBounds(); 60 bool CheckBounds(int relative[NDIM]); 59 61 void GetNeighbourBounds(int lower[NDIM], int upper[NDIM]); 60 62
Note:
See TracChangeset
for help on using the changeset viewer.
