Changeset 1eba7c for src/UIElements
- Timestamp:
- Apr 25, 2016, 7:05:31 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:
- ea7926
- Parents:
- efeeb7
- git-author:
- Frederik Heber <heber@…> (04/18/16 20:57:47)
- git-committer:
- Frederik Heber <heber@…> (04/25/16 07:05:31)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
refeeb7 r1eba7c 229 229 connect(_atom.get(), SIGNAL(moleculeChanged()), this, SLOT(reparentAtom())); 230 230 231 boost::recursive_mutex::scoped_lock lock(Atom_mutex); 232 231 233 // store the object, as we need it on reparenting 232 {234 const ObservedValue_Index_t atomid = _atom->getIndex(); 233 235 #ifndef NDEBUG 234 236 std::pair< ObservedAtoms_t::iterator, bool > inserter = 235 237 #endif 236 237 238 238 ObservedAtoms.insert( std::make_pair(_atom.get(), _atom) ); 239 ASSERT( inserter.second, 240 "GLWorldScene::connectAtom() - observed atom "+toString(_atom)+" already stored?"); 239 241 #ifndef NDEBUG 240 242 std::pair< ObservedValueIndexLookup_t::iterator, bool > indexinserter = 241 243 #endif 242 ObservedValueIndexLookup.insert( std::make_pair(_atom->getIndex(), _atom.get()) ); 243 ASSERT( indexinserter.second, 244 "GLWorldScene::connectAtom() - observed atom's index " 245 +toString(_atom->getIndex())+" already stored?"); 246 } 247 { 248 const ObservedValue_Index_t atomid = _atom->getIndex(); 249 boost::recursive_mutex::scoped_lock lock(AtomNodeParentMap_mutex); 250 AtomNodeParentMap.left.insert( std::make_pair(atomid, (ObservedValue_Index_t)NULL) ); 251 } 244 ObservedValueIndexLookup.insert( std::make_pair(atomid, _atom.get()) ); 245 ASSERT( indexinserter.second, 246 "GLWorldScene::connectAtom() - observed atom's index " 247 +toString(atomid)+" already stored?"); 248 249 // and create entry in the parent map 250 AtomNodeParentMap.left.insert( std::make_pair(atomid, (ObservedValue_Index_t)NULL) ); 252 251 253 252 emit atomConnected(_atom); … … 262 261 LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom " 263 262 << _atom->getAtomIndex()); 263 boost::recursive_mutex::scoped_lock lock(Atom_mutex); 264 264 265 265 const ObservedValue_Index_t atomid = _atom->getIndex(); … … 267 267 GLMoleculeObject_atom *atomObject = NULL; 268 268 { 269 boost::recursive_mutex::scoped_lock lock(AtomNodeParentMap_mutex);270 269 AtomNodeParentMap_t::left_iterator parentiter = AtomNodeParentMap.left.find(atomid); 271 270 ASSERT (parentiter != AtomNodeParentMap.left.end(), … … 335 334 void GLWorldScene::checkAndRemoveAtom(const ObservedValue_Index_t &_atomid) 336 335 { 337 boost::recursive_mutex::scoped_lock lock(Atom NodeParentMap_mutex);336 boost::recursive_mutex::scoped_lock lock(Atom_mutex); 338 337 339 338 if (checkAtomRemoval(AtomNodeParentMap, ToBeRemovedNodes, _atomid)) { … … 354 353 LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+"."); 355 354 // bonds are removed by signal coming from ~bond 355 boost::recursive_mutex::scoped_lock lock(Atom_mutex); 356 356 357 357 ASSERT( ToBeRemovedNodes.count(_atomid) == 0, … … 381 381 connect(_bond.get(), SIGNAL(rightmoleculeChanged()), this, SLOT(reparentBondRight()), Qt::QueuedConnection); 382 382 383 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 384 383 385 // store the object, as we need it on reparenting 386 const ObservedValue_Index_t bondid = _bond->getIndex(); 384 387 { 385 388 #ifndef NDEBUG … … 392 395 std::pair< ObservedValueIndexLookup_t::iterator, bool > indexinserter = 393 396 #endif 394 ObservedValueIndexLookup.insert( std::make_pair( _bond->getIndex(), _bond.get()) );397 ObservedValueIndexLookup.insert( std::make_pair(bondid, _bond.get()) ); 395 398 ASSERT( indexinserter.second, 396 399 "GLWorldScene::connectBond() - observed bond's index " 397 +toString( _bond->getIndex())+" already stored?");400 +toString(bondid)+" already stored?"); 398 401 } 399 402 { 400 const ObservedValue_Index_t bondid = _bond->getIndex();401 boost::recursive_mutex::scoped_lock lock(BondNodeParentMap_mutex);402 403 if ((_bond->getLeftAtom() != NULL) && (_bond->getLeftAtom()->getMoleculeRef() != NULL)) 403 404 BondNodeParentMaps[0].left.insert( … … 423 424 void GLWorldScene::insertBond(QtObservedBond::ptr _bond) 424 425 { 425 static const std::vector< GLMoleculeObject_bond::SideOfBond > bondsides = 426 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 427 428 const std::vector< GLMoleculeObject_bond::SideOfBond > bondsides = 426 429 boost::assign::list_of<GLMoleculeObject_bond::SideOfBond> 427 430 (GLMoleculeObject_bond::left) … … 436 439 #endif 437 440 { 438 boost::recursive_mutex::scoped_lock lock(BondNodeParentMap_mutex);439 441 for (size_t i=0;i<2;++i) { 440 442 BondNodeParentMap_t::left_iterator parentiter = BondNodeParentMaps[i].left.find(bondid); … … 464 466 void GLWorldScene::checkAndRemoveBond(const ObservedValue_Index_t &_bondid) 465 467 { 468 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 469 466 470 if (checkBondRemoval(BondNodeParentMaps, ToBeRemovedNodes, _bondid)) { 467 471 LOG(3, "DEBUG: Found both parents of to be removed bond " << _bondid << " as GLWorldScene, removing."); … … 479 483 void GLWorldScene::removeBond(ObservedValue_Index_t _bondid) 480 484 { 481 boost::recursive_mutex::scoped_lock lock(Bond NodeParentMap_mutex);485 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 482 486 LOG(3, "INFO: GLWorldScene::removedBond() - got bondRemoved signal from board for id " << _bondid); 483 487 … … 495 499 void GLWorldScene::hoverChangedSignalled(GLMoleculeObject *ob) 496 500 { 501 boost::recursive_mutex::scoped_lock lock(Atom_mutex); 497 502 // Find the atom, ob corresponds to. 498 503 hoverAtomId = -1; … … 565 570 // check all atoms for not yet assigned parents 566 571 { 567 boost::recursive_mutex::scoped_lock lock(Atom NodeParentMap_mutex);572 boost::recursive_mutex::scoped_lock lock(Atom_mutex); 568 573 std::pair<AtomNodeParentMap_t::right_const_iterator, AtomNodeParentMap_t::right_const_iterator> iters = 569 574 AtomNodeParentMap.right.equal_range(molid); … … 577 582 // check all bonds for not yet assigned parents 578 583 { 579 boost::recursive_mutex::scoped_lock lock(Bond NodeParentMap_mutex);584 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 580 585 for (size_t i=0;i<2;++i) { 581 586 std::pair<BondNodeParentMap_t::right_const_iterator, BondNodeParentMap_t::right_const_iterator> iters = … … 671 676 void GLWorldScene::reparentAtom() 672 677 { 673 boost::recursive_mutex::scoped_lock lock(Atom NodeParentMap_mutex);678 boost::recursive_mutex::scoped_lock lock(Atom_mutex); 674 679 QObject * origin = sender(); 675 680 if (origin == NULL) { … … 709 714 void GLWorldScene::reparentBondLeft() 710 715 { 711 boost::recursive_mutex::scoped_lock lock(Bond NodeParentMap_mutex);716 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 712 717 QObject * origin = sender(); 713 718 if (origin == NULL) { … … 732 737 void GLWorldScene::reparentBondRight() 733 738 { 734 boost::recursive_mutex::scoped_lock lock(Bond NodeParentMap_mutex);739 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 735 740 QObject * origin = sender(); 736 741 if (origin == NULL) { … … 777 782 const GLMoleculeObject_bond::SideOfBond _side) 778 783 { 779 boost::recursive_mutex::scoped_lock lock(Bond NodeParentMap_mutex);784 boost::recursive_mutex::scoped_lock lock(Bond_mutex); 780 785 const size_t dim = (_side == GLMoleculeObject_bond::left) ? 0 : 1; 781 786 const ObservedValue_Index_t bondid = _bond->getIndex(); -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
refeeb7 r1eba7c 170 170 atomId_t hoverAtomId; 171 171 172 //!> mutex to ascertain atomic access to NodeParentMaps 173 boost::recursive_mutex AtomNodeParentMap_mutex; 174 boost::recursive_mutex BondNodeParentMap_mutex; 172 //!> mutex to ascertain atomic access to atom-related internal maps 173 boost::recursive_mutex Atom_mutex; 174 //!> mutex to ascertain atomic access to bond-related internal maps 175 boost::recursive_mutex Bond_mutex; 175 176 176 177 AtomNodeMap AtomsinSceneMap;
Note:
See TracChangeset
for help on using the changeset viewer.