Ignore:
Timestamp:
Feb 12, 2016, 11:15:06 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:
15c8a9
Parents:
099f67
git-author:
Frederik Heber <heber@…> (01/25/16 11:01:10)
git-committer:
Frederik Heber <heber@…> (02/12/16 23:15:06)
Message:

Changed GLMoleculeObject_...:countSubjectKilled() to taking id parameter.

  • this is a precursor for when the ObservedValues reside with QtInstanceInformationBoard.
  • enhanced ObservedValue_wCallback to take a bound getIndex function().
  • additionally, we route internally to ObservedValue::get() and this gets us out of the painful situation where we need to supply an index getter to the ObservedValue that monitors the index (and hence must be present already to bind to its get function).
File:
1 edited

Legend:

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

    r099f67 r026bef  
    7878GLMoleculeObject_atom::AtomBondsChannels(getAtomBondsChannels());
    7979
    80 GLMoleculeObject_atom::GLMoleculeObject_atom(QGLSceneNode *mesh[], QObject *parent, const atomId_t _id) :
     80GLMoleculeObject_atom::GLMoleculeObject_atom(
     81    QGLSceneNode *mesh[],
     82    QObject *parent,
     83    const atomId_t _id) :
    8184  GLMoleculeObject(mesh, parent),
    8285  Observer(std::string("GLMoleculeObject_atom")+toString(_id)),
     
    8689  owner(NULL)
    8790{
    88   boost::function<void()> subjectKilled =
    89       boost::bind(&GLMoleculeObject_atom::countsubjectKilled, this);
     91  boost::function<void(const atomId_t)> subjectKilled =
     92      boost::bind(&GLMoleculeObject_atom::countsubjectKilled, this, _id);
    9093  initObservedValues(ObservedValues, _id, atomref, subjectKilled);
    9194
     95  init(_id);
     96}
     97
     98GLMoleculeObject_atom::GLMoleculeObject_atom(
     99    QGLSceneNode *mesh[],
     100    QObject *parent,
     101    const atomId_t _id,
     102    std::vector<boost::any> _ObservedValues) :
     103  GLMoleculeObject(mesh, parent),
     104  Observer(std::string("GLMoleculeObject_atom")+toString(_id)),
     105  atomref(getAtom(_id)),
     106  ObservedValues(_ObservedValues),
     107  subjectKilledCount(0),
     108  owner(NULL)
     109{
     110  init(_id);
     111}
     112
     113void GLMoleculeObject_atom::init(const atomId_t _id)
     114{
    92115  setObjectId(_id);
    93116  resetPosition();
     
    317340  deactivateObserver();
    318341
    319   countsubjectKilled();
     342  countsubjectKilled(getAtomIndex());
    320343}
    321344
     
    348371}
    349372
    350 void GLMoleculeObject_atom::countsubjectKilled()
     373void GLMoleculeObject_atom::countsubjectKilled(const atomId_t)
    351374{
    352375  ++subjectKilledCount;
     
    360383    const atomId_t _id,
    361384    const atom * const _atomref,
    362     const boost::function<void()> &_subjectKilled)
     385    const boost::function<void(const atomId_t)> &_subjectKilled)
    363386{
    364387  /* This is an old note from when the code was still part of cstor's initializer body.
     
    399422      boost::bind(&GLMoleculeObject_atom::updateBonds, AtomIndexGetter));
    400423
    401   _ObservedValues[AtomPosition] = new ObservedValue_wCallback<Vector>(
     424  _ObservedValues[AtomPosition] = new ObservedValue_wCallback<Vector, atomId_t>(
    402425      _atomref,
    403426      AtomPositionUpdater,
     
    405428      AtomPositionUpdater(),
    406429      AtomPositionChannels,
    407       _subjectKilled);
    408   _ObservedValues[AtomElement] = new ObservedValue_wCallback<atomicNumber_t>(
     430      _subjectKilled,
     431      AtomIndexGetter);
     432  _ObservedValues[AtomElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(
    409433      _atomref,
    410434      AtomElementUpdater,
     
    412436      AtomElementUpdater(),
    413437      AtomElementChannels,
    414       _subjectKilled);
    415   _ObservedValues[AtomBonds] = new ObservedValue_wCallback<ListOfBonds_t>(
     438      _subjectKilled,
     439      AtomIndexGetter);
     440  _ObservedValues[AtomBonds] = new ObservedValue_wCallback<ListOfBonds_t, atomId_t>(
    416441      _atomref,
    417442      AtomBondsUpdater,
     
    419444      AtomBondsUpdater(),
    420445      AtomBondsChannels,
    421       _subjectKilled);
     446      _subjectKilled,
     447      AtomIndexGetter);
    422448}
    423449
     
    426452{
    427453  delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[AtomIndex]);
    428   delete boost::any_cast<ObservedValue_wCallback<Vector> *>(_ObservedValues[AtomPosition]);
    429   delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t> *>(_ObservedValues[AtomElement]);
    430   delete boost::any_cast<ObservedValue_wCallback<ListOfBonds_t> *>(_ObservedValues[AtomBonds]);
     454  delete boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(_ObservedValues[AtomPosition]);
     455  delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(_ObservedValues[AtomElement]);
     456  delete boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, atomId_t> *>(_ObservedValues[AtomBonds]);
    431457  _ObservedValues.clear();
    432458}
     
    439465Vector GLMoleculeObject_atom::getAtomPosition() const
    440466{
    441   return boost::any_cast<ObservedValue_wCallback<Vector> *>(ObservedValues[AtomPosition])->get();
     467  return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->get();
    442468}
    443469
    444470atomicNumber_t GLMoleculeObject_atom::getAtomElement() const
    445471{
    446   return boost::any_cast<ObservedValue_wCallback<atomicNumber_t> *>(ObservedValues[AtomElement])->get();
     472  return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[AtomElement])->get();
    447473}
    448474
    449475GLMoleculeObject_atom::ListOfBonds_t GLMoleculeObject_atom::getAtomBonds() const
    450476{
    451   return boost::any_cast<ObservedValue_wCallback<ListOfBonds_t> *>(ObservedValues[AtomBonds])->get();
    452 }
     477  return boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, atomId_t> *>(ObservedValues[AtomBonds])->get();
     478}
Note: See TracChangeset for help on using the changeset viewer.