Changes in src/ellipsoid.cpp [717e0c:a67d19]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ellipsoid.cpp
r717e0c ra67d19 146 146 { 147 147 int status = GSL_SUCCESS; 148 Log() << Verbose(2) << "Begin of FitPointSetToEllipsoid " << endl;148 DoLog(2) && (Log() << Verbose(2) << "Begin of FitPointSetToEllipsoid " << endl); 149 149 if (N >= 3) { // check that enough points are given (9 d.o.f.) 150 150 struct EllipsoidMinimisation par; … … 199 199 EllipsoidAngle[i] = gsl_vector_get (s->x, i+6); 200 200 } 201 Log() << Verbose(4) << setprecision(3) << "Converged fit at: " << *EllipsoidCenter << ", lengths " << EllipsoidLength[0] << ", " << EllipsoidLength[1] << ", " << EllipsoidLength[2] << ", angles " << EllipsoidAngle[0] << ", " << EllipsoidAngle[1] << ", " << EllipsoidAngle[2] << " with summed distance " << s->fval << "." << endl;201 DoLog(4) && (Log() << Verbose(4) << setprecision(3) << "Converged fit at: " << *EllipsoidCenter << ", lengths " << EllipsoidLength[0] << ", " << EllipsoidLength[1] << ", " << EllipsoidLength[2] << ", angles " << EllipsoidAngle[0] << ", " << EllipsoidAngle[1] << ", " << EllipsoidAngle[2] << " with summed distance " << s->fval << "." << endl); 202 202 } 203 203 … … 209 209 210 210 } else { 211 Log() << Verbose(3) << "Not enough points provided for fit to ellipsoid." << endl;211 DoLog(3) && (Log() << Verbose(3) << "Not enough points provided for fit to ellipsoid." << endl); 212 212 return false; 213 213 } 214 Log() << Verbose(2) << "End of FitPointSetToEllipsoid" << endl;214 DoLog(2) && (Log() << Verbose(2) << "End of FitPointSetToEllipsoid" << endl); 215 215 if (status == GSL_SUCCESS) 216 216 return true; … … 235 235 int index; 236 236 TesselPoint *Candidate = NULL; 237 Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl;237 DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl); 238 238 239 239 // allocate array … … 241 241 x = new Vector[PointsToPick]; 242 242 } else { 243 eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl;243 DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl); 244 244 } 245 245 … … 247 247 for(int i=0;i<NDIM;i++) // pick three random indices 248 248 LC->n[i] = (rand() % LC->N[i]); 249 Log() << Verbose(2) << "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " ... ";249 DoLog(2) && (Log() << Verbose(2) << "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " ... "); 250 250 // get random cell 251 const Linked Nodes *List = LC->GetCurrentCell();251 const LinkedCell::LinkedNodes *List = LC->GetCurrentCell(); 252 252 if (List == NULL) { // set index to it 253 253 continue; 254 254 } 255 Log() << Verbose(2) << "with No. " << LC->index << "." << endl;256 257 Log() << Verbose(2) << "LC Intervals:";255 DoLog(2) && (Log() << Verbose(2) << "with No. " << LC->index << "." << endl); 256 257 DoLog(2) && (Log() << Verbose(2) << "LC Intervals:"); 258 258 for (int i=0;i<NDIM;i++) { 259 259 Nlower[i] = ((LC->n[i]-1) >= 0) ? LC->n[i]-1 : 0; 260 260 Nupper[i] = ((LC->n[i]+1) < LC->N[i]) ? LC->n[i]+1 : LC->N[i]-1; 261 Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";262 } 263 Log() << Verbose(0) << endl;261 DoLog(0) && (Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] "); 262 } 263 DoLog(0) && (Log() << Verbose(0) << endl); 264 264 265 265 // count whether there are sufficient atoms in this cell+neighbors … … 268 268 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 269 269 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 270 const Linked Nodes *List = LC->GetCurrentCell();270 const LinkedCell::LinkedNodes *List = LC->GetCurrentCell(); 271 271 PointsLeft += List->size(); 272 272 } 273 Log() << Verbose(2) << "There are " << PointsLeft << " atoms in this neighbourhood." << endl;273 DoLog(2) && (Log() << Verbose(2) << "There are " << PointsLeft << " atoms in this neighbourhood." << endl); 274 274 if (PointsLeft < PointsToPick) { // ensure that we can pick enough points in its neighbourhood at all. 275 275 continue; … … 293 293 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 294 294 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 295 const Linked Nodes *List = LC->GetCurrentCell();295 const LinkedCell::LinkedNodes *List = LC->GetCurrentCell(); 296 296 // Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 297 297 if (List != NULL) { … … 300 300 // else 301 301 // Log() << Verbose(2) << "Cell is empty ... " << endl; 302 for (Linked Nodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {302 for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 303 303 if ((current != PickedAtomNrs.end()) && (*current == index)) { 304 304 Candidate = (*Runner); 305 Log() << Verbose(2) << "Current picked node is " << **Runner << " with index " << index << "." << endl;305 DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << **Runner << " with index " << index << "." << endl); 306 306 x[PointsPicked++].CopyVector(Candidate->node); // we have one more atom picked 307 307 current++; // next pre-picked atom … … 313 313 } 314 314 } 315 Log() << Verbose(2) << "The following points were picked: " << endl;315 DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl); 316 316 for (size_t i=0;i<PointsPicked;i++) 317 Log() << Verbose(2) << x[i] << endl;317 DoLog(2) && (Log() << Verbose(2) << x[i] << endl); 318 318 if (PointsPicked == PointsToPick) // break out of loop if we have all 319 319 break; 320 320 } while(1); 321 321 322 Log() << Verbose(2) << "End of PickRandomPointSet" << endl;322 DoLog(2) && (Log() << Verbose(2) << "End of PickRandomPointSet" << endl); 323 323 }; 324 324 … … 335 335 double value, threshold; 336 336 PointMap *List = &T->PointsOnBoundary; 337 Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl;337 DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl); 338 338 339 339 // allocate array … … 341 341 x = new Vector[PointsToPick]; 342 342 } else { 343 eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl;343 DoeLog(2) && (eLog()<< Verbose(2) << "Given pointer to vector array seems already allocated." << endl); 344 344 } 345 345 … … 358 358 PointsLeft--; 359 359 } 360 Log() << Verbose(2) << "The following points were picked: " << endl;360 DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl); 361 361 for (size_t i=0;i<PointsPicked;i++) 362 Log() << Verbose(3) << x[i] << endl;363 364 Log() << Verbose(2) << "End of PickRandomPointSet" << endl;362 DoLog(3) && (Log() << Verbose(3) << x[i] << endl); 363 364 DoLog(2) && (Log() << Verbose(2) << "End of PickRandomPointSet" << endl); 365 365 }; 366 366 … … 382 382 double EllipsoidAngle[3]; 383 383 double distance, MaxDistance, MinDistance; 384 Log() << Verbose(0) << "Begin of FindDistributionOfEllipsoids" << endl;384 DoLog(0) && (Log() << Verbose(0) << "Begin of FindDistributionOfEllipsoids" << endl); 385 385 386 386 // construct center of gravity of boundary point set for initial ellipsoid center … … 389 389 Center.AddVector(Runner->second->node->node); 390 390 Center.Scale(1./T->PointsOnBoundaryCount); 391 Log() << Verbose(1) << "Center is at " << Center << "." << endl;391 DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl); 392 392 393 393 // Output header … … 397 397 // loop over desired number of parameter sets 398 398 for (;number >0;number--) { 399 Log() << Verbose(1) << "Determining data set " << number << " ... " << endl;399 DoLog(1) && (Log() << Verbose(1) << "Determining data set " << number << " ... " << endl); 400 400 // pick the point set 401 401 x = NULL; … … 423 423 // fit the parameters 424 424 if (FitPointSetToEllipsoid(x, N, &EllipsoidCenter, &EllipsoidLength[0], &EllipsoidAngle[0])) { 425 Log() << Verbose(1) << "Picking succeeded!" << endl;425 DoLog(1) && (Log() << Verbose(1) << "Picking succeeded!" << endl); 426 426 // output obtained parameter set 427 427 output << number << "\t"; … … 434 434 output << endl; 435 435 } else { // increase N to pick one more 436 Log() << Verbose(1) << "Picking failed!" << endl;436 DoLog(1) && (Log() << Verbose(1) << "Picking failed!" << endl); 437 437 number++; 438 438 } … … 442 442 output.close(); 443 443 444 Log() << Verbose(0) << "End of FindDistributionOfEllipsoids" << endl;445 }; 444 DoLog(0) && (Log() << Verbose(0) << "End of FindDistributionOfEllipsoids" << endl); 445 };
Note:
See TracChangeset
for help on using the changeset viewer.