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

Comparing trunk/OOPSE/libmdtools/StuntDouble.cpp (file contents):
Revision 1187 by chrisfen, Sat May 22 18:16:18 2004 UTC vs.
Revision 1452 by tim, Mon Aug 23 15:11:36 2004 UTC

# Line 25 | Line 25
25  
26   */
27  
28 + StuntDouble::~StuntDouble(){
29 +  map<string, GenericData*>::iterator iter;
30 +
31 +  for(iter = properties.begin(); iter != properties.end(); ++iter ){
32 +    delete iter->second;
33 +    properties.erase(iter);
34 +  }
35 +    
36 + }
37 +
38   int StuntDouble::getObjType(){
39    return objType;
40   }
# Line 128 | Line 138 | void StuntDouble::setVel(double vel[3]){
138   }
139  
140   void StuntDouble::setVel(double vel[3]){
141 +
142    switch (objType)
143      {
144      case OT_ATOM :
# Line 146 | Line 157 | void StuntDouble::setVel(double vel[3]){
157      }  
158   }
159  
160 + void StuntDouble::setFrc(double frc[3]){
161 +
162 +  switch (objType)
163 +    {
164 +    case OT_ATOM :
165 +    case OT_DATOM:      
166 +      ((Atom*)this)->setFrc(frc);
167 +      break;
168 +    case OT_RIGIDBODY:
169 +      ((RigidBody*)this)->setFrc(frc);
170 +      break;      
171 +    default:
172 +      sprintf( painCave.errMsg,
173 +               "Unrecognized ObjType (%d) in StuntDouble::setFrc.\n",
174 +               objType );
175 +      painCave.isFatal = 1;
176 +      simError();    
177 +    }  
178 + }
179 +
180   void StuntDouble::addFrc(double frc[3]){
181    switch (objType)
182      {
# Line 356 | Line 387 | void StuntDouble::getTrq(double trq[3]){
387    }
388   }
389  
390 + void StuntDouble::setTrq(double trq[3]){
391 +  switch (objType)
392 +    {
393 +    case OT_ATOM:
394 +      sprintf( painCave.errMsg,
395 +               "StuntDouble::setTrq was called for a regular atom.\n"
396 +               "\tRegular Atoms don't have torques.  Be smarter.\n");
397 +      painCave.isFatal = 1;
398 +      simError();
399 +      break;
400 +    case OT_DATOM:
401 +      ((DirectionalAtom*)this)->setTrq(trq);
402 +    break;
403 +    case OT_RIGIDBODY:
404 +      ((RigidBody*)this)->setTrq(trq);
405 +    break;
406 +    default:
407 +      sprintf( painCave.errMsg,
408 +               "Unrecognized ObjType (%d) in StuntDouble::addTrq.\n",
409 +               objType );
410 +      painCave.isFatal = 1;
411 +      simError();    
412 +    }
413 + }
414 +
415   void StuntDouble::addTrq(double trq[3]){
416    switch (objType)
417      {
# Line 622 | Line 678 | void StuntDouble::removeProperty(const string& propNam
678      
679    result = properties.find(propName);
680    
681 <  if(result != properties.end())
681 >  if(result != properties.end()){
682 >    delete result->second;
683      properties.erase(result);
684 +    
685 +  }
686    
687   }
688   GenericData* StuntDouble::getProperty(const string& propName){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines