Changeset 4a187d for src


Ignore:
Timestamp:
Feb 26, 2016, 9:54:40 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:
0824dd
Parents:
1187c5
git-author:
Frederik Heber <heber@…> (02/16/16 08:32:23)
git-committer:
Frederik Heber <heber@…> (02/26/16 09:54:40)
Message:

GLWorldScene also takes note of empty molecule.

  • this is for the case when a molecule is signalled empty before it signals ready for removal. This may happen cause the empty and the removal signal come from different sources, empty from GLMoleculeObject_molecule and removal from the board.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
2 edited

Legend:

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

    r1187c5 r4a187d  
    213213  const MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
    214214  if (moliter != MoleculesinSceneMap.end()) {
     215    const RemovedMoleculesMap_t::iterator emptyiter = EmptyMolecules.find(_mol);
     216    if (emptyiter != EmptyMolecules.end())
     217      EmptyMolecules.erase(emptyiter);
    215218    // check that it is the right molecule
    216219    QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
     
    497500
    498501  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(molid);
    499   if ( iter != MoleculesinSceneMap.end()) {
    500     LOG(1, "DEBUG: Removing GLMoleculeObject_molecule to id " << molid << " from scene.");
     502  ASSERT ( iter != MoleculesinSceneMap.end(),
     503      "GLWorldScene::moleculeRemoved() - to be removed molecule "+toString(molid)
     504      +" is already gone.");
     505  // check if it's already empty
     506  const RemovedMoleculesMap_t::iterator emptyiter = EmptyMolecules.find(_mol);
     507  if (emptyiter != EmptyMolecules.end()) {
     508    LOG(1, "DEBUG: Removing empty GLMoleculeObject_molecule to id " << molid << " from scene.");
     509    // it's already empty, remove it
     510    ASSERT( emptyiter->second == iter->second,
     511        "GLWorldScene::moleculeRemoved() - empty molecule "
     512        +toString(emptyiter->second)+" and removed molecule "
     513        +toString(iter->second)+" don't match.");
     514    LOG(1, "DEBUG: Deleting already empty GLMoleculeObject_molecule to id " << molid);
     515    GLMoleculeObject_molecule *molObject = emptyiter->second;
     516    EmptyMolecules.erase(emptyiter);
     517    molObject->disconnect();
     518    delete molObject;
     519
     520    emit changed();
     521    emit changeOccured();
     522  } else {
     523    // otherwise note it as removal candidate
    501524    RemovedMolecules.insert( std::make_pair(_mol, iter->second) );
    502     MoleculesinSceneMap.erase(iter);
    503   }
     525  }
     526  MoleculesinSceneMap.erase(iter);
    504527
    505528  // remove any possible state changes left
     
    517540  boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    518541
    519   RemovedMoleculesMap_t::iterator iter = RemovedMolecules.find(_mol.get());
    520   if ( iter != RemovedMolecules.end()) {
    521     LOG(1, "DEBUG: Deleting GLMoleculeObject_molecule to id " << molid);
    522     GLMoleculeObject_molecule *molObject = iter->second;
    523     RemovedMolecules.erase(iter);
     542  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(molid);
     543  if ( iter == MoleculesinSceneMap.end()) {
     544    RemovedMoleculesMap_t::iterator removeiter = RemovedMolecules.find(_mol.get());
     545    ASSERT ( removeiter != RemovedMolecules.end(),
     546        "GLWorldScene::moleculeEmpty() - to be removed molecule "+toString(molid)
     547        +" is neither in MoleculesinSceneMap, nor in RemovedMolecules.");
     548    // it's noted for removal already, remove it
     549    LOG(1, "DEBUG: Deleting empty GLMoleculeObject_molecule to id " << molid);
     550    GLMoleculeObject_molecule *molObject = removeiter->second;
     551    RemovedMolecules.erase(removeiter);
    524552    molObject->disconnect();
    525553    delete molObject;
     554
     555    emit changed();
     556    emit changeOccured();
    526557  } else {
    527     ASSERT(0,
    528         "GLWorldScene::moleculeEmpty() - molecule "+toString(molid)+" is empty that is not present.");
    529   }
    530 
    531   // remove any possible state changes left
    532   {
    533     boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
    534     MoleculeMissedStateMap.erase(molid);
    535   }
    536 
    537   emit changed();
    538   emit changeOccured();
     558    // otherwise just note it as empty
     559    EmptyMolecules.insert( std::make_pair(_mol.get(), iter->second) );
     560  }
     561
     562//  // remove any possible state changes left
     563//  {
     564//    boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
     565//    MoleculeMissedStateMap.erase(molid);
     566//  }
    539567}
    540568
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r1187c5 r4a187d  
    141141  //!> set of all currently removed molecules
    142142  RemovedMoleculesMap_t RemovedMolecules;
     143  //!> set of all currently empty molecules (about to be removed)
     144  RemovedMoleculesMap_t EmptyMolecules;
    143145
    144146  //!> flag to indicate whether state map is currently worked on
Note: See TracChangeset for help on using the changeset viewer.