Changeset 1e168b for src/boundary.cpp


Ignore:
Timestamp:
Nov 25, 2009, 12:18:18 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:
8725ed
Parents:
791138
Message:

Now the best (in terms of ShortestAngle) baseline is picked among all open ones instead of the next.

  • Element initialization was done for all constructors in tesselation.cpp
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r791138 r1e168b  
    955955{
    956956  bool freeLC = false;
    957   LineMap::iterator baseline;
     957  CandidateForTesselation *baseline;
    958958  LineMap::iterator testline;
    959   bool OneLoopWithoutSuccessFlag = false;  // marks whether we went once through all baselines without finding any without two triangles
     959  bool OneLoopWithoutSuccessFlag = true;  // marks whether we went once through all baselines without finding any without two triangles
    960960  bool TesselationFailFlag = false;
    961961
     
    982982
    983983  // 2. expand from there
    984   baseline = TesselStruct->LinesOnBoundary.begin();
    985   baseline++; // skip first line
    986   while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
    987     if (baseline->second->triangles.size() == 1) {
    988       CheckListOfBaselines(TesselStruct);
    989       // 3. find next triangle
    990       TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    991       OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag;
    992       if (!TesselationFailFlag)
    993         eLog() << Verbose(2) << "FindNextSuitableTriangle failed." << endl;
    994 
    995       // write temporary envelope
    996       if (filename != NULL) {
    997         if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
    998           TesselStruct->Output(filename, mol);
    999         }
     984  while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) {
     985    // 2a. fill all new OpenLines
     986    Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl;
     987    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
     988      Log() << Verbose(1) << *(Runner->second) << endl;
     989
     990    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     991      baseline = Runner->second;
     992      if (baseline->point == NULL) {
     993        Log() << Verbose(0) << "Finding best candidate for open line " << *baseline->BaseLine << endl;
     994        TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *(((baseline->BaseLine->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    1000995      }
    1001       if (TesselationFailFlag) {
    1002         baseline = TesselStruct->LinesOnBoundary.begin();
    1003         OneLoopWithoutSuccessFlag = false;
    1004         Log() << Verbose(2) << "Baseline set to begin." << endl;
     996    }
     997
     998    // 2b. search for smallest ShortestAngle among all candidates
     999    double ShortestAngle = 4.*M_PI;
     1000    Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl;
     1001    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
     1002      Log() << Verbose(1) << *(Runner->second) << endl;
     1003
     1004    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     1005      if (Runner->second->ShortestAngle < ShortestAngle) {
     1006        baseline = Runner->second;
     1007        ShortestAngle = baseline->ShortestAngle;
     1008        //Log() << Verbose(0) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl;
    10051009      }
    1006     } else {
    1007       //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl;
    1008       if (baseline->second->triangles.size() != 2) {
    1009         eLog() << Verbose(0) << "TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl;
    1010         performCriticalExit();
     1010    }
     1011    if ((ShortestAngle == 4.*M_PI) || (baseline->point == NULL))
     1012      OneLoopWithoutSuccessFlag = false;
     1013    else {
     1014      TesselStruct->AddCandidateTriangle(*baseline);
     1015    }
     1016
     1017    // write temporary envelope
     1018    if (filename != NULL) {
     1019      if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
     1020        TesselStruct->Output(filename, mol);
    10111021      }
    10121022    }
    1013 
    1014     if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
    1015       baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
    1016       OneLoopWithoutSuccessFlag = false;
    1017     }
    1018     baseline++;
    10191023  }
    10201024  // check envelope for consistency
Note: See TracChangeset for help on using the changeset viewer.