Changeset a564be for src


Ignore:
Timestamp:
Dec 6, 2010, 7:37:05 PM (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:
4c1230
Parents:
fd19ff
git-author:
Frederik Heber <heber@…> (12/06/10 19:15:03)
git-committer:
Frederik Heber <heber@…> (12/06/10 19:37:05)
Message:

Removed ancient StackClass, replaced by std::deque.

  • all PopLast replaced by pop_front.
  • all PopFirst replaced by pop_front.
  • and we have two remove items in two steps, first get item, then pop.
Location:
src
Files:
3 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/DepthFirstSearchAction.cpp

    rfd19ff ra564be  
    2424#include "config.hpp"
    2525#include "Helpers/Log.hpp"
     26#include "Helpers/Verbose.hpp"
    2627#include "molecule.hpp"
    2728#include "Descriptors/MoleculeDescriptor.hpp"
    2829#include "Descriptors/MoleculeIdDescriptor.hpp"
    29 #include "stackclass.hpp"
    30 #include "Helpers/Verbose.hpp"
    3130#include "World.hpp"
    3231
     
    5150  int *MinimumRingSize = new int[mol->getAtomCount()];
    5251  atom **ListOfAtoms = NULL;
    53   class StackClass<bond *> *BackEdgeStack = NULL;
    54   class StackClass<bond *> *LocalBackEdgeStack = NULL;
     52  std::deque<bond *> *BackEdgeStack = NULL;
     53  std::deque<bond *> *LocalBackEdgeStack = NULL;
    5554  mol->CreateAdjacencyList(params.distance, World::getInstance().getConfig()->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    5655  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
     
    6160      ListOfAtoms = NULL;
    6261      Subgraphs->FillBondStructureFromReference(mol, ListOfAtoms, false);  // we want to keep the created ListOfLocalAtoms
    63       LocalBackEdgeStack = new StackClass<bond *> (Subgraphs->Leaf->BondCount);
     62      LocalBackEdgeStack = new std::deque<bond *>; // no need to have it Subgraphs->Leaf->BondCount size
    6463      Subgraphs->Leaf->PickLocalBackEdges(ListOfAtoms, BackEdgeStack, LocalBackEdgeStack);
    6564      Subgraphs->Leaf->CyclicStructureAnalysis(LocalBackEdgeStack, MinimumRingSize);
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    rfd19ff ra564be  
    2424#include "config.hpp"
    2525#include "Helpers/Log.hpp"
     26#include "Helpers/Verbose.hpp"
    2627#include "molecule.hpp"
    2728#include "Descriptors/MoleculeDescriptor.hpp"
    28 #include "stackclass.hpp"
    2929#include "World.hpp"
    3030
  • src/Actions/FragmentationAction/SubgraphDissectionAction.cpp

    rfd19ff ra564be  
    3030#include "Helpers/Verbose.hpp"
    3131#include "molecule.hpp"
    32 #include "stackclass.hpp"
    3332#include "World.hpp"
    3433
     
    103102  // 2. scan for connected subgraphs
    104103  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
    105   class StackClass<bond *> *BackEdgeStack = NULL;
     104  std::deque<bond *> *BackEdgeStack = NULL;
    106105  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
    107106  delete(BackEdgeStack);
  • src/Makefile.am

    rfd19ff ra564be  
    209209  parser.hpp \
    210210  periodentafel.hpp \
    211   stackclass.hpp \
    212211  ThermoStatContainer.hpp \
    213212  triangleintersectionlist.hpp \
  • src/molecule.cpp

    rfd19ff ra564be  
    4040
    4141#include "periodentafel.hpp"
    42 #include "stackclass.hpp"
    4342#include "tesselation.hpp"
    4443#include "LinearAlgebra/Vector.hpp"
  • src/molecule.hpp

    rfd19ff ra564be  
    1616#include <map>
    1717#include <set>
     18#include <stack>
    1819#include <deque>
    1920#include <list>
     
    4849class Vector;
    4950class Shape;
    50 template <class> class StackClass;
    5151
    5252/******************************** Some definitions for easier reading **********************************/
     
    226226
    227227  // Graph analysis
    228   MoleculeLeafClass * DepthFirstSearchAnalysis(class StackClass<bond *> *&BackEdgeStack) const;
    229   void CyclicStructureAnalysis(class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize) const;
    230   bool PickLocalBackEdges(atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const;
     228  MoleculeLeafClass * DepthFirstSearchAnalysis(std::deque<bond *> *&BackEdgeStack) const;
     229  void CyclicStructureAnalysis(std::deque<bond *> *BackEdgeStack, int *&MinimumRingSize) const;
     230  bool PickLocalBackEdges(atom **ListOfLocalAtoms, std::deque<bond *> *&ReferenceStack, std::deque<bond *> *&LocalStack) const;
    231231  bond * FindNextUnused(atom *vertex) const;
    232232  void SetNextComponentNumber(atom *vertex, int nr) const;
  • src/molecule_fragmentation.cpp

    rfd19ff ra564be  
    3636#include "LinearAlgebra/RealSpaceMatrix.hpp"
    3737#include "Box.hpp"
    38 #include "stackclass.hpp"
    3938
    4039/************************************* Functions for class molecule *********************************/
     
    613612  fstream File;
    614613  bool FragmentationToDo = true;
    615   class StackClass<bond *> *BackEdgeStack = NULL, *LocalBackEdgeStack = NULL;
     614  std::deque<bond *> *BackEdgeStack = NULL, *LocalBackEdgeStack = NULL;
    616615  bool CheckOrder = false;
    617616  Graph **FragmentList = NULL;
     
    656655    MolecularWalker->FillBondStructureFromReference(this, ListOfAtoms, false);  // we want to keep the created ListOfLocalAtoms
    657656    DoLog(0) && (Log() << Verbose(0) << "Analysing the cycles of subgraph " << MolecularWalker->Leaf << " with nr. " << FragmentCounter << "." << endl);
    658     LocalBackEdgeStack = new StackClass<bond *> (MolecularWalker->Leaf->BondCount);
     657    LocalBackEdgeStack = new std::deque<bond *>; // (MolecularWalker->Leaf->BondCount);
    659658//    // check the list of local atoms for debugging
    660659//    Log() << Verbose(0) << "ListOfLocalAtoms for this subgraph is:" << endl;
     
    884883
    885884
    886 /** Looks through a StackClass<atom *> and returns the likeliest removal candiate.
     885/** Looks through a std::deque<atom *> and returns the likeliest removal candiate.
    887886 * \param *out output stream for debugging messages
    888887 * \param *&Leaf KeySet to look through
     
    17431742  double tmp;
    17441743  Vector Translationvector;
    1745   //class StackClass<atom *> *CompStack = NULL;
    1746   class StackClass<atom *> *AtomStack = new StackClass<atom *>(getAtomCount());
     1744  //std::deque<atom *> *CompStack = NULL;
     1745  std::deque<atom *> *AtomStack = new std::deque<atom *>; // (getAtomCount());
    17471746  bool flag = true;
    17481747
     
    17851784      for (int i=getAtomCount();i--;)
    17861785        ColorList[i] = white;
    1787       AtomStack->Push(Binder->leftatom);
    1788       while (!AtomStack->IsEmpty()) {
    1789         Walker = AtomStack->PopFirst();
     1786      AtomStack->push_front(Binder->leftatom);
     1787      while (!AtomStack->empty()) {
     1788        Walker = AtomStack->front();
     1789        AtomStack->pop_front();
    17901790        //Log() << Verbose (3) << "Current Walker is: " << *Walker << "." << endl;
    17911791        ColorList[Walker->nr] = black;    // mark as explored
     
    17951795            OtherWalker = (*Runner)->GetOtherAtom(Walker);
    17961796            if (ColorList[OtherWalker->nr] == white) {
    1797               AtomStack->Push(OtherWalker); // push if yet unexplored
     1797              AtomStack->push_front(OtherWalker); // push if yet unexplored
    17981798            }
    17991799          }
  • src/molecule_graph.cpp

    rfd19ff ra564be  
    1919
    2020#include "Helpers/MemDebug.hpp"
     21
     22#include <stack>
    2123
    2224#include "atom.hpp"
     
    3840#include "LinearAlgebra/RealSpaceMatrix.hpp"
    3941#include "Box.hpp"
    40 #include "stackclass.hpp"
    4142
    4243struct BFSAccounting
     
    4546  int *ShortestPathList;
    4647  enum Shading *ColorList;
    47   class StackClass<atom *> *BFSStack;
    48   class StackClass<atom *> *TouchedStack;
     48  std::deque<atom *> *BFSStack;
     49  std::deque<atom *> *TouchedStack;
    4950  int AtomCount;
    5051  int BondOrder;
     
    5960struct DFSAccounting
    6061{
    61   class StackClass<atom *> *AtomStack;
    62   class StackClass<bond *> *BackEdgeStack;
     62  std::deque<atom *> *AtomStack;
     63  std::deque<bond *> *BackEdgeStack;
    6364  int CurrentGraphNr;
    6465  int ComponentNumber;
     
    310311  int *MinimumRingSize = NULL;
    311312  MoleculeLeafClass *Subgraphs = NULL;
    312   class StackClass<bond *> *BackEdgeStack = NULL;
     313  std::deque<bond *> *BackEdgeStack = NULL;
    313314  for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
    314315    if ((!(*AtomRunner)->ListOfBonds.empty()) && ((*(*AtomRunner)->ListOfBonds.begin())->Type == Undetermined)) {
     
    370371    Walker->LowpointNr = DFS.CurrentGraphNr;
    371372    DoLog(1) && (Log() << Verbose(1) << "Setting Walker[" << Walker->getName() << "]'s number to " << Walker->GraphNr << " with Lowpoint " << Walker->LowpointNr << "." << endl);
    372     DFS.AtomStack->Push(Walker);
     373    DFS.AtomStack->push_front(Walker);
    373374    DFS.CurrentGraphNr++;
    374375  }
     
    404405      // (4a) ... if "other" atom has been visited (GraphNr != 0), set lowpoint to minimum of both, go to (3)
    405406      Binder->Type = BackEdge;
    406       DFS.BackEdgeStack->Push(Binder);
     407      DFS.BackEdgeStack->push_front(Binder);
    407408      Walker->LowpointNr = (Walker->LowpointNr < OtherAtom->GraphNr) ? Walker->LowpointNr : OtherAtom->GraphNr;
    408409      DoLog(3) && (Log() << Verbose(3) << "(4a) Visited: Setting Lowpoint of Walker[" << Walker->getName() << "] to " << Walker->LowpointNr << "." << endl);
     
    451452      DoLog(3) && (Log() << Verbose(3) << "(7) Walker[" << Walker->getName() << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
    452453      do {
    453         OtherAtom = DFS.AtomStack->PopLast();
     454        ASSERT(!DFS.AtomStack->empty(), "DepthFirstSearchAnalysis_CheckForaNewComponent() - DFS.AtomStack is empty!");
     455        OtherAtom = DFS.AtomStack->front();
     456        DFS.AtomStack->pop_front();
    454457        LeafWalker->Leaf->AddCopyAtom(OtherAtom);
    455458        mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
     
    487490    DoLog(3) && (Log() << Verbose(3) << "(9) Walker[" << Walker->getName() << "]'s Component is " << DFS.ComponentNumber << "." << endl);
    488491    do {
    489       OtherAtom = DFS.AtomStack->PopLast();
     492      ASSERT(!DFS.AtomStack->empty(), "DepthFirstSearchAnalysis_CleanRootStackDownTillWalker() - DFS.AtomStack is empty!");
     493      OtherAtom = DFS.AtomStack->front();
     494      DFS.AtomStack->pop_front();
    490495      LeafWalker->Leaf->AddCopyAtom(OtherAtom);
    491496      mol->SetNextComponentNumber(OtherAtom, DFS.ComponentNumber);
    492       DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->getName() << "]'s Compont is " << DFS.ComponentNumber << "." << endl);
     497      DoLog(3) && (Log() << Verbose(3) << "(7) Other[" << OtherAtom->getName() << "]'s Component is " << DFS.ComponentNumber << "." << endl);
    493498    } while (OtherAtom != Walker);
    494499    DFS.ComponentNumber++;
     
    513518void DepthFirstSearchAnalysis_Init(struct DFSAccounting &DFS, const molecule * const mol)
    514519{
    515   DFS.AtomStack = new StackClass<atom *> (mol->getAtomCount());
     520  DFS.AtomStack = new std::deque<atom *> (mol->getAtomCount());
    516521  DFS.CurrentGraphNr = 0;
    517522  DFS.ComponentNumber = 0;
    518523  DFS.BackStepping = false;
    519524  mol->ResetAllBondsToUnused();
    520   DFS.BackEdgeStack->ClearStack();
     525  DFS.BackEdgeStack->clear();
    521526}
    522527;
     
    544549 * We use the algorithm from [Even, Graph Algorithms, p.62].
    545550 * \param *out output stream for debugging
    546  * \param *&BackEdgeStack NULL pointer to StackClass with all the found back edges, allocated and filled on return
     551 * \param *&BackEdgeStack NULL pointer to std::deque<bond *> with all the found back edges, allocated and filled on return
    547552 * \return list of each disconnected subgraph as an individual molecule class structure
    548553 */
    549 MoleculeLeafClass * molecule::DepthFirstSearchAnalysis(class StackClass<bond *> *&BackEdgeStack) const
     554MoleculeLeafClass * molecule::DepthFirstSearchAnalysis(std::deque<bond *> *&BackEdgeStack) const
    550555{
    551556  struct DFSAccounting DFS;
    552   BackEdgeStack = new StackClass<bond *> (BondCount);
     557  BackEdgeStack = new std::deque<bond *> (BondCount);
    553558  DFS.BackEdgeStack = BackEdgeStack;
    554559  MoleculeLeafClass *SubGraphs = new MoleculeLeafClass(NULL);
     
    566571    DFS.Root = *iter;
    567572    // (1) mark all edges unused, empty stack, set atom->GraphNr = -1 for all
    568     DFS.AtomStack->ClearStack();
     573    DFS.AtomStack->clear();
    569574
    570575    // put into new subgraph molecule and add this to list of subgraphs
     
    687692  BFS.ShortestPathList = new int[AtomCount];
    688693  BFS.ColorList = new enum Shading[AtomCount];
    689   BFS.BFSStack = new StackClass<atom *> (AtomCount);
    690   BFS.TouchedStack = new StackClass<atom *> (AtomCount);
     694  BFS.BFSStack = new std::deque<atom *> (AtomCount);
     695  BFS.TouchedStack = new std::deque<atom *> (AtomCount);
    691696
    692697  for (int i = AtomCount; i--;) {
     
    718723{
    719724  atom *Walker = NULL;
    720   while (!BFS.TouchedStack->IsEmpty()) {
    721     Walker = BFS.TouchedStack->PopFirst();
     725  while (!BFS.TouchedStack->empty()) {
     726    Walker = BFS.TouchedStack->front();
     727    BFS.TouchedStack->pop_front();
    722728    BFS.PredecessorList[Walker->nr] = NULL;
    723729    BFS.ShortestPathList[Walker->nr] = -1;
     
    734740{
    735741  BFS.ShortestPathList[Walker->nr] = 0;
    736   BFS.BFSStack->ClearStack(); // start with empty BFS stack
    737   BFS.BFSStack->Push(Walker);
    738   BFS.TouchedStack->Push(Walker);
     742  BFS.BFSStack->clear(); // start with empty BFS stack
     743  BFS.BFSStack->push_front(Walker);
     744  BFS.TouchedStack->push_front(Walker);
    739745};
    740746
     
    749755  atom *OtherAtom = NULL;
    750756  do { // look for Root
    751     Walker = BFS.BFSStack->PopFirst();
     757    ASSERT(!BFS.BFSStack->empty(), "CyclicStructureAnalysis_CyclicBFSFromRootToRoot() - BFS.BFSStack is empty!");
     758    Walker = BFS.BFSStack->front();
     759    BFS.BFSStack->pop_front();
    752760    DoLog(2) && (Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *BFS.Root << "." << endl);
    753761    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
     
    759767        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
    760768        if (BFS.ColorList[OtherAtom->nr] == white) {
    761           BFS.TouchedStack->Push(OtherAtom);
     769          BFS.TouchedStack->push_front(OtherAtom);
    762770          BFS.ColorList[OtherAtom->nr] = lightgray;
    763771          BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
     
    766774          //if (BFS.ShortestPathList[OtherAtom->nr] < MinimumRingSize[Walker->GetTrueFather()->nr]) { // Check for maximum distance
    767775          DoLog(3) && (Log() << Verbose(3) << "Putting OtherAtom into queue." << endl);
    768           BFS.BFSStack->Push(OtherAtom);
     776          BFS.BFSStack->push_front(OtherAtom);
    769777          //}
    770778        } else {
     
    796804        DoLog(3) && (Log() << Verbose(3) << "This cycle was already found before, skipping and removing seeker from search." << endl);
    797805        do {
    798           OtherAtom = BFS.TouchedStack->PopLast();
     806          ASSERT(!BFS.TouchedStack->empty(), "CyclicStructureAnalysis_CyclicBFSFromRootToRoot() - BFS.TouchedStack is empty!");
     807          OtherAtom = BFS.TouchedStack->front();
     808          BFS.TouchedStack->pop_front();
    799809          if (BFS.PredecessorList[OtherAtom->nr] == Walker) {
    800810            DoLog(4) && (Log() << Verbose(4) << "Removing " << *OtherAtom << " from lists and stacks." << endl);
     
    802812            BFS.ShortestPathList[OtherAtom->nr] = -1;
    803813            BFS.ColorList[OtherAtom->nr] = white;
    804             BFS.BFSStack->RemoveItem(OtherAtom);
     814            // rats ... deque has no find()
     815            std::deque<atom *>::iterator iter = find(
     816                BFS.BFSStack->begin(),
     817                BFS.BFSStack->end(),
     818                OtherAtom);
     819            ASSERT(iter != BFS.BFSStack->end(),
     820                "CyclicStructureAnalysis_CyclicBFSFromRootToRoot() - can't find "+toString(*OtherAtom)+" on stack!");
     821            BFS.BFSStack->erase(iter);
    805822          }
    806         } while ((!BFS.TouchedStack->IsEmpty()) && (BFS.PredecessorList[OtherAtom->nr] == NULL));
    807         BFS.TouchedStack->Push(OtherAtom); // last was wrongly popped
     823        } while ((!BFS.TouchedStack->empty()) && (BFS.PredecessorList[OtherAtom->nr] == NULL));
     824        BFS.TouchedStack->push_front(OtherAtom); // last was wrongly popped
    808825        OtherAtom = BackEdge->rightatom; // set to not Root
    809826      } else
    810827        OtherAtom = BFS.Root;
    811828    }
    812   } while ((!BFS.BFSStack->IsEmpty()) && (OtherAtom != BFS.Root) && (OtherAtom != NULL)); // || (ShortestPathList[OtherAtom->nr] < MinimumRingSize[Walker->GetTrueFather()->nr])));
     829  } while ((!BFS.BFSStack->empty()) && (OtherAtom != BFS.Root) && (OtherAtom != NULL)); // || (ShortestPathList[OtherAtom->nr] < MinimumRingSize[Walker->GetTrueFather()->nr])));
    813830};
    814831
     
    871888  ResetBFSAccounting(Walker, BFS);
    872889  while (OtherAtom != NULL) { // look for Root
    873     Walker = BFS.BFSStack->PopFirst();
     890    ASSERT(!BFS.BFSStack->empty(), "CyclicStructureAnalysis_BFSToNextCycle() - BFS.BFSStack is empty!");
     891    Walker = BFS.BFSStack->front();
     892    BFS.BFSStack->pop_front();
    874893    //Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "." << endl;
    875894    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
     
    879898        //Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl;
    880899        if (BFS.ColorList[OtherAtom->nr] == white) {
    881           BFS.TouchedStack->Push(OtherAtom);
     900          BFS.TouchedStack->push_front(OtherAtom);
    882901          BFS.ColorList[OtherAtom->nr] = lightgray;
    883902          BFS.PredecessorList[OtherAtom->nr] = Walker; // Walker is the predecessor
     
    889908            break;
    890909          } else
    891             BFS.BFSStack->Push(OtherAtom);
     910            BFS.BFSStack->push_front(OtherAtom);
    892911        } else {
    893912          //Log() << Verbose(3) << "Not Adding, has already been visited." << endl;
     
    947966 * \todo BFS from the not-same-LP to find back to starting point of tributary cycle over more than one bond
    948967 */
    949 void molecule::CyclicStructureAnalysis(class StackClass<bond *> * BackEdgeStack, int *&MinimumRingSize) const
     968void molecule::CyclicStructureAnalysis(std::deque<bond *> * BackEdgeStack, int *&MinimumRingSize) const
    950969{
    951970  struct BFSAccounting BFS;
     
    963982  DoLog(1) && (Log() << Verbose(1) << "Analysing cycles ... " << endl);
    964983  NumCycles = 0;
    965   while (!BackEdgeStack->IsEmpty()) {
    966     BackEdge = BackEdgeStack->PopFirst();
     984  while (!BackEdgeStack->empty()) {
     985    BackEdge = BackEdgeStack->front();
     986    BackEdgeStack->pop_front();
    967987    // this is the target
    968988    BFS.Root = BackEdge->leftatom;
     
    12271247 * \return true - everything ok, false - ReferenceStack was empty
    12281248 */
    1229 bool molecule::PickLocalBackEdges(atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const
     1249bool molecule::PickLocalBackEdges(atom **ListOfLocalAtoms, std::deque<bond *> *&ReferenceStack, std::deque<bond *> *&LocalStack) const
    12301250{
    12311251  bool status = true;
    1232   if (ReferenceStack->IsEmpty()) {
     1252  if (ReferenceStack->empty()) {
    12331253    DoLog(1) && (Log() << Verbose(1) << "ReferenceStack is empty!" << endl);
    12341254    return false;
    12351255  }
    1236   bond *Binder = ReferenceStack->PopFirst();
     1256  bond *Binder = ReferenceStack->front();
     1257  ReferenceStack->pop_front();
    12371258  bond *FirstBond = Binder; // mark the first bond, so that we don't loop through the stack indefinitely
    12381259  atom *Walker = NULL, *OtherAtom = NULL;
    1239   ReferenceStack->Push(Binder);
     1260  ReferenceStack->push_front(Binder);
    12401261
    12411262  do { // go through all bonds and push local ones
     
    12451266        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    12461267        if (OtherAtom == ListOfLocalAtoms[(*Runner)->rightatom->nr]) { // found the bond
    1247           LocalStack->Push((*Runner));
     1268          LocalStack->push_front((*Runner));
    12481269          DoLog(3) && (Log() << Verbose(3) << "Found local edge " << *(*Runner) << "." << endl);
    12491270          break;
    12501271        }
    12511272      }
    1252     Binder = ReferenceStack->PopFirst(); // loop the stack for next item
     1273    ASSERT(!ReferenceStack->empty(), "molecule::PickLocalBackEdges() - ReferenceStack is empty!");
     1274    Binder = ReferenceStack->front(); // loop the stack for next item
     1275    ReferenceStack->pop_front();
    12531276    DoLog(3) && (Log() << Verbose(3) << "Current candidate edge " << Binder << "." << endl);
    1254     ReferenceStack->Push(Binder);
     1277    ReferenceStack->push_front(Binder);
    12551278  } while (FirstBond != Binder);
    12561279
     
    12661289  BFS.ShortestPathList = new int[AtomCount];
    12671290  BFS.ColorList = new enum Shading[AtomCount];
    1268   BFS.BFSStack = new StackClass<atom *> (AtomCount);
     1291  BFS.BFSStack = new std::deque<atom *> (AtomCount);
    12691292
    12701293  BFS.Root = Root;
    1271   BFS.BFSStack->ClearStack();
    1272   BFS.BFSStack->Push(Root);
     1294  BFS.BFSStack->clear();
     1295  BFS.BFSStack->push_front(Root);
    12731296
    12741297  // initialise each vertex as white with no predecessor, empty queue, color Root lightgray
     
    13181341    }
    13191342    DoLog(0) && (Log() << Verbose(0) << ", putting OtherAtom into queue." << endl);
    1320     BFS.BFSStack->Push(OtherAtom);
     1343    BFS.BFSStack->push_front(OtherAtom);
    13211344  } else { // out of bond order, then replace
    13221345    if ((AddedAtomList[OtherAtom->nr] == NULL) && (Binder->Cyclic))
     
    13601383
    13611384/** Adds atoms up to \a BondCount distance from \a *Root and notes them down in \a **AddedAtomList.
    1362  * Gray vertices are always enqueued in an StackClass<atom *> FIFO queue, the rest is usual BFS with adding vertices found was
     1385 * Gray vertices are always enqueued in an std::deque<atom *> FIFO queue, the rest is usual BFS with adding vertices found was
    13631386 * white and putting into queue.
    13641387 * \param *out output stream for debugging
     
    13841407
    13851408  // and go on ... Queue always contains all lightgray vertices
    1386   while (!BFS.BFSStack->IsEmpty()) {
     1409  while (!BFS.BFSStack->empty()) {
    13871410    // we have to pop the oldest atom from stack. This keeps the atoms on the stack always of the same ShortestPath distance.
    13881411    // e.g. if current atom is 2, push to end of stack are of length 3, but first all of length 2 would be popped. They again
    13891412    // append length of 3 (their neighbours). Thus on stack we have always atoms of a certain length n at bottom of stack and
    13901413    // followed by n+1 till top of stack.
    1391     Walker = BFS.BFSStack->PopFirst(); // pop oldest added
     1414    Walker = BFS.BFSStack->front(); // pop oldest added
     1415    BFS.BFSStack->pop_front();
    13921416    DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->getName() << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl);
    13931417    for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
  • src/moleculelist.cpp

    rfd19ff ra564be  
    4242#include "LinearAlgebra/RealSpaceMatrix.hpp"
    4343#include "Box.hpp"
    44 #include "stackclass.hpp"
    4544
    4645#include "Helpers/Assert.hpp"
  • src/unittests/Makefile.am

    rfd19ff ra564be  
    4242  ShapeUnittest \
    4343  SingletonTest \
    44   StackClassUnitTest \
    4544  SubspaceFactorizerUnitTest \
    4645  TesselationUnitTest \
     
    104103  ShapeUnittest.cpp \
    105104  SingletonTest.cpp \
    106   stackclassunittest.cpp \
    107105  tesselationunittest.cpp \
    108106  tesselation_boundarytriangleunittest.cpp \
     
    144142  RegistryUnitTest.hpp \
    145143  SingletonTest.hpp \
    146   stackclassunittest.hpp \
    147144  tesselationunittest.hpp \
    148145  tesselation_boundarytriangleunittest.hpp \
     
    251248SingletonTest_LDADD = ${ALLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}
    252249
    253 StackClassUnitTest_SOURCES = UnitTestMain.cpp stackclassunittest.cpp stackclassunittest.hpp
    254 StackClassUnitTest_LDADD = ${ALLLIBS}
    255 
    256250SubspaceFactorizerUnitTest_SOURCES = UnitTestMain.cpp SubspaceFactorizerUnittest.cpp SubspaceFactorizerUnittest.hpp
    257251SubspaceFactorizerUnitTest_LDADD = ${GSLLIBS}
Note: See TracChangeset for help on using the changeset viewer.