Ignore:
Timestamp:
Oct 18, 2009, 2:51:38 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
77894f
Parents:
b0ee98
git-author:
Frederik Heber <heber@…> (10/18/09 14:15:37)
git-committer:
Frederik Heber <heber@…> (10/18/09 14:51:38)
Message:

Huge refactoring: molecule::ListOfBondsPerAtom and molecule::NumberOfBondsPerAtom removed, atom::ListOfBonds introduced. Unit Test for ListOfBonds manipulation introduced.

  • changes to builder.cpp: removed CreateListOfBondsPerAtom() calls, as the creation of the global arrays is not necessary anymore
  • changes to LinkedCell: LinkedCell::CheckBounds(int[NDIM]) does not admonish out of bonds as this is not desired for the local offset which may become out of bounds.
  • changes to lists.hpp templates: BUGFIX: unlink() now sets ->next and ->previous to NULL, cleanup() uses removedwithoutcheck()
  • new templates for molecule.hpp: SumPerAtom() allows for summation of the return value of atom:...() member fiunctions. This is needed e.g. for atom::CorrectBondDegree()

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/bond.cpp

    rb0ee98 r872b51  
    5353  Cyclic = false;
    5454};
     55
    5556bond::bond(atom *left, atom *right)
    5657{
     
    7778{
    7879  // remove this node from the list structure
    79   if (previous != NULL) {
    80     previous->next = next;
    81   }
    82   if (next != NULL) {
    83     next->previous = previous;
    84   }
     80  if (leftatom != NULL)
     81    leftatom->UnregisterBond(this);
     82  if (rightatom != NULL)
     83  rightatom->UnregisterBond(this);
     84  unlink(this);
    8585};
    8686
     
    9595 * \return pointer to the other atom in the bond, NULL if no match (indicates something's wrong with the bond)
    9696 */
    97 atom * bond::GetOtherAtom(atom *Atom) const
     97atom * bond::GetOtherAtom(const atom *Atom) const
    9898{
    9999  if(leftatom == Atom)
     
    105105};
    106106
    107 /** Get the other atom in a bond if one is specified.
    108  * \param *Atom the pointer to the one atom
    109  * \return pointer to the other atom in the bond, NULL if no match (indicates something's wrong with the bond)
    110  */
    111 bond * bond::GetFirstBond()
    112 {
    113   return GetFirst(this);
    114 };
    115 
    116 /** Get the other atom in a bond if one is specified.
    117  * \param *Atom the pointer to the one atom
    118  * \return pointer to the other atom in the bond, NULL if no match (indicates something's wrong with the bond)
    119  */
    120 bond * bond::GetLastBond()
    121 {
    122   return GetLast(this);
    123 };
    124107
    125108/** Returns whether vertex was used in DFS.
Note: See TracChangeset for help on using the changeset viewer.