Changeset 805fdc for src/UIElements


Ignore:
Timestamp:
Feb 26, 2016, 9:46:19 AM (9 years ago)
Author:
Frederik Heber <heber@…>
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:
e29427
Parents:
5c9604
git-author:
Frederik Heber <heber@…> (02/13/16 15:30:05)
git-committer:
Frederik Heber <heber@…> (02/26/16 09:46:19)
Message:

FIX: GLWorldScene's moleculesAtomRemoved was checking QtObservedAtomMap.

  • however, the atom may already be a different one. Also, we do not even need it as we obtain the molecule from QtObservedMolecule directly.
  • also, molecule may no longer be present in MoleculesInSceneMap but still in RemovedMolecules and no molecule with same id already instantiated ...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r5c9604 r805fdc  
    253253  LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+".");
    254254
    255   // if atom is not in map, then GLMoleculeObject_molecule is already present anyway.
    256   if (QtObservedAtomMap.count(_atomid)) {
    257     const QtObservedAtom::ptr atom = QtObservedAtomMap[_atomid];
    258     const moleculeId_t molid = atom->getAtomMoleculeIndex();
    259     // check of molecule is already present
    260     boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    261     const MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
    262     if (moliter != MoleculesinSceneMap.end()) {
    263       QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
    264       if (checkmol.get() == _mol) {
    265         LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)+".");
    266         QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
    267                                   "atomRemoved",       // member name (no parameters here)
    268                                   Qt::QueuedConnection,     // connection type
    269                                   Q_ARG(const atomId_t, _atomid));     // parameters
    270       } else {
    271         // relay atomRemoved to GLMoleculeObject_molecule in RemovedMolecules
    272         LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)
    273             +" to molecule in RemovedMolecules.");
    274         const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
    275         ASSERT( removedmoliter != RemovedMolecules.end(),
    276             "GLWorldScene::moleculesAtomRemoved() - signal from old mol "
    277             +toString(molid)+", but not present in RemovedMolecules");
    278         QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
    279                                   "atomRemoved",       // member name (no parameters here)
    280                                   Qt::QueuedConnection,     // connection type
    281                                   Q_ARG(const atomId_t, _atomid));     // parameters
    282       }
     255  const moleculeId_t molid = _mol->getMolIndex();
     256  // check of molecule is already present
     257  boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
     258  const MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
     259  if (moliter != MoleculesinSceneMap.end()) {
     260    const QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
     261    if (checkmol.get() == _mol) {
     262      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)+".");
     263      QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
     264                                "atomRemoved",       // member name (no parameters here)
     265                                Qt::QueuedConnection,     // connection type
     266                                Q_ARG(const atomId_t, _atomid));     // parameters
     267    } else {
     268      // relay atomRemoved to GLMoleculeObject_molecule in RemovedMolecules
     269      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)
     270          +" to molecule in RemovedMolecules.");
     271      const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
     272      ASSERT( removedmoliter != RemovedMolecules.end(),
     273          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
     274          +toString(molid)+", but not present in RemovedMolecules");
     275#ifndef NDEBUG
     276      const QtObservedMolecule::ptr &othercheckmol = removedmoliter->second->ObservedMolecule;
     277#endif
     278      ASSERT( othercheckmol.get() == _mol,
     279          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
     280          +toString(molid)+", but different one "+toString(othercheckmol)
     281          +" present in RemovedMolecules.");
     282      QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
     283                                "atomRemoved",       // member name (no parameters here)
     284                                Qt::QueuedConnection,     // connection type
     285                                Q_ARG(const atomId_t, _atomid));     // parameters
     286    }
     287  } else {
     288    const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
     289    if (removedmoliter != RemovedMolecules.end()) {
     290      ASSERT( removedmoliter != RemovedMolecules.end(),
     291          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
     292          +toString(molid)+", but not present in RemovedMolecules");
     293#ifndef NDEBUG
     294      const QtObservedMolecule::ptr &othercheckmol = removedmoliter->second->ObservedMolecule;
     295#endif
     296      ASSERT( othercheckmol.get() == _mol,
     297          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
     298          +toString(molid)+", but different one "+toString(othercheckmol)
     299          +" present in RemovedMolecules.");
     300      QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
     301                                "atomRemoved",       // member name (no parameters here)
     302                                Qt::QueuedConnection,     // connection type
     303                                Q_ARG(const atomId_t, _atomid));     // parameters
    283304    } else {
    284305      boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
Note: See TracChangeset for help on using the changeset viewer.