--- trunk/src/selection/SelectionEvaluator.cpp 2005/02/07 19:13:18 295 +++ trunk/src/selection/SelectionEvaluator.cpp 2005/03/09 17:30:29 413 @@ -49,7 +49,9 @@ namespace oopse { namespace oopse { -SelectionEvaluator::SelectionEvaluator(SimInfo* si) : info(si), nameFinder(info), distanceFinder(info), isLoaded_(false){ +SelectionEvaluator::SelectionEvaluator(SimInfo* si) + : info(si), nameFinder(info), distanceFinder(info), indexFinder(info), isLoaded_(false){ + nStuntDouble = info->getNGlobalAtoms() + info->getNRigidBodies(); } @@ -102,7 +104,7 @@ bool SelectionEvaluator::loadScriptFileInternal(const } bool SelectionEvaluator::loadScriptFileInternal(const std::string & filename) { - ifstream ifs(filename.c_str()); + std::ifstream ifs(filename.c_str()); if (!ifs.is_open()) { return false; } @@ -300,7 +302,7 @@ void SelectionEvaluator::define() { std::string variable = boost::any_cast(statement[1].value); - variables.insert(std::make_pair(variable, expression(statement, 2))); + variables.insert(VariablesType::value_type(variable, expression(statement, 2))); } @@ -319,7 +321,7 @@ void SelectionEvaluator::predefine(const std::string& int tok = statement[1].tok; if (tok == Token::identifier || (tok & Token::predefinedset) == Token::predefinedset) { std::string variable = boost::any_cast(statement[1].value); - variables.insert(std::make_pair(variable, statement)); + variables.insert(VariablesType::value_type(variable, statement)); } else { evalError("invalid variable name:" + script); @@ -386,6 +388,7 @@ BitSet SelectionEvaluator::evaluate() { BitSet SelectionEvaluator::evaluate() { BitSet bs(nStuntDouble); if (isLoaded_) { + pc = 0; instructionDispatchLoop(bs); } @@ -400,7 +403,7 @@ BitSet SelectionEvaluator::indexInstruction(const boos if (index < 0 || index >= bs.size()) { invalidIndex(index); } else { - bs.setBitOn(index); + indexFinder.find(index); } } else if (value.type() == typeid(std::pair)) { std::pair indexRange= boost::any_cast >(value); @@ -408,15 +411,11 @@ BitSet SelectionEvaluator::indexInstruction(const boos if (indexRange.first < 0 || indexRange.second >= bs.size()) { invalidIndexRange(indexRange); }else { - bs.setRangeOn(indexRange.first, indexRange.second); + indexFinder.find(indexRange.first, indexRange.second); } } return bs; } -//BitSet SelectionEvaluator::evaluate(int frameNo) { -// -//} - }