Changeset d2dbac0
- Timestamp:
- Feb 25, 2010, 10:50:54 AM (15 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:
- 244d26
- Parents:
- 0e2a47
- Location:
- src
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
r0e2a47 rd2dbac0 32 32 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp Descriptors/AtomIdDescriptor.hpp Descriptors/AtomTypeDescriptor.hpp 33 33 34 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${DESCRIPTORSOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp lists.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp 34 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${DESCRIPTORSOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp lists.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp WorldIterators.cpp 35 35 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PATTERNHEADER} ${UIHEADER} ${DESCRIPTORHEADER} ${LEGACYHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp World.hpp 36 36 -
src/World.cpp
r0e2a47 rd2dbac0 49 49 mol = new molecule(periode); 50 50 molecules_deprecated->insert(mol); 51 molecules.insert(mol); 51 assert(!molecules.count(currMoleculeId)); 52 molecules[currMoleculeId++] = mol; 52 53 mol->signOn(this); 53 54 return mol; … … 58 59 OBSERVE; 59 60 atom *res = NewAtom(); 61 assert(!atoms.count(currAtomId)); 60 62 res->setId(currAtomId++); 61 63 res->setWorld(this); … … 66 68 int World::registerAtom(atom *atom){ 67 69 OBSERVE; 70 assert(!atoms.count(currAtomId)); 68 71 atom->setId(currAtomId++); 69 72 atom->setWorld(this); … … 107 110 /******************************* Iterators ********************************/ 108 111 109 World::AtomIterator::AtomIterator(){ 110 state = World::get()->atomEnd(); 111 } 112 113 World::AtomIterator::AtomIterator(AtomDescriptor _descr, World* _world) : 114 descr(_descr.get_impl()), 115 world(_world), 116 index(0) 117 { 118 state = world->atoms.begin(); 119 advanceState(); 120 } 121 122 World::AtomIterator::AtomIterator(const AtomIterator& rhs) : 123 state(rhs.state), 124 descr(rhs.descr), 125 index(rhs.index), 126 world(rhs.world) 127 {} 128 129 World::AtomIterator& World::AtomIterator::operator=(const AtomIterator& rhs) 130 { 131 if(&rhs!=this){ 132 state=rhs.state; 133 descr=rhs.descr; 134 index=rhs.index; 135 world=rhs.world; 136 } 137 return *this; 138 } 139 140 World::AtomIterator& World::AtomIterator::operator++(){ 141 ++state; 142 ++index; 143 advanceState(); 144 return *this; 145 } 146 147 World::AtomIterator World::AtomIterator::operator++(int){ 148 AtomIterator res(*this); 149 ++(*this); 150 return res; 151 } 152 153 bool World::AtomIterator::operator==(const AtomIterator& rhs){ 154 return state==rhs.state; 155 } 156 157 bool World::AtomIterator::operator==(const World::AtomList::iterator& rhs){ 158 return state==rhs; 159 } 160 161 bool World::AtomIterator::operator!=(const AtomIterator& rhs){ 162 return state!=rhs.state; 163 } 164 165 bool World::AtomIterator::operator!=(const World::AtomList::iterator& rhs){ 166 return state!=rhs; 167 } 168 169 atom* World::AtomIterator::operator*(){ 170 return (*state).second; 171 } 172 173 void World::AtomIterator::advanceState(){ 174 while((state!=world->atoms.end()) && (!descr->predicate(*state))){ 175 ++state; 176 ++index; 177 } 178 } 179 180 int World::AtomIterator::getCount(){ 181 return index; 182 } 112 /* 113 * Actual Implementation of the iterators can be found in WorldIterators.cpp 114 */ 183 115 184 116 World::AtomIterator World::getAtomIter(AtomDescriptor descr){ … … 186 118 } 187 119 188 World::Atom List::iterator World::atomEnd(){120 World::AtomSet::iterator World::atomEnd(){ 189 121 return atoms.end(); 190 122 } … … 200 132 World::World() : 201 133 currAtomId(0), 134 currMoleculeId(0), 202 135 periode(new periodentafel), 203 136 molecules_deprecated(new MoleculeListClass), 204 atoms() 137 atoms(), 138 molecules() 205 139 { 206 140 molecules_deprecated->signOn(this); … … 211 145 delete molecules_deprecated; 212 146 delete periode; 213 Atom List::iterator iter;147 AtomSet::iterator iter; 214 148 for(iter=atoms.begin();iter!=atoms.end();++iter){ 215 149 DeleteAtom((*iter).second); -
src/World.hpp
r0e2a47 rd2dbac0 41 41 template<typename> friend class AtomsCalculation; 42 42 43 typedef std::map<int,atom*> AtomList; 43 typedef std::map<int,atom*> AtomSet; 44 typedef std::map<int,molecule*> MoleculeSet; 44 45 public: 45 46 … … 131 132 AtomIterator operator++(int); // postfix with dummy parameter 132 133 bool operator==(const AtomIterator&); 133 bool operator==(const Atom List::iterator&);134 bool operator==(const AtomSet::iterator&); 134 135 bool operator!=(const AtomIterator&); 135 bool operator!=(const Atom List::iterator&);136 bool operator!=(const AtomSet::iterator&); 136 137 atom* operator*(); 137 138 … … 140 141 void advanceState(); 141 142 World* world; 142 Atom List::iterator state;143 AtomSet::iterator state; 143 144 boost::shared_ptr<AtomDescriptor_impl> descr; 144 145 int index; … … 152 153 153 154 /** 154 * returns an iterator to the end of the Atom List. Due to overloading this iterator155 * returns an iterator to the end of the AtomSet. Due to overloading this iterator 155 156 * can be compared to iterators produced by getAtomIter (see the mis-matching types). 156 157 * Thus it can be used to detect when such an iterator is at the end of the list. 157 158 * used for internal purposes, like AtomProcesses and AtomCalculations. 158 159 */ 159 Atom List::iterator atomEnd();160 AtomSet::iterator atomEnd(); 160 161 161 162 /******* Internal manipulation routines for double callback and Observer mechanism ******/ … … 164 165 private: 165 166 periodentafel *periode; 166 Atom List atoms;167 AtomSet atoms; 167 168 int currAtomId; //!< stores the next available Id for atoms 168 std::set<molecule*> molecules; 169 MoleculeSet molecules; 170 int currMoleculeId; 169 171 170 172
Note:
See TracChangeset
for help on using the changeset viewer.