Changeset e472eab


Ignore:
Timestamp:
Jul 25, 2010, 9:41:34 PM (14 years ago)
Author:
Frederik Heber <heber@…>
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:
521bbf
Parents:
8d4aa1
Message:

Added new all/none selection actions for atoms and molecules.

Location:
src
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Makefile.am

    r8d4aa1 re472eab  
    114114
    115115SELECTIONACTIONSOURCE = \
     116        SelectionAction/AllAtomsAction.cpp \
     117        SelectionAction/AllMoleculesAction.cpp \
    116118        SelectionAction/AtomByIdAction.cpp \
    117119        SelectionAction/MoleculeByIdAction.cpp \
     120        SelectionAction/NotAllAtomsAction.cpp \
     121        SelectionAction/NotAllMoleculesAction.cpp \
    118122        SelectionAction/NotAtomByIdAction.cpp \
    119123        SelectionAction/NotMoleculeByIdAction.cpp
    120124SELECTIONACTIONHEADER = \
     125        SelectionAction/AllAtomsAction.hpp \
     126        SelectionAction/AllMoleculesAction.hpp \
    121127        SelectionAction/AtomByIdAction.hpp \
    122128        SelectionAction/MoleculeByIdAction.hpp \
     129        SelectionAction/NotAllAtomsAction.hpp \
     130        SelectionAction/NotAllMoleculesAction.hpp \
    123131        SelectionAction/NotAtomByIdAction.hpp \
    124132        SelectionAction/NotMoleculeByIdAction.hpp
  • src/Actions/MapOfActions.cpp

    r8d4aa1 re472eab  
    6464#include "Actions/ParserAction/LoadXyzAction.hpp"
    6565#include "Actions/ParserAction/SaveXyzAction.hpp"
     66#include "Actions/SelectionAction/AllAtomsAction.hpp"
     67#include "Actions/SelectionAction/AllMoleculesAction.hpp"
    6668#include "Actions/SelectionAction/AtomByIdAction.hpp"
    6769#include "Actions/SelectionAction/MoleculeByIdAction.hpp"
     70#include "Actions/SelectionAction/NotAllAtomsAction.hpp"
     71#include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
    6872#include "Actions/SelectionAction/NotAtomByIdAction.hpp"
    6973#include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
     
    236240  DescriptionMap["periodic"] = "system is constraint to periodic boundary conditions (y/n)";
    237241  DescriptionMap["position"] = "position in R^3 space";
     242  DescriptionMap["select-all-atoms"] = "select all atoms";
     243  DescriptionMap["select-all-molecules"] = "select all molecules";
    238244  DescriptionMap["select-atom-by-id"] = "select an atom by index";
    239245  DescriptionMap["select-molecule-by-id"] = "select a molecule by index";
    240246  DescriptionMap["start-step"] = "first or start step";
     247  DescriptionMap["unselect-all-atoms"] = "unselect all atoms";
     248  DescriptionMap["unselect-all-molecules"] = "unselect all molecules";
    241249  DescriptionMap["unselect-atom-by-id"] = "unselect an atom by index";
    242250  DescriptionMap["unselect-molecule-by-id"] = "unselect a molecule by index";
     
    343351  TypeMap["periodic"] = &typeid(bool);
    344352  TypeMap["position"] = &typeid(VectorValue);
     353  TypeMap["select-all-atoms"] = &typeid(void);
     354  TypeMap["select-all-molecules"] = &typeid(void);
    345355  TypeMap["select-atom-by-id"] = &typeid(atom);
    346356  TypeMap["select-molecule-by-id"] = &typeid(molecule);
    347357  TypeMap["start-step"] = &typeid(int);
     358  TypeMap["unselect-all-atoms"] = &typeid(void);
     359  TypeMap["unselect-all-molecules"] = &typeid(void);
    348360  TypeMap["unselect-atom-by-id"] = &typeid(atom);
    349361  TypeMap["unselect-molecule-by-id"] = &typeid(molecule);
     
    475487  generic.insert("save-temperature");
    476488  generic.insert("scale-box");
     489  generic.insert("select-all-atoms");
     490  generic.insert("select-all-molecules");
     491  generic.insert("select-atom-by-id");
     492  generic.insert("select-molecule-by-id");
    477493  generic.insert("set-basis");
    478494  generic.insert("set-output");
     
    480496  generic.insert("suspend-in-water");
    481497  generic.insert("translate-mol");
     498  generic.insert("unselect-all-atoms");
     499  generic.insert("unselect-all-molecules");
     500  generic.insert("unselect-atom-by-id");
     501  generic.insert("unselect-molecule-by-id");
    482502        generic.insert("verbose");
    483503  generic.insert("verlet-integrate");
     
    507527  hidden.insert("periodic");
    508528  hidden.insert("position");
    509   hidden.insert("select-atom-by-id");
    510   hidden.insert("select-molecule-by-id");
    511529  hidden.insert("start-step");
    512   hidden.insert("unselect-atom-by-id");
    513   hidden.insert("unselect-molecule-by-id");
    514530}
    515531
     
    790806  new ParserSaveXyzAction();
    791807
     808  new SelectionAllAtomsAction();
     809  new SelectionAllMoleculesAction();
    792810  new SelectionAtomByIdAction();
    793811  new SelectionMoleculeByIdAction();
     812  new SelectionNotAllAtomsAction();
     813  new SelectionNotAllMoleculesAction();
    794814  new SelectionNotAtomByIdAction();
    795815  new SelectionNotMoleculeByIdAction();
  • src/World.cpp

    r8d4aa1 re472eab  
    558558}
    559559
    560 size_t World::countSelectedAtoms() {
     560size_t World::countSelectedAtoms() const {
    561561  size_t count = 0;
    562   for (internal_AtomIterator iter = getAtomIter_internal(AllAtoms()); iter != atomEnd_internal(); ++iter)
     562  for (AtomSet::const_iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter)
    563563    count++;
    564564  return count;
    565565}
    566566
    567 bool World::isSelected(atom *atom) {
     567bool World::isSelected(atom *atom) const {
    568568  return selectedAtoms.find(atom->getId()) != selectedAtoms.end();
    569569}
     570
     571const std::vector<atom *> World::getSelectedAtoms() const {
     572  std::vector<atom *> returnAtoms;
     573  returnAtoms.resize(countSelectedAtoms());
     574  int count = 0;
     575  for (AtomSet::const_iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter)
     576    returnAtoms[count++] = iter->second;
     577  return returnAtoms;
     578}
     579
    570580
    571581// Molecules
     
    585595}
    586596
    587 void World::selectAllMoleculess(MoleculeDescriptor descr){
     597void World::selectAllMolecules(MoleculeDescriptor descr){
    588598  internal_MoleculeIterator begin = getMoleculeIter_internal(descr);
    589599  internal_MoleculeIterator end = moleculeEnd_internal();
     
    616626}
    617627
    618 void World::unselectAllMoleculess(MoleculeDescriptor descr){
     628void World::unselectAllMolecules(MoleculeDescriptor descr){
    619629  internal_MoleculeIterator begin = getMoleculeIter_internal(descr);
    620630  internal_MoleculeIterator end = moleculeEnd_internal();
     
    637647}
    638648
    639 size_t World::countSelectedMolecules() {
     649size_t World::countSelectedMolecules() const {
    640650  size_t count = 0;
    641   for (internal_MoleculeIterator iter = getMoleculeIter_internal(AllMolecules()); iter != moleculeEnd_internal(); ++iter)
     651  for (MoleculeSet::const_iterator iter = selectedMolecules.begin(); iter != selectedMolecules.end(); ++iter)
    642652    count++;
    643653  return count;
    644654}
    645655
    646 bool World::isSelected(molecule *mol) {
     656bool World::isSelected(molecule *mol) const {
    647657  return selectedMolecules.find(mol->getId()) != selectedMolecules.end();
     658}
     659
     660const std::vector<molecule *> World::getSelectedMolecules() const {
     661  std::vector<molecule *> returnMolecules;
     662  returnMolecules.resize(countSelectedMolecules());
     663  int count = 0;
     664  for (MoleculeSet::const_iterator iter = selectedMolecules.begin(); iter != selectedMolecules.end(); ++iter)
     665    returnMolecules[count++] = iter->second;
     666  return returnMolecules;
    648667}
    649668
  • src/World.hpp

    r8d4aa1 re472eab  
    264264  void unselectAtomsOfMolecule(molecule*);
    265265  void unselectAtomsOfMolecule(moleculeId_t);
    266   size_t countSelectedAtoms();
    267   bool isSelected(atom *_atom);
     266  size_t countSelectedAtoms() const;
     267  bool isSelected(atom *_atom) const;
     268  const std::vector<atom *> getSelectedAtoms() const;
    268269
    269270  void clearMoleculeSelection();
    270271  void selectMolecule(molecule*);
    271272  void selectMolecule(moleculeId_t);
    272   void selectAllMoleculess(MoleculeDescriptor);
     273  void selectAllMolecules(MoleculeDescriptor);
    273274  void selectMoleculeOfAtom(atom*);
    274275  void selectMoleculeOfAtom(atomId_t);
    275276  void unselectMolecule(molecule*);
    276277  void unselectMolecule(moleculeId_t);
    277   void unselectAllMoleculess(MoleculeDescriptor);
     278  void unselectAllMolecules(MoleculeDescriptor);
    278279  void unselectMoleculeOfAtom(atom*);
    279280  void unselectMoleculeOfAtom(atomId_t);
    280   size_t countSelectedMolecules();
    281   bool isSelected(molecule *_mol);
     281  size_t countSelectedMolecules() const;
     282  bool isSelected(molecule *_mol) const;
     283  const std::vector<molecule *> getSelectedMolecules() const;
    282284
    283285  /******************** Iterators to selections *****************/
Note: See TracChangeset for help on using the changeset viewer.