ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new-templateless/OOPSE/libmdtools/SimInfo.cpp
(Generate patch)

Comparing:
trunk/OOPSE/libmdtools/SimInfo.cpp (file contents), Revision 841 by mmeineke, Wed Oct 29 17:55:28 2003 UTC vs.
branches/new-templateless/OOPSE/libmdtools/SimInfo.cpp (file contents), Revision 850 by mmeineke, Mon Nov 3 22:07:17 2003 UTC

# Line 61 | Line 61 | SimInfo::SimInfo(){
61  
62    myConfiguration = new SimState();
63  
64 +  properties = new GenericData();
65 +
66    wrapMeSimInfo( this );
67   }
68  
# Line 68 | Line 70 | SimInfo::~SimInfo(){
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]) {
# Line 524 | Line 521 | void SimInfo::setDefaultRcut( double theRcut ){
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 ){
# Line 537 | Line 538 | void SimInfo::setDefaultEcr( double theEcr ){
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 ){
# Line 619 | Line 624 | void SimInfo::checkCutOffs( void ){
624      ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0;
625      
626      if( cutChanged ){
622      
627        notifyFortranCutOffs( &rCut, &rList, &ecr, &est );
628      }
629      
# Line 636 | Line 640 | void SimInfo::checkCutOffs( void ){
640    
641   }
642  
643 < void SimInfo::addProperty(GenericData* prop){
643 > GenericData* SimInfo::getProperty(char* propName){
644  
645 <  map<string, GenericData*>::iterator result;
642 <  result = properties.find(prop->getID());
643 <  
644 <  //we can't simply use  properties[prop->getID()] = prop,
645 <  //it will cause memory leak if we already contain a propery which has the same name of prop
646 <  
647 <  if(result != properties.end()){
648 <    
649 <    delete (*result).second;
650 <    (*result).second = prop;
651 <      
652 <  }
653 <  else{
654 <
655 <    properties[prop->getID()] = prop;
656 <
657 <  }
658 <    
645 >  return properties->find( propName );
646   }
647  
661 GenericData* SimInfo::getProperty(const string& propName){
662
663  map<string, GenericData*>::iterator result;
664  
665  //string lowerCaseName = ();
666  
667  result = properties.find(propName);
668  
669  if(result != properties.end())
670    return (*result).second;  
671  else  
672    return NULL;  
673 }
674
675 vector<GenericData*> SimInfo::getProperties(){
676
677  vector<GenericData*> result;
678  map<string, GenericData*>::iterator i;
679  
680  for(i = properties.begin(); i != properties.end(); i++)
681    result.push_back((*i).second);
682    
683  return result;
684 }
685
648   double SimInfo::matTrace3(double m[3][3]){
649    double trace;
650    trace = m[0][0] + m[1][1] + m[2][2];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines