| 115 |
|
return loadScript(filename, script); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
< |
void SelectionEvaluator::instructionDispatchLoop(BitSet& bs){ |
| 118 |
> |
void SelectionEvaluator::instructionDispatchLoop(OOPSEBitSet& bs){ |
| 119 |
|
|
| 120 |
|
while ( pc < aatoken.size()) { |
| 121 |
|
statement = aatoken[pc++]; |
| 136 |
|
|
| 137 |
|
} |
| 138 |
|
|
| 139 |
< |
BitSet SelectionEvaluator::expression(const std::vector<Token>& code, int pcStart) { |
| 140 |
< |
BitSet bs; |
| 141 |
< |
std::stack<BitSet> stack; |
| 139 |
> |
OOPSEBitSet SelectionEvaluator::expression(const std::vector<Token>& code, int pcStart) { |
| 140 |
> |
OOPSEBitSet bs; |
| 141 |
> |
std::stack<OOPSEBitSet> stack; |
| 142 |
|
|
| 143 |
|
for (int pc = pcStart; pc < code.size(); ++pc) { |
| 144 |
|
Token instruction = code[pc]; |
| 149 |
|
case Token::expressionEnd: |
| 150 |
|
break; |
| 151 |
|
case Token::all: |
| 152 |
< |
bs = BitSet(nStuntDouble); |
| 152 |
> |
bs = OOPSEBitSet(nStuntDouble); |
| 153 |
|
bs.setAll(); |
| 154 |
|
stack.push(bs); |
| 155 |
|
break; |
| 156 |
|
case Token::none: |
| 157 |
< |
bs = BitSet(nStuntDouble); |
| 157 |
> |
bs = OOPSEBitSet(nStuntDouble); |
| 158 |
|
stack.push(bs); |
| 159 |
|
break; |
| 160 |
|
case Token::opOr: |
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
< |
BitSet SelectionEvaluator::comparatorInstruction(const Token& instruction) { |
| 209 |
> |
OOPSEBitSet SelectionEvaluator::comparatorInstruction(const Token& instruction) { |
| 210 |
|
int comparator = instruction.tok; |
| 211 |
|
int property = instruction.intValue; |
| 212 |
|
float comparisonValue = boost::any_cast<float>(instruction.value); |
| 213 |
|
float propertyValue; |
| 214 |
< |
BitSet bs(nStuntDouble); |
| 214 |
> |
OOPSEBitSet bs(nStuntDouble); |
| 215 |
|
bs.clearAll(); |
| 216 |
|
|
| 217 |
|
SimInfo::MoleculeIterator mi; |
| 235 |
|
return bs; |
| 236 |
|
} |
| 237 |
|
|
| 238 |
< |
void SelectionEvaluator::compareProperty(StuntDouble* sd, BitSet& bs, int property, int comparator, float comparisonValue) { |
| 239 |
< |
double propertyValue = 0.0; |
| 238 |
> |
void SelectionEvaluator::compareProperty(StuntDouble* sd, OOPSEBitSet& bs, int property, int comparator, float comparisonValue) { |
| 239 |
> |
RealType propertyValue = 0.0; |
| 240 |
|
switch (property) { |
| 241 |
|
case Token::mass: |
| 242 |
|
propertyValue = sd->getMass(); |
| 284 |
|
|
| 285 |
|
} |
| 286 |
|
|
| 287 |
< |
void SelectionEvaluator::withinInstruction(const Token& instruction, BitSet& bs){ |
| 287 |
> |
void SelectionEvaluator::withinInstruction(const Token& instruction, OOPSEBitSet& bs){ |
| 288 |
|
|
| 289 |
|
boost::any withinSpec = instruction.value; |
| 290 |
|
float distance; |
| 341 |
|
|
| 342 |
|
} |
| 343 |
|
|
| 344 |
< |
void SelectionEvaluator::select(BitSet& bs){ |
| 344 |
> |
void SelectionEvaluator::select(OOPSEBitSet& bs){ |
| 345 |
|
bs = expression(statement, 1); |
| 346 |
|
} |
| 347 |
|
|
| 348 |
< |
BitSet SelectionEvaluator::lookupValue(const std::string& variable){ |
| 348 |
> |
OOPSEBitSet SelectionEvaluator::lookupValue(const std::string& variable){ |
| 349 |
|
|
| 350 |
< |
BitSet bs(nStuntDouble); |
| 350 |
> |
OOPSEBitSet bs(nStuntDouble); |
| 351 |
|
std::map<std::string, boost::any>::iterator i = variables.find(variable); |
| 352 |
|
|
| 353 |
|
if (i != variables.end()) { |
| 354 |
< |
if (i->second.type() == typeid(BitSet)) { |
| 355 |
< |
return boost::any_cast<BitSet>(i->second); |
| 354 |
> |
if (i->second.type() == typeid(OOPSEBitSet)) { |
| 355 |
> |
return boost::any_cast<OOPSEBitSet>(i->second); |
| 356 |
|
} else if (i->second.type() == typeid(std::vector<Token>)){ |
| 357 |
|
bs = expression(boost::any_cast<std::vector<Token> >(i->second), 2); |
| 358 |
|
i->second = bs; /**@todo fixme */ |
| 365 |
|
return bs; |
| 366 |
|
} |
| 367 |
|
|
| 368 |
< |
BitSet SelectionEvaluator::nameInstruction(const std::string& name){ |
| 368 |
> |
OOPSEBitSet SelectionEvaluator::nameInstruction(const std::string& name){ |
| 369 |
|
|
| 370 |
|
return nameFinder.match(name); |
| 371 |
|
|
| 388 |
|
//predefine(); |
| 389 |
|
} |
| 390 |
|
|
| 391 |
< |
BitSet SelectionEvaluator::evaluate() { |
| 392 |
< |
BitSet bs(nStuntDouble); |
| 391 |
> |
OOPSEBitSet SelectionEvaluator::evaluate() { |
| 392 |
> |
OOPSEBitSet bs(nStuntDouble); |
| 393 |
|
if (isLoaded_) { |
| 394 |
|
pc = 0; |
| 395 |
|
instructionDispatchLoop(bs); |
| 398 |
|
return bs; |
| 399 |
|
} |
| 400 |
|
|
| 401 |
< |
BitSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
| 402 |
< |
BitSet bs(nStuntDouble); |
| 401 |
> |
OOPSEBitSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
| 402 |
> |
OOPSEBitSet bs(nStuntDouble); |
| 403 |
|
|
| 404 |
|
if (value.type() == typeid(int)) { |
| 405 |
|
int index = boost::any_cast<int>(value); |
| 422 |
|
} |
| 423 |
|
|
| 424 |
|
|
| 425 |
< |
double SelectionEvaluator::getCharge(Atom* atom) { |
| 426 |
< |
double charge =0.0; |
| 425 |
> |
RealType SelectionEvaluator::getCharge(Atom* atom) { |
| 426 |
> |
RealType charge =0.0; |
| 427 |
|
AtomType* atomType = atom->getAtomType(); |
| 428 |
|
if (atomType->isCharge()) { |
| 429 |
|
GenericData* data = atomType->getPropertyByName("Charge"); |