source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp@ 47f0e4

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 47f0e4 was 026bef, checked in by Frederik Heber <heber@…>, 9 years ago

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).
  • Property mode set to 100644
File size: 19.1 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 "World.hpp"
58
59#include "ObservedValue_wCallback.hpp"
60
61
62// static entities
63const Observable::channels_t
64GLMoleculeObject_bond::IndexChannels(1, AtomObservable::IndexChanged);
65const Observable::channels_t
66GLMoleculeObject_bond::BondPositionChannels(1, AtomObservable::PositionChanged);
67const Observable::channels_t
68GLMoleculeObject_bond::BondDegreeChannels(1, BondObservable::DegreeChanged);
69const Observable::channels_t
70GLMoleculeObject_bond::BondElementChannels(1, AtomObservable::ElementChanged);
71
72GLMoleculeObject_bond::GLMoleculeObject_bond(
73 QGLSceneNode *mesh[],
74 QObject *parent,
75 const bondIds_t bondIds,
76 const enum SideOfBond side) :
77 GLMoleculeObject(mesh, parent),
78 Observer(std::string("GLMoleculeObject_bond")
79 +toString(bondIds.first)
80 +std::string("-")
81 +toString(bondIds.second)),
82 leftowner(getAtomConst(bondIds.first)),
83 rightowner(getAtomConst(bondIds.second)),
84 bondowner(getAtomConst(bondIds.first)->getBond(getAtomConst(bondIds.second)).get()),
85 BondSide(side),
86 ObservedValues(MAX_ObservedTypes),
87 subjectKilledCount(0),
88 leftobservable_enabled(false),
89 rightobservable_enabled(false)
90{
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
120GLMoleculeObject_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
143void GLMoleculeObject_bond::init()
144{
145 // sign on as observer (obtain non-const instance before)
146 bondowner->signOn(this, BondObservable::BondRemoved);
147 bondowner->signOn(this, BondObservable::DegreeChanged);
148 bond_enabled = true;
149 leftowner->signOn(this, AtomObservable::PositionChanged);
150 leftowner->signOn(this, AtomObservable::ElementChanged);
151 leftobservable_enabled = true;
152 rightowner->signOn(this, AtomObservable::PositionChanged);
153 rightowner->signOn(this, AtomObservable::ElementChanged);
154 rightobservable_enabled = true;
155
156 resetElement();
157 resetPosition();
158 resetWidth();
159
160 connect(this, SIGNAL(elementChanged()), this, SLOT(resetElement()), Qt::QueuedConnection);
161 connect(this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
162 connect(this, SIGNAL(degreeChanged()), this, SLOT(resetWidth()), Qt::QueuedConnection);
163}
164
165GLMoleculeObject_bond::~GLMoleculeObject_bond()
166{
167 LOG(3, "DEBUG: Destroying GLMoleculeObject_bond to bond [" <<
168 getleftIndex() << "," << getrightIndex() << "] and side " << BondSide << ".");
169 // signOff() if not already done
170 removeChannels();
171 destroyObservedValues(ObservedValues);
172}
173
174void GLMoleculeObject_bond::removeChannels()
175{
176 // at this point both atoms should still be alive, hence we may safely sign off
177 // from the AtomObservable itself
178 if (bond_enabled) {
179 if (bondowner != NULL) {
180 bondowner->signOff(this, BondObservable::BondRemoved);
181 bondowner->signOff(this, BondObservable::DegreeChanged);
182 }
183 bond_enabled = false;
184 }
185 if (leftobservable_enabled) {
186 if (leftowner != NULL) {
187 leftowner->signOff(this, AtomObservable::PositionChanged);
188 leftowner->signOff(this, AtomObservable::ElementChanged);
189 }
190 leftobservable_enabled = false;
191 }
192 if (rightobservable_enabled) {
193 if (rightowner != NULL) {
194 rightowner->signOff(this, AtomObservable::PositionChanged);
195 rightowner->signOff(this, AtomObservable::ElementChanged);
196 }
197 rightobservable_enabled = false;
198 }
199}
200
201void GLMoleculeObject_bond::update(Observable *publisher)
202{
203 ASSERT(0, "GLMoleculeObject_bond::update() - we are not signed on for any global updates.");
204}
205
206void GLMoleculeObject_bond::subjectKilled(Observable *publisher)
207{
208 // we signOff from all other sources
209 removeChannels();
210 // check whether we should be removed
211 countsubjectKilled(std::make_pair(getleftIndex(), getrightIndex()));
212}
213
214void GLMoleculeObject_bond::recieveNotification(Observable *publisher, Notification_ptr notification)
215{
216#ifdef LOG_OBSERVER
217 if (publisher == static_cast<const Observable *>(bondowner)) {
218 observerLog().addMessage() << "++ Update of Observer "
219 << observerLog().getName(static_cast<Observer*>(this))
220 << " received notification from bond for channel "
221 << notification->getChannelNo() << ".";
222 } else if (publisher == static_cast<const Observable * const>(leftowner)) {
223 observerLog().addMessage() << "++ Update of Observer "
224 << observerLog().getName(static_cast<Observer*>(this))
225 << " received notification from leftatom " << getleftIndex() << " for channel "
226 << notification->getChannelNo() << ".";
227 } else if (publisher == static_cast<const Observable * const>(rightowner)) {
228 observerLog().addMessage() << "++ Update of Observer "
229 << observerLog().getName(static_cast<Observer*>(this))
230 << " received notification from rightatom " << getrightIndex() << " for channel "
231 << notification->getChannelNo() << ".";
232 }
233#endif
234 if (publisher == static_cast<const Observable *>(bondowner)){
235 switch (notification->getChannelNo()) {
236 case BondObservable::BondRemoved:
237// removeMe();
238 break;
239 case BondObservable::DegreeChanged:
240 emit degreeChanged();
241 break;
242 default:
243 ASSERT(0, "GLMoleculeObject_bond::recieveNotification() - unknown signal.");
244 break;
245 }
246 } else {
247 // from an atom
248 switch (notification->getChannelNo()) {
249 case AtomObservable::PositionChanged:
250 LOG(2, "INFO: Received notification of PositionChanged.");
251 emit positionChanged();
252 break;
253 case AtomObservable::ElementChanged:
254 LOG(2, "INFO: Received notification of ElementChanged.");
255 emit elementChanged();
256 break;
257 default:
258 break;
259 }
260 }
261}
262
263atomId_t GLMoleculeObject_bond::updateIndex()
264{
265 return const_cast<const World &>(World::getInstance()).lastChangedAtomId();
266}
267
268Vector GLMoleculeObject_bond::updateLeftPosition(
269 const boost::function<const atomId_t ()> &_getLeftAtomIndex)
270{
271 const atom * const _atom = getAtomConst(_getLeftAtomIndex());
272 return _atom->getPosition();
273}
274
275Vector GLMoleculeObject_bond::updateRightPosition(
276 const boost::function<const atomId_t ()> &_getRightAtomIndex)
277{
278 const atom * const _atom = getAtomConst(_getRightAtomIndex());
279 return _atom->getPosition();
280}
281
282atomicNumber_t GLMoleculeObject_bond::updateLeftElement(
283 const boost::function<const atomId_t ()> &_getLeftAtomIndex)
284{
285 const atom * const _atom = getAtomConst(_getLeftAtomIndex());
286 return _atom->getElementNo();
287}
288
289atomicNumber_t GLMoleculeObject_bond::updateRightElement(
290 const boost::function<const atomId_t ()> &_getRightAtomIndex)
291{
292 const atom * const _atom = getAtomConst(_getRightAtomIndex());
293 return _atom->getElementNo();
294}
295
296int GLMoleculeObject_bond::updateDegree(
297 const boost::function<const atomId_t ()> &_getLeftAtomIndex,
298 const boost::function<const atomId_t ()> &_getRightAtomIndex)
299{
300 const atom * const _leftatom = const_cast<const World &>(World::getInstance()).
301 getAtom(AtomById(_getLeftAtomIndex()));
302 const atom * const _rightatom = const_cast<const World &>(World::getInstance()).
303 getAtom(AtomById(_getRightAtomIndex()));
304 if ((_leftatom != NULL) && (_rightatom != NULL)) {
305 bond::ptr _bond = _leftatom->getBond(_rightatom);
306 return _bond->getDegree();
307 } else {
308 return 1;
309 }
310}
311
312void GLMoleculeObject_bond::resetElement()
313{
314 size_t elementno = getrightElement();
315 QGLMaterial *elementmaterial = getMaterial(elementno);
316 setMaterial(elementmaterial);
317}
318
319void GLMoleculeObject_bond::resetWidth()
320{
321 const double factor = 1.0f+.5f*(getDegree()-1);
322 LOG(2, "DEBUG: GLMoleculeObject_bond::resetWidth() - setting bond's width to " << factor << ".");
323 setScaleX(factor);
324 setScaleY(factor);
325
326 emit changed();
327}
328
329void GLMoleculeObject_bond::resetPosition()
330{
331 Vector Position = getleftPosition();
332 Vector OtherPosition = getrightPosition();
333 const double distance =
334 Position.distance(OtherPosition)/2.;
335 setScaleZ(distance);
336
337 // calculate position
338 Vector Z(unitVec[2]); // cylinder are initially aligned along the Z axis
339 Vector zeroVec(0.,0.,0.);
340 Vector a,b;
341 Vector OtherAxis;
342 double alpha;
343 a = Position - OtherPosition;
344 // construct rotation axis
345 b = a;
346 b.VectorProduct(Z);
347 Line axis(zeroVec, b);
348 // calculate rotation angle
349 alpha = a.Angle(Z);
350 // construct other axis to check right-hand rule
351 OtherAxis = b;
352 OtherAxis.VectorProduct(Z);
353 // assure right-hand rule for the rotation
354 if (a.ScalarProduct(OtherAxis) < MYEPSILON)
355 alpha = M_PI-alpha;
356 // check
357 Vector a_rotated = axis.rotateVector(a, alpha);
358 LOG(3, "INFO: Created cylinder from "// << Position << " to " << OtherPosition
359 << a << " to " << a_rotated << " around " << b << " by " << alpha/M_PI*180. << ", respectively.");
360
361 // set position (cylinder offset is in its barymetric center)
362 Vector OneFourth(Position - 0.75 * a);
363 setPosition(QVector3D(OneFourth[0], OneFourth[1], OneFourth[2]));
364 setRotationVector(QVector3D(b[0], b[1], b[2]));
365 setRotationAngle(alpha/M_PI*180.);
366
367 emit changed();
368}
369
370atom * const GLMoleculeObject_bond::getAtom(const atomId_t _id)
371{
372 atom * const _atom = World::getInstance().getAtom(AtomById(_id));
373 return _atom;
374}
375
376const atom * const GLMoleculeObject_bond::getAtomConst(const atomId_t _id)
377{
378 const atom * const _atom = const_cast<const World &>(World::getInstance()).
379 getAtom(AtomById(_id));
380 return _atom;
381}
382
383void GLMoleculeObject_bond::countsubjectKilled()
384{
385 ++subjectKilledCount;
386
387 if (subjectKilledCount > ObservedValues.size())
388 emit BondRemoved(getleftIndex(), getrightIndex());
389}
390
391static 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
398void GLMoleculeObject_bond::initObservedValues(
399 std::vector<boost::any> &_ObservedValues,
400 const atomId_t _leftatomId,
401 const atomId_t _rightatomId,
402 const Observable * const _leftowner,
403 const Observable * const _rightowner,
404 const Observable * const _bondowner,
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)
408{
409 /* This is an old note from when the code was still part of cstor's initializer body.
410 * TODO: Probably does not apply anymore but has not yet been tested.
411 *
412 * We must not use boost::cref(this) as "this" has not been properly constructed and seemingly
413 * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because
414 * the class has not been fully constructed yet. "This" itself seems to be working fine.
415 */
416
417 ASSERT( _ObservedValues.size() == MAX_ObservedTypes,
418 "GLMoleculeObject_bond::initObservedValues() - given ObservedValues has not correct size.");
419
420 // fill ObservedValues: index first
421 // Note that we only need one as the function just checks on the last changed id
422 // and ids cannot be changed simultaneously
423 const boost::function<atomId_t ()> AtomIndexUpdater(
424 boost::bind(&GLMoleculeObject_bond::updateIndex));
425
426 ObservedValue_wCallback<atomId_t> * const LeftIndexObservable =
427 new ObservedValue_wCallback<atomId_t>(
428 _leftowner,
429 AtomIndexUpdater,
430 "Bonds_LeftAtomIndex_"+toString(_leftatomId),
431 _leftatomId,
432 IndexChannels,
433 _leftsubjectKilled);
434 _ObservedValues[leftIndex] = LeftIndexObservable;
435 ObservedValue_wCallback<atomId_t> * const RightIndexObservable =
436 new ObservedValue_wCallback<atomId_t>(
437 _rightowner,
438 AtomIndexUpdater,
439 "Bonds_RightAtomIndex_"+toString(_rightatomId),
440 _rightatomId,
441 IndexChannels,
442 _rightsubjectKilled);
443 _ObservedValues[rightIndex] = RightIndexObservable;
444
445 const boost::function<const atomId_t ()> LeftIndexGetter =
446 boost::bind(&ObservedValue_wCallback<atomId_t>::get,
447 LeftIndexObservable);
448 const boost::function<const atomId_t ()> RightIndexGetter =
449 boost::bind(&ObservedValue_wCallback<atomId_t>::get,
450 RightIndexObservable);
451
452 // fill ObservedValues: then all the other that need index
453 const boost::function<Vector ()> LeftPositionUpdater(
454 boost::bind(&GLMoleculeObject_bond::updateLeftPosition, LeftIndexGetter));
455 const boost::function<Vector ()> RightPositionUpdater(
456 boost::bind(&GLMoleculeObject_bond::updateRightPosition, RightIndexGetter));
457 const boost::function<atomicNumber_t ()> LeftElementUpdater(
458 boost::bind(&GLMoleculeObject_bond::updateLeftElement, LeftIndexGetter));
459 const boost::function<atomicNumber_t ()> RightElementUpdater(
460 boost::bind(&GLMoleculeObject_bond::updateRightElement, RightIndexGetter));
461 const boost::function<int ()> DegreeUpdater(
462 boost::bind(&GLMoleculeObject_bond::updateDegree, LeftIndexGetter, RightIndexGetter));
463 const boost::function<bondIds_t ()> BondIdGetter(
464 boost::bind(&getBondIdsForIds, LeftIndexGetter, RightIndexGetter));
465
466 _ObservedValues[leftPosition] = new ObservedValue_wCallback<Vector, atomId_t>(
467 _leftowner,
468 LeftPositionUpdater,
469 "BondleftPosition_"+toString(_leftatomId),
470 LeftPositionUpdater(),
471 BondPositionChannels,
472 _leftsubjectKilled,
473 LeftIndexGetter);
474 _ObservedValues[rightPosition] = new ObservedValue_wCallback<Vector, atomId_t>(
475 _rightowner,
476 RightPositionUpdater,
477 "BondrightPosition_"+toString(_rightatomId),
478 RightPositionUpdater(),
479 BondPositionChannels,
480 _rightsubjectKilled,
481 RightIndexGetter);
482 _ObservedValues[leftElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(
483 _leftowner,
484 LeftElementUpdater,
485 "BondleftElement"+toString(_leftatomId),
486 LeftElementUpdater(),
487 BondElementChannels,
488 _leftsubjectKilled,
489 LeftIndexGetter);
490 _ObservedValues[rightElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(
491 _rightowner,
492 RightElementUpdater,
493 "BondrightElement"+toString(_rightatomId),
494 RightElementUpdater(),
495 BondElementChannels,
496 _rightsubjectKilled,
497 RightIndexGetter);
498 _ObservedValues[Degree] = new ObservedValue_wCallback<int, bondIds_t>(
499 _bondowner,
500 DegreeUpdater,
501 "BondDegree"+toString(_leftatomId)+"_"+toString(_rightatomId),
502 DegreeUpdater(),
503 BondDegreeChannels,
504 _bondsubjectKilled,
505 BondIdGetter);
506}
507
508void GLMoleculeObject_bond::destroyObservedValues(
509 std::vector<boost::any> &_ObservedValues)
510{
511 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[leftIndex]);
512 delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[rightIndex]);
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]);
518 _ObservedValues.clear();
519}
520
521atomId_t GLMoleculeObject_bond::getleftIndex() const
522{
523 return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[leftIndex])->get();
524}
525
526atomId_t GLMoleculeObject_bond::getrightIndex() const
527{
528 return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[rightIndex])->get();
529}
530
531Vector GLMoleculeObject_bond::getleftPosition() const
532{
533 return boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(ObservedValues[leftPosition])->get();
534}
535
536Vector GLMoleculeObject_bond::getrightPosition() const
537{
538 return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[rightPosition])->get();
539}
540
541atomicNumber_t GLMoleculeObject_bond::getleftElement() const
542{
543 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[leftElement])->get();
544}
545
546atomicNumber_t GLMoleculeObject_bond::getrightElement() const
547{
548 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[rightElement])->get();
549}
550
551int GLMoleculeObject_bond::getDegree() const
552{
553 return boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(ObservedValues[Degree])->get();
554}
Note: See TracBrowser for help on using the repository browser.