Changeset 08fd83


Ignore:
Timestamp:
May 8, 2008, 12:45:52 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
84e88a
Parents:
7b80a5
Message:

MoleculeLeafClass::FillRootStackForSubgraphs used to remove filling of root stack (abstraction)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecules.cpp

    r7b80a5 r08fd83  
    22172217    *out << Verbose(0) << "Bond order " << Order << " greater than or equal to Minimum Ring size of " << MinimumRingSize << " found is not allowed." << endl;
    22182218  } else {
    2219     FragmentList = (Graph **) Malloc(sizeof(Graph *)*FragmentCounter, "molecule::FragmentMolecule - **BondFragments");
     2219    FragmentList = (Graph **) Malloc(sizeof(Graph *)*Subgraphs->next->Count(), "molecule::FragmentMolecule - **BondFragments");
    22202220   
    22212221    // ===== 6a. fill RootStack for each subgraph (second adaptivity check) =====
    22222222    // NOTE: (keep this extern of following while loop, as lateron we may here look for which site to add to which subgraph)
    22232223    // fill the root stack
    2224     KeyStack RootStack[FragmentCounter];
    2225 
    2226     if (Order == -1) {  // means we want to increase order adaptively
    2227       cerr << "Adaptive chosing of sites not yet implemented!" << endl;
    2228     } else {  // means we just want to increase it at every site by one
    2229       FragmentCounter = 0;
    2230       MolecularWalker = Subgraphs;
    2231       // count subgraphs and allocate fragments
    2232       while (MolecularWalker->next != NULL) {
    2233         MolecularWalker = MolecularWalker->next;
    2234         // find first root candidates 
    2235         RootStack[FragmentCounter].clear(); 
    2236         Walker = MolecularWalker->Leaf->start;
    2237         while (Walker->next != MolecularWalker->Leaf->end) { // go through all (non-hydrogen) atoms
    2238           Walker = Walker->next;
    2239       #ifdef ADDHYDROGEN
    2240           if (Walker->type->Z != 1) // skip hydrogen
    2241       #endif
    2242             if (Walker->GetTrueFather()->AdaptiveOrder < Order) // only if Order is still greater
    2243               RootStack[FragmentCounter].push_front(Walker->nr);
    2244         }
    2245         FragmentCounter++;
    2246       }
    2247     }
     2224    KeyStack *RootStack = new KeyStack[Subgraphs->next->Count()];
     2225    Subgraphs->next->FillRootStackForSubgraphs(out, RootStack, Order, (FragmentCounter = 0));
    22482226
    22492227   // ===== 6b. assign each keyset to its respective subgraph =====
Note: See TracChangeset for help on using the changeset viewer.