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

Comparing trunk/OOPSE/libmdtools/SimInfo.cpp (file contents):
Revision 642 by mmeineke, Mon Jul 21 16:23:57 2003 UTC vs.
Revision 670 by mmeineke, Thu Aug 7 21:47:18 2003 UTC

# Line 54 | Line 54 | SimInfo::SimInfo(){
54    useGB = 0;
55    useEAM = 0;
56  
57 +  myConfiguration = new SimState();
58 +
59    wrapMeSimInfo( this );
60 + }
61 +
62 +
63 + SimInfo::~SimInfo(){
64 +
65 +  delete myConfiguration;
66 +
67 +  map<string, GenericData*>::iterator i;
68 +  
69 +  for(i = properties.begin(); i != properties.end(); i++)
70 +    delete (*i).second;
71 +    
72   }
73  
74   void SimInfo::setBox(double newBox[3]) {
# Line 292 | Line 306 | void SimInfo::calcBoxL( void ){
306    dsq = dx*dx + dy*dy + dz*dz;
307    boxL[2] = sqrt( dsq );
308    if( (0.5 * boxL[2]) < maxCutoff ) maxCutoff = 0.5 * boxL[2];
309 +  
310 +  checkCutOffs();
311  
312   }
313  
# Line 457 | Line 473 | void SimInfo::checkCutOffs( void ){
473   void SimInfo::checkCutOffs( void ){
474  
475    int cutChanged = 0;
476 +
477 +
478  
479    if( boxIsInit ){
480      
481      //we need to check cutOffs against the box
482 <    
483 <    if( maxCutoff > rCut ){
482 >  
483 >    if(( maxCutoff > rCut )&&(usePBC)){
484        if( rCut < origRcut ){
485          rCut = origRcut;
486          if (rCut > maxCutoff) rCut = maxCutoff;
# Line 491 | Line 509 | void SimInfo::checkCutOffs( void ){
509      }
510  
511  
512 <    if (rCut > maxCutoff) {
512 >    if ((rCut > maxCutoff)&&(usePBC)) {
513        sprintf( painCave.errMsg,
514                 "New Box size is setting the long range cutoff radius "
515                 "to %lf\n",
# Line 529 | Line 547 | void SimInfo::checkCutOffs( void ){
547    oldEcr = ecr;
548    oldRcut = rCut;
549   }
550 +
551 + void SimInfo::addProperty(GenericData* prop){
552 +
553 +  map<string, GenericData*>::iterator result;
554 +  result = properties.find(prop->getID());
555 +  
556 +  //we can't simply use  properties[prop->getID()] = prop,
557 +  //it will cause memory leak if we already contain a propery which has the same name of prop
558 +  
559 +  if(result != properties.end()){
560 +    
561 +    delete (*result).second;
562 +    (*result).second = prop;
563 +      
564 +  }
565 +  else{
566 +
567 +    properties[prop->getID()] = prop;
568 +
569 +  }
570 +    
571 + }
572 +
573 + GenericData* SimInfo::getProperty(const string& propName){
574 +
575 +  map<string, GenericData*>::iterator result;
576 +  
577 +  //string lowerCaseName = ();
578 +  
579 +  result = properties.find(propName);
580 +  
581 +  if(result != properties.end())
582 +    return (*result).second;  
583 +  else  
584 +    return NULL;  
585 + }
586 +
587 + vector<GenericData*> SimInfo::getProperties(){
588 +
589 +  vector<GenericData*> result;
590 +  map<string, GenericData*>::iterator i;
591 +  
592 +  for(i = properties.begin(); i != properties.end(); i++)
593 +    result.push_back((*i).second);
594 +    
595 +  return result;
596 + }
597 +
598 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines