Changeset 543ce4 for molecuilder/src/linkedcell.cpp
- Timestamp:
- Nov 4, 2009, 7:56:04 PM (16 years ago)
- Children:
- 4ef101, aa8542
- Parents:
- ec70ec
- File:
-
- 1 edited
-
molecuilder/src/linkedcell.cpp (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/linkedcell.cpp
rec70ec r543ce4 9 9 #include "helpers.hpp" 10 10 #include "linkedcell.hpp" 11 #include "log.hpp" 11 12 #include "molecule.hpp" 12 13 #include "tesselation.hpp" … … 44 45 max.Zero(); 45 46 min.Zero(); 46 cout<< Verbose(1) << "Begin of LinkedCell" << endl;47 Log() << Verbose(1) << "Begin of LinkedCell" << endl; 47 48 if (set->IsEmpty()) { 48 cerr<< "ERROR: set contains no linked cell nodes!" << endl;49 eLog() << Verbose(0) << "ERROR: set contains no linked cell nodes!" << endl; 49 50 return; 50 51 } … … 67 68 set->GoToNext(); 68 69 } 69 cout<< Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl;70 Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl; 70 71 71 72 // 2. find then number of cells per axis … … 73 74 N[i] = (int)floor((max.x[i] - min.x[i])/RADIUS)+1; 74 75 } 75 cout<< Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl;76 Log() << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl; 76 77 77 78 // 3. allocate the lists 78 cout<< Verbose(2) << "Allocating cells ... ";79 Log() << Verbose(2) << "Allocating cells ... "; 79 80 if (LC != NULL) { 80 cout<< Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;81 Log() << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl; 81 82 return; 82 83 } … … 85 86 LC [index].clear(); 86 87 } 87 cout<< "done." << endl;88 Log() << Verbose(0) << "done." << endl; 88 89 89 90 // 4. put each atom into its respective cell 90 cout<< Verbose(2) << "Filling cells ... ";91 Log() << Verbose(2) << "Filling cells ... "; 91 92 set->GoToFirst(); 92 93 while (!set->IsEnd()) { … … 97 98 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 98 99 LC[index].push_back(Walker); 99 // cout<< Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;100 //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl; 100 101 set->GoToNext(); 101 102 } 102 cout<< "done." << endl;103 cout<< Verbose(1) << "End of LinkedCell" << endl;103 Log() << Verbose(0) << "done." << endl; 104 Log() << Verbose(1) << "End of LinkedCell" << endl; 104 105 }; 105 106 … … 119 120 max.Zero(); 120 121 min.Zero(); 121 cout<< Verbose(1) << "Begin of LinkedCell" << endl;122 Log() << Verbose(1) << "Begin of LinkedCell" << endl; 122 123 if (set->empty()) { 123 cerr<< "ERROR: set contains no linked cell nodes!" << endl;124 eLog() << Verbose(0) << "ERROR: set contains no linked cell nodes!" << endl; 124 125 return; 125 126 } … … 139 140 } 140 141 } 141 cout<< Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl;142 Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl; 142 143 143 144 // 2. find then number of cells per axis … … 145 146 N[i] = (int)floor((max.x[i] - min.x[i])/RADIUS)+1; 146 147 } 147 cout<< Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl;148 Log() << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl; 148 149 149 150 // 3. allocate the lists 150 cout<< Verbose(2) << "Allocating cells ... ";151 Log() << Verbose(2) << "Allocating cells ... "; 151 152 if (LC != NULL) { 152 cout<< Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;153 Log() << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl; 153 154 return; 154 155 } … … 157 158 LC [index].clear(); 158 159 } 159 cout<< "done." << endl;160 Log() << Verbose(0) << "done." << endl; 160 161 161 162 // 4. put each atom into its respective cell 162 cout<< Verbose(2) << "Filling cells ... ";163 Log() << Verbose(2) << "Filling cells ... "; 163 164 for (LinkedNodes::iterator Runner = set->begin(); Runner != set->end(); Runner++) { 164 165 Walker = *Runner; … … 168 169 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 169 170 LC[index].push_back(Walker); 170 // cout<< Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;171 } 172 cout<< "done." << endl;173 cout<< Verbose(1) << "End of LinkedCell" << endl;171 //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl; 172 } 173 Log() << Verbose(0) << "done." << endl; 174 Log() << Verbose(1) << "End of LinkedCell" << endl; 174 175 }; 175 176 … … 198 199 status = status && ((n[i] >=0) && (n[i] < N[i])); 199 200 if (!status) 200 cerr<< "ERROR: indices are out of bounds!" << endl;201 eLog() << Verbose(0) << "ERROR: indices are out of bounds!" << endl; 201 202 return status; 202 203 }; … … 259 260 return status; 260 261 } else { 261 cerr<< Verbose(1) << "ERROR: Node at " << *Walker << " is out of bounds." << endl;262 eLog() << Verbose(1) << "ERROR: Node at " << *Walker << " is out of bounds." << endl; 262 263 return false; 263 264 } … … 273 274 lower[i] = ((n[i]-1) >= 0) ? n[i]-1 : 0; 274 275 upper[i] = ((n[i]+1) < N[i]) ? n[i]+1 : N[i]-1; 275 // cout<< " [" << Nlower[i] << "," << Nupper[i] << "] ";276 //Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] "; 276 277 // check for this axis whether the point is outside of our grid 277 278 if (n[i] < 0) … … 280 281 lower[i] = upper[i]; 281 282 282 // cout<< "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl;283 //Log() << Verbose(0) << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl; 283 284 } 284 285 };
Note:
See TracChangeset
for help on using the changeset viewer.
