62 class SelectionManager {
64 SelectionManager(
SimInfo* info);
69 void addSelection(
Bond* b) {
72 void addSelection(
Bend* b) {
89 ss_.bitsets_[
BOND] |= bs.bitsets_[
BOND];
92 ss_.bitsets_[
BEND] |= bs.bitsets_[
BEND];
105 return ss_.bitsets_[
STUNTDOUBLE].none() && ss_.bitsets_[
BOND].none() &&
106 ss_.bitsets_[
BEND].none() && ss_.bitsets_[
TORSION].none() &&
111 for (
int i = 0; i < N_SELECTIONTYPES; i++)
112 ss_.bitsets_[i] = bs.bitsets_[i];
119 ss_.bitsets_[
BOND] = bs.bitsets_[
BOND];
122 ss_.bitsets_[
BEND] = bs.bitsets_[
BEND];
134 std::vector<int> getSelectionCounts() {
135 std::vector<int> counts(N_SELECTIONTYPES, 0);
136 for (
int i = 0; i < N_SELECTIONTYPES; i++) {
137 counts[i] = ss_.bitsets_[i].countBits();
142 int getSelectionCount() {
return ss_.bitsets_[
STUNTDOUBLE].countBits(); }
143 int getBondSelectionCount() {
return ss_.bitsets_[
BOND].countBits(); }
144 int getBendSelectionCount() {
return ss_.bitsets_[
BEND].countBits(); }
145 int getTorsionSelectionCount() {
return ss_.bitsets_[
TORSION].countBits(); }
146 int getInversionSelectionCount() {
147 return ss_.bitsets_[
INVERSION].countBits();
149 int getMoleculeSelectionCount() {
150 return ss_.bitsets_[
MOLECULE].countBits();
171 void setSelection(
Bond* b) {
172 ss_.bitsets_[
BOND].clearAll();
175 void setSelection(
Bend* b) {
176 ss_.bitsets_[
BEND].clearAll();
179 void setSelection(
Torsion* t) {
180 ss_.bitsets_[
TORSION].clearAll();
195 void toggleSelection(
Bond* b) {
198 void toggleSelection(
Bend* b) {
201 void toggleSelection(
Torsion* t) {
211 void toggleSelection() {
212 for (
int i = 0; i < N_SELECTIONTYPES; i++)
213 ss_.bitsets_[i].flip();
217 for (
int i = 0; i < N_SELECTIONTYPES; i++)
218 ss_.bitsets_[i].setAll();
221 void clearSelection() {
222 for (
int i = 0; i < N_SELECTIONTYPES; i++)
223 ss_.bitsets_[i].clearAll();
226 SelectionManager replaceRigidBodiesWithAtoms()
const;
227 SelectionManager removeAtomsInRigidBodies()
const;
232 void clearSelection(
Bond* b) {
235 void clearSelection(
Bend* b) {
238 void clearSelection(
Torsion* t) {
248 bool isGlobalIDSelected(
int globalIndex) {
496 MoleculeStampSet getSelectedMoleculeStamps();
498 SelectionManager& operator&=(
const SelectionManager& sman) {
499 for (
int i = 0; i < N_SELECTIONTYPES; i++)
500 ss_.bitsets_[i] &= sman.ss_.bitsets_[i];
504 SelectionManager& operator|=(
const SelectionManager& sman) {
505 for (
int i = 0; i < N_SELECTIONTYPES; i++)
506 ss_.bitsets_[i] |= sman.ss_.bitsets_[i];
510 SelectionManager& operator^=(
const SelectionManager& sman) {
511 for (
int i = 0; i < N_SELECTIONTYPES; i++)
512 ss_.bitsets_[i] ^= sman.ss_.bitsets_[i];
516 SelectionManager& operator-=(
const SelectionManager& sman) {
517 for (
int i = 0; i < N_SELECTIONTYPES; i++)
518 ss_.bitsets_[i] -= sman.ss_.bitsets_[i];
522 friend SelectionManager operator|(
const SelectionManager& sman1,
523 const SelectionManager& sman2);
524 friend SelectionManager operator&(
const SelectionManager& sman1,
525 const SelectionManager& sman2);
526 friend SelectionManager operator^(
const SelectionManager& sman1,
527 const SelectionManager& sman2);
528 friend SelectionManager operator-(
const SelectionManager& sman1,
529 const SelectionManager& sman2);
534 std::vector<int> nObjects_;
535 std::vector<StuntDouble*> stuntdoubles_;
536 std::vector<Bond*> bonds_;
537 std::vector<Bend*> bends_;
538 std::vector<Torsion*> torsions_;
539 std::vector<Inversion*> inversions_;
540 std::vector<Molecule*> molecules_;