Changeset 1a58ce for src/UIElements/Qt4/InstanceBoard
- Timestamp:
- Apr 20, 2016, 7:17:43 AM (9 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:
- 3054f4a
- Parents:
- 59eabc
- git-author:
- Frederik Heber <heber@…> (03/21/16 21:42:14)
- git-committer:
- Frederik Heber <heber@…> (04/20/16 07:17:43)
- Location:
- src/UIElements/Qt4/InstanceBoard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp
r59eabc r1a58ce 144 144 const ObservedValue_Index_t index = static_cast<const Observable *>(_molecule); 145 145 moleculeObservedValues.insert(index, observedmolecule); 146 moleculeids_lookup. insert( std::make_pair(_id, index) );146 moleculeids_lookup.left.insert( std::make_pair(_id, index) ); 147 147 // we need to check for index changes 148 148 LOG(3, "DEBUG: InformationBoard signOn()s to molecule " << _id); … … 172 172 const ObservedValue_Index_t index = static_cast<const Observable *>(_atom); 173 173 atomObservedValues.insert(index, observedatom); 174 atomids_lookup. insert( std::make_pair(_id, index) );174 atomids_lookup.left.insert( std::make_pair(_id, index) ); 175 175 // we need to check for index changes 176 176 LOG(3, "DEBUG: InformationBoard signOn()s to atom " << _id); … … 196 196 LOG(3, "DEBUG: InformationBoard got IndexChanged from molecule " << molid << " to " << newmoleculeId); 197 197 { 198 typename IdtoIndex_t<moleculeId_t>:: iterator iter = moleculeids_lookup.find(molid);199 ASSERT( iter != moleculeids_lookup. end(),198 typename IdtoIndex_t<moleculeId_t>::left_iterator iter = moleculeids_lookup.left.find(molid); 199 ASSERT( iter != moleculeids_lookup.left.end(), 200 200 "QtObservedInstanceBoard::recieveNotification() - mol id " 201 201 +toString(molid)+" unknown to lookup."); 202 202 const ObservedValue_Index_t index = iter->second; 203 moleculeids_lookup. erase(iter);204 moleculeids_lookup. insert( std::pair<moleculeId_t, ObservedValue_Index_t>(newmoleculeId, index) );203 moleculeids_lookup.left.erase(iter); 204 moleculeids_lookup.left.insert( std::pair<moleculeId_t, ObservedValue_Index_t>(newmoleculeId, index) ); 205 205 } 206 206 // no need update SignedOn, ref does not change … … 220 220 LOG(3, "DEBUG: InformationBoard got IndexChanged from atom " << oldatomId << " to " << newatomId); 221 221 { 222 typename IdtoIndex_t<atomId_t>:: iterator iter = atomids_lookup.find(oldatomId);223 ASSERT( iter != atomids_lookup. end(),222 typename IdtoIndex_t<atomId_t>::left_iterator iter = atomids_lookup.left.find(oldatomId); 223 ASSERT( iter != atomids_lookup.left.end(), 224 224 "QtObservedInstanceBoard::recieveNotification() - atom id " 225 225 +toString(oldatomId)+" unknown to lookup."); 226 226 const ObservedValue_Index_t index = iter->second; 227 atomids_lookup. erase(iter);228 atomids_lookup. insert( std::pair<atomId_t, ObservedValue_Index_t>(newatomId, index) );227 atomids_lookup.left.erase(iter); 228 atomids_lookup.left.insert( std::pair<atomId_t, ObservedValue_Index_t>(newatomId, index) ); 229 229 } 230 230 // no need update SignedOn, ref does not change … … 253 253 } 254 254 255 const atomId_t QtObservedInstanceBoard::getAtomIdToIndex(ObservedValue_Index_t _id) const 256 { 257 typename IdtoIndex_t<atomId_t>::right_const_iterator iter = atomids_lookup.right.find(_id); 258 ASSERT( iter != atomids_lookup.right.end(), 259 "QtObservedInstanceBoard::getAtomIdToIndex() - index " 260 +toString(_id)+" is unknown."); 261 return iter->second; 262 } 263 264 const moleculeId_t QtObservedInstanceBoard::getMoleculeIdToIndex(ObservedValue_Index_t _id) const 265 { 266 typename IdtoIndex_t<moleculeId_t>::right_const_iterator iter = moleculeids_lookup.right.find(_id); 267 ASSERT( iter != moleculeids_lookup.right.end(), 268 "QtObservedInstanceBoard::getMoleculeIdToIndex() - index " 269 +toString(_id)+" is unknown."); 270 return iter->second; 271 } 272 255 273 QtObservedAtom::ptr QtObservedInstanceBoard::getObservedAtom(const atomId_t _id) 256 274 { 257 return atomObservedValues.get(atomids_lookup [_id]);275 return atomObservedValues.get(atomids_lookup.left.at(_id)); 258 276 } 259 277 260 278 QtObservedMolecule::ptr QtObservedInstanceBoard::getObservedMolecule(const moleculeId_t _id) 261 279 { 262 return moleculeObservedValues.get(moleculeids_lookup [_id]);280 return moleculeObservedValues.get(moleculeids_lookup.left.at(_id)); 263 281 } 264 282 … … 276 294 { 277 295 atomObservedValues.eraseObservedValues(_id); 296 atomids_lookup.right.erase(_id); 278 297 } 279 298 … … 291 310 { 292 311 moleculeObservedValues.eraseObservedValues(_id); 293 } 312 moleculeids_lookup.right.erase(_id); 313 } -
src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp
r59eabc r1a58ce 21 21 22 22 #include <map> 23 #include <boost/bimap.hpp> 23 24 #include <boost/function.hpp> 24 25 … … 79 80 void recieveNotification(Observable *publisher, Notification_ptr notification); 80 81 82 const atomId_t getAtomIdToIndex(ObservedValue_Index_t _id) const; 83 const moleculeId_t getMoleculeIdToIndex(ObservedValue_Index_t _id) const; 84 81 85 QtObservedAtom::ptr getObservedAtom(const atomId_t _id); 82 86 QtObservedMolecule::ptr getObservedMolecule(const moleculeId_t _id); … … 113 117 //!> "templated typedef" for an id to index map. 114 118 template <class id> 115 struct IdtoIndex_t : std::map<id, ObservedValue_Index_t> {};119 struct IdtoIndex_t : boost::bimap<id, ObservedValue_Index_t> {}; 116 120 IdtoIndex_t<atomId_t> atomids_lookup; 117 121 IdtoIndex_t<moleculeId_t> moleculeids_lookup;
Note:
See TracChangeset
for help on using the changeset viewer.