| 58 |
|
: info(si), nameFinder(info), distanceFinder(info), hullFinder(info), |
| 59 |
|
indexFinder(info), hasSurfaceArea_(false), |
| 60 |
|
isLoaded_(false){ |
| 61 |
< |
nStuntDouble = info->getNGlobalAtoms() + info->getNGlobalRigidBodies(); |
| 62 |
< |
} |
| 63 |
< |
|
| 61 |
> |
nObjects.push_back(info->getNGlobalAtoms() + info->getNGlobalRigidBodies()); |
| 62 |
> |
nObjects.push_back(info->getNGlobalBonds()); |
| 63 |
> |
nObjects.push_back(info->getNGlobalBends()); |
| 64 |
> |
nObjects.push_back(info->getNGlobalTorsions()); |
| 65 |
> |
nObjects.push_back(info->getNGlobalInversions()); |
| 66 |
> |
nObjects.push_back(info->getNGlobalMolecules()); |
| 67 |
> |
} |
| 68 |
> |
|
| 69 |
|
bool SelectionEvaluator::loadScript(const std::string& filename, |
| 70 |
|
const std::string& script) { |
| 71 |
|
clearDefinitionsAndLoadPredefined(); |
| 132 |
|
return loadScript(filename, script); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
< |
void SelectionEvaluator::instructionDispatchLoop(OpenMDBitSet& bs){ |
| 135 |
> |
void SelectionEvaluator::instructionDispatchLoop(SelectionSet& bs){ |
| 136 |
|
|
| 137 |
|
while ( pc < aatoken.size()) { |
| 138 |
|
statement = aatoken[pc++]; |
| 153 |
|
|
| 154 |
|
} |
| 155 |
|
|
| 156 |
< |
void SelectionEvaluator::instructionDispatchLoop(OpenMDBitSet& bs, int frame){ |
| 156 |
> |
void SelectionEvaluator::instructionDispatchLoop(SelectionSet& bs, int frame){ |
| 157 |
|
|
| 158 |
|
while ( pc < aatoken.size()) { |
| 159 |
|
statement = aatoken[pc++]; |
| 174 |
|
|
| 175 |
|
} |
| 176 |
|
|
| 177 |
< |
OpenMDBitSet SelectionEvaluator::expression(const std::vector<Token>& code, |
| 177 |
> |
SelectionSet SelectionEvaluator::expression(const std::vector<Token>& code, |
| 178 |
|
int pcStart) { |
| 179 |
< |
OpenMDBitSet bs; |
| 180 |
< |
std::stack<OpenMDBitSet> stack; |
| 179 |
> |
SelectionSet bs = createSelectionSets(); |
| 180 |
> |
std::stack<SelectionSet> stack; |
| 181 |
> |
vector<int> bsSize = bs.size(); |
| 182 |
|
|
| 183 |
|
for (unsigned int pc = pcStart; pc < code.size(); ++pc) { |
| 184 |
|
Token instruction = code[pc]; |
| 190 |
|
break; |
| 191 |
|
case Token::all: |
| 192 |
|
bs = allInstruction(); |
| 193 |
< |
stack.push(bs); |
| 193 |
> |
stack.push(bs); |
| 194 |
|
break; |
| 195 |
|
case Token::none: |
| 196 |
< |
bs = OpenMDBitSet(nStuntDouble); |
| 197 |
< |
stack.push(bs); |
| 196 |
> |
bs = createSelectionSets(); |
| 197 |
> |
stack.push(bs); |
| 198 |
|
break; |
| 199 |
|
case Token::opOr: |
| 200 |
< |
bs = stack.top(); |
| 201 |
< |
stack.pop(); |
| 202 |
< |
stack.top() |= bs; |
| 200 |
> |
bs= stack.top(); |
| 201 |
> |
stack.pop(); |
| 202 |
> |
stack.top() |= bs; |
| 203 |
|
break; |
| 204 |
|
case Token::opAnd: |
| 205 |
< |
bs = stack.top(); |
| 206 |
< |
stack.pop(); |
| 207 |
< |
stack.top() &= bs; |
| 205 |
> |
bs = stack.top(); |
| 206 |
> |
stack.pop(); |
| 207 |
> |
stack.top() &= bs; |
| 208 |
|
break; |
| 209 |
|
case Token::opNot: |
| 210 |
< |
stack.top().flip(); |
| 210 |
> |
stack.top().flip(); |
| 211 |
|
break; |
| 212 |
|
case Token::within: |
| 213 |
|
withinInstruction(instruction, stack.top()); |
| 214 |
|
break; |
| 215 |
|
case Token::hull: |
| 216 |
< |
stack.push(hull()); |
| 216 |
> |
stack.push(hull()); |
| 217 |
|
break; |
| 218 |
|
//case Token::selected: |
| 219 |
|
// stack.push(getSelectionSet()); |
| 220 |
|
// break; |
| 221 |
|
case Token::name: |
| 222 |
< |
stack.push(nameInstruction(boost::any_cast<std::string>(instruction.value))); |
| 222 |
> |
stack.push(nameInstruction(boost::any_cast<std::string>(instruction.value))); |
| 223 |
|
break; |
| 224 |
|
case Token::index: |
| 225 |
< |
stack.push(indexInstruction(instruction.value)); |
| 225 |
> |
stack.push(indexInstruction(instruction.value)); |
| 226 |
|
break; |
| 227 |
|
case Token::identifier: |
| 228 |
< |
stack.push(lookupValue(boost::any_cast<std::string>(instruction.value))); |
| 228 |
> |
stack.push(lookupValue(boost::any_cast<std::string>(instruction.value))); |
| 229 |
|
break; |
| 230 |
|
case Token::opLT: |
| 231 |
|
case Token::opLE: |
| 246 |
|
} |
| 247 |
|
|
| 248 |
|
|
| 249 |
< |
OpenMDBitSet SelectionEvaluator::expression(const std::vector<Token>& code, |
| 249 |
> |
SelectionSet SelectionEvaluator::expression(const std::vector<Token>& code, |
| 250 |
|
int pcStart, int frame) { |
| 251 |
< |
OpenMDBitSet bs; |
| 252 |
< |
std::stack<OpenMDBitSet> stack; |
| 251 |
> |
SelectionSet bs = createSelectionSets(); |
| 252 |
> |
std::stack<SelectionSet> stack; |
| 253 |
|
|
| 254 |
|
for (unsigned int pc = pcStart; pc < code.size(); ++pc) { |
| 255 |
|
Token instruction = code[pc]; |
| 264 |
|
stack.push(bs); |
| 265 |
|
break; |
| 266 |
|
case Token::none: |
| 267 |
< |
bs = OpenMDBitSet(nStuntDouble); |
| 267 |
> |
bs = SelectionSet(nObjects); |
| 268 |
|
stack.push(bs); |
| 269 |
|
break; |
| 270 |
|
case Token::opOr: |
| 318 |
|
|
| 319 |
|
|
| 320 |
|
|
| 321 |
< |
OpenMDBitSet SelectionEvaluator::comparatorInstruction(const Token& instruction) { |
| 321 |
> |
SelectionSet SelectionEvaluator::comparatorInstruction(const Token& instruction) { |
| 322 |
|
int comparator = instruction.tok; |
| 323 |
|
int property = instruction.intValue; |
| 324 |
|
float comparisonValue = boost::any_cast<float>(instruction.value); |
| 325 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 325 |
> |
SelectionSet bs = createSelectionSets(); |
| 326 |
|
bs.clearAll(); |
| 327 |
|
|
| 328 |
|
SimInfo::MoleculeIterator mi; |
| 335 |
|
for (mol = info->beginMolecule(mi); mol != NULL; |
| 336 |
|
mol = info->nextMolecule(mi)) { |
| 337 |
|
|
| 338 |
+ |
compareProperty(mol, bs, property, comparator, comparisonValue); |
| 339 |
+ |
|
| 340 |
|
for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { |
| 341 |
|
compareProperty(atom, bs, property, comparator, comparisonValue); |
| 342 |
|
} |
| 350 |
|
return bs; |
| 351 |
|
} |
| 352 |
|
|
| 353 |
< |
OpenMDBitSet SelectionEvaluator::comparatorInstruction(const Token& instruction, int frame) { |
| 353 |
> |
SelectionSet SelectionEvaluator::comparatorInstruction(const Token& instruction, int frame) { |
| 354 |
|
int comparator = instruction.tok; |
| 355 |
|
int property = instruction.intValue; |
| 356 |
|
float comparisonValue = boost::any_cast<float>(instruction.value); |
| 357 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 357 |
> |
SelectionSet bs = createSelectionSets(); |
| 358 |
|
bs.clearAll(); |
| 359 |
|
|
| 360 |
|
SimInfo::MoleculeIterator mi; |
| 367 |
|
for (mol = info->beginMolecule(mi); mol != NULL; |
| 368 |
|
mol = info->nextMolecule(mi)) { |
| 369 |
|
|
| 370 |
+ |
compareProperty(mol, bs, property, comparator, comparisonValue, frame); |
| 371 |
+ |
|
| 372 |
|
for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { |
| 373 |
|
compareProperty(atom, bs, property, comparator, comparisonValue, frame); |
| 374 |
|
} |
| 382 |
|
return bs; |
| 383 |
|
} |
| 384 |
|
|
| 385 |
< |
void SelectionEvaluator::compareProperty(StuntDouble* sd, OpenMDBitSet& bs, |
| 385 |
> |
void SelectionEvaluator::compareProperty(StuntDouble* sd, SelectionSet& bs, |
| 386 |
|
int property, int comparator, |
| 387 |
|
float comparisonValue) { |
| 388 |
|
RealType propertyValue = 0.0; |
| 389 |
|
Vector3d pos; |
| 390 |
+ |
|
| 391 |
|
switch (property) { |
| 392 |
|
case Token::mass: |
| 393 |
|
propertyValue = sd->getMass(); |
| 457 |
|
match = propertyValue != comparisonValue; |
| 458 |
|
break; |
| 459 |
|
} |
| 460 |
+ |
|
| 461 |
|
if (match) |
| 462 |
< |
bs.setBitOn(sd->getGlobalIndex()); |
| 462 |
> |
bs.bitsets_[STUNTDOUBLE].setBitOn(sd->getGlobalIndex()); |
| 463 |
|
|
| 464 |
|
|
| 465 |
|
} |
| 466 |
|
|
| 467 |
< |
void SelectionEvaluator::compareProperty(StuntDouble* sd, OpenMDBitSet& bs, |
| 467 |
> |
void SelectionEvaluator::compareProperty(Molecule* mol, SelectionSet& bs, |
| 468 |
> |
int property, int comparator, |
| 469 |
> |
float comparisonValue) { |
| 470 |
> |
RealType propertyValue = 0.0; |
| 471 |
> |
Vector3d pos; |
| 472 |
> |
|
| 473 |
> |
switch (property) { |
| 474 |
> |
case Token::mass: |
| 475 |
> |
propertyValue = mol->getMass(); |
| 476 |
> |
break; |
| 477 |
> |
case Token::charge: |
| 478 |
> |
{ |
| 479 |
> |
Molecule::AtomIterator ai; |
| 480 |
> |
Atom* atom; |
| 481 |
> |
for (atom = mol->beginAtom(ai); atom != NULL; |
| 482 |
> |
atom = mol->nextAtom(ai)) { |
| 483 |
> |
propertyValue+= getCharge(atom); |
| 484 |
> |
} |
| 485 |
> |
} |
| 486 |
> |
break; |
| 487 |
> |
case Token::x: |
| 488 |
> |
propertyValue = mol->getCom().x(); |
| 489 |
> |
break; |
| 490 |
> |
case Token::y: |
| 491 |
> |
propertyValue = mol->getCom().y(); |
| 492 |
> |
break; |
| 493 |
> |
case Token::z: |
| 494 |
> |
propertyValue = mol->getCom().z(); |
| 495 |
> |
break; |
| 496 |
> |
case Token::wrappedX: |
| 497 |
> |
pos = mol->getCom(); |
| 498 |
> |
info->getSnapshotManager()->getCurrentSnapshot()->wrapVector(pos); |
| 499 |
> |
propertyValue = pos.x(); |
| 500 |
> |
break; |
| 501 |
> |
case Token::wrappedY: |
| 502 |
> |
pos = mol->getCom(); |
| 503 |
> |
info->getSnapshotManager()->getCurrentSnapshot()->wrapVector(pos); |
| 504 |
> |
propertyValue = pos.y(); |
| 505 |
> |
break; |
| 506 |
> |
case Token::wrappedZ: |
| 507 |
> |
pos = mol->getCom(); |
| 508 |
> |
info->getSnapshotManager()->getCurrentSnapshot()->wrapVector(pos); |
| 509 |
> |
propertyValue = pos.z(); |
| 510 |
> |
break; |
| 511 |
> |
case Token::r: |
| 512 |
> |
propertyValue = mol->getCom().length(); |
| 513 |
> |
break; |
| 514 |
> |
default: |
| 515 |
> |
unrecognizedMoleculeProperty(property); |
| 516 |
> |
} |
| 517 |
> |
|
| 518 |
> |
bool match = false; |
| 519 |
> |
switch (comparator) { |
| 520 |
> |
case Token::opLT: |
| 521 |
> |
match = propertyValue < comparisonValue; |
| 522 |
> |
break; |
| 523 |
> |
case Token::opLE: |
| 524 |
> |
match = propertyValue <= comparisonValue; |
| 525 |
> |
break; |
| 526 |
> |
case Token::opGE: |
| 527 |
> |
match = propertyValue >= comparisonValue; |
| 528 |
> |
break; |
| 529 |
> |
case Token::opGT: |
| 530 |
> |
match = propertyValue > comparisonValue; |
| 531 |
> |
break; |
| 532 |
> |
case Token::opEQ: |
| 533 |
> |
match = propertyValue == comparisonValue; |
| 534 |
> |
break; |
| 535 |
> |
case Token::opNE: |
| 536 |
> |
match = propertyValue != comparisonValue; |
| 537 |
> |
break; |
| 538 |
> |
} |
| 539 |
> |
|
| 540 |
> |
if (match) |
| 541 |
> |
bs.bitsets_[MOLECULE].setBitOn(mol->getGlobalIndex()); |
| 542 |
> |
} |
| 543 |
> |
|
| 544 |
> |
void SelectionEvaluator::compareProperty(Molecule* mol, SelectionSet& bs, |
| 545 |
|
int property, int comparator, |
| 546 |
|
float comparisonValue, int frame) { |
| 547 |
|
RealType propertyValue = 0.0; |
| 548 |
|
Vector3d pos; |
| 549 |
|
switch (property) { |
| 550 |
|
case Token::mass: |
| 551 |
+ |
propertyValue = mol->getMass(); |
| 552 |
+ |
break; |
| 553 |
+ |
case Token::charge: |
| 554 |
+ |
{ |
| 555 |
+ |
Molecule::AtomIterator ai; |
| 556 |
+ |
Atom* atom; |
| 557 |
+ |
for (atom = mol->beginAtom(ai); atom != NULL; |
| 558 |
+ |
atom = mol->nextAtom(ai)) { |
| 559 |
+ |
propertyValue+= getCharge(atom,frame); |
| 560 |
+ |
} |
| 561 |
+ |
} |
| 562 |
+ |
break; |
| 563 |
+ |
case Token::x: |
| 564 |
+ |
propertyValue = mol->getCom(frame).x(); |
| 565 |
+ |
break; |
| 566 |
+ |
case Token::y: |
| 567 |
+ |
propertyValue = mol->getCom(frame).y(); |
| 568 |
+ |
break; |
| 569 |
+ |
case Token::z: |
| 570 |
+ |
propertyValue = mol->getCom(frame).z(); |
| 571 |
+ |
break; |
| 572 |
+ |
case Token::wrappedX: |
| 573 |
+ |
pos = mol->getCom(frame); |
| 574 |
+ |
info->getSnapshotManager()->getSnapshot(frame)->wrapVector(pos); |
| 575 |
+ |
propertyValue = pos.x(); |
| 576 |
+ |
break; |
| 577 |
+ |
case Token::wrappedY: |
| 578 |
+ |
pos = mol->getCom(frame); |
| 579 |
+ |
info->getSnapshotManager()->getSnapshot(frame)->wrapVector(pos); |
| 580 |
+ |
propertyValue = pos.y(); |
| 581 |
+ |
break; |
| 582 |
+ |
case Token::wrappedZ: |
| 583 |
+ |
pos = mol->getCom(frame); |
| 584 |
+ |
info->getSnapshotManager()->getSnapshot(frame)->wrapVector(pos); |
| 585 |
+ |
propertyValue = pos.z(); |
| 586 |
+ |
break; |
| 587 |
+ |
|
| 588 |
+ |
case Token::r: |
| 589 |
+ |
propertyValue = mol->getCom(frame).length(); |
| 590 |
+ |
break; |
| 591 |
+ |
default: |
| 592 |
+ |
unrecognizedMoleculeProperty(property); |
| 593 |
+ |
} |
| 594 |
+ |
|
| 595 |
+ |
bool match = false; |
| 596 |
+ |
switch (comparator) { |
| 597 |
+ |
case Token::opLT: |
| 598 |
+ |
match = propertyValue < comparisonValue; |
| 599 |
+ |
break; |
| 600 |
+ |
case Token::opLE: |
| 601 |
+ |
match = propertyValue <= comparisonValue; |
| 602 |
+ |
break; |
| 603 |
+ |
case Token::opGE: |
| 604 |
+ |
match = propertyValue >= comparisonValue; |
| 605 |
+ |
break; |
| 606 |
+ |
case Token::opGT: |
| 607 |
+ |
match = propertyValue > comparisonValue; |
| 608 |
+ |
break; |
| 609 |
+ |
case Token::opEQ: |
| 610 |
+ |
match = propertyValue == comparisonValue; |
| 611 |
+ |
break; |
| 612 |
+ |
case Token::opNE: |
| 613 |
+ |
match = propertyValue != comparisonValue; |
| 614 |
+ |
break; |
| 615 |
+ |
} |
| 616 |
+ |
if (match) |
| 617 |
+ |
bs.bitsets_[MOLECULE].setBitOn(mol->getGlobalIndex()); |
| 618 |
+ |
|
| 619 |
+ |
|
| 620 |
+ |
} |
| 621 |
+ |
void SelectionEvaluator::compareProperty(StuntDouble* sd, SelectionSet& bs, |
| 622 |
+ |
int property, int comparator, |
| 623 |
+ |
float comparisonValue, int frame) { |
| 624 |
+ |
RealType propertyValue = 0.0; |
| 625 |
+ |
Vector3d pos; |
| 626 |
+ |
switch (property) { |
| 627 |
+ |
case Token::mass: |
| 628 |
|
propertyValue = sd->getMass(); |
| 629 |
|
break; |
| 630 |
|
case Token::charge: |
| 694 |
|
break; |
| 695 |
|
} |
| 696 |
|
if (match) |
| 697 |
< |
bs.setBitOn(sd->getGlobalIndex()); |
| 697 |
> |
bs.bitsets_[STUNTDOUBLE].setBitOn(sd->getGlobalIndex()); |
| 698 |
|
|
| 699 |
|
|
| 700 |
|
} |
| 701 |
|
|
| 702 |
+ |
|
| 703 |
|
void SelectionEvaluator::withinInstruction(const Token& instruction, |
| 704 |
< |
OpenMDBitSet& bs){ |
| 704 |
> |
SelectionSet& bs){ |
| 705 |
|
|
| 706 |
|
boost::any withinSpec = instruction.value; |
| 707 |
|
float distance; |
| 718 |
|
} |
| 719 |
|
|
| 720 |
|
void SelectionEvaluator::withinInstruction(const Token& instruction, |
| 721 |
< |
OpenMDBitSet& bs, int frame){ |
| 721 |
> |
SelectionSet& bs, int frame){ |
| 722 |
|
|
| 723 |
|
boost::any withinSpec = instruction.value; |
| 724 |
|
float distance; |
| 775 |
|
} |
| 776 |
|
} |
| 777 |
|
|
| 778 |
< |
void SelectionEvaluator::select(OpenMDBitSet& bs){ |
| 778 |
> |
void SelectionEvaluator::select(SelectionSet& bs){ |
| 779 |
|
bs = expression(statement, 1); |
| 780 |
|
} |
| 781 |
|
|
| 782 |
< |
void SelectionEvaluator::select(OpenMDBitSet& bs, int frame){ |
| 782 |
> |
void SelectionEvaluator::select(SelectionSet& bs, int frame){ |
| 783 |
|
bs = expression(statement, 1, frame); |
| 784 |
|
} |
| 785 |
|
|
| 786 |
< |
OpenMDBitSet SelectionEvaluator::lookupValue(const std::string& variable){ |
| 786 |
> |
SelectionSet SelectionEvaluator::lookupValue(const std::string& variable){ |
| 787 |
|
|
| 788 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 788 |
> |
SelectionSet bs = createSelectionSets(); |
| 789 |
|
std::map<std::string, boost::any>::iterator i = variables.find(variable); |
| 790 |
|
|
| 791 |
|
if (i != variables.end()) { |
| 792 |
< |
if (i->second.type() == typeid(OpenMDBitSet)) { |
| 793 |
< |
return boost::any_cast<OpenMDBitSet>(i->second); |
| 792 |
> |
if (i->second.type() == typeid(SelectionSet)) { |
| 793 |
> |
return boost::any_cast<SelectionSet>(i->second); |
| 794 |
|
} else if (i->second.type() == typeid(std::vector<Token>)){ |
| 795 |
|
bs = expression(boost::any_cast<std::vector<Token> >(i->second), 2); |
| 796 |
|
i->second = bs; /**@todo fixme */ |
| 803 |
|
return bs; |
| 804 |
|
} |
| 805 |
|
|
| 806 |
< |
OpenMDBitSet SelectionEvaluator::nameInstruction(const std::string& name){ |
| 806 |
> |
SelectionSet SelectionEvaluator::nameInstruction(const std::string& name){ |
| 807 |
|
return nameFinder.match(name); |
| 808 |
|
} |
| 809 |
|
|
| 824 |
|
//predefine(); |
| 825 |
|
} |
| 826 |
|
|
| 827 |
< |
OpenMDBitSet SelectionEvaluator::evaluate() { |
| 828 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 827 |
> |
SelectionSet SelectionEvaluator::createSelectionSets() { |
| 828 |
> |
SelectionSet ss(nObjects); |
| 829 |
> |
return ss; |
| 830 |
> |
} |
| 831 |
> |
|
| 832 |
> |
SelectionSet SelectionEvaluator::evaluate() { |
| 833 |
> |
SelectionSet bs = createSelectionSets(); |
| 834 |
|
if (isLoaded_) { |
| 835 |
|
pc = 0; |
| 836 |
|
instructionDispatchLoop(bs); |
| 838 |
|
return bs; |
| 839 |
|
} |
| 840 |
|
|
| 841 |
< |
OpenMDBitSet SelectionEvaluator::evaluate(int frame) { |
| 842 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 841 |
> |
SelectionSet SelectionEvaluator::evaluate(int frame) { |
| 842 |
> |
SelectionSet bs = createSelectionSets(); |
| 843 |
|
if (isLoaded_) { |
| 844 |
|
pc = 0; |
| 845 |
|
instructionDispatchLoop(bs, frame); |
| 847 |
|
return bs; |
| 848 |
|
} |
| 849 |
|
|
| 850 |
< |
OpenMDBitSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
| 851 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 850 |
> |
SelectionSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
| 851 |
> |
SelectionSet bs = createSelectionSets(); |
| 852 |
|
|
| 853 |
|
if (value.type() == typeid(int)) { |
| 854 |
|
int index = boost::any_cast<int>(value); |
| 855 |
< |
if (index < 0 || index >= bs.size()) { |
| 855 |
> |
if (index < 0 || index >= bs.bitsets_[STUNTDOUBLE].size()) { |
| 856 |
|
invalidIndex(index); |
| 857 |
|
} else { |
| 858 |
|
bs = indexFinder.find(index); |
| 860 |
|
} else if (value.type() == typeid(std::pair<int, int>)) { |
| 861 |
|
std::pair<int, int> indexRange= boost::any_cast<std::pair<int, int> >(value); |
| 862 |
|
assert(indexRange.first <= indexRange.second); |
| 863 |
< |
if (indexRange.first < 0 || indexRange.second >= bs.size()) { |
| 863 |
> |
if (indexRange.first < 0 || |
| 864 |
> |
indexRange.second >= bs.bitsets_[STUNTDOUBLE].size()) { |
| 865 |
|
invalidIndexRange(indexRange); |
| 866 |
|
}else { |
| 867 |
|
bs = indexFinder.find(indexRange.first, indexRange.second); |
| 871 |
|
return bs; |
| 872 |
|
} |
| 873 |
|
|
| 874 |
< |
OpenMDBitSet SelectionEvaluator::allInstruction() { |
| 875 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 874 |
> |
SelectionSet SelectionEvaluator::allInstruction() { |
| 875 |
> |
SelectionSet ss = createSelectionSets(); |
| 876 |
|
|
| 877 |
|
SimInfo::MoleculeIterator mi; |
| 705 |
– |
Molecule* mol; |
| 878 |
|
Molecule::AtomIterator ai; |
| 707 |
– |
Atom* atom; |
| 879 |
|
Molecule::RigidBodyIterator rbIter; |
| 880 |
+ |
Molecule::BondIterator bondIter; |
| 881 |
+ |
Molecule::BendIterator bendIter; |
| 882 |
+ |
Molecule::TorsionIterator torsionIter; |
| 883 |
+ |
Molecule::InversionIterator inversionIter; |
| 884 |
+ |
|
| 885 |
+ |
Molecule* mol; |
| 886 |
+ |
Atom* atom; |
| 887 |
|
RigidBody* rb; |
| 888 |
+ |
Bond* bond; |
| 889 |
+ |
Bend* bend; |
| 890 |
+ |
Torsion* torsion; |
| 891 |
+ |
Inversion* inversion; |
| 892 |
|
|
| 893 |
|
// Doing the loop insures that we're actually on this processor. |
| 894 |
|
|
| 895 |
|
for (mol = info->beginMolecule(mi); mol != NULL; |
| 896 |
|
mol = info->nextMolecule(mi)) { |
| 715 |
– |
|
| 897 |
|
for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { |
| 898 |
< |
bs.setBitOn(atom->getGlobalIndex()); |
| 899 |
< |
} |
| 719 |
< |
|
| 898 |
> |
ss.bitsets_[STUNTDOUBLE].setBitOn(atom->getGlobalIndex()); |
| 899 |
> |
} |
| 900 |
|
for (rb = mol->beginRigidBody(rbIter); rb != NULL; |
| 901 |
|
rb = mol->nextRigidBody(rbIter)) { |
| 902 |
< |
bs.setBitOn(rb->getGlobalIndex()); |
| 902 |
> |
ss.bitsets_[STUNTDOUBLE].setBitOn(rb->getGlobalIndex()); |
| 903 |
|
} |
| 904 |
+ |
for (bond = mol->beginBond(bondIter); bond != NULL; |
| 905 |
+ |
bond = mol->nextBond(bondIter)) { |
| 906 |
+ |
ss.bitsets_[BOND].setBitOn(bond->getGlobalIndex()); |
| 907 |
+ |
} |
| 908 |
+ |
for (bend = mol->beginBend(bendIter); bend != NULL; |
| 909 |
+ |
bend = mol->nextBend(bendIter)) { |
| 910 |
+ |
ss.bitsets_[BEND].setBitOn(bend->getGlobalIndex()); |
| 911 |
+ |
} |
| 912 |
+ |
for (torsion = mol->beginTorsion(torsionIter); torsion != NULL; |
| 913 |
+ |
torsion = mol->nextTorsion(torsionIter)) { |
| 914 |
+ |
ss.bitsets_[TORSION].setBitOn(torsion->getGlobalIndex()); |
| 915 |
+ |
} |
| 916 |
+ |
for (inversion = mol->beginInversion(inversionIter); inversion != NULL; |
| 917 |
+ |
inversion = mol->nextInversion(inversionIter)) { |
| 918 |
+ |
ss.bitsets_[INVERSION].setBitOn(inversion->getGlobalIndex()); |
| 919 |
+ |
} |
| 920 |
+ |
ss.bitsets_[MOLECULE].setBitOn(mol->getGlobalIndex()); |
| 921 |
|
} |
| 922 |
|
|
| 923 |
< |
return bs; |
| 923 |
> |
return ss; |
| 924 |
|
} |
| 925 |
|
|
| 926 |
< |
OpenMDBitSet SelectionEvaluator::hull() { |
| 927 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 926 |
> |
SelectionSet SelectionEvaluator::hull() { |
| 927 |
> |
SelectionSet bs = createSelectionSets(); |
| 928 |
|
|
| 929 |
|
bs = hullFinder.findHull(); |
| 930 |
|
surfaceArea_ = hullFinder.getSurfaceArea(); |
| 933 |
|
} |
| 934 |
|
|
| 935 |
|
|
| 936 |
< |
OpenMDBitSet SelectionEvaluator::hull(int frame) { |
| 937 |
< |
OpenMDBitSet bs(nStuntDouble); |
| 936 |
> |
SelectionSet SelectionEvaluator::hull(int frame) { |
| 937 |
> |
SelectionSet bs = createSelectionSets(); |
| 938 |
|
|
| 939 |
|
bs = hullFinder.findHull(frame); |
| 940 |
|
|