Ignore:
Timestamp:
Feb 12, 2016, 11:15:04 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:
2831b3
Parents:
e25448
git-author:
Frederik Heber <heber@…> (10/16/15 11:51:16)
git-committer:
Frederik Heber <heber@…> (02/12/16 23:15:04)
Message:

FIX: All ObservedValue's of GLMoleculeObject_atom/bond/molecule wrapped into vector.

  • the idea is that a GLMoleculeObject may only remove itself _after_ each and every contained Observer has gotten the subjectKilled() signal from the Observables. Only then will destroying the Object and its members thereby not cause any signOff() which try to access Observables or their channels which are no longer present. This can be imagined as a graph where we have to start destroying object at the very bottom.
  • This is the avoid the following conflict: A superior object gets note of a molecule to be removed. It sends the visual representation a signal to remove itself, which causes it to use signOff(). On a parallel track (in another thread) we have the observed object calling subjectKilled() to inform any Observer about its immediate destruction. These two tracks collide. Now, we let first pass all subjectKilled() and when the last Observable has gotten its signal, we begin destroying the visual rep.
  • rerouted signal/slots accordingly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp

    re25448 r7c7c4a  
    1515
    1616#include "GLMoleculeObject.hpp"
     17
     18#include <vector>
     19#include <boost/any.hpp>
    1720
    1821#include "CodePatterns/ObservedValue.hpp"
     
    6164  void elementChanged();
    6265  void bondsChanged();
     66  void InstanceRemoved(const atomId_t);
    6367
    6468private:
     
    8892  atom * const atomref;
    8993
    90   //!> cached value of the atom's id
    91   ObservedValue<atomId_t> AtomIndex;
    92   //!> cached value of the atom's position
    93   ObservedValue<Vector> AtomPosition;
    94   //!> cached value of the atom's element
    95   ObservedValue<atomicNumber_t> AtomElement;
    96   //!> cached value of the atom's id
    97   ObservedValue<ListOfBonds_t> AtomBonds;
     94private:
     95  /** Observed Values **/
     96
     97  //!> enumeration of observed values to match with entries in ObservedValues
     98  enum ObservedTypes {
     99    //!> contains the current atom index
     100    AtomIndex,
     101    //!> contains the current atom position
     102    AtomPosition,
     103    //!> contains the current atom element
     104    AtomElement,
     105    //!> contains the current set of bonds atoms fort the atom
     106    AtomBonds,
     107    //!> gives the size of the enumeration
     108    MAX_ObservedTypes
     109  };
     110
     111  //!> vector with all observed values
     112  std::vector<boost::any> ObservedValues;
     113
     114  /** Initializes all \a ObservedValues entries.
     115   *
     116   * \param _id atom id
     117   */
     118  void initObservedValues(const atomId_t _id);
     119
     120  /** Destroys all \a ObservedValues entries.
     121   *
     122   */
     123  void destroyObservedValues();
     124
     125  /** Getter to atom index contained in \a ObservedValues.
     126   *
     127   * \return atom's index
     128   */
     129  atomId_t getAtomIndex() const;
     130
     131  /** Getter to atom position contained in \a ObservedValues.
     132   *
     133   * \return atom's position
     134   */
     135  Vector getAtomPosition() const;
     136
     137  /** Getter to atom element contained in \a ObservedValues.
     138   *
     139   * \return atom's elemnt
     140   */
     141  atomicNumber_t getAtomElement() const;
     142
     143  /** Getter to atom bonds contained in \a ObservedValues.
     144   *
     145   * \return atom's bonds
     146   */
     147  ListOfBonds_t getAtomBonds() const;
     148
     149  /** Counts how many ObservedValues got subjectKilled.
     150   *
     151   * This is used to give InstanceRemoved() signal only when each and every
     152   * ObservedValue (and the instance itself) has been subjectKilled by the
     153   * monitored Observable. Only then can we safely remove the instance.
     154   *
     155   */
     156  void countsubjectKilled();
     157
     158  //!> counts how many ObservedValues have already been subjectKilled()
     159  mutable size_t subjectKilledCount;
     160
     161private:
    98162
    99163  //!> list of channels when index needs to update
Note: See TracChangeset for help on using the changeset viewer.