Ignore:
Timestamp:
Mar 1, 2011, 10:16:46 AM (14 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:
3738f0
Parents:
4092c5
git-author:
Frederik Heber <heber@…> (02/18/11 16:24:28)
git-committer:
Frederik Heber <heber@…> (03/01/11 10:16:46)
Message:

Moved Shading and EdgeType from defs.hpp to bond.hpp, getColor from molecule to class bond.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_graph.cpp

    r4092c5 rce5f05  
    4848  atom **PredecessorList;
    4949  int *ShortestPathList;
    50   enum Shading *ColorList;
     50  enum bond::Shading *ColorList;
    5151  std::deque<atom *> *BFSStack;
    5252  std::deque<atom *> *TouchedStack;
     
    308308  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) {
    309309    const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds();
    310     if ((!ListOfBonds.empty()) && ((*ListOfBonds.begin())->Type == Undetermined)) {
     310    if ((!ListOfBonds.empty()) && ((*ListOfBonds.begin())->Type == bond::Undetermined)) {
    311311      DoLog(0) && (Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl);
    312312      Subgraphs = DepthFirstSearchAnalysis(BackEdgeStack);
     
    334334;
    335335
    336 /** Returns Shading as a char string.
    337  * \param color the Shading
    338  * \return string of the flag
    339  */
    340 string molecule::GetColor(enum Shading color) const
    341 {
    342   switch (color) {
    343     case white:
    344       return "white";
    345       break;
    346     case lightgray:
    347       return "lightgray";
    348       break;
    349     case darkgray:
    350       return "darkgray";
    351       break;
    352     case black:
    353       return "black";
    354       break;
    355     default:
    356       return "uncolored";
    357       break;
    358   };
    359 }
    360 ;
    361336
    362337/** Sets atom::GraphNr and atom::LowpointNr to BFSAccounting::CurrentGraphNr.
     
    397372    DoLog(2) && (Log() << Verbose(2) << "Current Unused Bond is " << *Binder << "." << endl);
    398373    // (4) Mark Binder used, ...
    399     Binder->MarkUsed(black);
     374    Binder->MarkUsed(bond::black);
    400375    OtherAtom = Binder->GetOtherAtom(Walker);
    401376    DoLog(2) && (Log() << Verbose(2) << "(4) OtherAtom is " << OtherAtom->getName() << "." << endl);
    402377    if (OtherAtom->GraphNr != -1) {
    403378      // (4a) ... if "other" atom has been visited (GraphNr != 0), set lowpoint to minimum of both, go to (3)
    404       Binder->Type = BackEdge;
     379      Binder->Type = bond::BackEdge;
    405380      DFS.BackEdgeStack->push_front(Binder);
    406381      Walker->LowpointNr = (Walker->LowpointNr < OtherAtom->GraphNr) ? Walker->LowpointNr : OtherAtom->GraphNr;
     
    408383    } else {
    409384      // (4b) ... otherwise set OtherAtom as Ancestor of Walker and Walker as OtherAtom, go to (2)
    410       Binder->Type = TreeEdge;
     385      Binder->Type = bond::TreeEdge;
    411386      OtherAtom->Ancestor = Walker;
    412387      Walker = OtherAtom;
     
    664639        if (DoLog(2)) {
    665640          ostream &out = (Log() << Verbose(2));
    666           out << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <";
     641          out << ((Binder->Type == bond::TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <";
    667642          out << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.";
    668643          Binder->leftatom->OutputComponentNumber(&out);
     
    688663  BFS.PredecessorList = new atom*[AtomCount];
    689664  BFS.ShortestPathList = new int[AtomCount];
    690   BFS.ColorList = new enum Shading[AtomCount];
     665  BFS.ColorList = new enum bond::Shading[AtomCount];
    691666  BFS.BFSStack = new std::deque<atom *> (AtomCount);
    692667  BFS.TouchedStack = new std::deque<atom *> (AtomCount);
     
    695670    BFS.ShortestPathList[i] = -1;
    696671    BFS.PredecessorList[i] = 0;
    697     BFS.ColorList[i] = white;
     672    BFS.ColorList[i] = bond::white;
    698673  }
    699674};
     
    723698    BFS.PredecessorList[Walker->getNr()] = NULL;
    724699    BFS.ShortestPathList[Walker->getNr()] = -1;
    725     BFS.ColorList[Walker->getNr()] = white;
     700    BFS.ColorList[Walker->getNr()] = bond::white;
    726701  }
    727702};
     
    762737#endif
    763738        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
    764         if (BFS.ColorList[OtherAtom->getNr()] == white) {
     739        if (BFS.ColorList[OtherAtom->getNr()] == bond::white) {
    765740          BFS.TouchedStack->push_front(OtherAtom);
    766           BFS.ColorList[OtherAtom->getNr()] = lightgray;
     741          BFS.ColorList[OtherAtom->getNr()] = bond::lightgray;
    767742          BFS.PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor
    768743          BFS.ShortestPathList[OtherAtom->getNr()] = BFS.ShortestPathList[Walker->getNr()] + 1;
     
    780755      } else {
    781756        DoLog(2) && (Log() << Verbose(2) << "Skipping hydrogen atom " << *OtherAtom << "." << endl);
    782         BFS.ColorList[OtherAtom->getNr()] = black;
     757        BFS.ColorList[OtherAtom->getNr()] = bond::black;
    783758      }
    784759#endif
     
    787762      }
    788763    }
    789     BFS.ColorList[Walker->getNr()] = black;
     764    BFS.ColorList[Walker->getNr()] = bond::black;
    790765    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl);
    791766    if (OtherAtom == BFS.Root) { // if we have found the root, check whether this cycle wasn't already found beforehand
     
    807782            BFS.PredecessorList[OtherAtom->getNr()] = NULL;
    808783            BFS.ShortestPathList[OtherAtom->getNr()] = -1;
    809             BFS.ColorList[OtherAtom->getNr()] = white;
     784            BFS.ColorList[OtherAtom->getNr()] = bond::white;
    810785            // rats ... deque has no find()
    811786            std::deque<atom *>::iterator iter = find(
     
    894869        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    895870        //Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl;
    896         if (BFS.ColorList[OtherAtom->getNr()] == white) {
     871        if (BFS.ColorList[OtherAtom->getNr()] == bond::white) {
    897872          BFS.TouchedStack->push_front(OtherAtom);
    898           BFS.ColorList[OtherAtom->getNr()] = lightgray;
     873          BFS.ColorList[OtherAtom->getNr()] = bond::lightgray;
    899874          BFS.PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor
    900875          BFS.ShortestPathList[OtherAtom->getNr()] = BFS.ShortestPathList[Walker->getNr()] + 1;
     
    913888      }
    914889    }
    915     BFS.ColorList[Walker->getNr()] = black;
     890    BFS.ColorList[Walker->getNr()] = bond::black;
    916891    //Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl;
    917892  }
     
    10411016      Runner != ListOfBonds.end();
    10421017      ++Runner)
    1043     if ((*Runner)->IsUsed() == white)
     1018    if ((*Runner)->IsUsed() == bond::white)
    10441019      return ((*Runner));
    10451020  return NULL;
     
    13041279  BFS.PredecessorList = new atom*[AtomCount];
    13051280  BFS.ShortestPathList = new int[AtomCount];
    1306   BFS.ColorList = new enum Shading[AtomCount];
     1281  BFS.ColorList = new enum bond::Shading[AtomCount];
    13071282  BFS.BFSStack = new std::deque<atom *> (AtomCount);
    13081283
     
    13161291    BFS.ShortestPathList[i] = -1;
    13171292    if ((AddedAtomList != NULL) && (AddedAtomList[i] != NULL)) // mark already present atoms (i.e. Root and maybe others) as visited
    1318       BFS.ColorList[i] = lightgray;
     1293      BFS.ColorList[i] = bond::lightgray;
    13191294    else
    1320       BFS.ColorList[i] = white;
     1295      BFS.ColorList[i] = bond::white;
    13211296  }
    13221297  //BFS.ShortestPathList[Root->getNr()] = 0; // done by Calloc
     
    13371312{
    13381313  if (Binder != Bond) // let other atom white if it's via Root bond. In case it's cyclic it has to be reached again (yet Root is from OtherAtom already black, thus no problem)
    1339     BFS.ColorList[OtherAtom->getNr()] = lightgray;
     1314    BFS.ColorList[OtherAtom->getNr()] = bond::lightgray;
    13401315  BFS.PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor
    13411316  BFS.ShortestPathList[OtherAtom->getNr()] = BFS.ShortestPathList[Walker->getNr()] + 1;
    1342   DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom->getNr()] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);
     1317  DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom->getNr()] == bond::white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);
    13431318  if ((((BFS.ShortestPathList[OtherAtom->getNr()] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance
    13441319    DoLog(3) && (Log() << Verbose(3));
     
    13601335  } else { // out of bond order, then replace
    13611336    if ((AddedAtomList[OtherAtom->getNr()] == NULL) && (Binder->Cyclic))
    1362       BFS.ColorList[OtherAtom->getNr()] = white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)
     1337      BFS.ColorList[OtherAtom->getNr()] = bond::white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)
    13631338    if (Binder == Bond)
    13641339      DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is the Root bond");
     
    14381413        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    14391414        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
    1440         if (BFS.ColorList[OtherAtom->getNr()] == white) {
     1415        if (BFS.ColorList[OtherAtom->getNr()] == bond::white) {
    14411416          BreadthFirstSearchAdd_UnvisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem);
    14421417        } else {
     
    14451420      }
    14461421    }
    1447     BFS.ColorList[Walker->getNr()] = black;
     1422    BFS.ColorList[Walker->getNr()] = bond::black;
    14481423    DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl);
    14491424  }
Note: See TracChangeset for help on using the changeset viewer.