Changeset f35f7e for src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp
- Timestamp:
- Mar 14, 2016, 9:53:43 AM (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:
- 7f1c00
- Parents:
- d845bd
- git-author:
- Frederik Heber <heber@…> (03/14/16 09:51:32)
- git-committer:
- Frederik Heber <heber@…> (03/14/16 09:53:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp
rd845bd rf35f7e 143 143 } 144 144 145 atomId_t QtObservedAtom::updateIndex() 146 { 147 return const_cast<const World &>(World::getInstance()).lastChangedAtomId(); 145 #ifdef HAVE_INLINE 146 inline 147 #endif 148 atomId_t QtObservedAtom::updateIndex(const atom &_atomref) 149 { 150 return _atomref.getId(); 148 151 } 149 152 150 153 QtObservedAtom::ListOfBonds_t QtObservedAtom::updateBonds( 151 const boost::function<const atomId_t ()> &_getAtomIndex)154 const atom &_atom) 152 155 { 153 156 ListOfBonds_t ListOfBonds; 154 const atom * const _atom = getAtomConst(_getAtomIndex()); 155 if (_atom != NULL) { 156 // make sure bonds is up-to-date 157 const BondList ListBonds = _atom->getListOfBonds(); 158 for (BondList::const_iterator iter = ListBonds.begin(); 159 iter != ListBonds.end(); 160 ++iter) 161 ListOfBonds.insert( ListOfBonds.end(), std::make_pair( 162 (*iter)->leftatom->getId(), 163 (*iter)->rightatom->getId()) ); 164 } 157 // make sure bonds is up-to-date 158 const BondList ListBonds = _atom.getListOfBonds(); 159 for (BondList::const_iterator iter = ListBonds.begin(); 160 iter != ListBonds.end(); 161 ++iter) 162 ListOfBonds.insert( ListOfBonds.end(), std::make_pair( 163 (*iter)->leftatom->getId(), 164 (*iter)->rightatom->getId()) ); 165 165 return ListOfBonds; 166 166 } 167 167 168 #ifdef HAVE_INLINE 169 inline 170 #endif 168 171 atomicNumber_t QtObservedAtom::updateElement( 169 const boost::function<const atomId_t ()> &_getAtomIndex) 170 { 171 const atom * const _atom = getAtomConst(_getAtomIndex()); 172 if (_atom != NULL) { 173 return _atom->getElementNo(); 174 } else { 175 return (atomicNumber_t)-1; 176 } 177 } 178 172 const atom &_atom) 173 { 174 return _atom.getElementNo(); 175 } 176 177 #ifdef HAVE_INLINE 178 inline 179 #endif 179 180 QtObservedMolecule* QtObservedAtom::updateMoleculeIndex( 180 const boost::function<const atomId_t ()> &_getAtomIndex) 181 { 182 const atom * const _atom = getAtomConst(_getAtomIndex()); 183 if ((_atom != NULL) && (_atom->getMolecule() != NULL)) { 184 const moleculeId_t molid = _atom->getMolecule()->getId(); 181 const atom &_atom) 182 { 183 if (_atom.getMolecule() != NULL) { 184 const moleculeId_t molid = _atom.getMolecule()->getId(); 185 185 QtObservedMolecule* mol = board.getObservedMolecule(molid).get(); 186 186 if (mol != NULL) … … 193 193 } 194 194 195 #ifdef HAVE_INLINE 196 inline 197 #endif 195 198 std::string QtObservedAtom::updateName( 196 const boost::function<const atomId_t ()> &_getAtomIndex) 197 { 198 const atom * const _atom = getAtomConst(_getAtomIndex()); 199 if (_atom != NULL) { 200 return _atom->getName(); 201 } else { 202 return std::string(""); 203 } 204 } 205 199 const atom &_atom) 200 { 201 return _atom.getName(); 202 } 203 204 #ifdef HAVE_INLINE 205 inline 206 #endif 206 207 Vector QtObservedAtom::updatePosition( 207 const boost::function<const atomId_t ()> &_getAtomIndex) 208 { 209 const atom * const _atom = getAtomConst(_getAtomIndex()); 210 if (_atom != NULL) { 211 return _atom->getPosition(); 212 } else { 213 return zeroVec; 214 } 215 } 216 208 const atom &_atom) 209 { 210 return _atom.getPosition(); 211 } 212 213 #ifdef HAVE_INLINE 214 inline 215 #endif 217 216 bool QtObservedAtom::updateSelected( 218 const boost::function<const atomId_t ()> &_getAtomIndex) 219 { 220 const atom * const _atom = getAtomConst(_getAtomIndex()); 221 if (_atom != NULL) { 222 return _atom->getSelected(); 223 } else { 224 return false; 225 } 217 const atom &_atom) 218 { 219 return _atom.getSelected(); 226 220 } 227 221 … … 353 347 // fill ObservedValues: index first 354 348 const boost::function<atomId_t ()> AtomIndexUpdater( 355 boost::bind(&QtObservedAtom::updateIndex ));349 boost::bind(&QtObservedAtom::updateIndex, boost::cref(*_atomref))); 356 350 357 351 ObservedValue_wCallback<atomId_t> * const IndexObservable = 358 352 new ObservedValue_wCallback<atomId_t>( 359 353 _atomref, 360 boost::bind(&QtObservedAtom::updateIndex),354 AtomIndexUpdater, 361 355 "AtomIndex_"+toString(_id), 362 356 _id, … … 371 365 // fill ObservedValues: then all the other that need index 372 366 const boost::function<ListOfBonds_t ()> AtomBondsUpdater( 373 boost::bind(&QtObservedAtom::updateBonds, AtomIndexGetter));367 boost::bind(&QtObservedAtom::updateBonds, boost::cref(*_atomref))); 374 368 const boost::function<atomicNumber_t ()> AtomElementUpdater( 375 boost::bind(&QtObservedAtom::updateElement, AtomIndexGetter));369 boost::bind(&QtObservedAtom::updateElement, boost::cref(*_atomref))); 376 370 const boost::function<QtObservedMolecule* ()> AtomMoleculeUpdater( 377 boost::bind(&QtObservedAtom::updateMoleculeIndex, this, AtomIndexGetter));371 boost::bind(&QtObservedAtom::updateMoleculeIndex, this, boost::cref(*_atomref))); 378 372 const boost::function<std::string ()> AtomNameUpdater( 379 boost::bind(&QtObservedAtom::updateName, AtomIndexGetter));373 boost::bind(&QtObservedAtom::updateName, boost::cref(*_atomref))); 380 374 const boost::function<Vector ()> AtomPositionUpdater( 381 boost::bind(&QtObservedAtom::updatePosition, AtomIndexGetter));375 boost::bind(&QtObservedAtom::updatePosition, boost::cref(*_atomref))); 382 376 const boost::function<bool ()> AtomSelectedUpdater( 383 boost::bind(&QtObservedAtom::updateSelected, AtomIndexGetter));377 boost::bind(&QtObservedAtom::updateSelected, boost::cref(*_atomref))); 384 378 385 379 _ObservedValues[AtomBonds] = new ObservedValue_wCallback<ListOfBonds_t, atomId_t>(
Note:
See TracChangeset
for help on using the changeset viewer.