Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ellipsoid.cpp

    r717e0c ra67d19  
    146146{
    147147  int status = GSL_SUCCESS;
    148   Log() << Verbose(2) << "Begin of FitPointSetToEllipsoid " << endl;
     148  DoLog(2) && (Log() << Verbose(2) << "Begin of FitPointSetToEllipsoid " << endl);
    149149  if (N >= 3) { // check that enough points are given (9 d.o.f.)
    150150    struct EllipsoidMinimisation par;
     
    199199          EllipsoidAngle[i] = gsl_vector_get (s->x, i+6);
    200200        }
    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);
    202202      }
    203203
     
    209209
    210210  } 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);
    212212    return false;
    213213  }
    214   Log() << Verbose(2) << "End of FitPointSetToEllipsoid" << endl;
     214  DoLog(2) && (Log() << Verbose(2) << "End of FitPointSetToEllipsoid" << endl);
    215215  if (status == GSL_SUCCESS)
    216216    return true;
     
    235235  int index;
    236236  TesselPoint *Candidate = NULL;
    237   Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl;
     237  DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl);
    238238
    239239  // allocate array
     
    241241    x = new Vector[PointsToPick];
    242242  } 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);
    244244  }
    245245
     
    247247    for(int i=0;i<NDIM;i++) // pick three random indices
    248248      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] << " ... ");
    250250    // get random cell
    251     const LinkedNodes *List = LC->GetCurrentCell();
     251    const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
    252252    if (List == NULL) {  // set index to it
    253253      continue;
    254254    }
    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:");
    258258    for (int i=0;i<NDIM;i++) {
    259259      Nlower[i] = ((LC->n[i]-1) >= 0) ? LC->n[i]-1 : 0;
    260260      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);
    264264
    265265    // count whether there are sufficient atoms in this cell+neighbors
     
    268268      for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    269269        for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    270           const LinkedNodes *List = LC->GetCurrentCell();
     270          const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
    271271          PointsLeft += List->size();
    272272        }
    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);
    274274    if (PointsLeft < PointsToPick) {  // ensure that we can pick enough points in its neighbourhood at all.
    275275      continue;
     
    293293      for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    294294        for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    295           const LinkedNodes *List = LC->GetCurrentCell();
     295          const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
    296296//          Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
    297297          if (List != NULL) {
     
    300300//            else
    301301//              Log() << Verbose(2) << "Cell is empty ... " << endl;
    302             for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     302            for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    303303              if ((current != PickedAtomNrs.end()) && (*current == index)) {
    304304                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);
    306306                x[PointsPicked++].CopyVector(Candidate->node);    // we have one more atom picked
    307307                current++;    // next pre-picked atom
     
    313313          }
    314314        }
    315     Log() << Verbose(2) << "The following points were picked: " << endl;
     315    DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl);
    316316    for (size_t i=0;i<PointsPicked;i++)
    317       Log() << Verbose(2) << x[i] << endl;
     317      DoLog(2) && (Log() << Verbose(2) << x[i] << endl);
    318318    if (PointsPicked == PointsToPick)  // break out of loop if we have all
    319319      break;
    320320  } while(1);
    321321
    322   Log() << Verbose(2) << "End of PickRandomPointSet" << endl;
     322  DoLog(2) && (Log() << Verbose(2) << "End of PickRandomPointSet" << endl);
    323323};
    324324
     
    335335  double value, threshold;
    336336  PointMap *List = &T->PointsOnBoundary;
    337   Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl;
     337  DoLog(2) && (Log() << Verbose(2) << "Begin of PickRandomPointSet" << endl);
    338338
    339339  // allocate array
     
    341341    x = new Vector[PointsToPick];
    342342  } 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);
    344344  }
    345345
     
    358358      PointsLeft--;
    359359    }
    360   Log() << Verbose(2) << "The following points were picked: " << endl;
     360  DoLog(2) && (Log() << Verbose(2) << "The following points were picked: " << endl);
    361361  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);
    365365};
    366366
     
    382382  double EllipsoidAngle[3];
    383383  double distance, MaxDistance, MinDistance;
    384   Log() << Verbose(0) << "Begin of FindDistributionOfEllipsoids" << endl;
     384  DoLog(0) && (Log() << Verbose(0) << "Begin of FindDistributionOfEllipsoids" << endl);
    385385
    386386  // construct center of gravity of boundary point set for initial ellipsoid center
     
    389389    Center.AddVector(Runner->second->node->node);
    390390  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);
    392392
    393393  // Output header
     
    397397  // loop over desired number of parameter sets
    398398  for (;number >0;number--) {
    399     Log() << Verbose(1) << "Determining data set " << number << " ... " << endl;
     399    DoLog(1) && (Log() << Verbose(1) << "Determining data set " << number << " ... " << endl);
    400400    // pick the point set
    401401    x = NULL;
     
    423423    // fit the parameters
    424424    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);
    426426      // output obtained parameter set
    427427      output << number << "\t";
     
    434434      output << endl;
    435435    } else { // increase N to pick one more
    436       Log() << Verbose(1) << "Picking failed!" << endl;
     436      DoLog(1) && (Log() << Verbose(1) << "Picking failed!" << endl);
    437437      number++;
    438438    }
     
    442442  output.close();
    443443
    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.