Changeset a67d19 for src/ellipsoid.cpp


Ignore:
Timestamp:
Apr 22, 2010, 2:00:03 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
299554
Parents:
6613ec
Message:

Huge change: Log() << Verbose(.) --> DoLog(.) && (Log() << Verbose(.) << ...);

Most of the files are affected, but this is necessary as if DoLog() says verbosity is not enough, all the stream operators won"t get executed which saves substantial amount of computation time.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ellipsoid.cpp

    r6613ec 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
     
    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
    251251    const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
     
    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
     
    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;
     
    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
     
    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.