Changeset 8e1f901
- Timestamp:
- Mar 30, 2012, 9:16:31 AM (13 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:
- c67ff9
- Parents:
- 5e6534
- git-author:
- Frederik Heber <heber@…> (03/21/12 11:41:02)
- git-committer:
- Frederik Heber <heber@…> (03/30/12 09:16:31)
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Fragmentation.cpp
r5e6534 r8e1f901 27 27 #include "Atom/atom.hpp" 28 28 #include "Bond/bond.hpp" 29 #include "Descriptors/MoleculeDescriptor.hpp" 29 30 #include "Element/element.hpp" 30 31 #include "Element/periodentafel.hpp" -
src/Graph/DepthFirstSearchAnalysis.cpp
r5e6534 r8e1f901 32 32 #include "CodePatterns/Verbose.hpp" 33 33 #include "Descriptors/AtomDescriptor.hpp" 34 #include "Descriptors/MoleculeDescriptor.hpp" 34 35 #include "molecule.hpp" 35 36 #include "MoleculeLeafClass.hpp" -
src/molecule.cpp
r5e6534 r8e1f901 165 165 /************************** Access to the List of Atoms ****************/ 166 166 167 168 molecule::iterator molecule::begin(){169 return iterator(atomIds.begin(), FromIdToAtom());170 }171 172 molecule::const_iterator molecule::begin() const{173 return const_iterator(atomIds.begin(), FromIdToAtom());174 }175 176 molecule::iterator molecule::end(){177 return iterator(atomIds.end(), FromIdToAtom());178 }179 180 molecule::const_iterator molecule::end() const{181 return const_iterator(atomIds.end(), FromIdToAtom());182 }183 184 bool molecule::empty() const185 {186 return (atomIds.empty());187 }188 189 size_t molecule::size() const190 {191 size_t counter = 0;192 for (const_iterator iter = begin(); iter != end (); ++iter)193 counter++;194 return counter;195 }196 197 167 molecule::const_iterator molecule::erase( const_iterator loc ) 198 168 { … … 222 192 } 223 193 224 molecule::const_iterator molecule::find ( atom * key ) const225 {226 return const_iterator(atomIds.find(key->getId()), FromIdToAtom());227 }228 229 194 pair<molecule::iterator,bool> molecule::insert ( atom * const key ) 230 195 { 231 196 OBSERVE; 232 pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());197 std::pair<iterator,bool> res = atomIds.insert(key->getId()); 233 198 if (res.second) { // push atom if went well 234 199 key->setNr(atomIdPool.getNextId()); 235 200 setAtomName(key); 236 201 formula+=key->getType(); 237 return pair<iterator,bool>(iterator(res.first, FromIdToAtom()),res.second);202 return res; 238 203 } else { 239 204 return pair<iterator,bool>(end(),res.second); … … 256 221 { 257 222 World::AtomComposite vector_of_atoms; 258 // std::copy(MyIter(atomIds.begin(), FromIdToAtom()),259 // MyIter(atomIds.end(), FromIdToAtom()),260 // vector_of_atoms.begin());261 // for (MyIter iter = MyIter(atomIds.begin(), FromIdToAtom());262 // iter != MyIter(atomIds.end(), FromIdToAtom());263 // ++iter)264 223 for (molecule::iterator iter = begin(); iter != end(); ++iter) 265 224 vector_of_atoms.push_back(*iter); … … 851 810 "molecule::isInMolecule() - atom is not designated to be in molecule '" 852 811 +toString(this->getName())+"'."); 853 molecule:: atomIdSet::const_iterator iter = atomIds.find(_atom->getId());812 molecule::const_iterator iter = atomIds.find(_atom->getId()); 854 813 return (iter != atomIds.end()); 855 814 } -
src/molecule.hpp
r5e6534 r8e1f901 21 21 #include <vector> 22 22 23 #include <boost/iterator/transform_iterator.hpp>24 25 23 #include <string> 26 24 25 #include "AtomIdSet.hpp" 27 26 #include "Atom/AtomSet.hpp" 28 27 #include "CodePatterns/Cacheable.hpp" 29 28 #include "CodePatterns/Observer/Observable.hpp" 30 #include "CodePatterns/Observer/ObservedIterator.hpp"31 29 #include "Descriptors/AtomIdDescriptor.hpp" 32 30 #include "Fragmentation/HydrogenSaturation_enum.hpp" … … 36 34 #include "IdPool.hpp" 37 35 #include "types.hpp" 38 39 // TODO: Was is the include of MoleculeDescriptor_impl.hpp doing in molecule.hpp40 #include "Descriptors/MoleculeDescriptor_impl.hpp"41 36 42 37 /****************************************** forward declarations *****************************/ … … 59 54 class Shape; 60 55 61 /******************************** Some definitions for easier reading **********************************/62 63 struct FromIdToAtom :64 public std::unary_function<atom *, atomId_t>65 {66 atom * operator()(atomId_t id) const {67 return World::getInstance().getAtom(AtomById(id));68 }69 };70 71 56 /************************************* Class definitions ****************************************/ 72 57 … … 80 65 81 66 public: 82 typedef std::set<atomId_t>atomIdSet;83 typedef boost::transform_iterator<FromIdToAtom, atomIdSet::iterator, atom *, atomId_t>iterator;84 typedef boost::transform_iterator<FromIdToAtom, atomIdSet::const_iterator, const atom *, atomId_t const &>const_iterator;67 typedef AtomIdSet::atomIdSet atomIdSet; 68 typedef AtomIdSet::iterator iterator; 69 typedef AtomIdSet::const_iterator const_iterator; 85 70 86 71 int MDSteps; //!< The number of MD steps in Trajectories … … 97 82 Cacheable<int> BondCount; //!< number of atoms, brought up-to-date by doCountBonds() 98 83 moleculeId_t id; 99 atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms84 AtomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms 100 85 IdPool<atomId_t, uniqueId> atomIdPool; //!< pool of internal ids such that way may guarantee uniqueness 101 86 … … 125 110 World::AtomComposite getAtomSet() const; 126 111 127 iterator begin(); 128 const_iterator begin() const; 129 iterator end(); 130 const_iterator end() const; 131 bool empty() const; 132 size_t size() const; 133 const_iterator find(atom * key) const; 134 pair<iterator, bool> insert(atom * const key); 112 // simply pass on all functions to AtomIdSet 113 iterator begin() { 114 return atomIds.begin(); 115 } 116 const_iterator begin() const 117 { 118 return atomIds.begin(); 119 } 120 iterator end() 121 { 122 return atomIds.end(); 123 } 124 const_iterator end() const 125 { 126 return atomIds.end(); 127 } 128 bool empty() const 129 { 130 return atomIds.empty(); 131 } 132 size_t size() const 133 { 134 return atomIds.size(); 135 } 136 const_iterator find(atom * key) const 137 { 138 return atomIds.find(key); 139 } 140 const atomIdSet & getAtomIds() const { 141 return atomIds.getAtomIds(); 142 } 143 144 std::pair<iterator, bool> insert(atom * const key); 145 135 146 bool containsAtom(atom* key); 136 147 … … 145 156 */ 146 157 const_iterator erase(const_iterator loc); 158 147 159 /** Erase an atom from the list. 148 160 * \note This should only be called by atom::removeFromMolecule(),
Note:
See TracChangeset
for help on using the changeset viewer.