# | Line 33 | Line 33 | SimInfo::SimInfo(){ | |
---|---|---|
33 | the_integrator = NULL; | |
34 | setTemp = 0; | |
35 | thermalTime = 0.0; | |
36 | + | currentTime = 0.0; |
37 | rCut = 0.0; | |
38 | ecr = 0.0; | |
39 | est = 0.0; | |
# | Line 56 | Line 57 | SimInfo::SimInfo(){ | |
57 | wrapMeSimInfo( this ); | |
58 | } | |
59 | ||
60 | + | SimInfo::~SimInfo(){ |
61 | + | |
62 | + | map<string, GenericData*>::iterator i; |
63 | + | |
64 | + | for(i = properties.begin(); i != properties.end(); i++) |
65 | + | delete (*i).second; |
66 | + | |
67 | + | |
68 | + | } |
69 | + | |
70 | void SimInfo::setBox(double newBox[3]) { | |
71 | ||
72 | int i, j; | |
# | Line 291 | Line 302 | void SimInfo::calcBoxL( void ){ | |
302 | dsq = dx*dx + dy*dy + dz*dz; | |
303 | boxL[2] = sqrt( dsq ); | |
304 | if( (0.5 * boxL[2]) < maxCutoff ) maxCutoff = 0.5 * boxL[2]; | |
305 | + | |
306 | + | checkCutOffs(); |
307 | ||
308 | } | |
309 | ||
# | Line 457 | Line 470 | void SimInfo::checkCutOffs( void ){ | |
470 | ||
471 | int cutChanged = 0; | |
472 | ||
473 | + | |
474 | + | |
475 | if( boxIsInit ){ | |
476 | ||
477 | //we need to check cutOffs against the box | |
478 | < | |
479 | < | if( maxCutoff > rCut ){ |
478 | > | |
479 | > | if(( maxCutoff > rCut )&&(usePBC)){ |
480 | if( rCut < origRcut ){ | |
481 | rCut = origRcut; | |
482 | if (rCut > maxCutoff) rCut = maxCutoff; | |
# | Line 490 | Line 505 | void SimInfo::checkCutOffs( void ){ | |
505 | } | |
506 | ||
507 | ||
508 | < | if (rCut > maxCutoff) { |
508 | > | if ((rCut > maxCutoff)&&(usePBC)) { |
509 | sprintf( painCave.errMsg, | |
510 | "New Box size is setting the long range cutoff radius " | |
511 | "to %lf\n", | |
# | Line 527 | Line 542 | void SimInfo::checkCutOffs( void ){ | |
542 | ||
543 | oldEcr = ecr; | |
544 | oldRcut = rCut; | |
545 | + | } |
546 | + | |
547 | + | void SimInfo::addProperty(GenericData* prop){ |
548 | + | |
549 | + | map<string, GenericData*>::iterator result; |
550 | + | result = properties.find(prop->getID()); |
551 | + | |
552 | + | //we can't simply use properties[prop->getID()] = prop, |
553 | + | //it will cause memory leak if we already contain a propery which has the same name of prop |
554 | + | |
555 | + | if(result != properties.end()){ |
556 | + | |
557 | + | delete (*result).second; |
558 | + | (*result).second = prop; |
559 | + | |
560 | + | } |
561 | + | else{ |
562 | + | |
563 | + | properties[prop->getID()] = prop; |
564 | + | |
565 | + | } |
566 | + | |
567 | } | |
568 | + | |
569 | + | GenericData* SimInfo::getProperty(const string& propName){ |
570 | + | |
571 | + | map<string, GenericData*>::iterator result; |
572 | + | |
573 | + | //string lowerCaseName = (); |
574 | + | |
575 | + | result = properties.find(propName); |
576 | + | |
577 | + | if(result != properties.end()) |
578 | + | return (*result).second; |
579 | + | else |
580 | + | return NULL; |
581 | + | } |
582 | + | |
583 | + | vector<GenericData*> SimInfo::getProperties(){ |
584 | + | |
585 | + | vector<GenericData*> result; |
586 | + | map<string, GenericData*>::iterator i; |
587 | + | |
588 | + | for(i = properties.begin(); i != properties.end(); i++) |
589 | + | result.push_back((*i).second); |
590 | + | |
591 | + | return result; |
592 | + | } |
593 | + | |
594 | + |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |