| 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 |
|
|
| 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) { |
| 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]; |
| 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) { |
| 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); |
| 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_; |
| 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()); |
| 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++) |
| 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()]; |
| 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); |
| 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]; |
| 335 |
|
std::vector<Bend*> bends_; |
| 336 |
|
std::vector<Torsion*> torsions_; |
| 337 |
|
std::vector<Inversion*> inversions_; |
| 338 |
+ |
std::vector<Molecule*> molecules_; |
| 339 |
|
}; |
| 340 |
|
|
| 341 |
|
} |