Changeset f444ce for molecuilder


Ignore:
Timestamp:
Oct 18, 2009, 4:09:26 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
6e250f
Parents:
c9f639
Message:

Shifted molecuke::InitComponentNumbers() to atom::InitComponentNr.

Note that this is still only possible due to ListOfBondsPerAtom() -> atom::ListOfBonds() switch.

Location:
molecuilder/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/atom.cpp

    rc9f639 rf444ce  
    292292};
    293293
     294/** Outputs the current atom::AdaptiveOrder and atom::MaxOrder to \a *file.
     295 * \param *file output stream
     296 */
     297void atom::OutputOrder(ofstream *file)
     298{
     299  *file << nr << "\t" << (int)AdaptiveOrder << "\t" << (int)MaxOrder << endl;
     300  //cout << Verbose(2) << "Storing: " << nr << "\t" << (int)AdaptiveOrder << "\t" << (int)MaxOrder << "." << endl;
     301};
     302
     303/** Initialises the component number array.
     304 * Size is set to atom::ListOfBonds.size()+1 (last is th encode end by -1)
     305 */
     306void atom::InitComponentNr()
     307{
     308  if (ComponentNr != NULL)
     309    Free(&ComponentNr);
     310  ComponentNr = Malloc<int>(ListOfBonds.size()+1, "atom::InitComponentNumbers: *ComponentNr");
     311  for (int i=ListOfBonds.size()+1;i--;)
     312    ComponentNr[i] = -1;
     313};
     314
    294315/** Puts a given bond into atom::ListOfBonds.
    295316 * \param *Binder bond to insert
     
    471492};
    472493
    473 /** Outputs the current atom::AdaptiveOrder and atom::MaxOrder to \a *file.
    474  * \param *file output stream
    475  */
    476 void atom::OutputOrder(ofstream *file)
    477 {
    478   *file << nr << "\t" << (int)AdaptiveOrder << "\t" << (int)MaxOrder << endl;
    479   //cout << Verbose(2) << "Storing: " << nr << "\t" << (int)AdaptiveOrder << "\t" << (int)MaxOrder << "." << endl;
    480 }
    481 
    482494/** Returns squared distance to a given vector.
    483495 * \param origin vector to calculate distance to
  • molecuilder/src/atom.hpp

    rc9f639 rf444ce  
    104104  void OutputGraphInfo(ofstream *out) const;
    105105  void OutputComponentNumber(ofstream *out) const;
     106  void InitComponentNr();
    106107  int CountBonds() const;
    107108  int CorrectBondDegree(ofstream *out);
  • molecuilder/src/molecule_graph.cpp

    rc9f639 rf444ce  
    388388  ResetAllBondsToUnused();
    389389  ResetAllAtomNumbers();
    390   InitComponentNumbers();
     390  ActOnAllAtoms( &atom::InitComponentNr );
    391391  BackEdgeStack->ClearStack();
    392392  while (Root != end) { // if there any atoms at all
     
    781781  } else
    782782      cerr << "Error: Given vertex is NULL!" << endl;
    783 };
    784 
    785 /** Allocates memory for all atom::*ComponentNr in this molecule and sets each entry to -1.
    786  */
    787 void molecule::InitComponentNumbers()
    788 {
    789   atom *Walker = start;
    790   while(Walker->next != end) {
    791     Walker = Walker->next;
    792     if (Walker->ComponentNr != NULL)
    793       Free(&Walker->ComponentNr);
    794     Walker->ComponentNr = Malloc<int>(Walker->ListOfBonds.size()+1, "molecule::InitComponentNumbers: *Walker->ComponentNr");
    795     for (int i=Walker->ListOfBonds.size()+1;i--;)
    796       Walker->ComponentNr[i] = -1;
    797   }
    798783};
    799784
Note: See TracChangeset for help on using the changeset viewer.