61 |
|
|
62 |
|
myConfiguration = new SimState(); |
63 |
|
|
64 |
+ |
properties = new GenericData(); |
65 |
+ |
|
66 |
|
wrapMeSimInfo( this ); |
67 |
|
} |
68 |
|
|
70 |
|
SimInfo::~SimInfo(){ |
71 |
|
|
72 |
|
delete myConfiguration; |
73 |
< |
|
72 |
< |
map<string, GenericData*>::iterator i; |
73 |
< |
|
74 |
< |
for(i = properties.begin(); i != properties.end(); i++) |
75 |
< |
delete (*i).second; |
76 |
< |
|
73 |
> |
delete properties; |
74 |
|
} |
75 |
|
|
76 |
|
void SimInfo::setBox(double newBox[3]) { |
511 |
|
|
512 |
|
|
513 |
|
void SimInfo::setRcut( double theRcut ){ |
517 |
– |
|
518 |
– |
if( !haveOrigRcut ){ |
519 |
– |
haveOrigRcut = 1; |
520 |
– |
origRcut = theRcut; |
521 |
– |
} |
514 |
|
|
515 |
|
rCut = theRcut; |
516 |
|
checkCutOffs(); |
517 |
|
} |
518 |
|
|
519 |
< |
void SimInfo::setEcr( double theEcr ){ |
519 |
> |
void SimInfo::setDefaultRcut( double theRcut ){ |
520 |
|
|
521 |
< |
if( !haveOrigEcr ){ |
522 |
< |
haveOrigEcr = 1; |
523 |
< |
origEcr = theEcr; |
532 |
< |
} |
521 |
> |
haveOrigRcut = 1; |
522 |
> |
origRcut = theRcut; |
523 |
> |
rCut = theRcut; |
524 |
|
|
525 |
+ |
( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
526 |
+ |
|
527 |
+ |
notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
528 |
+ |
} |
529 |
+ |
|
530 |
+ |
void SimInfo::setEcr( double theEcr ){ |
531 |
+ |
|
532 |
|
ecr = theEcr; |
533 |
|
checkCutOffs(); |
534 |
|
} |
535 |
|
|
536 |
+ |
void SimInfo::setDefaultEcr( double theEcr ){ |
537 |
+ |
|
538 |
+ |
haveOrigEcr = 1; |
539 |
+ |
origEcr = theEcr; |
540 |
+ |
|
541 |
+ |
( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
542 |
+ |
|
543 |
+ |
ecr = theEcr; |
544 |
+ |
|
545 |
+ |
notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
546 |
+ |
} |
547 |
+ |
|
548 |
|
void SimInfo::setEcr( double theEcr, double theEst ){ |
549 |
|
|
550 |
|
est = theEst; |
551 |
|
setEcr( theEcr ); |
552 |
|
} |
553 |
|
|
554 |
+ |
void SimInfo::setDefaultEcr( double theEcr, double theEst ){ |
555 |
|
|
556 |
+ |
est = theEst; |
557 |
+ |
setDefaultEcr( theEcr ); |
558 |
+ |
} |
559 |
+ |
|
560 |
+ |
|
561 |
|
void SimInfo::checkCutOffs( void ){ |
562 |
|
|
563 |
|
int cutChanged = 0; |
624 |
|
( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
625 |
|
|
626 |
|
if( cutChanged ){ |
611 |
– |
|
627 |
|
notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
628 |
|
} |
629 |
|
|
640 |
|
|
641 |
|
} |
642 |
|
|
643 |
< |
void SimInfo::addProperty(GenericData* prop){ |
643 |
> |
GenericData* SimInfo::getProperty(char* propName){ |
644 |
|
|
645 |
< |
map<string, GenericData*>::iterator result; |
631 |
< |
result = properties.find(prop->getID()); |
632 |
< |
|
633 |
< |
//we can't simply use properties[prop->getID()] = prop, |
634 |
< |
//it will cause memory leak if we already contain a propery which has the same name of prop |
635 |
< |
|
636 |
< |
if(result != properties.end()){ |
637 |
< |
|
638 |
< |
delete (*result).second; |
639 |
< |
(*result).second = prop; |
640 |
< |
|
641 |
< |
} |
642 |
< |
else{ |
643 |
< |
|
644 |
< |
properties[prop->getID()] = prop; |
645 |
< |
|
646 |
< |
} |
647 |
< |
|
645 |
> |
return properties->find( propName ); |
646 |
|
} |
647 |
|
|
650 |
– |
GenericData* SimInfo::getProperty(const string& propName){ |
651 |
– |
|
652 |
– |
map<string, GenericData*>::iterator result; |
653 |
– |
|
654 |
– |
//string lowerCaseName = (); |
655 |
– |
|
656 |
– |
result = properties.find(propName); |
657 |
– |
|
658 |
– |
if(result != properties.end()) |
659 |
– |
return (*result).second; |
660 |
– |
else |
661 |
– |
return NULL; |
662 |
– |
} |
663 |
– |
|
664 |
– |
vector<GenericData*> SimInfo::getProperties(){ |
665 |
– |
|
666 |
– |
vector<GenericData*> result; |
667 |
– |
map<string, GenericData*>::iterator i; |
668 |
– |
|
669 |
– |
for(i = properties.begin(); i != properties.end(); i++) |
670 |
– |
result.push_back((*i).second); |
671 |
– |
|
672 |
– |
return result; |
673 |
– |
} |
674 |
– |
|
648 |
|
double SimInfo::matTrace3(double m[3][3]){ |
649 |
|
double trace; |
650 |
|
trace = m[0][0] + m[1][1] + m[2][2]; |