source: src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp@ 8ac6d0e

Candidate_v1.6.1 ChemicalSpaceEvaluator Gui_displays_atomic_force_velocity PythonUI_with_named_parameters TremoloParser_IncreasedPrecision
Last change on this file since 8ac6d0e was 897a01, checked in by Frederik Heber <frederik.heber@…>, 7 years ago

Arrows display velocity and force of each atom.

  • Property mode set to 100644
File size: 18.0 KB
RevLine 
[0070aa]1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2015 Frederik Heber. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * QtObservedAtom.cpp
25 *
26 * Created on: Oct 28, 2015
27 * Author: heber
28 */
29
30
31// include config.h
32#ifdef HAVE_CONFIG_H
33#include <config.h>
34#endif
35
36#include "QtObservedAtom.hpp"
37
[65c323]38#include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp"
39
[9eb71b3]40//#include "CodePatterns/MemDebug.hpp"
[0070aa]41
[65c323]42#include <boost/assign.hpp>
43
44#include "Atom/atom.hpp"
45#include "Bond/bond.hpp"
46#include "Descriptors/AtomIdDescriptor.hpp"
47#include "Element/element.hpp"
48#include "World.hpp"
[4dfe724]49#include "WorldTime.hpp"
[65c323]50
[494478]51#include "UIElements/Qt4/InstanceBoard/ObservedValue_wCallback.hpp"
[65c323]52
53using namespace boost::assign;
54
55static const Observable::channels_t getAtomBondsChannels()
56{
57 Observable::channels_t channels;
58 channels += AtomObservable::BondsAdded, AtomObservable::BondsRemoved;
59 return channels;
60}
61
62static const Observable::channels_t getAllObservedChannels()
63{
64 Observable::channels_t channels;
65 channels +=
66 AtomObservable::IndexChanged,
67 AtomObservable::BondsAdded,
[fe493f]68 AtomObservable::BondsRemoved,
69 AtomObservable::MoleculeChanged,
70 AtomObservable::NameChanged,
71 AtomObservable::ElementChanged,
[9e9100]72 AtomObservable::PositionChanged,
73 AtomObservable::SelectionChanged;
[65c323]74 return channels;
75}
76
77// static entities
78const Observable::channels_t
79QtObservedAtom::AtomIndexChannels(1, AtomObservable::IndexChanged);
80const Observable::channels_t
[fe493f]81QtObservedAtom::AtomBondsChannels(getAtomBondsChannels());
[65c323]82const Observable::channels_t
83QtObservedAtom::AtomElementChannels(1, AtomObservable::ElementChanged);
84const Observable::channels_t
[273c8a]85QtObservedAtom::MoleculeChangedChannels(1, AtomObservable::MoleculeChanged);
[fe493f]86const Observable::channels_t
87QtObservedAtom::AtomNameChannels(1, AtomObservable::NameChanged);
88const Observable::channels_t
89QtObservedAtom::AtomPositionChannels(1, AtomObservable::PositionChanged);
[9e9100]90const Observable::channels_t
[897a01]91QtObservedAtom::AtomVelocityChannels(1, AtomObservable::VelocityChanged);
92const Observable::channels_t
93QtObservedAtom::AtomForceChannels(1, AtomObservable::ForceChanged);
94const Observable::channels_t
[9e9100]95QtObservedAtom::AtomSelectedChannels(1, AtomObservable::SelectionChanged);
[65c323]96
[98c35c]97QtObservedAtom::QtObservedAtom(
[62a0ee]98 const atomId_t _id,
99 const atom * const _atom,
[65c323]100 QtObservedInstanceBoard &_board,
[98c35c]101 QWidget * _parent) :
[0070aa]102 QWidget(_parent),
[98c35c]103 Observer("QtObservedAtom"),
[65c323]104 subjectKilledCount(0),
105 AllsignedOnChannels(getAllObservedChannels().size()),
106 signedOffChannels(0),
107 owner(NULL),
[08a7ecc]108 index(static_cast<const ObservedValue_Index_t>(const_cast<const QtObservedAtom * const>(this))),
[65c323]109 board(_board),
[04c3a3]110 BoardIsGone(false),
[62a0ee]111 ObservedValues(QtObservedAtom::MAX_ObservedTypes)
[65c323]112{
[d48a16]113 boost::function<void ()> atomSubjectKilled(
[62a0ee]114 boost::bind(&QtObservedAtom::countValuesSubjectKilled,
115 boost::ref(*this),
[ee3fb8]116 boost::bind(&QtObservedAtom::getIndex, boost::ref(*this))));
[62a0ee]117 initObservedValues( ObservedValues, _id, _atom, atomSubjectKilled);
118
119 // activating Observer is done by ObservedValueContainer when it's inserted
[65c323]120}
[0070aa]121
122QtObservedAtom::~QtObservedAtom()
[65c323]123{
[ee3fb8]124 boost::any_cast<ObservedValue_wCallback<atomId_t, ObservedValue_Index_t> *>(ObservedValues[AtomIndex])->noteCallBackIsGone();
125 boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, ObservedValue_Index_t> *>(ObservedValues[AtomBonds])->noteCallBackIsGone();
126 boost::any_cast<ObservedValue_wCallback<atomicNumber_t, ObservedValue_Index_t> *>(ObservedValues[AtomElement])->noteCallBackIsGone();
[273c8a]127 boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>(ObservedValues[MoleculeRef])->noteCallBackIsGone();
[ee3fb8]128 boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[AtomName])->noteCallBackIsGone();
129 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomPosition])->noteCallBackIsGone();
[897a01]130 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomVelocity])->noteCallBackIsGone();
131 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomForce])->noteCallBackIsGone();
[ee3fb8]132 boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(ObservedValues[AtomSelected])->noteCallBackIsGone();
[04c3a3]133
[65c323]134 deactivateObserver();
[c44763]135
136 destroyObservedValues(ObservedValues);
[65c323]137}
138
139const atom * const QtObservedAtom::getAtomConst(const atomId_t _id)
140{
141 const atom * const _atom = const_cast<const World &>(World::getInstance()).
142 getAtom(AtomById(_id));
143 return _atom;
144}
145
146atom * const QtObservedAtom::getAtom(const atomId_t _id)
147{
148 atom * const _atom = World::getInstance().getAtom(AtomById(_id));
149 return _atom;
150}
151
[f35f7e]152#ifdef HAVE_INLINE
153inline
154#endif
155atomId_t QtObservedAtom::updateIndex(const atom &_atomref)
[65c323]156{
[f35f7e]157 return _atomref.getId();
[65c323]158}
159
[fe493f]160QtObservedAtom::ListOfBonds_t QtObservedAtom::updateBonds(
[f35f7e]161 const atom &_atom)
[65c323]162{
[fe493f]163 ListOfBonds_t ListOfBonds;
[f35f7e]164 // make sure bonds is up-to-date
165 const BondList ListBonds = _atom.getListOfBonds();
166 for (BondList::const_iterator iter = ListBonds.begin();
167 iter != ListBonds.end();
168 ++iter)
169 ListOfBonds.insert( ListOfBonds.end(), std::make_pair(
170 (*iter)->leftatom->getId(),
171 (*iter)->rightatom->getId()) );
[fe493f]172 return ListOfBonds;
[65c323]173}
174
[f35f7e]175#ifdef HAVE_INLINE
176inline
177#endif
[65c323]178atomicNumber_t QtObservedAtom::updateElement(
[f35f7e]179 const atom &_atom)
[65c323]180{
[f35f7e]181 return _atom.getElementNo();
[65c323]182}
183
[f35f7e]184#ifdef HAVE_INLINE
185inline
186#endif
[273c8a]187QtObservedMolecule* QtObservedAtom::updateMoleculeRef(
[f35f7e]188 const atom &_atom)
[fe493f]189{
[f35f7e]190 if (_atom.getMolecule() != NULL) {
191 const moleculeId_t molid = _atom.getMolecule()->getId();
[273c8a]192 const QtObservedMolecule::ptr mol = board.getObservedMolecule(molid);
193 ASSERT(mol,
194 "QtObservedAtom::updateMoleculeRef() - could not update the ref, "
195 +toString(molid)+" unknown to Instance board?");
196 return mol.get();
[fe493f]197 } else {
[273c8a]198 return (QtObservedMolecule*)NULL;
[fe493f]199 }
200}
201
[f35f7e]202#ifdef HAVE_INLINE
203inline
204#endif
[fe493f]205std::string QtObservedAtom::updateName(
[f35f7e]206 const atom &_atom)
[65c323]207{
[f35f7e]208 return _atom.getName();
[fe493f]209}
210
[f35f7e]211#ifdef HAVE_INLINE
212inline
213#endif
[fe493f]214Vector QtObservedAtom::updatePosition(
[f35f7e]215 const atom &_atom)
[fe493f]216{
[f35f7e]217 return _atom.getPosition();
[65c323]218}
[98c35c]219
[897a01]220#ifdef HAVE_INLINE
221inline
222#endif
223Vector QtObservedAtom::updateVelocity(
224 const atom &_atom)
225{
226 return _atom.getAtomicVelocity();
227}
228
229#ifdef HAVE_INLINE
230inline
231#endif
232Vector QtObservedAtom::updateForce(
233 const atom &_atom)
234{
235 return _atom.getAtomicForce();
236}
237
[f35f7e]238#ifdef HAVE_INLINE
239inline
240#endif
[9e9100]241bool QtObservedAtom::updateSelected(
[f35f7e]242 const atom &_atom)
[9e9100]243{
[f35f7e]244 return _atom.getSelected();
[9e9100]245}
246
[98c35c]247void QtObservedAtom::update(Observable *publisher)
[65c323]248{
249 ASSERT(0, "QtObservedAtom::update() - we are not signed on for global updates.");
250}
[98c35c]251
252void QtObservedAtom::subjectKilled(Observable *publisher)
[65c323]253{
254 ++signedOffChannels;
255
[ee3fb8]256 checkForRemoval(getIndex());
[62a0ee]257}
258
[ee3fb8]259void QtObservedAtom::countValuesSubjectKilled(ObservedValue_Index_t _id)
[62a0ee]260{
[ee3fb8]261 ASSERT( _id == getIndex(),
262 "QtObservedAtom::countValuesSubjectKilled() - atom "+toString(getIndex())
[62a0ee]263 +" received countValuesSubjectKilled for atom id "+toString(_id)+".");
264
265 ++subjectKilledCount;
266
[ee3fb8]267 checkForRemoval(_id);
[62a0ee]268}
269
270#ifdef HAVE_INLINE
271inline
272#endif
[ee3fb8]273void QtObservedAtom::checkForRemoval(ObservedValue_Index_t _id)
[62a0ee]274{
275 if ((signedOffChannels == AllsignedOnChannels) && (subjectKilledCount == MAX_ObservedTypes)) {
[65c323]276 // remove owner: no more signOff needed
277 owner = NULL;
278
[fe493f]279 emit atomRemoved();
[4e6ffe]280
281 if (!BoardIsGone) {
[ee3fb8]282 board.markObservedAtomAsDisconnected(_id);
283 board.markObservedAtomForErase(_id);
[4e6ffe]284 }
[65c323]285 }
286}
[98c35c]287
288void QtObservedAtom::recieveNotification(Observable *publisher, Notification_ptr notification)
[65c323]289{
290 // ObservedValues have been updated before, hence convert updates to Qt's signals
[4dfe724]291 if (publisher == WorldTime::getPointer()) {
292 // force update of all changes that may occur from one time step to another
293 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(
294 ObservedValues[AtomPosition])->forceUpdate();
[897a01]295 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(
296 ObservedValues[AtomVelocity])->forceUpdate();
297 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(
298 ObservedValues[AtomForce])->forceUpdate();
[4dfe724]299 boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>(
300 ObservedValues[MoleculeRef])->forceUpdate();
301 // then tell Qt part about updates
302 emit positionChanged();
[897a01]303 emit velocityChanged();
304 emit forceChanged();
[4dfe724]305 emit moleculeChanged();
306 } else {
307 switch (notification->getChannelNo()) {
308 case AtomObservable::IndexChanged:
309 {
310 emit indexChanged();
311 break;
312 }
313 case AtomObservable::BondsAdded:
314 case AtomObservable::BondsRemoved:
315 emit bondsChanged();
316 break;
317 case AtomObservable::ElementChanged:
318 emit elementChanged();
319 break;
320 case AtomObservable::MoleculeChanged:
321 emit moleculeChanged();
322 break;
323 case AtomObservable::NameChanged:
324 emit nameChanged();
325 break;
326 case AtomObservable::PositionChanged:
327 emit positionChanged();
328 break;
[897a01]329 case AtomObservable::VelocityChanged:
330 emit velocityChanged();
331 break;
332 case AtomObservable::ForceChanged:
333 emit forceChanged();
334 break;
[4dfe724]335 case AtomObservable::SelectionChanged:
336 emit selectedChanged();
337 break;
338 default:
339 ASSERT(0, "QtObservedAtom::recieveNotification() - we are not signed on to channel "
340 +toString(notification->getChannelNo())+" of the atom.");
341 break;
[1c0961]342 }
[65c323]343 }
344}
345
346void QtObservedAtom::activateObserver()
347{
348 atom * atomref = getAtom(getAtomIndex());
349 if (atomref != NULL) {
350 Observable::channels_t channels = getAllObservedChannels();
351 owner = static_cast<const Observable *>(atomref);
352 for (Observable::channels_t::const_iterator iter = channels.begin();
353 iter != channels.end(); ++iter)
354 owner->signOn(this, *iter);
[04c3a3]355 if (!BoardIsGone)
[59eabc]356 board.markObservedAtomAsConnected(getIndex());
[65c323]357 } else
[04c3a3]358 signedOffChannels = AllsignedOnChannels;
[4dfe724]359
360 WorldTime::getInstance().signOn(this, WorldTime::TimeChanged);
[65c323]361}
362
363void QtObservedAtom::deactivateObserver()
364{
365 // sign Off
366 if (owner != NULL) {
367 Observable::channels_t channels = getAllObservedChannels();
368 for (Observable::channels_t::const_iterator iter = channels.begin();
369 iter != channels.end(); ++iter)
370 owner->signOff(this, *iter);
371 owner = NULL;
372 signedOffChannels = AllsignedOnChannels;
[04c3a3]373 if (!BoardIsGone)
[59eabc]374 board.markObservedAtomAsDisconnected(getIndex());
[65c323]375 }
[4dfe724]376
377 WorldTime::getInstance().signOff(this, WorldTime::TimeChanged);
[65c323]378}
379
380void QtObservedAtom::initObservedValues(
381 ObservedValues_t &_ObservedValues,
382 const atomId_t _id,
383 const atom * const _atomref,
[d48a16]384 const boost::function<void()> &_subjectKilled)
[65c323]385{
386 ASSERT( _ObservedValues.size() == MAX_ObservedTypes,
387 "QtObservedAtom::initObservedValues() - given ObservedValues has not correct size.");
388
389 // fill ObservedValues: then all the other that need index
[ee3fb8]390 const boost::function<atomId_t ()> AtomIndexUpdater(
391 boost::bind(&QtObservedAtom::updateIndex, boost::cref(*_atomref)));
[65c323]392 const boost::function<ListOfBonds_t ()> AtomBondsUpdater(
[f35f7e]393 boost::bind(&QtObservedAtom::updateBonds, boost::cref(*_atomref)));
[fe493f]394 const boost::function<atomicNumber_t ()> AtomElementUpdater(
[f35f7e]395 boost::bind(&QtObservedAtom::updateElement, boost::cref(*_atomref)));
[fe493f]396 const boost::function<std::string ()> AtomNameUpdater(
[f35f7e]397 boost::bind(&QtObservedAtom::updateName, boost::cref(*_atomref)));
[fe493f]398 const boost::function<Vector ()> AtomPositionUpdater(
[f35f7e]399 boost::bind(&QtObservedAtom::updatePosition, boost::cref(*_atomref)));
[897a01]400 const boost::function<Vector ()> AtomVelocityUpdater(
401 boost::bind(&QtObservedAtom::updateVelocity, boost::cref(*_atomref)));
402 const boost::function<Vector ()> AtomForceUpdater(
403 boost::bind(&QtObservedAtom::updateForce, boost::cref(*_atomref)));
[9e9100]404 const boost::function<bool ()> AtomSelectedUpdater(
[f35f7e]405 boost::bind(&QtObservedAtom::updateSelected, boost::cref(*_atomref)));
[273c8a]406 const boost::function<QtObservedMolecule* ()> MoleculeRefUpdater(
407 boost::bind(&QtObservedAtom::updateMoleculeRef, this, boost::cref(*_atomref)));
[65c323]408
[ee3fb8]409 _ObservedValues[AtomIndex] = new ObservedValue_wCallback<atomId_t, ObservedValue_Index_t>(
410 _atomref,
411 AtomIndexUpdater,
412 "AtomIndex_"+toString(_id),
413 _id,
414 AtomIndexChannels,
[d48a16]415 _subjectKilled);
[ee3fb8]416 _ObservedValues[AtomBonds] = new ObservedValue_wCallback<ListOfBonds_t, ObservedValue_Index_t>(
[65c323]417 _atomref,
[fe493f]418 AtomBondsUpdater,
419 "AtomBonds_"+toString(_id),
420 AtomBondsUpdater(),
421 AtomBondsChannels,
[d48a16]422 _subjectKilled);
[ee3fb8]423 _ObservedValues[AtomElement] = new ObservedValue_wCallback<atomicNumber_t, ObservedValue_Index_t>(
[65c323]424 _atomref,
425 AtomElementUpdater,
426 "AtomElement"+toString(_id),
427 AtomElementUpdater(),
428 AtomElementChannels,
[d48a16]429 _subjectKilled);
[ee3fb8]430 _ObservedValues[AtomName] = new ObservedValue_wCallback<std::string, ObservedValue_Index_t>(
[fe493f]431 _atomref,
432 AtomNameUpdater,
433 "AtomName"+toString(_id),
434 AtomNameUpdater(),
435 AtomNameChannels,
[d48a16]436 _subjectKilled);
[ee3fb8]437 _ObservedValues[AtomPosition] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>(
[fe493f]438 _atomref,
439 AtomPositionUpdater,
440 "AtomPosition_"+toString(_id),
441 AtomPositionUpdater(),
442 AtomPositionChannels,
[d48a16]443 _subjectKilled);
[897a01]444 _ObservedValues[AtomVelocity] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>(
445 _atomref,
446 AtomVelocityUpdater,
447 "AtomVelocity_"+toString(_id),
448 AtomVelocityUpdater(),
449 AtomVelocityChannels,
450 _subjectKilled);
451 _ObservedValues[AtomForce] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>(
452 _atomref,
453 AtomForceUpdater,
454 "AtomForce_"+toString(_id),
455 AtomForceUpdater(),
456 AtomForceChannels,
457 _subjectKilled);
[ee3fb8]458 _ObservedValues[AtomSelected] = new ObservedValue_wCallback<bool, ObservedValue_Index_t>(
[9e9100]459 _atomref,
460 AtomSelectedUpdater,
461 "AtomSelected_"+toString(_id),
462 AtomSelectedUpdater(),
463 AtomSelectedChannels,
[d48a16]464 _subjectKilled);
[273c8a]465 _ObservedValues[MoleculeRef] = new ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t>(
466 _atomref,
467 MoleculeRefUpdater,
468 "AtomMoleculeIndex"+toString(_id),
469 MoleculeRefUpdater(),
470 MoleculeChangedChannels,
471 _subjectKilled);
[65c323]472}
473
474void QtObservedAtom::destroyObservedValues(
475 std::vector<boost::any> &_ObservedValues)
476{
[ee3fb8]477 delete boost::any_cast<ObservedValue_wCallback<atomId_t, ObservedValue_Index_t> *>(_ObservedValues[AtomIndex]);
478 delete boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, ObservedValue_Index_t> *>(_ObservedValues[AtomBonds]);
479 delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t, ObservedValue_Index_t> *>(_ObservedValues[AtomElement]);
480 delete boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(_ObservedValues[AtomName]);
481 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomPosition]);
[897a01]482 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomVelocity]);
483 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomForce]);
[ee3fb8]484 delete boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(_ObservedValues[AtomSelected]);
[273c8a]485 delete boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>(_ObservedValues[MoleculeRef]);
[65c323]486 _ObservedValues.clear();
487}
488
[59eabc]489ObservedValue_Index_t QtObservedAtom::getIndex() const
490{
[498c678]491 ASSERT( index != NULL,
[59eabc]492 "QtObservedAtom::getIndex() - index is NULL");
[498c678]493 return index;
[59eabc]494}
495
[3b9aa1]496const atomId_t& QtObservedAtom::getAtomIndex() const
[65c323]497{
[ee3fb8]498 return boost::any_cast<ObservedValue_wCallback<atomId_t, ObservedValue_Index_t> *>(ObservedValues[AtomIndex])->get();
[65c323]499}
500
[3b9aa1]501const QtObservedAtom::ListOfBonds_t& QtObservedAtom::getAtomBonds() const
[65c323]502{
[ee3fb8]503 return boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, ObservedValue_Index_t> *>(ObservedValues[AtomBonds])->get();
[65c323]504}
505
[3b9aa1]506const atomicNumber_t& QtObservedAtom::getAtomElement() const
[65c323]507{
[ee3fb8]508 return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, ObservedValue_Index_t> *>(ObservedValues[AtomElement])->get();
[65c323]509}
510
[3b9aa1]511const std::string& QtObservedAtom::getAtomName() const
[fe493f]512{
[ee3fb8]513 return boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[AtomName])->get();
[fe493f]514}
515
[3b9aa1]516const Vector& QtObservedAtom::getAtomPosition() const
[fe493f]517{
[ee3fb8]518 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomPosition])->get();
[65c323]519}
[9e9100]520
[897a01]521const Vector& QtObservedAtom::getAtomVelocity() const
522{
523 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomVelocity])->get();
524}
525
526const Vector& QtObservedAtom::getAtomForce() const
527{
528 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomForce])->get();
529}
530
[9e9100]531const bool QtObservedAtom::getAtomSelected() const
532{
[ee3fb8]533 return boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(ObservedValues[AtomSelected])->get();
[9e9100]534}
[273c8a]535
536const QtObservedMolecule* const QtObservedAtom::getMoleculeRef() const
537{
538 return boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>(ObservedValues[MoleculeRef])->get();
539}
Note: See TracBrowser for help on using the repository browser.