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(); |
254 |
|
} |
255 |
|
} |
256 |
|
break; |
257 |
+ |
case Token::x: |
258 |
+ |
propertyValue = sd->getPos().x(); |
259 |
+ |
break; |
260 |
+ |
case Token::y: |
261 |
+ |
propertyValue = sd->getPos().y(); |
262 |
+ |
break; |
263 |
+ |
case Token::z: |
264 |
+ |
propertyValue = sd->getPos().z(); |
265 |
+ |
break; |
266 |
|
default: |
267 |
|
unrecognizedAtomProperty(property); |
268 |
|
} |
293 |
|
|
294 |
|
} |
295 |
|
|
296 |
< |
void SelectionEvaluator::withinInstruction(const Token& instruction, BitSet& bs){ |
296 |
> |
void SelectionEvaluator::withinInstruction(const Token& instruction, OOPSEBitSet& bs){ |
297 |
|
|
298 |
|
boost::any withinSpec = instruction.value; |
299 |
|
float distance; |
350 |
|
|
351 |
|
} |
352 |
|
|
353 |
< |
void SelectionEvaluator::select(BitSet& bs){ |
353 |
> |
void SelectionEvaluator::select(OOPSEBitSet& bs){ |
354 |
|
bs = expression(statement, 1); |
355 |
|
} |
356 |
|
|
357 |
< |
BitSet SelectionEvaluator::lookupValue(const std::string& variable){ |
357 |
> |
OOPSEBitSet SelectionEvaluator::lookupValue(const std::string& variable){ |
358 |
|
|
359 |
< |
BitSet bs(nStuntDouble); |
359 |
> |
OOPSEBitSet bs(nStuntDouble); |
360 |
|
std::map<std::string, boost::any>::iterator i = variables.find(variable); |
361 |
|
|
362 |
|
if (i != variables.end()) { |
363 |
< |
if (i->second.type() == typeid(BitSet)) { |
364 |
< |
return boost::any_cast<BitSet>(i->second); |
363 |
> |
if (i->second.type() == typeid(OOPSEBitSet)) { |
364 |
> |
return boost::any_cast<OOPSEBitSet>(i->second); |
365 |
|
} else if (i->second.type() == typeid(std::vector<Token>)){ |
366 |
|
bs = expression(boost::any_cast<std::vector<Token> >(i->second), 2); |
367 |
|
i->second = bs; /**@todo fixme */ |
374 |
|
return bs; |
375 |
|
} |
376 |
|
|
377 |
< |
BitSet SelectionEvaluator::nameInstruction(const std::string& name){ |
377 |
> |
OOPSEBitSet SelectionEvaluator::nameInstruction(const std::string& name){ |
378 |
|
|
379 |
|
return nameFinder.match(name); |
380 |
|
|
397 |
|
//predefine(); |
398 |
|
} |
399 |
|
|
400 |
< |
BitSet SelectionEvaluator::evaluate() { |
401 |
< |
BitSet bs(nStuntDouble); |
400 |
> |
OOPSEBitSet SelectionEvaluator::evaluate() { |
401 |
> |
OOPSEBitSet bs(nStuntDouble); |
402 |
|
if (isLoaded_) { |
403 |
|
pc = 0; |
404 |
|
instructionDispatchLoop(bs); |
407 |
|
return bs; |
408 |
|
} |
409 |
|
|
410 |
< |
BitSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
411 |
< |
BitSet bs(nStuntDouble); |
410 |
> |
OOPSEBitSet SelectionEvaluator::indexInstruction(const boost::any& value) { |
411 |
> |
OOPSEBitSet bs(nStuntDouble); |
412 |
|
|
413 |
|
if (value.type() == typeid(int)) { |
414 |
|
int index = boost::any_cast<int>(value); |
431 |
|
} |
432 |
|
|
433 |
|
|
434 |
< |
double SelectionEvaluator::getCharge(Atom* atom) { |
435 |
< |
double charge =0.0; |
434 |
> |
RealType SelectionEvaluator::getCharge(Atom* atom) { |
435 |
> |
RealType charge =0.0; |
436 |
|
AtomType* atomType = atom->getAtomType(); |
437 |
|
if (atomType->isCharge()) { |
438 |
|
GenericData* data = atomType->getPropertyByName("Charge"); |