ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/selection/SelectionManager.hpp
(Generate patch)

Comparing trunk/src/selection/SelectionManager.hpp (file contents):
Revision 2051 by gezelter, Thu Dec 5 18:19:26 2013 UTC vs.
Revision 2052 by gezelter, Fri Jan 9 19:06:35 2015 UTC

# Line 49 | Line 49
49   #include "primitives/Bend.hpp"
50   #include "primitives/Torsion.hpp"
51   #include "primitives/Inversion.hpp"
52 + #include "primitives/Molecule.hpp"
53  
54   namespace OpenMD {
55  
# Line 57 | Line 58 | namespace OpenMD {
58    public:
59      SelectionManager(SimInfo* info);
60  
61 <    void addSelection(StuntDouble* sd) {
61 <      
61 >    void addSelection(StuntDouble* sd) {      
62        ss_.bitsets_[STUNTDOUBLE].setBitOn(sd->getGlobalIndex());
63      }
64      void addSelection(Bond* b) {
# Line 73 | Line 73 | namespace OpenMD {
73      void addSelection(Inversion* i) {
74        ss_.bitsets_[INVERSION].setBitOn(i->getGlobalIndex());
75      }
76 +    void addSelection(Molecule* m) {
77 +      ss_.bitsets_[MOLECULE].setBitOn(m->getGlobalIndex());
78 +    }
79          
80      void addSelectionSet(const SelectionSet& bs) {
81        ss_.bitsets_[STUNTDOUBLE] |= bs.bitsets_[STUNTDOUBLE];
# Line 89 | Line 92 | namespace OpenMD {
92      void addInversionSelectionSet(const SelectionSet& bs) {
93        ss_.bitsets_[INVERSION] |= bs.bitsets_[INVERSION];
94      }
95 +    void addMoleculeSelectionSet(const SelectionSet& bs) {
96 +      ss_.bitsets_[MOLECULE] |= bs.bitsets_[MOLECULE];
97 +    }
98  
99      bool isEmpty() {
100        return ss_.bitsets_[STUNTDOUBLE].none() && ss_.bitsets_[BOND].none()
101          && ss_.bitsets_[BEND].none()  && ss_.bitsets_[TORSION].none()
102 <        && ss_.bitsets_[INVERSION].none();
102 >        && ss_.bitsets_[INVERSION].none() && ss_.bitsets_[MOLECULE].none();
103      }
104  
105      void setSelectionSet(const SelectionSet& bs) {
# Line 116 | Line 122 | namespace OpenMD {
122      void setInversionSelectionSet(const SelectionSet& bs) {
123        ss_.bitsets_[INVERSION] = bs.bitsets_[INVERSION];          
124      }
125 +    void setMoleculeSelectionSet(const SelectionSet& bs) {
126 +      ss_.bitsets_[MOLECULE] = bs.bitsets_[MOLECULE];          
127 +    }
128  
129      std::vector<int> getSelectionCounts() {
130        std::vector<int> counts(N_SELECTIONTYPES,0);
# Line 140 | Line 149 | namespace OpenMD {
149      int getInversionSelectionCount() {
150        return ss_.bitsets_[INVERSION].countBits();
151      }
152 +    int getMoleculeSelectionCount() {
153 +      return ss_.bitsets_[MOLECULE].countBits();
154 +    }
155      
156      SelectionSet getSelectionSet() {
157        return ss_;
# Line 178 | Line 190 | namespace OpenMD {
190        ss_.bitsets_[INVERSION].clearAll();
191        ss_.bitsets_[INVERSION].setBitOn(i->getGlobalIndex());
192      }
193 +    void setSelection(Molecule* m) {
194 +      ss_.bitsets_[MOLECULE].clearAll();
195 +      ss_.bitsets_[MOLECULE].setBitOn(m->getGlobalIndex());
196 +    }
197  
198      void toggleSelection(StuntDouble* sd) {
199        ss_.bitsets_[STUNTDOUBLE].flip(sd->getGlobalIndex());
# Line 194 | Line 210 | namespace OpenMD {
210      void toggleSelection(Inversion* i) {
211        ss_.bitsets_[INVERSION].flip(i->getGlobalIndex());
212      }
213 +    void toggleSelection(Molecule* m) {
214 +      ss_.bitsets_[MOLECULE].flip(m->getGlobalIndex());
215 +    }
216  
217      void toggleSelection() {
218        for (int i = 0; i < N_SELECTIONTYPES; i++)
# Line 225 | Line 244 | namespace OpenMD {
244      void clearSelection(Inversion* i) {
245        ss_.bitsets_[INVERSION].setBitOff(i->getGlobalIndex());
246      }
247 +    void clearSelection(Molecule* m) {
248 +      ss_.bitsets_[MOLECULE].setBitOff(m->getGlobalIndex());
249 +    }
250  
251      bool isSelected(StuntDouble* sd) {
252        return ss_.bitsets_[STUNTDOUBLE][sd->getGlobalIndex()];
# Line 241 | Line 263 | namespace OpenMD {
263      bool isSelected(Inversion* i) {
264        return ss_.bitsets_[INVERSION][i->getGlobalIndex()];
265      }
266 +    bool isSelected(Molecule* m) {
267 +      return ss_.bitsets_[MOLECULE][m->getGlobalIndex()];
268 +    }
269  
270      StuntDouble* beginSelected(int& i);
271      StuntDouble* nextSelected(int& i);
# Line 267 | Line 292 | namespace OpenMD {
292      Inversion* beginUnselectedInversion(int& i);
293      Inversion* nextUnSelectedInversion(int& i);
294  
295 +    Molecule* beginSelectedMolecule(int& i);
296 +    Molecule* nextSelectedMolecule(int& i);
297 +    Molecule* beginUnselectedMolecule(int& i);
298 +    Molecule* nextUnSelectedMolecule(int& i);
299 +
300      SelectionManager& operator&= (const SelectionManager &sman) {
301        for (int i = 0; i < N_SELECTIONTYPES; i++)
302          ss_.bitsets_[i] &= sman.ss_.bitsets_[i];
# Line 305 | Line 335 | namespace OpenMD {
335      std::vector<Bend*> bends_;
336      std::vector<Torsion*> torsions_;
337      std::vector<Inversion*> inversions_;
338 +    std::vector<Molecule*> molecules_;
339    };
340  
341   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines