- Timestamp:
- Feb 12, 2016, 11:15:06 PM (9 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
r099f67 r026bef 89 89 rightobservable_enabled(false) 90 90 { 91 boost::function<void()> subjectKilled = 92 boost::bind(&GLMoleculeObject_bond::countsubjectKilled, this); 93 initObservedValues(ObservedValues, bondIds.first, bondIds.second, leftowner, rightowner, bondowner, subjectKilled); 94 91 boost::function<void(const atomId_t &)> leftsubjectKilled = 92 boost::bind( 93 static_cast<void (GLMoleculeObject_bond::*) (const atomId_t &)>( 94 &GLMoleculeObject_bond::countsubjectKilled), 95 this, _1); 96 boost::function<void(const atomId_t &)> rightsubjectKilled = 97 boost::bind( 98 static_cast<void (GLMoleculeObject_bond::*) (const atomId_t &)>( 99 &GLMoleculeObject_bond::countsubjectKilled) 100 , this, _1); 101 boost::function<void(const bondIds_t &)> bondsubjectKilled = 102 boost::bind( 103 static_cast<void (GLMoleculeObject_bond::*) (const bondIds_t &)>( 104 &GLMoleculeObject_bond::countsubjectKilled) 105 , this, _1); 106 initObservedValues( 107 ObservedValues, 108 bondIds.first, 109 bondIds.second, 110 leftowner, 111 rightowner, 112 bondowner, 113 leftsubjectKilled, 114 rightsubjectKilled, 115 bondsubjectKilled); 116 117 init(); 118 } 119 120 GLMoleculeObject_bond::GLMoleculeObject_bond( 121 QGLSceneNode *mesh[], 122 QObject *parent, 123 const bondIds_t bondIds, 124 const enum SideOfBond side, 125 std::vector<boost::any> &_ObservedValues) : 126 GLMoleculeObject(mesh, parent), 127 Observer(std::string("GLMoleculeObject_bond") 128 +toString(bondIds.first) 129 +std::string("-") 130 +toString(bondIds.second)), 131 leftowner(getAtomConst(bondIds.first)), 132 rightowner(getAtomConst(bondIds.second)), 133 bondowner(getAtomConst(bondIds.first)->getBond(getAtomConst(bondIds.second)).get()), 134 BondSide(side), 135 ObservedValues(_ObservedValues), 136 subjectKilledCount(0), 137 leftobservable_enabled(false), 138 rightobservable_enabled(false) 139 { 140 init(); 141 } 142 143 void GLMoleculeObject_bond::init() 144 { 95 145 // sign on as observer (obtain non-const instance before) 96 146 bondowner->signOn(this, BondObservable::BondRemoved); … … 159 209 removeChannels(); 160 210 // check whether we should be removed 161 countsubjectKilled( );211 countsubjectKilled(std::make_pair(getleftIndex(), getrightIndex())); 162 212 } 163 213 … … 339 389 } 340 390 391 static GLMoleculeObject_bond::bondIds_t getBondIdsForIds( 392 const boost::function<const atomId_t ()> _left, 393 const boost::function<const atomId_t ()> _right) 394 { 395 return std::make_pair( _left(), _right()); 396 } 397 341 398 void GLMoleculeObject_bond::initObservedValues( 342 399 std::vector<boost::any> &_ObservedValues, … … 346 403 const Observable * const _rightowner, 347 404 const Observable * const _bondowner, 348 const boost::function<void()> &_subjectKilled) 405 const boost::function<void(const atomId_t &)> &_leftsubjectKilled, 406 const boost::function<void(const atomId_t &)> &_rightsubjectKilled, 407 const boost::function<void(const bondIds_t &)> &_bondsubjectKilled) 349 408 { 350 409 /* This is an old note from when the code was still part of cstor's initializer body. … … 372 431 _leftatomId, 373 432 IndexChannels, 374 _ subjectKilled);433 _leftsubjectKilled); 375 434 _ObservedValues[leftIndex] = LeftIndexObservable; 376 435 ObservedValue_wCallback<atomId_t> * const RightIndexObservable = … … 381 440 _rightatomId, 382 441 IndexChannels, 383 _ subjectKilled);442 _rightsubjectKilled); 384 443 _ObservedValues[rightIndex] = RightIndexObservable; 385 444 … … 402 461 const boost::function<int ()> DegreeUpdater( 403 462 boost::bind(&GLMoleculeObject_bond::updateDegree, LeftIndexGetter, RightIndexGetter)); 404 405 _ObservedValues[leftPosition] = new ObservedValue_wCallback<Vector>( 463 const boost::function<bondIds_t ()> BondIdGetter( 464 boost::bind(&getBondIdsForIds, LeftIndexGetter, RightIndexGetter)); 465 466 _ObservedValues[leftPosition] = new ObservedValue_wCallback<Vector, atomId_t>( 406 467 _leftowner, 407 468 LeftPositionUpdater, … … 409 470 LeftPositionUpdater(), 410 471 BondPositionChannels, 411 _subjectKilled); 412 _ObservedValues[rightPosition] = new ObservedValue_wCallback<Vector>( 472 _leftsubjectKilled, 473 LeftIndexGetter); 474 _ObservedValues[rightPosition] = new ObservedValue_wCallback<Vector, atomId_t>( 413 475 _rightowner, 414 476 RightPositionUpdater, … … 416 478 RightPositionUpdater(), 417 479 BondPositionChannels, 418 _subjectKilled); 419 _ObservedValues[leftElement] = new ObservedValue_wCallback<atomicNumber_t>( 480 _rightsubjectKilled, 481 RightIndexGetter); 482 _ObservedValues[leftElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>( 420 483 _leftowner, 421 484 LeftElementUpdater, … … 423 486 LeftElementUpdater(), 424 487 BondElementChannels, 425 _subjectKilled); 426 _ObservedValues[rightElement] = new ObservedValue_wCallback<atomicNumber_t>( 488 _leftsubjectKilled, 489 LeftIndexGetter); 490 _ObservedValues[rightElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>( 427 491 _rightowner, 428 492 RightElementUpdater, … … 430 494 RightElementUpdater(), 431 495 BondElementChannels, 432 _subjectKilled); 433 _ObservedValues[Degree] = new ObservedValue_wCallback<int>( 496 _rightsubjectKilled, 497 RightIndexGetter); 498 _ObservedValues[Degree] = new ObservedValue_wCallback<int, bondIds_t>( 434 499 _bondowner, 435 500 DegreeUpdater, … … 437 502 DegreeUpdater(), 438 503 BondDegreeChannels, 439 _subjectKilled); 504 _bondsubjectKilled, 505 BondIdGetter); 440 506 } 441 507 … … 445 511 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[leftIndex]); 446 512 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[rightIndex]); 447 delete boost::any_cast<ObservedValue_wCallback<Vector > *>(_ObservedValues[leftPosition]);448 delete boost::any_cast<ObservedValue_wCallback<Vector > *>(_ObservedValues[rightPosition]);449 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t > *>(_ObservedValues[leftElement]);450 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t > *>(_ObservedValues[rightElement]);451 delete boost::any_cast<ObservedValue_wCallback<int > *>(_ObservedValues[Degree]);513 delete boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(_ObservedValues[leftPosition]); 514 delete boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(_ObservedValues[rightPosition]); 515 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t,atomId_t> *>(_ObservedValues[leftElement]); 516 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t,atomId_t> *>(_ObservedValues[rightElement]); 517 delete boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(_ObservedValues[Degree]); 452 518 _ObservedValues.clear(); 453 519 } … … 465 531 Vector GLMoleculeObject_bond::getleftPosition() const 466 532 { 467 return boost::any_cast<ObservedValue_wCallback<Vector > *>(ObservedValues[leftPosition])->get();533 return boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(ObservedValues[leftPosition])->get(); 468 534 } 469 535 470 536 Vector GLMoleculeObject_bond::getrightPosition() const 471 537 { 472 return boost::any_cast<ObservedValue_wCallback<Vector > *>(ObservedValues[rightPosition])->get();538 return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[rightPosition])->get(); 473 539 } 474 540 475 541 atomicNumber_t GLMoleculeObject_bond::getleftElement() const 476 542 { 477 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t > *>(ObservedValues[leftElement])->get();543 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[leftElement])->get(); 478 544 } 479 545 480 546 atomicNumber_t GLMoleculeObject_bond::getrightElement() const 481 547 { 482 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t > *>(ObservedValues[rightElement])->get();548 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[rightElement])->get(); 483 549 } 484 550 485 551 int GLMoleculeObject_bond::getDegree() const 486 552 { 487 return boost::any_cast<ObservedValue_wCallback<int > *>(ObservedValues[Degree])->get();488 } 553 return boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(ObservedValues[Degree])->get(); 554 }
Note:
See TracChangeset
for help on using the changeset viewer.