- Timestamp:
- Apr 20, 2016, 10:58:43 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:
- d48a16
- Parents:
- b4bd0e
- git-author:
- Frederik Heber <heber@…> (03/24/16 13:26:51)
- git-committer:
- Frederik Heber <heber@…> (04/20/16 22:58:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
rb4bd0e r96f14a 47 47 #include "CodePatterns/Assert.hpp" 48 48 #include "CodePatterns/Log.hpp" 49 #include "CodePatterns/Observer/Notification.hpp" 50 #include "CodePatterns/Observer/ObserverLog.hpp" 51 #include "Descriptors/AtomIdDescriptor.hpp" 49 52 50 #include "Atom/atom.hpp" 53 51 #include "Bond/bond.hpp" … … 56 54 #include "LinearAlgebra/Line.hpp" 57 55 #include "LinearAlgebra/Vector.hpp" 58 #include "UIElements/Qt4/InstanceBoard/ObservedValue_wCallback.hpp"59 56 #include "World.hpp" 60 61 62 // static entities63 const Observable::channels_t64 GLMoleculeObject_bond::IndexChannels(1, AtomObservable::IndexChanged);65 const Observable::channels_t66 GLMoleculeObject_bond::BondPositionChannels(1, AtomObservable::PositionChanged);67 const Observable::channels_t68 GLMoleculeObject_bond::BondDegreeChannels(1, BondObservable::DegreeChanged);69 const Observable::channels_t70 GLMoleculeObject_bond::BondElementChannels(1, AtomObservable::ElementChanged);71 72 static GLMoleculeObject_bond::bondIds_t getBondIdsForIds(73 const boost::function<const atomId_t()> &_left,74 const boost::function<const atomId_t()> &_right)75 {76 return std::make_pair(_left(), _right());77 }78 57 79 58 GLMoleculeObject_bond::GLMoleculeObject_bond( 80 59 QGLSceneNode *mesh[], 81 60 QObject *parent, 82 const bondIds_t bondIds,61 QtObservedBond::ptr &_ObservedBond, 83 62 const enum SideOfBond side) : 84 63 GLMoleculeObject(mesh, parent), 85 Observer(std::string("GLMoleculeObject_bond")86 +toString(bondIds.first)87 +std::string("-")88 +toString(bondIds.second)),89 leftowner(getAtomConst(bondIds.first)),90 rightowner(getAtomConst(bondIds.second)),91 bondowner(getAtomConst(bondIds.first)->getBond(getAtomConst(bondIds.second)).get()),92 64 BondSide(side), 93 ObservedValues(MAX_ObservedTypes), 94 subjectKilledCount(0), 95 leftobservable_enabled(false), 96 rightobservable_enabled(false), 97 board_subjectKilled( 98 boost::bind( 99 static_cast<void (GLMoleculeObject_bond::*) ()>( 100 &GLMoleculeObject_bond::countsubjectKilled), 101 this)) 65 ObservedBond(_ObservedBond) 102 66 { 103 boost::function<void(const atomId_t &)> leftsubjectKilled =104 boost::bind(105 static_cast<void (GLMoleculeObject_bond::*) (const atomId_t &)>(106 &GLMoleculeObject_bond::countsubjectKilled),107 this, _1);108 boost::function<void(const atomId_t &)> rightsubjectKilled =109 boost::bind(110 static_cast<void (GLMoleculeObject_bond::*) (const atomId_t &)>(111 &GLMoleculeObject_bond::countsubjectKilled)112 , this, _1);113 boost::function<void(const bondIds_t &)> bondsubjectKilled =114 boost::bind(115 static_cast<void (GLMoleculeObject_bond::*) (const bondIds_t &)>(116 &GLMoleculeObject_bond::countsubjectKilled)117 , this, _1);118 initObservedValues(119 ObservedValues,120 bondIds.first,121 bondIds.second,122 leftowner,123 rightowner,124 bondowner,125 leftsubjectKilled,126 rightsubjectKilled,127 bondsubjectKilled);128 129 init();130 }131 132 GLMoleculeObject_bond::GLMoleculeObject_bond(133 QGLSceneNode *mesh[],134 QObject *parent,135 const bondIds_t bondIds,136 const enum SideOfBond side,137 std::vector<boost::any> &_ObservedValues,138 const boost::function<void (const bondIds_t)> &_subjectKilled) :139 GLMoleculeObject(mesh, parent),140 Observer(std::string("GLMoleculeObject_bond")141 +toString(bondIds.first)142 +std::string("-")143 +toString(bondIds.second)),144 leftowner(getAtomConst(bondIds.first)),145 rightowner(getAtomConst(bondIds.second)),146 bondowner(getAtomConst(bondIds.first)->getBond(getAtomConst(bondIds.second)).get()),147 BondSide(side),148 ObservedValues(_ObservedValues),149 subjectKilledCount(0),150 leftobservable_enabled(false),151 rightobservable_enabled(false),152 board_subjectKilled(_subjectKilled)153 {154 init();155 }156 157 void GLMoleculeObject_bond::init()158 {159 // sign on as observer (obtain non-const instance before)160 bondowner->signOn(this, BondObservable::BondRemoved);161 bondowner->signOn(this, BondObservable::DegreeChanged);162 bond_enabled = true;163 leftowner->signOn(this, AtomObservable::PositionChanged);164 leftowner->signOn(this, AtomObservable::ElementChanged);165 leftobservable_enabled = true;166 rightowner->signOn(this, AtomObservable::PositionChanged);167 rightowner->signOn(this, AtomObservable::ElementChanged);168 rightobservable_enabled = true;169 170 67 resetElement(); 171 68 resetPosition(); 172 69 resetWidth(); 173 70 174 connect(this, SIGNAL(elementChanged()), this, SLOT(resetElement()), Qt::QueuedConnection); 175 connect(this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection); 176 connect(this, SIGNAL(degreeChanged()), this, SLOT(resetWidth()), Qt::QueuedConnection); 71 // connect to observed bond's signals 72 connect(_ObservedBond.get(), SIGNAL(degreeChanged()), this, SLOT(resetWidth())); 73 if (side == left) 74 connect(_ObservedBond.get(), SIGNAL(leftAtomElementChanged()), this, SLOT(resetElement())); 75 else 76 connect(_ObservedBond.get(), SIGNAL(rightAtomElementChanged()), this, SLOT(resetElement())); 77 connect(_ObservedBond.get(), SIGNAL(leftAtomPositionChanged()), this, SLOT(resetPosition())); 78 connect(_ObservedBond.get(), SIGNAL(rightAtomPositionChanged()), this, SLOT(resetPosition())); 79 } 80 81 static const atomicNumber_t& getElement( 82 const QtObservedBond::ptr &_ObservedBond, 83 const enum GLMoleculeObject_bond::SideOfBond _side) 84 { 85 if (_side == GLMoleculeObject_bond::left) 86 return _ObservedBond->getLeftAtomElement(); 87 else 88 return _ObservedBond->getRightAtomElement(); 89 } 90 91 static const Vector& getPosition( 92 const QtObservedBond::ptr &_ObservedBond, 93 const enum GLMoleculeObject_bond::SideOfBond _side) 94 { 95 if (_side == GLMoleculeObject_bond::left) 96 return _ObservedBond->getLeftAtomPosition(); 97 else 98 return _ObservedBond->getRightAtomPosition(); 99 } 100 101 static const Vector& getOtherPosition( 102 const QtObservedBond::ptr &_ObservedBond, 103 const enum GLMoleculeObject_bond::SideOfBond _side) 104 { 105 if (_side == GLMoleculeObject_bond::left) 106 return _ObservedBond->getRightAtomPosition(); 107 else 108 return _ObservedBond->getLeftAtomPosition(); 177 109 } 178 110 179 111 GLMoleculeObject_bond::~GLMoleculeObject_bond() 180 112 { 181 LOG( 3, "DEBUG: Destroying GLMoleculeObject_bond to bond [" <<182 getleftIndex() << "," << getrightIndex() << "] and side " << BondSide << ".");113 LOG(4, "DEBUG: Destroying GLMoleculeObject_bond to bond [" << 114 ObservedBond->getBondIndex() << "] and side " << BondSide << "."); 183 115 // signOff() if not already done 184 removeChannels();185 destroyObservedValues(ObservedValues);186 }187 188 void GLMoleculeObject_bond::removeChannels()189 {190 // at this point both atoms should still be alive, hence we may safely sign off191 // from the AtomObservable itself192 if (bond_enabled) {193 if (bondowner != NULL) {194 bondowner->signOff(this, BondObservable::BondRemoved);195 bondowner->signOff(this, BondObservable::DegreeChanged);196 }197 bond_enabled = false;198 }199 if (leftobservable_enabled) {200 if (leftowner != NULL) {201 leftowner->signOff(this, AtomObservable::PositionChanged);202 leftowner->signOff(this, AtomObservable::ElementChanged);203 }204 leftobservable_enabled = false;205 }206 if (rightobservable_enabled) {207 if (rightowner != NULL) {208 rightowner->signOff(this, AtomObservable::PositionChanged);209 rightowner->signOff(this, AtomObservable::ElementChanged);210 }211 rightobservable_enabled = false;212 }213 }214 215 void GLMoleculeObject_bond::update(Observable *publisher)216 {217 ASSERT(0, "GLMoleculeObject_bond::update() - we are not signed on for any global updates.");218 }219 220 void GLMoleculeObject_bond::subjectKilled(Observable *publisher)221 {222 // we signOff from all other sources223 removeChannels();224 // check whether we should be removed225 board_subjectKilled(std::make_pair(getleftIndex(), getrightIndex()));226 }227 228 void GLMoleculeObject_bond::recieveNotification(Observable *publisher, Notification_ptr notification)229 {230 #ifdef LOG_OBSERVER231 if (publisher == static_cast<const Observable *>(bondowner)) {232 observerLog().addMessage() << "++ Update of Observer "233 << observerLog().getName(static_cast<Observer*>(this))234 << " received notification from bond for channel "235 << notification->getChannelNo() << ".";236 } else if (publisher == static_cast<const Observable * const>(leftowner)) {237 observerLog().addMessage() << "++ Update of Observer "238 << observerLog().getName(static_cast<Observer*>(this))239 << " received notification from leftatom " << getleftIndex() << " for channel "240 << notification->getChannelNo() << ".";241 } else if (publisher == static_cast<const Observable * const>(rightowner)) {242 observerLog().addMessage() << "++ Update of Observer "243 << observerLog().getName(static_cast<Observer*>(this))244 << " received notification from rightatom " << getrightIndex() << " for channel "245 << notification->getChannelNo() << ".";246 }247 #endif248 if (publisher == static_cast<const Observable *>(bondowner)){249 switch (notification->getChannelNo()) {250 case BondObservable::BondRemoved:251 // removeMe();252 break;253 case BondObservable::DegreeChanged:254 emit degreeChanged();255 break;256 default:257 ASSERT(0, "GLMoleculeObject_bond::recieveNotification() - unknown signal.");258 break;259 }260 } else {261 // from an atom262 switch (notification->getChannelNo()) {263 case AtomObservable::PositionChanged:264 LOG(2, "INFO: Received notification of PositionChanged.");265 emit positionChanged();266 break;267 case AtomObservable::ElementChanged:268 LOG(2, "INFO: Received notification of ElementChanged.");269 emit elementChanged();270 break;271 default:272 break;273 }274 }275 }276 277 atomId_t GLMoleculeObject_bond::updateIndex()278 {279 return const_cast<const World &>(World::getInstance()).lastChangedAtomId();280 }281 282 Vector GLMoleculeObject_bond::updateLeftPosition(283 const boost::function<const atomId_t ()> &_getLeftAtomIndex)284 {285 const atom * const _atom = getAtomConst(_getLeftAtomIndex());286 return _atom->getPosition();287 }288 289 Vector GLMoleculeObject_bond::updateRightPosition(290 const boost::function<const atomId_t ()> &_getRightAtomIndex)291 {292 const atom * const _atom = getAtomConst(_getRightAtomIndex());293 return _atom->getPosition();294 }295 296 atomicNumber_t GLMoleculeObject_bond::updateLeftElement(297 const boost::function<const atomId_t ()> &_getLeftAtomIndex)298 {299 const atom * const _atom = getAtomConst(_getLeftAtomIndex());300 return _atom->getElementNo();301 }302 303 atomicNumber_t GLMoleculeObject_bond::updateRightElement(304 const boost::function<const atomId_t ()> &_getRightAtomIndex)305 {306 const atom * const _atom = getAtomConst(_getRightAtomIndex());307 return _atom->getElementNo();308 }309 310 int GLMoleculeObject_bond::updateDegree(311 const boost::function<const atomId_t ()> &_getLeftAtomIndex,312 const boost::function<const atomId_t ()> &_getRightAtomIndex)313 {314 const atom * const _leftatom = const_cast<const World &>(World::getInstance()).315 getAtom(AtomById(_getLeftAtomIndex()));316 const atom * const _rightatom = const_cast<const World &>(World::getInstance()).317 getAtom(AtomById(_getRightAtomIndex()));318 if ((_leftatom != NULL) && (_rightatom != NULL)) {319 bond::ptr _bond = _leftatom->getBond(_rightatom);320 return _bond->getDegree();321 } else {322 return 1;323 }324 116 } 325 117 326 118 void GLMoleculeObject_bond::resetElement() 327 119 { 328 size_t elementno = getrightElement();120 const atomicNumber_t& elementno = getElement(ObservedBond, BondSide); 329 121 QGLMaterial *elementmaterial = getMaterial(elementno); 330 122 setMaterial(elementmaterial); … … 333 125 void GLMoleculeObject_bond::resetWidth() 334 126 { 335 const double factor = 1.0f+.5f*( getDegree()-1);336 LOG( 2, "DEBUG: GLMoleculeObject_bond::resetWidth() - setting bond's width to " << factor << ".");127 const double factor = 1.0f+.5f*(ObservedBond->getBondDegree()-1); 128 LOG(4, "DEBUG: GLMoleculeObject_bond::resetWidth() - setting bond's width to " << factor << "."); 337 129 setScaleX(factor); 338 130 setScaleY(factor); … … 343 135 void GLMoleculeObject_bond::resetPosition() 344 136 { 345 Vector Position = getleftPosition();346 Vector OtherPosition = getrightPosition();137 const Vector& Position = getPosition(ObservedBond, BondSide); 138 const Vector& OtherPosition = getOtherPosition(ObservedBond, BondSide); 347 139 const double distance = 348 140 Position.distance(OtherPosition)/2.; … … 355 147 Vector OtherAxis; 356 148 double alpha; 357 a = Position - OtherPosition;149 a = OtherPosition - Position; 358 150 // construct rotation axis 359 151 b = a; … … 370 162 // check 371 163 Vector a_rotated = axis.rotateVector(a, alpha); 372 LOG( 3, "INFO: Created cylinder from "// << Position << " to " << OtherPosition164 LOG(4, "DEBUG: Created cylinder from "// << Position << " to " << OtherPosition 373 165 << a << " to " << a_rotated << " around " << b << " by " << alpha/M_PI*180. << ", respectively."); 374 166 375 167 // set position (cylinder offset is in its barymetric center) 376 Vector OneFourth( Position - 0.75 * a);168 Vector OneFourth(OtherPosition - 0.75 * a); 377 169 setPosition(QVector3D(OneFourth[0], OneFourth[1], OneFourth[2])); 378 170 setRotationVector(QVector3D(b[0], b[1], b[2])); … … 381 173 emit changed(); 382 174 } 383 384 atom * const GLMoleculeObject_bond::getAtom(const atomId_t _id)385 {386 atom * const _atom = World::getInstance().getAtom(AtomById(_id));387 return _atom;388 }389 390 const atom * const GLMoleculeObject_bond::getAtomConst(const atomId_t _id)391 {392 const atom * const _atom = const_cast<const World &>(World::getInstance()).393 getAtom(AtomById(_id));394 return _atom;395 }396 397 void GLMoleculeObject_bond::countsubjectKilled()398 {399 ++subjectKilledCount;400 401 if (subjectKilledCount > ObservedValues.size())402 emit BondRemoved(getleftIndex(), getrightIndex());403 }404 405 void GLMoleculeObject_bond::initObservedValues(406 std::vector<boost::any> &_ObservedValues,407 const atomId_t _leftatomId,408 const atomId_t _rightatomId,409 const Observable * const _leftowner,410 const Observable * const _rightowner,411 const Observable * const _bondowner,412 const boost::function<void(const atomId_t &)> &_leftsubjectKilled,413 const boost::function<void(const atomId_t &)> &_rightsubjectKilled,414 const boost::function<void(const bondIds_t &)> &_bondsubjectKilled)415 {416 /* This is an old note from when the code was still part of cstor's initializer body.417 * TODO: Probably does not apply anymore but has not yet been tested.418 *419 * We must not use boost::cref(this) as "this" has not been properly constructed and seemingly420 * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because421 * the class has not been fully constructed yet. "This" itself seems to be working fine.422 */423 424 ASSERT( _ObservedValues.size() == MAX_ObservedTypes,425 "GLMoleculeObject_bond::initObservedValues() - given ObservedValues has not correct size.");426 427 // fill ObservedValues: index first428 // Note that we only need one as the function just checks on the last changed id429 // and ids cannot be changed simultaneously430 const boost::function<atomId_t ()> AtomIndexUpdater(431 boost::bind(&GLMoleculeObject_bond::updateIndex));432 433 ObservedValue_wCallback<atomId_t> * const LeftIndexObservable =434 new ObservedValue_wCallback<atomId_t>(435 _leftowner,436 AtomIndexUpdater,437 "Bonds_LeftAtomIndex_"+toString(_leftatomId),438 _leftatomId,439 IndexChannels,440 _leftsubjectKilled);441 _ObservedValues[leftIndex] = LeftIndexObservable;442 ObservedValue_wCallback<atomId_t> * const RightIndexObservable =443 new ObservedValue_wCallback<atomId_t>(444 _rightowner,445 AtomIndexUpdater,446 "Bonds_RightAtomIndex_"+toString(_rightatomId),447 _rightatomId,448 IndexChannels,449 _rightsubjectKilled);450 _ObservedValues[rightIndex] = RightIndexObservable;451 452 const boost::function<const atomId_t ()> LeftIndexGetter =453 boost::bind(&ObservedValue_wCallback<atomId_t>::get,454 LeftIndexObservable);455 const boost::function<const atomId_t ()> RightIndexGetter =456 boost::bind(&ObservedValue_wCallback<atomId_t>::get,457 RightIndexObservable);458 459 // fill ObservedValues: then all the other that need index460 const boost::function<Vector ()> LeftPositionUpdater(461 boost::bind(&GLMoleculeObject_bond::updateLeftPosition, LeftIndexGetter));462 const boost::function<Vector ()> RightPositionUpdater(463 boost::bind(&GLMoleculeObject_bond::updateRightPosition, RightIndexGetter));464 const boost::function<atomicNumber_t ()> LeftElementUpdater(465 boost::bind(&GLMoleculeObject_bond::updateLeftElement, LeftIndexGetter));466 const boost::function<atomicNumber_t ()> RightElementUpdater(467 boost::bind(&GLMoleculeObject_bond::updateRightElement, RightIndexGetter));468 const boost::function<int ()> DegreeUpdater(469 boost::bind(&GLMoleculeObject_bond::updateDegree, LeftIndexGetter, RightIndexGetter));470 const boost::function<bondIds_t ()> BondIdGetter(471 boost::bind(&getBondIdsForIds, LeftIndexGetter, RightIndexGetter));472 473 _ObservedValues[leftPosition] = new ObservedValue_wCallback<Vector, atomId_t>(474 _leftowner,475 LeftPositionUpdater,476 "BondleftPosition_"+toString(_leftatomId),477 LeftPositionUpdater(),478 BondPositionChannels,479 _leftsubjectKilled,480 LeftIndexGetter);481 _ObservedValues[rightPosition] = new ObservedValue_wCallback<Vector, atomId_t>(482 _rightowner,483 RightPositionUpdater,484 "BondrightPosition_"+toString(_rightatomId),485 RightPositionUpdater(),486 BondPositionChannels,487 _rightsubjectKilled,488 RightIndexGetter);489 _ObservedValues[leftElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(490 _leftowner,491 LeftElementUpdater,492 "BondleftElement"+toString(_leftatomId),493 LeftElementUpdater(),494 BondElementChannels,495 _leftsubjectKilled,496 LeftIndexGetter);497 _ObservedValues[rightElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(498 _rightowner,499 RightElementUpdater,500 "BondrightElement"+toString(_rightatomId),501 RightElementUpdater(),502 BondElementChannels,503 _rightsubjectKilled,504 RightIndexGetter);505 _ObservedValues[Degree] = new ObservedValue_wCallback<int, bondIds_t>(506 _bondowner,507 DegreeUpdater,508 "BondDegree"+toString(_leftatomId)+"_"+toString(_rightatomId),509 DegreeUpdater(),510 BondDegreeChannels,511 _bondsubjectKilled,512 BondIdGetter);513 }514 515 void GLMoleculeObject_bond::destroyObservedValues(516 std::vector<boost::any> &_ObservedValues)517 {518 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[leftIndex]);519 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[rightIndex]);520 delete boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(_ObservedValues[leftPosition]);521 delete boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(_ObservedValues[rightPosition]);522 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t,atomId_t> *>(_ObservedValues[leftElement]);523 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t,atomId_t> *>(_ObservedValues[rightElement]);524 delete boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(_ObservedValues[Degree]);525 _ObservedValues.clear();526 }527 528 const atomId_t& GLMoleculeObject_bond::getleftIndex() const529 {530 return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[leftIndex])->get();531 }532 533 const atomId_t& GLMoleculeObject_bond::getrightIndex() const534 {535 return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[rightIndex])->get();536 }537 538 const Vector& GLMoleculeObject_bond::getleftPosition() const539 {540 return boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(ObservedValues[leftPosition])->get();541 }542 543 const Vector& GLMoleculeObject_bond::getrightPosition() const544 {545 return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[rightPosition])->get();546 }547 548 const atomicNumber_t& GLMoleculeObject_bond::getleftElement() const549 {550 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[leftElement])->get();551 }552 553 const atomicNumber_t& GLMoleculeObject_bond::getrightElement() const554 {555 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[rightElement])->get();556 }557 558 const int& GLMoleculeObject_bond::getDegree() const559 {560 return boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(ObservedValues[Degree])->get();561 }
Note:
See TracChangeset
for help on using the changeset viewer.