source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp@ 65c323

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
Last change on this file since 65c323 was 2f7988, checked in by Frederik Heber <heber@…>, 9 years ago

Moved and renamed QtInstanceInformationBoard -> QtObservedInstanceBoard.

  • Property mode set to 100644
File size: 19.5 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 * Copyright (C) 2013 Frederik Heber. All rights reserved.
6 *
7 *
8 * This file is part of MoleCuilder.
9 *
10 * MoleCuilder is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * MoleCuilder is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24/*
25 * GLMoleculeObject_bond.cpp
26 *
27 * Created on: Aug 17, 2011
28 * Author: heber
29 */
30
31// include config.h
32#ifdef HAVE_CONFIG_H
33#include <config.h>
34#endif
35
36#include "GLMoleculeObject_bond.hpp"
37
38#include <Qt3D/qglmaterial.h>
39#include <Qt3D/qglscenenode.h>
40
41#include "CodePatterns/MemDebug.hpp"
42
43
44#include <cmath>
45
46#include "CodePatterns/Assert.hpp"
47#include "CodePatterns/Log.hpp"
48#include "CodePatterns/Observer/Notification.hpp"
49#include "CodePatterns/Observer/ObserverLog.hpp"
50#include "Descriptors/AtomIdDescriptor.hpp"
51#include "Atom/atom.hpp"
52#include "Bond/bond.hpp"
53#include "Element/element.hpp"
54#include "Helpers/defs.hpp"
55#include "LinearAlgebra/Line.hpp"
56#include "LinearAlgebra/Vector.hpp"
57#include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp"
58#include "World.hpp"
59
60#include "ObservedValue_wCallback.hpp"
61
62
63// static entities
64const Observable::channels_t
65GLMoleculeObject_bond::IndexChannels(1, AtomObservable::IndexChanged);
66const Observable::channels_t
67GLMoleculeObject_bond::BondPositionChannels(1, AtomObservable::PositionChanged);
68const Observable::channels_t
69GLMoleculeObject_bond::BondDegreeChannels(1, BondObservable::DegreeChanged);
70const Observable::channels_t
71GLMoleculeObject_bond::BondElementChannels(1, AtomObservable::ElementChanged);
72
73static GLMoleculeObject_bond::bondIds_t getBondIdsForIds(
74 const boost::function<const atomId_t()> &_left,
75 const boost::function<const atomId_t()> &_right)
76{
77 return std::make_pair(_left(), _right());
78}
79
80GLMoleculeObject_bond::GLMoleculeObject_bond(
81 QGLSceneNode *mesh[],
82 QObject *parent,
83 const bondIds_t bondIds,
84 const enum SideOfBond side) :
85 GLMoleculeObject(mesh, parent),
86 Observer(std::string("GLMoleculeObject_bond")
87 +toString(bondIds.first)
88 +std::string("-")
89 +toString(bondIds.second)),
90 leftowner(getAtomConst(bondIds.first)),
91 rightowner(getAtomConst(bondIds.second)),
92 bondowner(getAtomConst(bondIds.first)->getBond(getAtomConst(bondIds.second)).get()),
93 BondSide(side),
94 ObservedValues(MAX_ObservedTypes),
95 subjectKilledCount(0),
96 leftobservable_enabled(false),
97 rightobservable_enabled(false),
98 board_subjectKilled(
99 boost::bind(
100 static_cast<void (GLMoleculeObject_bond::*) ()>(
101 &GLMoleculeObject_bond::countsubjectKilled),
102 this))
103{
104 boost::function<void(const atomId_t &)> leftsubjectKilled =
105 boost::bind(
106 static_cast<void (GLMoleculeObject_bond::*) (const atomId_t &)>(
107 &GLMoleculeObject_bond::countsubjectKilled),
108 this, _1);
109 boost::function<void(const atomId_t &)> rightsubjectKilled =
110 boost::bind(
111 static_cast<void (GLMoleculeObject_bond::*) (const atomId_t &)>(
112 &GLMoleculeObject_bond::countsubjectKilled)
113 , this, _1);
114 boost::function<void(const bondIds_t &)> bondsubjectKilled =
115 boost::bind(
116 static_cast<void (GLMoleculeObject_bond::*) (const bondIds_t &)>(
117 &GLMoleculeObject_bond::countsubjectKilled)
118 , this, _1);
119 initObservedValues(
120 ObservedValues,
121 bondIds.first,
122 bondIds.second,
123 leftowner,
124 rightowner,
125 bondowner,
126 leftsubjectKilled,
127 rightsubjectKilled,
128 bondsubjectKilled);
129
130 init();
131}
132
133GLMoleculeObject_bond::GLMoleculeObject_bond(
134 QGLSceneNode *mesh[],
135 QObject *parent,
136 const bondIds_t bondIds,
137 const enum SideOfBond side,
138 std::vector<boost::any> &_ObservedValues,
139 const boost::function<void (const bondIds_t)> &_subjectKilled) :
140 GLMoleculeObject(mesh, parent),
141 Observer(std::string("GLMoleculeObject_bond")
142 +toString(bondIds.first)
143 +std::string("-")
144 +toString(bondIds.second)),
145 leftowner(getAtomConst(bondIds.first)),
146 rightowner(getAtomConst(bondIds.second)),
147 bondowner(getAtomConst(bondIds.first)->getBond(getAtomConst(bondIds.second)).get()),
148 BondSide(side),
149 ObservedValues(_ObservedValues),
150 subjectKilledCount(0),
151 leftobservable_enabled(false),
152 rightobservable_enabled(false),
153 board_subjectKilled(_subjectKilled)
154{
155 init();
156}
157
158void GLMoleculeObject_bond::init()
159{
160 // sign on as observer (obtain non-const instance before)
161 bondowner->signOn(this, BondObservable::BondRemoved);
162 bondowner->signOn(this, BondObservable::DegreeChanged);
163 bond_enabled = true;
164 leftowner->signOn(this, AtomObservable::PositionChanged);
165 leftowner->signOn(this, AtomObservable::ElementChanged);
166 leftobservable_enabled = true;
167 rightowner->signOn(this, AtomObservable::PositionChanged);
168 rightowner->signOn(this, AtomObservable::ElementChanged);
169 rightobservable_enabled = true;
170
171 resetElement();
172 resetPosition();
173 resetWidth();
174
175 connect(this, SIGNAL(elementChanged()), this, SLOT(resetElement()), Qt::QueuedConnection);
176 connect(this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
177 connect(this, SIGNAL(degreeChanged()), this, SLOT(resetWidth()), Qt::QueuedConnection);
178}
179
180GLMoleculeObject_bond::~GLMoleculeObject_bond()
181{
182 LOG(3, "DEBUG: Destroying GLMoleculeObject_bond to bond [" <<
183 getleftIndex() << "," << getrightIndex() << "] and side " << BondSide << ".");
184 // signOff() if not already done
185 removeChannels();
186 destroyObservedValues(ObservedValues);
187}
188
189void GLMoleculeObject_bond::removeChannels()
190{
191 // at this point both atoms should still be alive, hence we may safely sign off
192 // from the AtomObservable itself
193 if (bond_enabled) {
194 if (bondowner != NULL) {
195 bondowner->signOff(this, BondObservable::BondRemoved);
196 bondowner->signOff(this, BondObservable::DegreeChanged);
197 }
198 bond_enabled = false;
199 }
200 if (leftobservable_enabled) {
201 if (leftowner != NULL) {
202 leftowner->signOff(this, AtomObservable::PositionChanged);
203 leftowner->signOff(this, AtomObservable::ElementChanged);
204 }
205 leftobservable_enabled = false;
206 }
207 if (rightobservable_enabled) {
208 if (rightowner != NULL) {
209 rightowner->signOff(this, AtomObservable::PositionChanged);
210 rightowner->signOff(this, AtomObservable::ElementChanged);
211 }
212 rightobservable_enabled = false;
213 }
214}
215
216void GLMoleculeObject_bond::update(Observable *publisher)
217{
218 ASSERT(0, "GLMoleculeObject_bond::update() - we are not signed on for any global updates.");
219}
220
221void GLMoleculeObject_bond::subjectKilled(Observable *publisher)
222{
223 // we signOff from all other sources
224 removeChannels();
225 // check whether we should be removed
226 board_subjectKilled(std::make_pair(getleftIndex(), getrightIndex()));
227}
228
229void GLMoleculeObject_bond::recieveNotification(Observable *publisher, Notification_ptr notification)
230{
231#ifdef LOG_OBSERVER
232 if (publisher == static_cast<const Observable *>(bondowner)) {
233 observerLog().addMessage() << "++ Update of Observer "
234 << observerLog().getName(static_cast<Observer*>(this))
235 << " received notification from bond for channel "
236 << notification->getChannelNo() << ".";
237 } else if (publisher == static_cast<const Observable * const>(leftowner)) {
238 observerLog().addMessage() << "++ Update of Observer "
239 << observerLog().getName(static_cast<Observer*>(this))
240 << " received notification from leftatom " << getleftIndex() << " for channel "
241 << notification->getChannelNo() << ".";
242 } else if (publisher == static_cast<const Observable * const>(rightowner)) {
243 observerLog().addMessage() << "++ Update of Observer "
244 << observerLog().getName(static_cast<Observer*>(this))
245 << " received notification from rightatom " << getrightIndex() << " for channel "
246 << notification->getChannelNo() << ".";
247 }
248#endif
249 if (publisher == static_cast<const Observable *>(bondowner)){
250 switch (notification->getChannelNo()) {
251 case BondObservable::BondRemoved:
252// removeMe();
253 break;
254 case BondObservable::DegreeChanged:
255 emit degreeChanged();
256 break;
257 default:
258 ASSERT(0, "GLMoleculeObject_bond::recieveNotification() - unknown signal.");
259 break;
260 }
261 } else {
262 // from an atom
263 switch (notification->getChannelNo()) {
264 case AtomObservable::PositionChanged:
265 LOG(2, "INFO: Received notification of PositionChanged.");
266 emit positionChanged();
267 break;
268 case AtomObservable::ElementChanged:
269 LOG(2, "INFO: Received notification of ElementChanged.");
270 emit elementChanged();
271 break;
272 default:
273 break;
274 }
275 }
276}
277
278atomId_t GLMoleculeObject_bond::updateIndex()
279{
280 return const_cast<const World &>(World::getInstance()).lastChangedAtomId();
281}
282
283Vector GLMoleculeObject_bond::updateLeftPosition(
284 const boost::function<const atomId_t ()> &_getLeftAtomIndex)
285{
286 const atom * const _atom = getAtomConst(_getLeftAtomIndex());
287 return _atom->getPosition();
288}
289
290Vector GLMoleculeObject_bond::updateRightPosition(
291 const boost::function<const atomId_t ()> &_getRightAtomIndex)
292{
293 const atom * const _atom = getAtomConst(_getRightAtomIndex());
294 return _atom->getPosition();
295}
296
297atomicNumber_t GLMoleculeObject_bond::updateLeftElement(
298 const boost::function<const atomId_t ()> &_getLeftAtomIndex)
299{
300 const atom * const _atom = getAtomConst(_getLeftAtomIndex());
301 return _atom->getElementNo();
302}
303
304atomicNumber_t GLMoleculeObject_bond::updateRightElement(
305 const boost::function<const atomId_t ()> &_getRightAtomIndex)
306{
307 const atom * const _atom = getAtomConst(_getRightAtomIndex());
308 return _atom->getElementNo();
309}
310
311int GLMoleculeObject_bond::updateDegree(
312 const boost::function<const atomId_t ()> &_getLeftAtomIndex,
313 const boost::function<const atomId_t ()> &_getRightAtomIndex)
314{
315 const atom * const _leftatom = const_cast<const World &>(World::getInstance()).
316 getAtom(AtomById(_getLeftAtomIndex()));
317 const atom * const _rightatom = const_cast<const World &>(World::getInstance()).
318 getAtom(AtomById(_getRightAtomIndex()));
319 if ((_leftatom != NULL) && (_rightatom != NULL)) {
320 bond::ptr _bond = _leftatom->getBond(_rightatom);
321 return _bond->getDegree();
322 } else {
323 return 1;
324 }
325}
326
327void GLMoleculeObject_bond::resetElement()
328{
329 size_t elementno = getrightElement();
330 QGLMaterial *elementmaterial = getMaterial(elementno);
331 setMaterial(elementmaterial);
332}
333
334void GLMoleculeObject_bond::resetWidth()
335{
336 const double factor = 1.0f+.5f*(getDegree()-1);
337 LOG(2, "DEBUG: GLMoleculeObject_bond::resetWidth() - setting bond's width to " << factor << ".");
338 setScaleX(factor);
339 setScaleY(factor);
340
341 emit changed();
342}
343
344void GLMoleculeObject_bond::resetPosition()
345{
346 Vector Position = getleftPosition();
347 Vector OtherPosition = getrightPosition();
348 const double distance =
349 Position.distance(OtherPosition)/2.;
350 setScaleZ(distance);
351
352 // calculate position
353 Vector Z(unitVec[2]); // cylinder are initially aligned along the Z axis
354 Vector zeroVec(0.,0.,0.);
355 Vector a,b;
356 Vector OtherAxis;
357 double alpha;
358 a = Position - OtherPosition;
359 // construct rotation axis
360 b = a;
361 b.VectorProduct(Z);
362 Line axis(zeroVec, b);
363 // calculate rotation angle
364 alpha = a.Angle(Z);
365 // construct other axis to check right-hand rule
366 OtherAxis = b;
367 OtherAxis.VectorProduct(Z);
368 // assure right-hand rule for the rotation
369 if (a.ScalarProduct(OtherAxis) < MYEPSILON)
370 alpha = M_PI-alpha;
371 // check
372 Vector a_rotated = axis.rotateVector(a, alpha);
373 LOG(3, "INFO: Created cylinder from "// << Position << " to " << OtherPosition
374 << a << " to " << a_rotated << " around " << b << " by " << alpha/M_PI*180. << ", respectively.");
375
376 // set position (cylinder offset is in its barymetric center)
377 Vector OneFourth(Position - 0.75 * a);
378 setPosition(QVector3D(OneFourth[0], OneFourth[1], OneFourth[2]));
379 setRotationVector(QVector3D(b[0], b[1], b[2]));
380 setRotationAngle(alpha/M_PI*180.);
381
382 emit changed();
383}
384
385atom * const GLMoleculeObject_bond::getAtom(const atomId_t _id)
386{
387 atom * const _atom = World::getInstance().getAtom(AtomById(_id));
388 return _atom;
389}
390
391const atom * const GLMoleculeObject_bond::getAtomConst(const atomId_t _id)
392{
393 const atom * const _atom = const_cast<const World &>(World::getInstance()).
394 getAtom(AtomById(_id));
395 return _atom;
396}
397
398void GLMoleculeObject_bond::countsubjectKilled()
399{
400 ++subjectKilledCount;
401
402 if (subjectKilledCount > ObservedValues.size())
403 emit BondRemoved(getleftIndex(), getrightIndex());
404}
405
406void GLMoleculeObject_bond::initObservedValues(
407 std::vector<boost::any> &_ObservedValues,
408 const atomId_t _leftatomId,
409 const atomId_t _rightatomId,
410 const Observable * const _leftowner,
411 const Observable * const _rightowner,
412 const Observable * const _bondowner,
413 const boost::function<void(const atomId_t &)> &_leftsubjectKilled,
414 const boost::function<void(const atomId_t &)> &_rightsubjectKilled,
415 const boost::function<void(const bondIds_t &)> &_bondsubjectKilled)
416{
417 /* This is an old note from when the code was still part of cstor's initializer body.
418 * TODO: Probably does not apply anymore but has not yet been tested.
419 *
420 * We must not use boost::cref(this) as "this" has not been properly constructed and seemingly
421 * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because
422 * the class has not been fully constructed yet. "This" itself seems to be working fine.
423 */
424
425 ASSERT( _ObservedValues.size() == MAX_ObservedTypes,
426 "GLMoleculeObject_bond::initObservedValues() - given ObservedValues has not correct size.");
427
428 // fill ObservedValues: index first
429 // Note that we only need one as the function just checks on the last changed id
430 // and ids cannot be changed simultaneously
431 const boost::function<atomId_t ()> AtomIndexUpdater(
432 boost::bind(&GLMoleculeObject_bond::updateIndex));
433
434 ObservedValue_wCallback<atomId_t> * const LeftIndexObservable =
435 new ObservedValue_wCallback<atomId_t>(
436 _leftowner,
437 AtomIndexUpdater,
438 "Bonds_LeftAtomIndex_"+toString(_leftatomId),
439 _leftatomId,
440 IndexChannels,
441 _leftsubjectKilled);
442 _ObservedValues[leftIndex] = LeftIndexObservable;
443 ObservedValue_wCallback<atomId_t> * const RightIndexObservable =
444 new ObservedValue_wCallback<atomId_t>(
445 _rightowner,
446 AtomIndexUpdater,
447 "Bonds_RightAtomIndex_"+toString(_rightatomId),
448 _rightatomId,
449 IndexChannels,
450 _rightsubjectKilled);
451 _ObservedValues[rightIndex] = RightIndexObservable;
452
453 const boost::function<const atomId_t ()> LeftIndexGetter =
454 boost::bind(&ObservedValue_wCallback<atomId_t>::get,
455 LeftIndexObservable);
456 const boost::function<const atomId_t ()> RightIndexGetter =
457 boost::bind(&ObservedValue_wCallback<atomId_t>::get,
458 RightIndexObservable);
459
460 // fill ObservedValues: then all the other that need index
461 const boost::function<Vector ()> LeftPositionUpdater(
462 boost::bind(&GLMoleculeObject_bond::updateLeftPosition, LeftIndexGetter));
463 const boost::function<Vector ()> RightPositionUpdater(
464 boost::bind(&GLMoleculeObject_bond::updateRightPosition, RightIndexGetter));
465 const boost::function<atomicNumber_t ()> LeftElementUpdater(
466 boost::bind(&GLMoleculeObject_bond::updateLeftElement, LeftIndexGetter));
467 const boost::function<atomicNumber_t ()> RightElementUpdater(
468 boost::bind(&GLMoleculeObject_bond::updateRightElement, RightIndexGetter));
469 const boost::function<int ()> DegreeUpdater(
470 boost::bind(&GLMoleculeObject_bond::updateDegree, LeftIndexGetter, RightIndexGetter));
471 const boost::function<bondIds_t ()> BondIdGetter(
472 boost::bind(&getBondIdsForIds, LeftIndexGetter, RightIndexGetter));
473
474 _ObservedValues[leftPosition] = new ObservedValue_wCallback<Vector, atomId_t>(
475 _leftowner,
476 LeftPositionUpdater,
477 "BondleftPosition_"+toString(_leftatomId),
478 LeftPositionUpdater(),
479 BondPositionChannels,
480 _leftsubjectKilled,
481 LeftIndexGetter);
482 _ObservedValues[rightPosition] = new ObservedValue_wCallback<Vector, atomId_t>(
483 _rightowner,
484 RightPositionUpdater,
485 "BondrightPosition_"+toString(_rightatomId),
486 RightPositionUpdater(),
487 BondPositionChannels,
488 _rightsubjectKilled,
489 RightIndexGetter);
490 _ObservedValues[leftElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(
491 _leftowner,
492 LeftElementUpdater,
493 "BondleftElement"+toString(_leftatomId),
494 LeftElementUpdater(),
495 BondElementChannels,
496 _leftsubjectKilled,
497 LeftIndexGetter);
498 _ObservedValues[rightElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(
499 _rightowner,
500 RightElementUpdater,
501 "BondrightElement"+toString(_rightatomId),
502 RightElementUpdater(),
503 BondElementChannels,
504 _rightsubjectKilled,
505 RightIndexGetter);
506 _ObservedValues[Degree] = new ObservedValue_wCallback<int, bondIds_t>(
507 _bondowner,
508 DegreeUpdater,
509 "BondDegree"+toString(_leftatomId)+"_"+toString(_rightatomId),
510 DegreeUpdater(),
511 BondDegreeChannels,
512 _bondsubjectKilled,
513 BondIdGetter);
514}
515
516void GLMoleculeObject_bond::destroyObservedValues(
517 std::vector<boost::any> &_ObservedValues)
518{
519 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[leftIndex]);
520 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[rightIndex]);
521 delete boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(_ObservedValues[leftPosition]);
522 delete boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(_ObservedValues[rightPosition]);
523 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t,atomId_t> *>(_ObservedValues[leftElement]);
524 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t,atomId_t> *>(_ObservedValues[rightElement]);
525 delete boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(_ObservedValues[Degree]);
526 _ObservedValues.clear();
527}
528
529atomId_t GLMoleculeObject_bond::getleftIndex() const
530{
531 return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[leftIndex])->get();
532}
533
534atomId_t GLMoleculeObject_bond::getrightIndex() const
535{
536 return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[rightIndex])->get();
537}
538
539Vector GLMoleculeObject_bond::getleftPosition() const
540{
541 return boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(ObservedValues[leftPosition])->get();
542}
543
544Vector GLMoleculeObject_bond::getrightPosition() const
545{
546 return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[rightPosition])->get();
547}
548
549atomicNumber_t GLMoleculeObject_bond::getleftElement() const
550{
551 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[leftElement])->get();
552}
553
554atomicNumber_t GLMoleculeObject_bond::getrightElement() const
555{
556 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[rightElement])->get();
557}
558
559int GLMoleculeObject_bond::getDegree() const
560{
561 return boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(ObservedValues[Degree])->get();
562}
Note: See TracBrowser for help on using the repository browser.