Changeset 61d655e


Ignore:
Timestamp:
Jul 16, 2010, 10:34:12 AM (14 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
3839e5
Parents:
90c4280
Message:

Added methods for unselecting molecules and atoms

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/World.cpp

    r90c4280 r61d655e  
    525525}
    526526
     527void World::unselectAtom(atom *atom){
     528  ASSERT(atom,"Invalid pointer in unselection of atom");
     529  unselectAtom(atom->getId());
     530}
     531
     532void World::unselectAtom(atomId_t id){
     533  ASSERT(atoms.count(id),"Atom Id unselected that was not in the world");
     534  selectedAtoms.erase(id);
     535}
     536
     537void World::unselectAllAtoms(AtomDescriptor descr){
     538  internal_AtomIterator begin = getAtomIter_internal(descr);
     539  internal_AtomIterator end = atomEnd_internal();
     540  void (World::*func)(atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
     541  for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above
     542}
     543
     544void World::unselectAtomsOfMolecule(molecule *_mol){
     545  ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule");
     546  // need to make it const to get the fast iterators
     547  const molecule *mol = _mol;
     548  void (World::*func)(atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
     549  for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is unsselect... see above
     550}
     551
     552void World::unselectAtomsOfMolecule(moleculeId_t id){
     553  ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule");
     554  unselectAtomsOfMolecule(molecules[id]);
     555}
     556
    527557// Molecules
    528558
     
    560590  ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\
    561591  selectMoleculeOfAtom(atoms[id]);
     592}
     593
     594void World::unselectMolecule(molecule *mol){
     595  ASSERT(mol,"invalid pointer in unselection of molecule");
     596  unselectMolecule(mol->getId());
     597}
     598
     599void World::unselectMolecule(moleculeId_t id){
     600  ASSERT(molecules.count(id),"No such molecule with ID in unselection");
     601  selectedMolecules.erase(id);
     602}
     603
     604void World::unselectAllMoleculess(MoleculeDescriptor descr){
     605  internal_MoleculeIterator begin = getMoleculeIter_internal(descr);
     606  internal_MoleculeIterator end = moleculeEnd_internal();
     607  void (World::*func)(molecule*) = &World::unselectMolecule; // needed for type resolution of overloaded function
     608  for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above
     609}
     610
     611void World::unselectMoleculeOfAtom(atom *atom){
     612  ASSERT(atom,"Invalid atom pointer in selection of MoleculeOfAtom");
     613  molecule *mol=atom->getMolecule();
     614  // the atom might not be part of a molecule
     615  if(mol){
     616    unselectMolecule(mol);
     617  }
     618}
     619
     620void World::unselectMoleculeOfAtom(atomId_t id){
     621  ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\
     622  unselectMoleculeOfAtom(atoms[id]);
    562623}
    563624
  • src/World.hpp

    r90c4280 r61d655e  
    256256  void selectAtomsOfMolecule(molecule*);
    257257  void selectAtomsOfMolecule(moleculeId_t);
     258  void unselectAtom(atom*);
     259  void unselectAtom(atomId_t);
     260  void unselectAllAtoms(AtomDescriptor);
     261  void unselectAtomsOfMolecule(molecule*);
     262  void unselectAtomsOfMolecule(moleculeId_t);
    258263
    259264  void clearMoleculeSelection();
     
    263268  void selectMoleculeOfAtom(atom*);
    264269  void selectMoleculeOfAtom(atomId_t);
     270  void unselectMolecule(molecule*);
     271  void unselectMolecule(moleculeId_t);
     272  void unselectAllMoleculess(MoleculeDescriptor);
     273  void unselectMoleculeOfAtom(atom*);
     274  void unselectMoleculeOfAtom(atomId_t);
    265275
    266276protected:
Note: See TracChangeset for help on using the changeset viewer.