184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
int expCell(0);
std::string Comd=Line;
StrFunc::stripComment(Comd);
Comd=StrFunc::fullBlock(Comd);
// Check the first 2 characters for comment
if(Comd.size()<2 || (isspace(Comd[1]) &&
( tolower(Comd[0])=='c' || Comd[0]=='!')))
return 0;
std::string::size_type pos=Comd.find("mode ");
if (pos!=std::string::npos)
{
std::string item;
Comd.erase(0,pos+5);
while(StrFunc::section(Comd,item))
mode.addElm(item);
return 1;
}
pos=Comd.find("print ");
if (pos!=std::string::npos)
{
printNum.clear();
std::string Item=Comd.substr(pos+1);
int pNum;
while(StrFunc::section(Item,pNum))
printNum.push_back(pNum);
}
pos=Comd.find("imp:");
if (pos!=std::string::npos)
{
Comd.erase(0,pos+4);
ImpCards.push_back(PhysImp("imp"));
// Ugly hack to get all the a,b,c,d items
// since I can't think of the regular expression
unsigned int index;
for(index=0;index<Comd.length() && !isspace(Comd[index]);index++)
if (Comd[index]!=',')
ImpCards.back().addElm(std::string(1,Comd[index]));
return 1;
}
pos=Comd.find("vol");
if (pos!=std::string::npos)
{
Comd.erase(0,pos+3);
Volume=PhysImp("vol");
return 1;
}
pos=Comd.find("histp");
if (pos!=std::string::npos)
{
histp=1;
return 1;
}
// This is ignored since we have a prdmp card
pos=Comd.find("prdmp");
if (pos!=std::string::npos)
{
return 1;
}
pos=Comd.find("nps");
if (pos!=std::string::npos)
{
Comd.erase(0,pos+3);
if (!StrFunc::convert(Comd,nps))
nps=800000;
return 1;
}
pos=Comd.find("dbcn");
if (pos!=std::string::npos)
{
long int RS;
size_t kType;
double D;
std::string keyName;
Comd.erase(0,pos+4);
if (StrFunc::convert(Comd,RS))
dbCard->setComp("rndSeed",RS);
else if (StrFunc::section(Comd,keyName) &&
(kType=dbCard->keyType(keyName)) )
{
if (kType==1 && StrFunc::section(Comd,RS))
dbCard->setComp(keyName,RS);
else if (StrFunc::section(Comd,D))
dbCard->setComp(keyName,RS);
else
ELog::EM<<"DBCN ["<<keyName<<"] error == "
<<Comd<<ELog::endErr;
}
else
{
ELog::EM<<"DBCN [rnd] error == "<<Comd<<ELog::endErr;
}
return 1;
}
pos=Comd.find("cut:");
if (pos!=std::string::npos)
{
Comd.erase(0,pos+4);
PhysCards.push_back(PhysCard("cut"));
std::string Item;
if (StrFunc::section(Comd,Item))
{
std::vector<std::string> part;
boost::split(part,Item,boost::is_any_of(","));
for(std::string& PStr : part)
boost::trim(PStr,std::locale());
// ensure no empty particles
part.erase(
remove_if(part.begin(),part.end(),
std::bind<bool>(&std::string::empty,
std::placeholders::_1)),
part.end());
PhysCard& PC(PhysCards.back());
for(const std::string& PStr : part)
PC.addElm(PStr);
// Strip and process numbers / j
for(size_t i=0;i<5 && !Comd.empty();i++)
{
double d;
if (StrFunc::section(Comd,d))
PC.setValue(i,d);
else if (StrFunc::section(Comd,Item))
{
if (Item.size()==1 && tolower(Item[0]=='j'))
PC.setDef(i);
}
}
}
return 1;
}
// ext card
pos=Comd.find("exp:");
if (pos!=std::string::npos)
{
Comd.erase(0,pos+4);
// Ugly hack to get all the a,b,c,d items
// since I can't think of the regular expression
size_t index;
for(index=0;index<Comd.length() && !isspace(Comd[index]);index++)
if (Comd[index]!=',')
ExtCard->addElm(std::string(1,Comd[index]));
// NOW HAVE PROBLEM BECAUSE MULTI-LINE
expCell=1;
if (ExtCard->addUnitList(expCell,Comd))
return 1;
// drops through to further processing |