--- trunk/src/selection/SelectionManager.hpp 2013/12/05 18:19:26 1953 +++ trunk/src/selection/SelectionManager.hpp 2015/01/09 19:06:35 2052 @@ -49,6 +49,7 @@ #include "primitives/Bend.hpp" #include "primitives/Torsion.hpp" #include "primitives/Inversion.hpp" +#include "primitives/Molecule.hpp" namespace OpenMD { @@ -57,8 +58,7 @@ namespace OpenMD { public: SelectionManager(SimInfo* info); - void addSelection(StuntDouble* sd) { - + void addSelection(StuntDouble* sd) { ss_.bitsets_[STUNTDOUBLE].setBitOn(sd->getGlobalIndex()); } void addSelection(Bond* b) { @@ -73,6 +73,9 @@ namespace OpenMD { void addSelection(Inversion* i) { ss_.bitsets_[INVERSION].setBitOn(i->getGlobalIndex()); } + void addSelection(Molecule* m) { + ss_.bitsets_[MOLECULE].setBitOn(m->getGlobalIndex()); + } void addSelectionSet(const SelectionSet& bs) { ss_.bitsets_[STUNTDOUBLE] |= bs.bitsets_[STUNTDOUBLE]; @@ -89,11 +92,14 @@ namespace OpenMD { void addInversionSelectionSet(const SelectionSet& bs) { ss_.bitsets_[INVERSION] |= bs.bitsets_[INVERSION]; } + void addMoleculeSelectionSet(const SelectionSet& bs) { + ss_.bitsets_[MOLECULE] |= bs.bitsets_[MOLECULE]; + } bool isEmpty() { return ss_.bitsets_[STUNTDOUBLE].none() && ss_.bitsets_[BOND].none() && ss_.bitsets_[BEND].none() && ss_.bitsets_[TORSION].none() - && ss_.bitsets_[INVERSION].none(); + && ss_.bitsets_[INVERSION].none() && ss_.bitsets_[MOLECULE].none(); } void setSelectionSet(const SelectionSet& bs) { @@ -116,6 +122,9 @@ namespace OpenMD { void setInversionSelectionSet(const SelectionSet& bs) { ss_.bitsets_[INVERSION] = bs.bitsets_[INVERSION]; } + void setMoleculeSelectionSet(const SelectionSet& bs) { + ss_.bitsets_[MOLECULE] = bs.bitsets_[MOLECULE]; + } std::vector getSelectionCounts() { std::vector counts(N_SELECTIONTYPES,0); @@ -140,6 +149,9 @@ namespace OpenMD { int getInversionSelectionCount() { return ss_.bitsets_[INVERSION].countBits(); } + int getMoleculeSelectionCount() { + return ss_.bitsets_[MOLECULE].countBits(); + } SelectionSet getSelectionSet() { return ss_; @@ -178,6 +190,10 @@ namespace OpenMD { ss_.bitsets_[INVERSION].clearAll(); ss_.bitsets_[INVERSION].setBitOn(i->getGlobalIndex()); } + void setSelection(Molecule* m) { + ss_.bitsets_[MOLECULE].clearAll(); + ss_.bitsets_[MOLECULE].setBitOn(m->getGlobalIndex()); + } void toggleSelection(StuntDouble* sd) { ss_.bitsets_[STUNTDOUBLE].flip(sd->getGlobalIndex()); @@ -194,6 +210,9 @@ namespace OpenMD { void toggleSelection(Inversion* i) { ss_.bitsets_[INVERSION].flip(i->getGlobalIndex()); } + void toggleSelection(Molecule* m) { + ss_.bitsets_[MOLECULE].flip(m->getGlobalIndex()); + } void toggleSelection() { for (int i = 0; i < N_SELECTIONTYPES; i++) @@ -225,6 +244,9 @@ namespace OpenMD { void clearSelection(Inversion* i) { ss_.bitsets_[INVERSION].setBitOff(i->getGlobalIndex()); } + void clearSelection(Molecule* m) { + ss_.bitsets_[MOLECULE].setBitOff(m->getGlobalIndex()); + } bool isSelected(StuntDouble* sd) { return ss_.bitsets_[STUNTDOUBLE][sd->getGlobalIndex()]; @@ -241,6 +263,9 @@ namespace OpenMD { bool isSelected(Inversion* i) { return ss_.bitsets_[INVERSION][i->getGlobalIndex()]; } + bool isSelected(Molecule* m) { + return ss_.bitsets_[MOLECULE][m->getGlobalIndex()]; + } StuntDouble* beginSelected(int& i); StuntDouble* nextSelected(int& i); @@ -267,6 +292,11 @@ namespace OpenMD { Inversion* beginUnselectedInversion(int& i); Inversion* nextUnSelectedInversion(int& i); + Molecule* beginSelectedMolecule(int& i); + Molecule* nextSelectedMolecule(int& i); + Molecule* beginUnselectedMolecule(int& i); + Molecule* nextUnSelectedMolecule(int& i); + SelectionManager& operator&= (const SelectionManager &sman) { for (int i = 0; i < N_SELECTIONTYPES; i++) ss_.bitsets_[i] &= sman.ss_.bitsets_[i]; @@ -305,6 +335,7 @@ namespace OpenMD { std::vector bends_; std::vector torsions_; std::vector inversions_; + std::vector molecules_; }; }