Changeset 4e6ffe for src/UIElements
- Timestamp:
- Feb 14, 2016, 12:33:42 PM (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:
- 42d7dc
- Parents:
- 04c3a3
- git-author:
- Frederik Heber <heber@…> (12/13/15 14:15:58)
- git-committer:
- Frederik Heber <heber@…> (02/14/16 12:33:42)
- Location:
- src/UIElements/Qt4/InstanceBoard
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer.hpp
r04c3a3 r4e6ffe 79 79 void countsubjectKilled(const id _id); 80 80 81 /** Prepares removeal a vector of observed values of an instance identified by \a _id. 82 * 83 * \param _id identifier of instance 84 */ 85 void removeObservedValues(const id _id); 86 81 87 /** Erases a vector of observed values of an instance identified by \a _id. 82 88 * 83 89 * \param _id identifier of instance 84 90 */ 85 void removeObservedValues(const id _id);91 void eraseObservedValues(const id _id); 86 92 87 93 private: … … 96 102 //!> counts how many ObservedValues have already been subjectKilled() 97 103 subjectKilledCount_t subjectKilledCount; 104 105 //!> typedef for the set with ids to be erase 106 typedef std::set<id> MarkedForErase_t; 107 108 //!> marks ids marked for erase (i.e. all subjectKilled() received) 109 MarkedForErase_t MarkedForErase; 98 110 99 111 //!> name used in describing the instance type … … 122 134 */ 123 135 bool checksubjectKilled(const id _id) const; 136 137 /** Internal function to check whether the vector of ObservedValue's 138 * identified by \a _id has been marked for erase. 139 * 140 * Marked for erase means that it has received all subjectKilled() 141 * (the container not the values themselves). 142 * 143 * \param _id identifier of instance 144 * \return true - marked for erase, false - else 145 */ 146 bool checkMarkedForErase(const id _id) const; 124 147 125 148 private: -
src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer_impl.hpp
r04c3a3 r4e6ffe 53 53 const id _id) 54 54 { 55 typename CountedObservedValues_t::iterator iter = ObservedValues.find(_id); 55 LOG(3, "DEBUG: ObservedValuesContainer got markObservedValuesAsConnected() for an observed value of " 56 << NameOfType << " " << _id); 57 typename CountedObservedValues_t::iterator iter = ObservedValues.find(_id); 56 58 ASSERT (iter != ObservedValues.end(), 57 59 "ObservedValuesContainer<T,id>::markObservedValuesAsConnected() - Observed value of " … … 72 74 const id _id) 73 75 { 76 LOG(3, "DEBUG: ObservedValuesContainer got markObservedValuesAsDisconnected() for an observed value of " 77 << NameOfType << " " << _id); 74 78 typename CountedObservedValues_t::iterator iter = ObservedValues.find(_id); 75 79 ASSERT (iter != ObservedValues.end(), … … 81 85 --(iter->second.second); 82 86 83 if (checkRefCount(_id) && checksubjectKilled(_id) )87 if (checkRefCount(_id) && checksubjectKilled(_id) && checkMarkedForErase(_id)) 84 88 removeObservedValues(_id); 85 89 } … … 109 113 ++(iter->second); 110 114 111 if (checkRefCount(_id) && checksubjectKilled(_id) )115 if (checkRefCount(_id) && checksubjectKilled(_id) && checkMarkedForErase(_id)) 112 116 removeObservedValues(_id); 113 117 } … … 121 125 subjectKilledCount.erase(_id); 122 126 ObservedValues.erase(_id); 127 MarkedForErase.erase(_id); 128 } 129 130 template <class T, typename id> 131 void ObservedValuesContainer<T,id>::eraseObservedValues(const id _id) 132 { 133 #ifndef NDEBUG 134 std::pair< typename std::set<id>::iterator, bool > inserter = 135 #endif 136 MarkedForErase.insert(_id); 137 ASSERT( inserter.second, 138 "ObservedValuesContainer<T,id>::eraseObservedValues() - received twice for " 139 +NameOfType+" "+toString(_id)+"."); 140 141 if (checkRefCount(_id) && checksubjectKilled(_id) && checkMarkedForErase(_id)) 142 removeObservedValues(_id); 143 } 144 145 template <class T, typename id> 146 bool ObservedValuesContainer<T,id>::checkMarkedForErase(const id _id) const 147 { 148 return MarkedForErase.count(_id); 123 149 } 124 150 … … 140 166 const typename subjectKilledCount_t::iterator Solditer = subjectKilledCount.find(_oldid); 141 167 const typename subjectKilledCount_t::iterator Snewiter = subjectKilledCount.find(_newid); 168 const typename MarkedForErase_t::iterator Eolditer = MarkedForErase.find(_oldid); 169 const typename MarkedForErase_t::iterator Enewiter = MarkedForErase.find(_newid); 142 170 bool status = ((Colditer != ObservedValues.end()) && (Cnewiter == ObservedValues.end())); 143 171 status &= ((Solditer != subjectKilledCount.end()) && (Snewiter == subjectKilledCount.end())); 172 status &= ((Eolditer != MarkedForErase.end()) && (Enewiter == MarkedForErase.end())); 144 173 // change id here only if still present 145 174 if (status) { … … 154 183 subjectKilledCount.insert( std::make_pair(_newid, countvalue) ); 155 184 } 185 { 186 MarkedForErase.erase(Eolditer); 187 MarkedForErase.insert(_newid); 188 } 156 189 return true; 157 190 } else -
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp
r04c3a3 r4e6ffe 209 209 owner = NULL; 210 210 211 if (!BoardIsGone) 211 emit atomRemoved(); 212 213 if (!BoardIsGone) { 212 214 board.markObservedAtomAsDisconnected(getAtomIndex()); 213 214 emit atomRemoved();215 board.markObservedAtomForErase(getAtomIndex()); 216 } 215 217 } 216 218 } -
src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp
r04c3a3 r4e6ffe 351 351 } 352 352 353 void QtObservedInstanceBoard::markObservedAtomForErase(const atomId_t _id) 354 { 355 atomObservedValues.eraseObservedValues(_id); 356 } 357 353 358 void QtObservedInstanceBoard::markObservedMoleculeAsConnected(const moleculeId_t _id) 354 359 { … … 360 365 moleculeObservedValues.markObservedValuesAsDisconnected(_id); 361 366 } 367 368 void QtObservedInstanceBoard::markObservedMoleculeForErase(const moleculeId_t _id) 369 { 370 moleculeObservedValues.eraseObservedValues(_id); 371 } -
src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp
r04c3a3 r4e6ffe 83 83 void markObservedAtomAsConnected(const atomId_t _id); 84 84 void markObservedAtomAsDisconnected(const atomId_t _id); 85 void markObservedAtomForErase(const atomId_t _id); 85 86 void markObservedMoleculeAsConnected(const moleculeId_t _id); 86 87 void markObservedMoleculeAsDisconnected(const moleculeId_t _id); 88 void markObservedMoleculeForErase(const moleculeId_t _id); 87 89 88 90 signals: -
src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp
r04c3a3 r4e6ffe 172 172 owner = NULL; 173 173 174 if (!BoardIsGone) 174 emit moleculeRemoved(); 175 176 if (!BoardIsGone) { 175 177 board.markObservedMoleculeAsDisconnected(getMolIndex()); 176 177 emit moleculeRemoved();178 board.markObservedMoleculeForErase(getMolIndex()); 179 } 178 180 } 179 181 }
Note:
See TracChangeset
for help on using the changeset viewer.