Changeset dcbdf2 for molecuilder/src


Ignore:
Timestamp:
Oct 5, 2009, 10:08:57 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
3746440
Parents:
d40b96
Message:

New function atom::CorrectFactor() and atom::EqualsFather().

Location:
molecuilder/src
Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • molecuilder/src/atom.cpp

    rd40b96 rdcbdf2  
    8181};
    8282
     83/** Sets father to itself or its father in case of copying a molecule.
     84 */
     85void atom::CorrectFather()
     86{
     87  if (father->father == father)   // same atom in copy's father points to itself
     88    father = this;  // set father to itself (copy of a whole molecule)
     89  else
     90   father = father->father;  // set father to original's father
     91
     92};
     93
     94/** Check whether father is equal to given atom.
     95 * \param *ptr atom to compare father to
     96 * \param **res return value (only set if atom::father is equal to \a *ptr)
     97 */
     98void atom::EqualsFather ( atom *ptr, atom **res )
     99{
     100  if ( ptr == father )
     101    *res = this;
     102};
     103
    83104/** Output of a single atom.
    84105 * \param ElementNo cardinal number of the element
  • molecuilder/src/atom.hpp

    rd40b96 rdcbdf2  
    5353  bool Output(int ElementNo, int AtomNo, ofstream *out, const char *comment = NULL) const;
    5454  bool OutputXYZLine(ofstream *out) const;
     55  void EqualsFather ( atom *ptr, atom **res );
     56  void CorrectFather();
    5557  atom *GetTrueFather();
    5658  bool Compare(const atom &ptr);
Note: See TracChangeset for help on using the changeset viewer.