[907636] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
[0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
[5aaa43] | 5 | * Copyright (C) 2013 Frederik Heber. All rights reserved.
|
---|
[94d5ac6] | 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/>.
|
---|
[907636] | 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 |
|
---|
[856d05] | 43 |
|
---|
[907636] | 44 | #include <cmath>
|
---|
| 45 |
|
---|
| 46 | #include "CodePatterns/Assert.hpp"
|
---|
[57a770] | 47 | #include "CodePatterns/Log.hpp"
|
---|
[2ad1ec] | 48 | #include "CodePatterns/Observer/Notification.hpp"
|
---|
[856d05] | 49 | #include "CodePatterns/Observer/ObserverLog.hpp"
|
---|
[c60665] | 50 | #include "Descriptors/AtomIdDescriptor.hpp"
|
---|
[6f0841] | 51 | #include "Atom/atom.hpp"
|
---|
[907636] | 52 | #include "Bond/bond.hpp"
|
---|
[3bdb6d] | 53 | #include "Element/element.hpp"
|
---|
[907636] | 54 | #include "Helpers/defs.hpp"
|
---|
| 55 | #include "LinearAlgebra/Line.hpp"
|
---|
| 56 | #include "LinearAlgebra/Vector.hpp"
|
---|
[c60665] | 57 | #include "World.hpp"
|
---|
[907636] | 58 |
|
---|
[7c7c4a] | 59 | #include "ObservedValue_wCallback.hpp"
|
---|
| 60 |
|
---|
[009e2e2] | 61 |
|
---|
| 62 | // static entities
|
---|
| 63 | const Observable::channels_t
|
---|
| 64 | GLMoleculeObject_bond::BondPositionChannels(1, AtomObservable::PositionChanged);
|
---|
| 65 | const Observable::channels_t
|
---|
| 66 | GLMoleculeObject_bond::BondDegreeChannels(1, BondObservable::DegreeChanged);
|
---|
| 67 | const Observable::channels_t
|
---|
| 68 | GLMoleculeObject_bond::BondElementChannels(1, AtomObservable::ElementChanged);
|
---|
| 69 |
|
---|
| 70 | GLMoleculeObject_bond::GLMoleculeObject_bond(
|
---|
| 71 | QGLSceneNode *mesh[],
|
---|
| 72 | QObject *parent,
|
---|
| 73 | const bondIds_t bondIds,
|
---|
| 74 | const enum SideOfBond side) :
|
---|
[bca99d] | 75 | GLMoleculeObject(mesh, parent),
|
---|
[2ad1ec] | 76 | Observer(std::string("GLMoleculeObject_bond")
|
---|
[009e2e2] | 77 | +toString(bondIds.first)
|
---|
[2ad1ec] | 78 | +std::string("-")
|
---|
[009e2e2] | 79 | +toString(bondIds.second)),
|
---|
| 80 | leftatomId(bondIds.first),
|
---|
| 81 | rightatomId(bondIds.second),
|
---|
[7e2adc] | 82 | leftowner(getAtom(leftatomId)),
|
---|
| 83 | rightowner(getAtom(rightatomId)),
|
---|
| 84 | bondowner(getAtom(leftatomId)->getBond(getAtom(rightatomId)).get()),
|
---|
[c60665] | 85 | BondSide(side),
|
---|
[7c7c4a] | 86 | ObservedValues(MAX_ObservedTypes),
|
---|
| 87 | subjectKilledCount(0),
|
---|
[c60665] | 88 | leftobservable_enabled(false),
|
---|
[009e2e2] | 89 | rightobservable_enabled(false)
|
---|
[907636] | 90 | {
|
---|
[7c7c4a] | 91 | initObservedValues();
|
---|
| 92 |
|
---|
[2ad1ec] | 93 | // sign on as observer (obtain non-const instance before)
|
---|
[7e2adc] | 94 | bondowner->signOn(this, BondObservable::BondRemoved);
|
---|
| 95 | bondowner->signOn(this, BondObservable::DegreeChanged);
|
---|
[c60665] | 96 | bond_enabled = true;
|
---|
[7e2adc] | 97 | leftowner->signOn(this, AtomObservable::PositionChanged);
|
---|
| 98 | leftowner->signOn(this, AtomObservable::ElementChanged);
|
---|
[c60665] | 99 | leftobservable_enabled = true;
|
---|
[7e2adc] | 100 | rightowner->signOn(this, AtomObservable::PositionChanged);
|
---|
| 101 | rightowner->signOn(this, AtomObservable::ElementChanged);
|
---|
[c60665] | 102 | rightobservable_enabled = true;
|
---|
[2ad1ec] | 103 |
|
---|
[009e2e2] | 104 | resetElement();
|
---|
[343a4b] | 105 | resetPosition();
|
---|
[4b62d3] | 106 | resetWidth();
|
---|
[009e2e2] | 107 |
|
---|
| 108 | connect(this, SIGNAL(elementChanged()), this, SLOT(resetElement()), Qt::QueuedConnection);
|
---|
| 109 | connect(this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
|
---|
| 110 | connect(this, SIGNAL(degreeChanged()), this, SLOT(resetWidth()), Qt::QueuedConnection);
|
---|
[907636] | 111 | }
|
---|
[2ad1ec] | 112 |
|
---|
| 113 | GLMoleculeObject_bond::~GLMoleculeObject_bond()
|
---|
[c60665] | 114 | {
|
---|
[009e2e2] | 115 | LOG(3, "DEBUG: Destroying GLMoleculeObject_bond to bond [" <<
|
---|
| 116 | leftatomId << "," << rightatomId << "] and side " << BondSide << ".");
|
---|
[c60665] | 117 | // signOff() if not already done
|
---|
| 118 | removeChannels();
|
---|
[7c7c4a] | 119 | destroyObservedValues();
|
---|
[c60665] | 120 | }
|
---|
| 121 |
|
---|
[7e2adc] | 122 | void GLMoleculeObject_bond::removeChannels()
|
---|
[c60665] | 123 | {
|
---|
| 124 | // at this point both atoms should still be alive, hence we may safely sign off
|
---|
| 125 | // from the AtomObservable itself
|
---|
[7e2adc] | 126 | if (bond_enabled) {
|
---|
| 127 | if (bondowner != NULL) {
|
---|
| 128 | bondowner->signOff(this, BondObservable::BondRemoved);
|
---|
| 129 | bondowner->signOff(this, BondObservable::DegreeChanged);
|
---|
[c60665] | 130 | }
|
---|
[7e2adc] | 131 | bond_enabled = false;
|
---|
[c60665] | 132 | }
|
---|
| 133 | if (leftobservable_enabled) {
|
---|
[7e2adc] | 134 | if (leftowner != NULL) {
|
---|
| 135 | leftowner->signOff(this, AtomObservable::PositionChanged);
|
---|
| 136 | leftowner->signOff(this, AtomObservable::ElementChanged);
|
---|
[c60665] | 137 | }
|
---|
| 138 | leftobservable_enabled = false;
|
---|
| 139 | }
|
---|
| 140 | if (rightobservable_enabled) {
|
---|
[7e2adc] | 141 | if (rightowner != NULL) {
|
---|
| 142 | rightowner->signOff(this, AtomObservable::PositionChanged);
|
---|
| 143 | rightowner->signOff(this, AtomObservable::ElementChanged);
|
---|
[c60665] | 144 | }
|
---|
| 145 | rightobservable_enabled = false;
|
---|
| 146 | }
|
---|
| 147 | }
|
---|
| 148 |
|
---|
[2ad1ec] | 149 | void GLMoleculeObject_bond::update(Observable *publisher)
|
---|
| 150 | {
|
---|
[009e2e2] | 151 | ASSERT(0, "GLMoleculeObject_bond::update() - we are not signed on for any global updates.");
|
---|
[2ad1ec] | 152 | }
|
---|
| 153 |
|
---|
| 154 | void GLMoleculeObject_bond::subjectKilled(Observable *publisher)
|
---|
| 155 | {
|
---|
[7e2adc] | 156 | // we signOff from all other sources
|
---|
[c60665] | 157 | removeChannels();
|
---|
[7c7c4a] | 158 | // check whether we should be removed
|
---|
| 159 | countsubjectKilled();
|
---|
[2ad1ec] | 160 | }
|
---|
| 161 |
|
---|
| 162 | void GLMoleculeObject_bond::recieveNotification(Observable *publisher, Notification_ptr notification)
|
---|
| 163 | {
|
---|
| 164 | #ifdef LOG_OBSERVER
|
---|
[7e2adc] | 165 | if (publisher == static_cast<const Observable *>(bondowner)) {
|
---|
[70db8f] | 166 | observerLog().addMessage() << "++ Update of Observer "
|
---|
| 167 | << observerLog().getName(static_cast<Observer*>(this))
|
---|
| 168 | << " received notification from bond for channel "
|
---|
| 169 | << notification->getChannelNo() << ".";
|
---|
[7e2adc] | 170 | } else if (publisher == static_cast<const Observable * const>(leftowner)) {
|
---|
[70db8f] | 171 | observerLog().addMessage() << "++ Update of Observer "
|
---|
| 172 | << observerLog().getName(static_cast<Observer*>(this))
|
---|
[c60665] | 173 | << " received notification from leftatom " << leftatomId << " for channel "
|
---|
[70db8f] | 174 | << notification->getChannelNo() << ".";
|
---|
[7e2adc] | 175 | } else if (publisher == static_cast<const Observable * const>(rightowner)) {
|
---|
[70db8f] | 176 | observerLog().addMessage() << "++ Update of Observer "
|
---|
| 177 | << observerLog().getName(static_cast<Observer*>(this))
|
---|
[c60665] | 178 | << " received notification from rightatom " << rightatomId << " for channel "
|
---|
[70db8f] | 179 | << notification->getChannelNo() << ".";
|
---|
[7e2adc] | 180 | }
|
---|
[2ad1ec] | 181 | #endif
|
---|
[7e2adc] | 182 | if (publisher == static_cast<const Observable *>(bondowner)){
|
---|
[1f693d] | 183 | switch (notification->getChannelNo()) {
|
---|
| 184 | case BondObservable::BondRemoved:
|
---|
[c60665] | 185 | // removeMe();
|
---|
[1f693d] | 186 | break;
|
---|
[4b62d3] | 187 | case BondObservable::DegreeChanged:
|
---|
[009e2e2] | 188 | emit degreeChanged();
|
---|
[4b62d3] | 189 | break;
|
---|
| 190 | default:
|
---|
| 191 | ASSERT(0, "GLMoleculeObject_bond::recieveNotification() - unknown signal.");
|
---|
| 192 | break;
|
---|
[1f693d] | 193 | }
|
---|
[70db8f] | 194 | } else {
|
---|
[343a4b] | 195 | // from an atom
|
---|
| 196 | switch (notification->getChannelNo()) {
|
---|
[70db8f] | 197 | case AtomObservable::PositionChanged:
|
---|
| 198 | LOG(2, "INFO: Received notification of PositionChanged.");
|
---|
[009e2e2] | 199 | emit positionChanged();
|
---|
[70db8f] | 200 | break;
|
---|
| 201 | case AtomObservable::ElementChanged:
|
---|
| 202 | LOG(2, "INFO: Received notification of ElementChanged.");
|
---|
[009e2e2] | 203 | emit elementChanged();
|
---|
[70db8f] | 204 | break;
|
---|
| 205 | default:
|
---|
| 206 | break;
|
---|
| 207 | }
|
---|
[343a4b] | 208 | }
|
---|
[4b62d3] | 209 | }
|
---|
| 210 |
|
---|
[009e2e2] | 211 | Vector GLMoleculeObject_bond::updateLeftPosition() const
|
---|
[4b62d3] | 212 | {
|
---|
[009e2e2] | 213 | const atom * const _atom = getAtomConst(leftatomId);
|
---|
| 214 | return _atom->getPosition();
|
---|
[343a4b] | 215 | }
|
---|
| 216 |
|
---|
[009e2e2] | 217 | Vector GLMoleculeObject_bond::updateRightPosition() const
|
---|
| 218 | {
|
---|
| 219 | const atom * const _atom = getAtomConst(rightatomId);
|
---|
| 220 | return _atom->getPosition();
|
---|
| 221 | }
|
---|
| 222 |
|
---|
| 223 | atomicNumber_t GLMoleculeObject_bond::updateLeftElement() const
|
---|
| 224 | {
|
---|
| 225 | const atom * const _atom = getAtomConst(leftatomId);
|
---|
| 226 | return _atom->getElementNo();
|
---|
| 227 | }
|
---|
| 228 |
|
---|
| 229 | atomicNumber_t GLMoleculeObject_bond::updateRightElement() const
|
---|
| 230 | {
|
---|
| 231 | const atom * const _atom = getAtomConst(rightatomId);
|
---|
| 232 | return _atom->getElementNo();
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | int GLMoleculeObject_bond::updateDegree() const
|
---|
[343a4b] | 236 | {
|
---|
[f01769] | 237 | const atom * const _leftatom = const_cast<const World &>(World::getInstance()).
|
---|
| 238 | getAtom(AtomById(leftatomId));
|
---|
| 239 | const atom * const _rightatom = const_cast<const World &>(World::getInstance()).
|
---|
| 240 | getAtom(AtomById(rightatomId));
|
---|
[009e2e2] | 241 | if ((_leftatom != NULL) && (_rightatom != NULL)) {
|
---|
| 242 | bond::ptr _bond = _leftatom->getBond(_rightatom);
|
---|
| 243 | return _bond->getDegree();
|
---|
| 244 | } else {
|
---|
| 245 | return 1;
|
---|
[2ad1ec] | 246 | }
|
---|
[009e2e2] | 247 | }
|
---|
| 248 |
|
---|
| 249 | void GLMoleculeObject_bond::resetElement()
|
---|
| 250 | {
|
---|
[7c7c4a] | 251 | size_t elementno = getrightElement();
|
---|
[009e2e2] | 252 | QGLMaterial *elementmaterial = getMaterial(elementno);
|
---|
| 253 | setMaterial(elementmaterial);
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 | void GLMoleculeObject_bond::resetWidth()
|
---|
| 257 | {
|
---|
[7c7c4a] | 258 | const double factor = 1.0f+.5f*(getDegree()-1);
|
---|
[009e2e2] | 259 | LOG(2, "DEBUG: GLMoleculeObject_bond::resetWidth() - setting bond's width to " << factor << ".");
|
---|
| 260 | setScaleX(factor);
|
---|
| 261 | setScaleY(factor);
|
---|
| 262 |
|
---|
| 263 | emit changed();
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 | void GLMoleculeObject_bond::resetPosition()
|
---|
| 267 | {
|
---|
[7c7c4a] | 268 | Vector Position = getleftPosition();
|
---|
| 269 | Vector OtherPosition = getrightPosition();
|
---|
[fbb1f1] | 270 | const double distance =
|
---|
| 271 | Position.distance(OtherPosition)/2.;
|
---|
| 272 | setScaleZ(distance);
|
---|
[343a4b] | 273 |
|
---|
| 274 | // calculate position
|
---|
[37e910] | 275 | Vector Z(unitVec[2]); // cylinder are initially aligned along the Z axis
|
---|
[343a4b] | 276 | Vector zeroVec(0.,0.,0.);
|
---|
| 277 | Vector a,b;
|
---|
| 278 | Vector OtherAxis;
|
---|
| 279 | double alpha;
|
---|
| 280 | a = Position - OtherPosition;
|
---|
| 281 | // construct rotation axis
|
---|
| 282 | b = a;
|
---|
| 283 | b.VectorProduct(Z);
|
---|
| 284 | Line axis(zeroVec, b);
|
---|
| 285 | // calculate rotation angle
|
---|
| 286 | alpha = a.Angle(Z);
|
---|
| 287 | // construct other axis to check right-hand rule
|
---|
| 288 | OtherAxis = b;
|
---|
| 289 | OtherAxis.VectorProduct(Z);
|
---|
| 290 | // assure right-hand rule for the rotation
|
---|
| 291 | if (a.ScalarProduct(OtherAxis) < MYEPSILON)
|
---|
| 292 | alpha = M_PI-alpha;
|
---|
| 293 | // check
|
---|
| 294 | Vector a_rotated = axis.rotateVector(a, alpha);
|
---|
| 295 | LOG(3, "INFO: Created cylinder from "// << Position << " to " << OtherPosition
|
---|
| 296 | << a << " to " << a_rotated << " around " << b << " by " << alpha/M_PI*180. << ", respectively.");
|
---|
| 297 |
|
---|
[37e910] | 298 | // set position (cylinder offset is in its barymetric center)
|
---|
| 299 | Vector OneFourth(Position - 0.75 * a);
|
---|
| 300 | setPosition(QVector3D(OneFourth[0], OneFourth[1], OneFourth[2]));
|
---|
[343a4b] | 301 | setRotationVector(QVector3D(b[0], b[1], b[2]));
|
---|
| 302 | setRotationAngle(alpha/M_PI*180.);
|
---|
[009e2e2] | 303 |
|
---|
| 304 | emit changed();
|
---|
| 305 | }
|
---|
| 306 |
|
---|
| 307 | atom * const GLMoleculeObject_bond::getAtom(const atomId_t _id)
|
---|
| 308 | {
|
---|
| 309 | atom * const _atom = World::getInstance().getAtom(AtomById(_id));
|
---|
| 310 | return _atom;
|
---|
| 311 | }
|
---|
| 312 |
|
---|
| 313 | const atom * const GLMoleculeObject_bond::getAtomConst(const atomId_t _id)
|
---|
| 314 | {
|
---|
| 315 | const atom * const _atom = const_cast<const World &>(World::getInstance()).
|
---|
| 316 | getAtom(AtomById(_id));
|
---|
| 317 | return _atom;
|
---|
[2ad1ec] | 318 | }
|
---|
[7c7c4a] | 319 |
|
---|
| 320 | void GLMoleculeObject_bond::countsubjectKilled()
|
---|
| 321 | {
|
---|
| 322 | ++subjectKilledCount;
|
---|
| 323 |
|
---|
| 324 | if (subjectKilledCount > ObservedValues.size())
|
---|
| 325 | emit BondRemoved(leftatomId, rightatomId);
|
---|
| 326 | }
|
---|
| 327 |
|
---|
| 328 | void GLMoleculeObject_bond::initObservedValues()
|
---|
| 329 | {
|
---|
| 330 | // fill ObservedValues
|
---|
| 331 | boost::function<void()> subjectKilled =
|
---|
| 332 | boost::bind(&GLMoleculeObject_bond::countsubjectKilled, this);
|
---|
| 333 | ObservedValues[leftPosition] = new ObservedValue_wCallback<Vector>(
|
---|
| 334 | leftowner,
|
---|
| 335 | boost::bind(&GLMoleculeObject_bond::updateLeftPosition, this),
|
---|
| 336 | "BondleftPosition_"+toString(leftatomId),
|
---|
| 337 | updateLeftPosition(),
|
---|
| 338 | BondPositionChannels,
|
---|
| 339 | subjectKilled);
|
---|
| 340 | ObservedValues[rightPosition] = new ObservedValue_wCallback<Vector>(
|
---|
| 341 | rightowner,
|
---|
| 342 | boost::bind(&GLMoleculeObject_bond::updateRightPosition, this),
|
---|
| 343 | "BondrightPosition_"+toString(rightatomId),
|
---|
| 344 | updateRightPosition(),
|
---|
| 345 | BondPositionChannels,
|
---|
| 346 | subjectKilled);
|
---|
| 347 | ObservedValues[leftElement] = new ObservedValue_wCallback<atomicNumber_t>(
|
---|
| 348 | leftowner,
|
---|
| 349 | boost::bind(&GLMoleculeObject_bond::updateLeftElement, this),
|
---|
| 350 | "BondleftElement"+toString(leftatomId),
|
---|
| 351 | updateLeftElement(),
|
---|
| 352 | BondElementChannels,
|
---|
| 353 | subjectKilled);
|
---|
| 354 | ObservedValues[rightElement] = new ObservedValue_wCallback<atomicNumber_t>(
|
---|
| 355 | rightowner,
|
---|
| 356 | boost::bind(&GLMoleculeObject_bond::updateRightElement, this),
|
---|
| 357 | "BondrightElement"+toString(rightatomId),
|
---|
| 358 | updateRightElement(),
|
---|
| 359 | BondElementChannels,
|
---|
| 360 | subjectKilled);
|
---|
| 361 | ObservedValues[Degree] = new ObservedValue_wCallback<int>(
|
---|
| 362 | bondowner,
|
---|
| 363 | boost::bind(&GLMoleculeObject_bond::updateDegree, this),
|
---|
| 364 | "BondDegree"+toString(leftatomId)+"_"+toString(rightatomId),
|
---|
| 365 | updateDegree(),
|
---|
| 366 | BondDegreeChannels,
|
---|
| 367 | subjectKilled);
|
---|
| 368 | }
|
---|
| 369 |
|
---|
| 370 | void GLMoleculeObject_bond::destroyObservedValues()
|
---|
| 371 | {
|
---|
| 372 | delete boost::any_cast<ObservedValue_wCallback<Vector> *>(ObservedValues[leftPosition]);
|
---|
| 373 | delete boost::any_cast<ObservedValue_wCallback<Vector> *>(ObservedValues[rightPosition]);
|
---|
| 374 | delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t> *>(ObservedValues[leftElement]);
|
---|
| 375 | delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t> *>(ObservedValues[rightElement]);
|
---|
| 376 | delete boost::any_cast<ObservedValue_wCallback<int> *>(ObservedValues[Degree]);
|
---|
| 377 | ObservedValues.clear();
|
---|
| 378 | }
|
---|
| 379 |
|
---|
| 380 | Vector GLMoleculeObject_bond::getleftPosition() const
|
---|
| 381 | {
|
---|
| 382 | return boost::any_cast<ObservedValue_wCallback<Vector> *>(ObservedValues[leftPosition])->get();
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | Vector GLMoleculeObject_bond::getrightPosition() const
|
---|
| 386 | {
|
---|
| 387 | return boost::any_cast<ObservedValue_wCallback<Vector> *>(ObservedValues[rightPosition])->get();
|
---|
| 388 | }
|
---|
| 389 |
|
---|
| 390 | atomicNumber_t GLMoleculeObject_bond::getleftElement() const
|
---|
| 391 | {
|
---|
| 392 | return boost::any_cast<ObservedValue_wCallback<atomicNumber_t> *>(ObservedValues[leftElement])->get();
|
---|
| 393 | }
|
---|
| 394 |
|
---|
| 395 | atomicNumber_t GLMoleculeObject_bond::getrightElement() const
|
---|
| 396 | {
|
---|
| 397 | return boost::any_cast<ObservedValue_wCallback<atomicNumber_t> *>(ObservedValues[rightElement])->get();
|
---|
| 398 | }
|
---|
| 399 |
|
---|
| 400 | int GLMoleculeObject_bond::getDegree() const
|
---|
| 401 | {
|
---|
| 402 | return boost::any_cast<ObservedValue_wCallback<int> *>(ObservedValues[Degree])->get();
|
---|
| 403 | }
|
---|