# | Line 49 | Line 49 | namespace oopse { | |
---|---|---|
49 | namespace oopse { | |
50 | ||
51 | ||
52 | < | SelectionEvaluator::SelectionEvaluator(SimInfo* si) : info(si), nameFinder(info), distanceFinder(info), isLoaded_(false){ |
52 | > | SelectionEvaluator::SelectionEvaluator(SimInfo* si) |
53 | > | : info(si), nameFinder(info), distanceFinder(info), indexFinder(info), isLoaded_(false){ |
54 | > | |
55 | nStuntDouble = info->getNGlobalAtoms() + info->getNRigidBodies(); | |
56 | } | |
57 | ||
# | Line 84 | Line 86 | void SelectionEvaluator::clearState() { | |
86 | } | |
87 | ||
88 | void SelectionEvaluator::clearState() { | |
87 | – | //for (int i = scriptLevelMax; --i >= 0; ) |
88 | – | // stack[i].clear(); |
89 | – | //scriptLevel = 0; |
89 | error = false; | |
90 | errorMessage = ""; | |
91 | } | |
# | Line 102 | Line 101 | bool SelectionEvaluator::loadScriptFileInternal(const | |
101 | } | |
102 | ||
103 | bool SelectionEvaluator::loadScriptFileInternal(const std::string & filename) { | |
104 | < | ifstream ifs(filename.c_str()); |
104 | > | std::ifstream ifs(filename.c_str()); |
105 | if (!ifs.is_open()) { | |
106 | return false; | |
107 | } | |
# | Line 228 | Line 227 | BitSet SelectionEvaluator::comparatorInstruction(const | |
227 | compareProperty(atom, bs, property, comparator, comparisonValue); | |
228 | } | |
229 | ||
231 | – | //change the positions of atoms which belong to the rigidbodies |
230 | for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { | |
231 | compareProperty(rb, bs, property, comparator, comparisonValue); | |
232 | } | |
# | Line 300 | Line 298 | void SelectionEvaluator::define() { | |
298 | ||
299 | std::string variable = boost::any_cast<std::string>(statement[1].value); | |
300 | ||
301 | < | variables.insert(std::make_pair(variable, expression(statement, 2))); |
301 | > | variables.insert(VariablesType::value_type(variable, expression(statement, 2))); |
302 | } | |
303 | ||
304 | ||
# | Line 319 | Line 317 | void SelectionEvaluator::predefine(const std::string& | |
317 | int tok = statement[1].tok; | |
318 | if (tok == Token::identifier || (tok & Token::predefinedset) == Token::predefinedset) { | |
319 | std::string variable = boost::any_cast<std::string>(statement[1].value); | |
320 | < | variables.insert(std::make_pair(variable, statement)); |
320 | > | variables.insert(VariablesType::value_type(variable, statement)); |
321 | ||
322 | } else { | |
323 | evalError("invalid variable name:" + script); | |
# | Line 386 | Line 384 | BitSet SelectionEvaluator::evaluate() { | |
384 | BitSet SelectionEvaluator::evaluate() { | |
385 | BitSet bs(nStuntDouble); | |
386 | if (isLoaded_) { | |
387 | + | pc = 0; |
388 | instructionDispatchLoop(bs); | |
389 | } | |
390 | ||
# | Line 400 | Line 399 | BitSet SelectionEvaluator::indexInstruction(const boos | |
399 | if (index < 0 || index >= bs.size()) { | |
400 | invalidIndex(index); | |
401 | } else { | |
402 | < | bs.setBitOn(index); |
402 | > | bs = indexFinder.find(index); |
403 | } | |
404 | } else if (value.type() == typeid(std::pair<int, int>)) { | |
405 | std::pair<int, int> indexRange= boost::any_cast<std::pair<int, int> >(value); | |
# | Line 408 | Line 407 | BitSet SelectionEvaluator::indexInstruction(const boos | |
407 | if (indexRange.first < 0 || indexRange.second >= bs.size()) { | |
408 | invalidIndexRange(indexRange); | |
409 | }else { | |
410 | < | bs.setRangeOn(indexRange.first, indexRange.second); |
410 | > | bs = indexFinder.find(indexRange.first, indexRange.second); |
411 | } | |
412 | } | |
413 | ||
414 | return bs; | |
415 | } | |
416 | ||
418 | – | //BitSet SelectionEvaluator::evaluate(int frameNo) { |
419 | – | // |
420 | – | //} |
421 | – | |
417 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |