38 |
|
|
39 |
|
const string IgnoreVisitor::toString(){ |
40 |
|
char buffer[65535]; |
41 |
+ |
string result; |
42 |
|
set<string>::iterator i; |
43 |
|
|
44 |
< |
sprintf(buffer,"------------------------------------------------------------------\n"); |
45 |
< |
sprintf(buffer,"Visitor name: %s", visitorName.c_str()); |
44 |
> |
sprintf(buffer ,"------------------------------------------------------------------\n"); |
45 |
> |
result += buffer; |
46 |
|
|
47 |
+ |
sprintf(buffer ,"Visitor name: %s", visitorName.c_str()); |
48 |
+ |
result += buffer; |
49 |
+ |
|
50 |
|
//print the ignore type list |
51 |
< |
sprintf(buffer, "Ignore type list contains below types:\n"); |
52 |
< |
for(i = itList.begin(); i != itList.end(); ++i) |
49 |
< |
sprintf(buffer,"%s,\t", i->c_str()); |
50 |
< |
sprintf(buffer,"\n"); |
51 |
> |
sprintf(buffer , "Ignore type list contains below types:\n"); |
52 |
> |
result += buffer; |
53 |
|
|
54 |
< |
sprintf(buffer,"------------------------------------------------------------------\n"); |
54 |
> |
for(i = itList.begin(); i != itList.end(); ++i){ |
55 |
> |
sprintf(buffer ,"%s,\t", i->c_str()); |
56 |
> |
result += buffer; |
57 |
|
|
58 |
+ |
} |
59 |
+ |
sprintf(buffer ,"\n"); |
60 |
+ |
result += buffer; |
61 |
+ |
|
62 |
+ |
sprintf(buffer ,"------------------------------------------------------------------\n"); |
63 |
+ |
result += buffer; |
64 |
+ |
|
65 |
|
return buffer; |
66 |
|
} |
67 |
|
|
172 |
|
|
173 |
|
const string ReplicateVisitor::toString(){ |
174 |
|
char buffer[65535]; |
175 |
+ |
string result; |
176 |
|
set<string>::iterator i; |
177 |
|
|
178 |
< |
sprintf(buffer,"------------------------------------------------------------------\n"); |
179 |
< |
sprintf(buffer,"Visitor name: %s", visitorName.c_str()); |
178 |
> |
sprintf(buffer ,"------------------------------------------------------------------\n"); |
179 |
> |
result += buffer; |
180 |
|
|
181 |
+ |
sprintf(buffer ,"Visitor name: %s", visitorName.c_str()); |
182 |
+ |
result += buffer; |
183 |
+ |
|
184 |
|
//print the replicate direction |
185 |
< |
sprintf(buffer, "repeatX = %d:\n", replicateOpt[0]); |
186 |
< |
sprintf(buffer, "repeatY = %d:\n", replicateOpt[1]); |
172 |
< |
sprintf(buffer, "repeatZ = %d:\n", replicateOpt[2]); |
185 |
> |
sprintf(buffer , "repeatX = %d:\n", replicateOpt[0]); |
186 |
> |
result += buffer; |
187 |
|
|
188 |
+ |
sprintf(buffer , "repeatY = %d:\n", replicateOpt[1]); |
189 |
+ |
result += buffer; |
190 |
|
|
191 |
+ |
sprintf(buffer , "repeatZ = %d:\n", replicateOpt[2]); |
192 |
+ |
result += buffer; |
193 |
+ |
|
194 |
+ |
|
195 |
|
sprintf(buffer,"------------------------------------------------------------------\n"); |
196 |
+ |
result += buffer; |
197 |
|
|
198 |
< |
return buffer; |
198 |
> |
return result; |
199 |
|
} |
200 |
|
|
201 |
|
//----------------------------------------------------------------------------// |
231 |
|
|
232 |
|
//if there is not atom data, just skip it |
233 |
|
data = sd->getProperty("ATOMDATA"); |
234 |
< |
if(data != NULL) |
234 |
> |
if(data != NULL){ |
235 |
|
atomData = dynamic_cast<AtomData*>(data); |
236 |
|
if(atomData == NULL) |
237 |
|
return; |
238 |
+ |
} |
239 |
|
else |
240 |
|
return; |
241 |
|
|
243 |
|
|
244 |
|
if(printDipole) |
245 |
|
sprintf(buffer, "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", |
246 |
< |
atomInfo->AtomType, |
246 |
> |
atomInfo->AtomType.c_str(), |
247 |
|
atomInfo->pos[0], |
248 |
|
atomInfo->pos[1], |
249 |
|
atomInfo->pos[2], |
252 |
|
atomInfo->dipole[2]); |
253 |
|
else |
254 |
|
sprintf(buffer, "%s%15.8f%15.8f%15.8f", |
255 |
< |
atomInfo->AtomType, |
255 |
> |
atomInfo->AtomType.c_str(), |
256 |
|
atomInfo->pos[0], |
257 |
|
atomInfo->pos[1], |
258 |
|
atomInfo->pos[2]); |
296 |
|
|
297 |
|
//----------------------------------------------------------------------------// |
298 |
|
|
299 |
< |
void PrepareVisitor::internalVisit(StuntDouble * sd){ |
299 |
> |
void PrepareVisitor::internalVisit(Atom * atom){ |
300 |
|
GenericData* data; |
301 |
|
AtomData* atomData; |
302 |
|
|
303 |
|
//if visited property is existed, remove it |
304 |
< |
data = sd->getProperty("VISITED"); |
304 |
> |
data = atom->getProperty("VISITED"); |
305 |
|
if(data != NULL){ |
306 |
< |
sd->removeProperty("VISITED"); |
306 |
> |
atom->removeProperty("VISITED"); |
307 |
|
} |
308 |
|
|
309 |
|
//remove atomdata |
310 |
< |
data = sd->getProperty("ATOMDATA"); |
311 |
< |
if(data != NULL) |
310 |
> |
data = atom->getProperty("ATOMDATA"); |
311 |
> |
if(data != NULL){ |
312 |
|
atomData = dynamic_cast<AtomData*>(data); |
313 |
|
if(atomData != NULL) |
314 |
< |
sd->removeProperty("ATOMDATA"); |
314 |
> |
atom->removeProperty("ATOMDATA"); |
315 |
> |
} |
316 |
> |
|
317 |
|
} |
318 |
|
|
319 |
+ |
void PrepareVisitor::internalVisit(RigidBody * rb){ |
320 |
+ |
GenericData* data; |
321 |
+ |
AtomData* atomData; |
322 |
+ |
vector<Atom*> myAtoms; |
323 |
+ |
vector<Atom*>::iterator atomIter; |
324 |
+ |
|
325 |
+ |
//if visited property is existed, remove it |
326 |
+ |
data = rb->getProperty("VISITED"); |
327 |
+ |
if(data != NULL){ |
328 |
+ |
rb->removeProperty("VISITED"); |
329 |
+ |
} |
330 |
+ |
|
331 |
+ |
//remove atomdata |
332 |
+ |
data = rb->getProperty("ATOMDATA"); |
333 |
+ |
if(data != NULL){ |
334 |
+ |
atomData = dynamic_cast<AtomData*>(data); |
335 |
+ |
if(atomData != NULL) |
336 |
+ |
rb->removeProperty("ATOMDATA"); |
337 |
+ |
} |
338 |
+ |
|
339 |
+ |
myAtoms = rb->getAtoms(); |
340 |
+ |
|
341 |
+ |
for(atomIter = myAtoms.begin(); atomIter != myAtoms.end(); ++atomIter) |
342 |
+ |
internalVisit (*atomIter); |
343 |
+ |
} |