Ignore:
Timestamp:
Feb 14, 2016, 12:34:28 PM (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:
62a0ee
Parents:
e7ed12
git-author:
Frederik Heber <heber@…> (01/06/16 17:34:22)
git-committer:
Frederik Heber <heber@…> (02/14/16 12:34:28)
Message:

QtObservedInstanceBoard now sends QtObserved..::ptr around in signals.

  • this should get rid of the problem that we need to keep the QtObservedAtom until it was requested at least once. And we don't know for how long. Now, we simply place the shared_ptr into the signal (to which it seems to be copied) and hence a representation of the atoms remains valid.
  • cstor of GLMoleculeObject_.. take Observed.. as ref.
Location:
src/UIElements/Qt4/InstanceBoard
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp

    re7ed12 r1b07b1  
    7575          _1)),
    7676  lastremovedatom((atomId_t)-1),
    77   lastremovedatomsmolecule( std::make_pair((moleculeId_t)-1,(atomId_t)-1) ),
    7877  lastremovedmolecule((moleculeId_t)-1)
    7978{
     
    169168          MoleculeSignedOn.insert( static_cast<Observable *>(const_cast<molecule *>(_molecule)) );
    170169
    171           emit moleculeInserted(_id);
     170          emit moleculeInserted(observedmolecule);
    172171        } else {
    173172          ELOG(1, "QtObservedInstanceBoard got MoleculeInserted for unknown molecule id " << _id);
     
    206205          _atom->signOn(this, atom::IndexChanged);
    207206          AtomSignedOn.insert( static_cast<Observable *>(const_cast<atom *>(_atom)) );
    208           emit atomInserted(observedatom->getAtomMoleculeIndex(), observedatom->getAtomIndex());
     207          emit atomInserted(observedatom);
    209208        } else {
    210209          ELOG(1, "QtObservedInstanceBoard got AtomInserted for unknown atom id " << _id);
     
    227226    const moleculeId_t molid = const_cast<const World &>(World::getInstance()).lastChangedMolId();
    228227    switch (notification->getChannelNo()) {
    229       case molecule::AtomInserted:
    230       {
    231         const molecule * const _molecule = const_cast<const World &>(World::getInstance()).
    232             getMolecule(MoleculeById(molid));
    233         if (_molecule != NULL) {
    234           const atomId_t atomid = const_cast<const molecule *>(_molecule)->lastChangedAtomId();
    235           LOG(3, "DEBUG: InformationBoard got AtomInserted signal for atom "
    236               << atomid << " from molecule " << molid);
    237           // check whether atom's observedvalues are present
    238           ASSERT( atomObservedValues.isPresent(atomid),
    239               "QtObservedInstanceBoard::recieveNotification() - ObservedValues for atom "
    240               +toString(atomid)+" are not present yet.");
    241           // and emit
    242           emit atomInserted(molid, atomid);
    243         } else {
    244           ELOG(2, "QtObservedInstanceBoard::recieveNotification() - molecule "
    245               << molid << " has disappeared.");
    246         }
    247         break;
    248       }
    249       case molecule::AtomRemoved:
    250       {
    251         const molecule * const _molecule = const_cast<const World &>(World::getInstance()).
    252             getMolecule(MoleculeById(molid));
    253         if (_molecule != NULL) {
    254           const atomId_t atomid = const_cast<const molecule *>(_molecule)->lastChangedAtomId();
    255           LOG(3, "DEBUG: InformationBoard got AtomRemoved signal for atom "
    256               << atomid << " from molecule " << molid);
    257           lastremovedatomsmolecule = std::make_pair(molid, atomid);
    258         }
    259         break;
    260       }
    261228      case molecule::IndexChanged:
    262229      {
     
    293260            "QtObservedInstanceBoard::recieveNotification() - cannot change atom's id "
    294261            +toString(oldatomId)+" "+toString(newatomId)+" in atomObservedValues.");
    295         // changed insertion delayed
    296         atomInsertionDelayed_t::iterator iter = atomInsertionDelayed.find(oldatomId);
    297         if (iter != atomInsertionDelayed.end()) {
    298           const moleculeId_t molid = iter->second;
    299           atomInsertionDelayed.erase(iter);
    300 #ifndef NDEBUG
    301           std::pair<atomInsertionDelayed_t::iterator, bool> inserter =
    302 #endif
    303           atomInsertionDelayed.insert( std::make_pair(newatomId, molid) );
    304           ASSERT( inserter.second,
    305               "QtObservedInstanceBoard::recieveNotification() - id "
    306               +toString(newatomId)+" already present in atomInsertionDelayed.");
    307         }
    308262        // no need update SignedOn, ref does not change
    309263        emit atomIndexChanged(oldatomId, newatomId);
     
    321275void QtObservedInstanceBoard::atomcountsubjectKilled(const atomId_t _atomid)
    322276{
    323   if ((_atomid == lastremovedatomsmolecule.second) && (_atomid == lastremovedatom)) {
     277  if ((_atomid == lastremovedatom)) {
    324278    LOG(3, "DEBUG: InstanceBoard emits atomRemoved for " << _atomid);
    325     emit atomRemoved(lastremovedatomsmolecule.first, lastremovedatomsmolecule.second);
     279    emit atomRemoved(lastremovedatom);
    326280  } else
    327281    ELOG(2, "QtObservedInstanceBoard::atomcountsubjectKilled() - id " << _atomid
    328         << " not fitting with " << lastremovedatomsmolecule << " or " << lastremovedatom);
     282        << " not fitting with " << lastremovedatom);
    329283}
    330284
  • src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp

    re7ed12 r1b07b1  
    8989
    9090signals:
    91   void atomInserted(const moleculeId_t _molid, const atomId_t _atomid);
    92   void atomRemoved(const moleculeId_t _molid, const atomId_t _atomid);
     91  void atomInserted(QtObservedAtom::ptr _atom);
     92  void atomRemoved(const atomId_t _atomid);
    9393  void atomIndexChanged(const atomId_t _oldid, const atomId_t _newid);
    94   void moleculeInserted(const moleculeId_t _molid);
     94  void moleculeInserted(QtObservedMolecule::ptr _mol);
    9595  void moleculeRemoved(const moleculeId_t _molid);
    9696  void moleculeIndexChanged(const moleculeId_t _oldid, const moleculeId_t _newid);
     
    143143  atomId_t lastremovedatom;
    144144
    145   //!> note down atom id of last removed atom to drop its ObservedValues
    146   std::pair<moleculeId_t, atomId_t> lastremovedatomsmolecule;
    147 
    148145  //!> note down molecule id of last removed molecule to drop its ObservedValues
    149146  moleculeId_t lastremovedmolecule;
  • src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp

    re7ed12 r1b07b1  
    201201      {
    202202        const atomId_t _id = _molecule->lastChangedAtomId();
     203        QtObservedAtom::ptr _atom = board.getObservedAtom(_id);
    203204        emit atomcountChanged();
    204         emit atomInserted(_id);
     205        emit atomInserted(_atom);
    205206        emit bondcountChanged();
    206207        emit boundingboxChanged();
  • src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp

    re7ed12 r1b07b1  
    2828#include "UIElements/Qt4/InstanceBoard/ObservedValue_types.hpp"
    2929#include "UIElements/Qt4/InstanceBoard/ObservedValuesContainer.hpp"
     30#include "UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp"
    3031#include "types.hpp"
    3132
     
    146147  void tesselationhullChanged();
    147148  void boundingboxChanged();
    148   void atomInserted(const atomId_t);
     149  void atomInserted(QtObservedAtom::ptr);
    149150  void atomRemoved(const atomId_t);
    150151  void moleculeRemoved();
Note: See TracChangeset for help on using the changeset viewer.