Changeset 7d82a5
- Timestamp:
- Feb 13, 2013, 3:47:38 PM (12 years ago)
- 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:
- b4b364
- Parents:
- c8302f3
- git-author:
- Frederik Heber <heber@…> (11/02/12 13:38:08)
- git-committer:
- Frederik Heber <heber@…> (02/13/13 15:47:38)
- Location:
- src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Atom/atom_bondedparticle.cpp
rc8302f3 r7d82a5 114 114 } 115 115 116 bond * newBond = new bond((atom*) this, (atom*) Partner, 1);116 bond::ptr newBond(new bond((atom*) this, (atom*) Partner, 1)); 117 117 RegisterBond(_step, newBond); 118 118 Partner->RegisterBond(_step, newBond); … … 121 121 } 122 122 123 /** Removes a bond of this atom to a given \a Partner. 124 * 125 * @param _step time step 126 * @param Partner bond partner 127 */ 128 void BondedParticle::removeBond(const unsigned int _step, BondedParticle * const Partner) 123 /** Helper function to find the time step to a given bond in \a Binder. 124 * 125 * \param Binder bond to look for 126 * \return ListOfBonds::size() - not found, else - step containing \a Binder 127 */ 128 unsigned int BondedParticle::findBondsStep(bond::ptr const Binder) const 129 { 130 131 size_t _step = 0; 132 for (;_step < ListOfBonds.size();++_step) { 133 const BondList& ListOfBonds = getListOfBondsAtStep(_step); 134 if (std::find(ListOfBonds.begin(), ListOfBonds.end(), Binder) != ListOfBonds.end()) 135 break; 136 } 137 return _step; 138 } 139 140 /** Helper function to find the iterator to a bond at a given time \a step to 141 * a given bond partner in \a Partner. 142 * 143 * \param _step time step to look at 144 * \param Partner bond partner to look for 145 * \return ListOfBonds::end() - not found, else - iterator pointing \a Binder 146 */ 147 BondList::const_iterator BondedParticle::findBondPartnerAtStep( 148 const unsigned int _step, 149 BondedParticle * const Partner) const 129 150 { 130 151 const BondList& ListOfBonds = getListOfBondsAtStep(_step); … … 134 155 _1, 135 156 boost::cref(Partner))); 136 if (iter != ListOfBonds.end()) { 137 delete *iter; //dstor takes care of unregistering and all 157 return iter; 158 } 159 160 /** Removes a bond of this atom to a given \a Partner. 161 * 162 * @param _step time step 163 * @param Partner bond partner 164 */ 165 void BondedParticle::removeBond(const unsigned int _step, BondedParticle * const Partner) 166 { 167 BondList::const_iterator iter = findBondPartnerAtStep(_step, Partner); 168 if (iter != getListOfBondsAtStep(_step).end()) { 169 // iter becomes invalid upon first unregister, 170 // hence store the bond someplace else first 171 bond::ptr const Binder = *iter; 172 UnregisterBond(_step, Binder); 173 Partner->UnregisterBond(_step, Binder); 138 174 } else 139 175 ELOG(1, "BondedParticle::removeBond() - I cannot find the bond in between " … … 145 181 * @param Binder bond to remove 146 182 */ 147 void BondedParticle::removeBond(bond::ptr binder) 148 { 149 UnregisterBond(binder); 183 void BondedParticle::removeBond(bond::ptr &binder) 184 { 185 if (binder != NULL) { 186 atom * const Other = binder->GetOtherAtom(this); 187 ASSERT( Other != NULL, 188 "BondedParticle::removeBonds() - cannot find bond partner for " 189 +toString(*binder)+"."); 190 // find bond at step 191 unsigned int step = findBondsStep(binder); 192 if (step != ListOfBonds.size()) { 193 UnregisterBond(step, binder); 194 Other->UnregisterBond(step, binder); 195 binder.reset(); 196 } 197 } 150 198 } 151 199 … … 165 213 void BondedParticle::removeAllBonds(const unsigned int _step) 166 214 { 167 for (BondList::iterator iter = ListOfBonds[_step].begin(); 168 !ListOfBonds[_step].empty(); 169 iter = ListOfBonds[_step].begin()) { 170 delete (*iter); 171 // unregister/NOTIFY is done by bond::~bond() 215 //LOG(3,"INFO: Clearing all bonds of " << *this << ": " << ListOfBonds[_step]); 216 for (BondList::iterator iter = (ListOfBonds[_step]).begin(); 217 !(ListOfBonds[_step]).empty(); 218 iter = (ListOfBonds[_step]).begin()) { 219 //LOG(3,"INFO: Clearing bond (" << *iter << ") " << *(*iter) << " of list " << &ListOfBonds); 220 atom * const Other = (*iter)->GetOtherAtom(this); 221 ASSERT( Other != NULL, 222 "BondedParticle::removeAllBonds() - cannot find bond partner for " 223 +toString(**iter)+"."); 224 Other->UnregisterBond(_step, *iter); 225 UnregisterBond(_step, *iter); 172 226 } 173 227 } … … 179 233 bool BondedParticle::RegisterBond(const unsigned int _step, bond::ptr const Binder) 180 234 { 181 OBSERVE;182 235 bool status = false; 183 236 if (Binder != NULL) { 237 OBSERVE; 184 238 if (Binder->Contains(this)) { 185 239 //LOG(3,"INFO: Registering bond "<< *Binder << " with atom " << *this << " at step " << _step); … … 200 254 201 255 /** Removes a given bond from atom::ListOfBonds. 256 * 257 * \warning This only removes this atom not its bond partner, i.e. 258 * both atoms need to call this function to fully empty a bond. 259 * 202 260 * @param _step time step to access 203 261 * \param *Binder bond to remove 204 262 */ 205 bool BondedParticle::UnregisterBond(bond::ptr const Binder) 206 { 207 OBSERVE; 263 bool BondedParticle::UnregisterBond(const unsigned int _step, bond::ptr const Binder) 264 { 208 265 bool status = false; 209 ASSERT(Binder != NULL, "BondedParticle::UnregisterBond() - Binder is NULL."); 210 const int step = ContainsBondAtStep(Binder); 211 if (step != -1) { 212 //LOG(0,"INFO: Unregistering bond "<< *Binder << " from list " << &ListOfBonds << " of atom " << *this << " at step " << step); 213 ListOfBonds[step].remove(Binder); 214 if (WorldTime::getTime() == step) 215 NOTIFY(AtomObservable::BondsRemoved); 216 status = true; 266 if (Binder != NULL) { 267 if (Binder->Contains(this)) { 268 OBSERVE; 269 //LOG(0,"INFO: Unregistering bond "<< *Binder << " from list " << &ListOfBonds << " of atom " << *this << " at step " << step); 270 #ifndef NDEBUG 271 BondList::const_iterator iter = 272 std::find(ListOfBonds[_step].begin(), ListOfBonds[_step].end(), Binder); 273 ASSERT( iter != ListOfBonds[_step].end(), 274 "BondedParticle::UnregisterBond() - "+toString(*Binder)+" not contained at " 275 +toString(_step)); 276 #endif 277 Binder->removeAtom(this); 278 ListOfBonds[_step].remove(Binder); 279 if (WorldTime::getTime() == _step) 280 NOTIFY(AtomObservable::BondsRemoved); 281 status = true; 282 } else { 283 ELOG(1, *Binder << " does not contain " << *this << "."); 284 } 217 285 } else { 218 ELOG(1, *Binder << " does not contain " << *this<< ".");286 ELOG(1, "Binder is " << Binder << "."); 219 287 } 220 288 return status; 221 289 }; 222 290 223 /** Removes all bonds from atom::ListOfBonds.224 * \note Does not do any memory de-allocation.225 */226 void BondedParticle::UnregisterAllBond(const unsigned int _step)227 {228 OBSERVE;229 NOTIFY(AtomObservable::BondsRemoved);230 ListOfBonds[_step].clear();231 }232 233 291 /** Removes all bonds of given \a _step with freeing memory. 234 292 * … … 237 295 void BondedParticle::ClearBondsAtStep(const unsigned int _step) 238 296 { 239 OBSERVE; 240 NOTIFY(AtomObservable::BondsRemoved); 241 //LOG(3,"INFO: Clearing all bonds of " << *this << ": " << ListOfBonds[_step]); 242 for (BondList::iterator iter = (ListOfBonds[_step]).begin(); 243 !(ListOfBonds[_step]).empty(); 244 iter = (ListOfBonds[_step]).begin()) { 245 //LOG(3,"INFO: Clearing bond (" << *iter << ") " << *(*iter) << " of list " << &ListOfBonds); 246 delete((*iter)); // will also unregister with us and remove from list 247 } 297 removeAllBonds(_step); 248 298 } 249 299 … … 286 336 int FalseBondDegree = 0; 287 337 atom *OtherWalker = NULL; 288 bond::ptr CandidateBond = NULL;338 bond::ptr CandidateBond; 289 339 290 340 NoBonds = CountBonds(); -
src/Atom/atom_bondedparticle.hpp
rc8302f3 r7d82a5 24 24 #include "atom_atominfo.hpp" 25 25 #include "atom_bondedparticleinfo.hpp" 26 #include "atom_observable.hpp" 26 27 #include "atom_particleinfo.hpp" 28 #include "atom_observable.hpp" 27 29 28 30 /****************************************** forward declarations *****************************/ … … 32 34 /********************************************** declarations *******************************/ 33 35 34 class BondedParticle : public BondedParticleInfo, public virtual ParticleInfo, public virtual AtomInfo { 36 class BondedParticle : 37 public BondedParticleInfo, 38 public virtual ParticleInfo, 39 public virtual AtomInfo, 40 public virtual AtomObservable 41 { 35 42 public: 36 43 BondedParticle(); … … 39 46 bond::ptr const addBond(const unsigned int _step, BondedParticle* Partner); 40 47 void removeBond(const unsigned int _step, BondedParticle* Partner); 41 void removeBond(bond::ptr binder);48 void removeBond(bond::ptr &binder); 42 49 void removeAllBonds(); 43 50 void removeAllBonds(const unsigned int _step); … … 55 62 protected: 56 63 bool RegisterBond(const unsigned int _step, bond::ptr const Binder); 57 bool UnregisterBond(bond::ptr const Binder); 58 void UnregisterAllBond(const unsigned int _step); 64 bool UnregisterBond(const unsigned int _step, bond::ptr const Binder); 59 65 60 66 int ContainsBondAtStep(bond::ptr Binder) const; 61 67 68 private: 69 unsigned int findBondsStep(bond::ptr const Binder) const; 70 BondList::const_iterator findBondPartnerAtStep( 71 const unsigned int _step, 72 BondedParticle * const Partner) const; 62 73 }; 63 74 -
src/Atom/atom_bondedparticleinfo.hpp
rc8302f3 r7d82a5 19 19 #endif 20 20 21 #include "atom_observable.hpp"21 //#include "atom_observable.hpp" 22 22 #include "Bond/bond.hpp" 23 23 … … 32 32 /********************************************** declarations *******************************/ 33 33 34 class BondedParticleInfo : public virtual AtomObservable { 34 class BondedParticleInfo // : public virtual AtomObservable // must be virtual(!) 35 { 35 36 friend class BondedParticle; 36 37 public: -
src/Bond/bond.cpp
rc8302f3 r7d82a5 81 81 NOTIFY(BondRemoved); 82 82 } 83 // remove this node from the list structure 84 if (leftatom != NULL) 85 leftatom->removeBond(this); 86 // there might be self-bonds 87 if ((leftatom != rightatom) && (rightatom != NULL)) 88 rightatom->removeBond(this); 83 // atoms should have been destroyed and NULL'd their entry already 84 ASSERT (leftatom == NULL, 85 "~bond() - leftatom is not NULL."); 86 ASSERT (rightatom == NULL, 87 "~bond() - rightatom is not NULL."); 89 88 }; 90 89 … … 101 100 atom * bond::GetOtherAtom(const ParticleInfo * const Atom) const 102 101 { 102 ASSERT( (leftatom != NULL) && (rightatom != NULL), 103 "bond::GetOtherAtom() - one of the atoms refs is NULL."); 103 104 if(leftatom == Atom) 104 105 return rightatom; … … 143 144 return (leftatom->DistanceSquared(*rightatom)); 144 145 }; 146 147 /** Sets either leftatom or rightatom to NULL. 148 * 149 * \param Atom atom to remove 150 */ 151 void bond::removeAtom(const ParticleInfo * const Atom) 152 { 153 if (static_cast<const ParticleInfo *>(leftatom) == Atom) 154 leftatom = NULL; 155 if (static_cast<const ParticleInfo *>(rightatom) == Atom) 156 rightatom = NULL; 157 } -
src/Bond/bond.hpp
rc8302f3 r7d82a5 18 18 #endif 19 19 20 #include <boost/shared_ptr.hpp> 21 20 22 #include "Bond/bond_observable.hpp" 21 23 #include "Bond/GraphEdge.hpp" … … 24 26 25 27 class atom; 28 class BondedParticle; 26 29 class ParticleInfo; 27 30 … … 39 42 public: 40 43 //!> typedef for a bond ptr 41 typedef bo nd*ptr;44 typedef boost::shared_ptr<bond> ptr; 42 45 43 46 atom *leftatom; //!< first bond partner … … 56 59 bond(atom *left, atom *right, const int degree=1); 57 60 ~bond(); 61 62 private: 63 //!> grant atom_bondedparticle access to unregister function 64 friend class BondedParticle; 65 void removeAtom(const ParticleInfo * const Atom); 58 66 }; 59 67 -
src/Fragmentation/BondsPerShortestPath.cpp
rc8302f3 r7d82a5 90 90 BondsPerSPCount[i] = 0; 91 91 BondsPerSPCount[0] = 1; 92 bond::ptr Binder = new bond(_Root, _Root);92 bond::ptr Binder(new bond(_Root, _Root)); 93 93 BondsPerSPList[0].push_back(Binder); 94 94 }; … … 110 110 (*iter)->leftatom = NULL; 111 111 (*iter)->rightatom = NULL; 112 // now delete it, there we unregister but this checks for NULL113 delete(*iter);114 112 } 115 113 BondsPerSPList[i].clear(); … … 138 136 atom *OtherWalker = NULL; 139 137 atom *Predecessor = NULL; 140 bond::ptr Binder = NULL;138 bond::ptr Binder; 141 139 int RootKeyNr = _RootKeyNr; 142 140 int RemainingWalkers = -1; … … 180 178 if ((OtherWalker != Predecessor) && (OtherWalker->GetTrueFather()->getNr() > RootKeyNr)) { // only pass through those with label bigger than Root's 181 179 // add the bond in between to the SP list 182 Binder = new bond(Walker, OtherWalker); // create a new bond in such a manner, that bond::rightatom is always the one more distant180 Binder.reset(new bond(Walker, OtherWalker)); // create a new bond in such a manner, that bond::rightatom is always the one more distant 183 181 BondsPerSPList[SP+1].push_back(Binder); 184 182 BondsPerSPCount[SP+1]++; -
src/Fragmentation/BondsPerShortestPath.hpp
rc8302f3 r7d82a5 14 14 #endif 15 15 16 #include "Bond/bond.hpp" 16 17 #include "Fragmentation/HydrogenSaturation_enum.hpp" 17 18 … … 20 21 21 22 class atom; 22 class bond;23 23 class KeySet; 24 24 … … 39 39 int getOrder() const; 40 40 41 typedef std::list<bond *> BondsPerSP;41 typedef std::list<bond::ptr> BondsPerSP; 42 42 typedef std::vector< BondsPerSP > AllSPBonds; 43 43 -
src/Fragmentation/PowerSetGenerator.cpp
rc8302f3 r7d82a5 220 220 221 221 // prepare the subset and call the generator 222 std::vector<bond *> BondsList;222 std::vector<bond::ptr> BondsList; 223 223 BondsList.resize(BondsPerSPList.BondsPerSPCount[0]); 224 224 ASSERT(BondsPerSPList.BondsPerSPList[0].size() != 0, -
src/Graph/BreadthFirstSearchAdd.cpp
rc8302f3 r7d82a5 152 152 Info FunctionInfo("BreadthFirstSearchAdd"); 153 153 atom *Walker = NULL, *OtherAtom = NULL; 154 bond::ptr Binder = NULL;154 bond::ptr Binder; 155 155 156 156 // add Root if not done yet -
src/Graph/CyclicStructureAnalysis.cpp
rc8302f3 r7d82a5 332 332 atom *Walker = NULL; 333 333 atom *OtherAtom = NULL; 334 bond::ptr BackEdge = NULL;334 bond::ptr BackEdge; 335 335 int NumCycles = 0; 336 336 int MinRingSize = -1; -
src/Graph/DepthFirstSearchAnalysis.cpp
rc8302f3 r7d82a5 85 85 if ((*Runner)->IsUsed() == GraphEdge::white) 86 86 return ((*Runner)); 87 return NULL;87 return bond::ptr(); 88 88 } 89 89 … … 264 264 break; 265 265 } 266 Binder = NULL;266 Binder.reset(); 267 267 } while (1); // (3) 268 268 } … … 355 355 int OldGraphNr = 0; 356 356 atom *Walker = NULL; 357 bond::ptr Binder = NULL;357 bond::ptr Binder; 358 358 359 359 if (World::getInstance().numAtoms() == 0) … … 385 385 break; 386 386 } else 387 Binder = NULL;387 Binder.reset(); 388 388 } while (1); // (2) 389 389 -
src/Tesselation/boundary.cpp
rc8302f3 r7d82a5 787 787 Vector Inserter; 788 788 double FillIt = false; 789 bond::ptr Binder = NULL;789 bond::ptr Binder; 790 790 double phi[NDIM]; 791 791 map<molecule *, Tesselation *> TesselStruct; -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
rc8302f3 r7d82a5 136 136 _bond->leftatom->signOff(this, AtomObservable::PositionChanged); 137 137 _bond->rightatom->signOff(this, AtomObservable::PositionChanged); 138 _bond = NULL;138 _bond.reset(); 139 139 delete this; 140 140 } … … 147 147 << notification->getChannelNo() << "."; 148 148 #endif 149 if (publisher == dynamic_cast<const Observable *>(_bond)){149 if (publisher == dynamic_cast<const Observable *>(_bond.get())){ 150 150 // from the bond 151 151 switch (notification->getChannelNo()) { … … 168 168 _bond->leftatom->signOff(this, AtomObservable::PositionChanged); 169 169 _bond->rightatom->signOff(this, AtomObservable::PositionChanged); 170 _bond = NULL;170 _bond.reset(); 171 171 delete this; 172 172 break; -
src/World.cpp
rc8302f3 r7d82a5 245 245 NOTIFY(MoleculeRemoved); 246 246 } 247 mol->signOff(this); 247 248 DeleteMolecule(mol); 248 249 if (isMoleculeSelected(id)) -
src/molecule.cpp
rc8302f3 r7d82a5 333 333 double bondangle; // bond angle of the bond to be replaced/cut 334 334 double BondRescale; // rescale value for the hydrogen bond length 335 bond::ptr FirstBond = NULL;336 bond::ptr SecondBond = NULL; // Other bonds in double bond case to determine "other" plane335 bond::ptr FirstBond; 336 bond::ptr SecondBond; // Other bonds in double bond case to determine "other" plane 337 337 atom *FirstOtherAtom = NULL, *SecondOtherAtom = NULL, *ThirdOtherAtom = NULL; // pointer to hydrogen atoms to be added 338 338 double b,l,d,f,g, alpha, factors[NDIM]; // hold temporary values in triple bond case for coordination determination … … 340 340 Vector InBondvector; // vector in direction of *Bond 341 341 const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM(); 342 bond::ptr Binder = NULL;342 bond::ptr Binder; 343 343 344 344 // create vector in direction of bond … … 688 688 bond::ptr molecule::AddBond(atom *atom1, atom *atom2, int degree) 689 689 { 690 bond::ptr Binder = NULL;690 bond::ptr Binder; 691 691 692 692 // some checks to make sure we are able to create the bond … … 704 704 +" is not part of molecule"); 705 705 706 Binder = new bond(atom1, atom2, degree);706 Binder.reset(new bond(atom1, atom2, degree)); 707 707 atom1->RegisterBond(WorldTime::getTime(), Binder); 708 708 atom2->RegisterBond(WorldTime::getTime(), Binder); -
src/molecule_graph.cpp
rc8302f3 r7d82a5 273 273 bool molecule::ScanForPeriodicCorrection() 274 274 { 275 bond::ptr Binder = NULL;275 bond::ptr Binder; 276 276 //bond::ptr OtherBinder = NULL; 277 277 atom *Walker = NULL; -
src/moleculelist.cpp
rc8302f3 r7d82a5 299 299 bool MoleculeListClass::AddHydrogenCorrection(std::string &path) 300 300 { 301 bond::ptr Binder = NULL;301 bond::ptr Binder; 302 302 double ***FitConstant = NULL, **correction = NULL; 303 303 int a, b; -
src/unittests/ListOfBondsUnitTest.cpp
rc8302f3 r7d82a5 44 44 #include "World.hpp" 45 45 #include "Atom/atom.hpp" 46 #include "Atom/AtomObserver.hpp" 47 46 48 #include "Bond/bond.hpp" 47 49 #include "Element/element.hpp" … … 109 111 // are all cleaned when the world is destroyed 110 112 World::purgeInstance(); 113 AtomObserver::purgeInstance(); 111 114 logger::purgeInstance(); 115 errorLogger::purgeInstance(); 116 WorldTime::purgeInstance(); 117 112 118 }; 113 119 … … 126 132 void ListOfBondsTest::AddingBondTest() 127 133 { 128 bond::ptr Binder = NULL;134 bond::ptr Binder; 129 135 molecule::iterator iter = TestMolecule->begin(); 130 136 atom *atom1 = *iter; … … 160 166 void ListOfBondsTest::DeleteBondTest() 161 167 { 162 bond::ptr Binder = NULL;168 bond::ptr Binder; 163 169 molecule::iterator iter = TestMolecule->begin(); 164 170 atom *atom1 = *iter; … … 173 179 174 180 // remove bond 175 delete Binder;176 // atom1->removeBond(Binder);177 //atom2->removeBond(Binder);181 atom1->removeBond(Binder); 182 // removed for atom2 automatically but check where nothing breaks 183 atom2->removeBond(Binder); 178 184 179 185 // check if removed from atoms … … 198 204 atom *atom1 = NULL; 199 205 atom *atom2 = NULL; 200 bond::ptr Binder = NULL;206 bond::ptr Binder; 201 207 { 202 208 molecule::iterator iter = TestMolecule->begin(); … … 207 213 CPPUNIT_ASSERT( atom1 != NULL ); 208 214 CPPUNIT_ASSERT( atom2 != NULL ); 215 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom1->getListOfBonds().size() ); 216 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom2->getListOfBonds().size() ); 209 217 210 218 // add bond … … 213 221 214 222 // access test via CurrentTime 215 { 216 const BondList& ListOfBonds = atom1->getListOfBonds(); 217 CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() ); 218 } 219 { 220 const BondList& ListOfBonds = atom2->getListOfBonds(); 221 CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() ); 222 } 223 CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom1->getListOfBonds().size() ); 224 CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom2->getListOfBonds().size() ); 223 225 224 226 CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() ); … … 244 246 atom *atom1 = NULL; 245 247 atom *atom2 = NULL; 246 bond::ptr Binder = NULL;248 bond::ptr Binder; 247 249 { 248 250 molecule::iterator iter = TestMolecule->begin();
Note:
See TracChangeset
for help on using the changeset viewer.