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

Comparing trunk/OOPSE-2.0/src/brains/SimInfo.cpp (file contents):
Revision 2018 by tim, Mon Feb 14 17:57:01 2005 UTC vs.
Revision 2119 by tim, Fri Mar 11 15:55:17 2005 UTC

# Line 73 | Line 73 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
73                                  nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0),
74                                  nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nRigidBodies_(0),
75                                  nIntegrableObjects_(0),  nCutoffGroups_(0), nConstraints_(0),
76 <                                sman_(NULL), fortranInitialized_(false), selectMan_(NULL) {
76 >                                sman_(NULL), fortranInitialized_(false) {
77  
78              
79      std::vector<std::pair<MoleculeStamp*, int> >::iterator i;
# Line 139 | Line 139 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
139      molToProcMap_.resize(nGlobalMols_);
140   #endif
141  
142    selectMan_ = new SelectionManager(this);
143    selectMan_->selectAll();
142   }
143  
144   SimInfo::~SimInfo() {
145 <    //MemoryUtils::deleteVectorOfPointer(molecules_);
146 <
147 <    MemoryUtils::deleteVectorOfPointer(moleculeStamps_);
145 >    std::map<int, Molecule*>::iterator i;
146 >    for (i = molecules_.begin(); i != molecules_.end(); ++i) {
147 >        delete i->second;
148 >    }
149 >    molecules_.clear();
150      
151 +    MemoryUtils::deletePointers(moleculeStamps_);
152 +    
153      delete sman_;
154      delete simParams_;
155      delete forceField_;
154    delete selectMan_;
156   }
157  
158   int SimInfo::getNGlobalConstraints() {
# Line 366 | Line 367 | void SimInfo::addExcludePairs(Molecule* mol) {
367          exclude_.addPair(c, d);        
368      }
369  
370 <    
370 >    Molecule::RigidBodyIterator rbIter;
371 >    RigidBody* rb;
372 >    for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
373 >        std::vector<Atom*> atoms = rb->getAtoms();
374 >        for (int i = 0; i < atoms.size() -1 ; ++i) {
375 >            for (int j = i + 1; j < atoms.size(); ++j) {
376 >                a = atoms[i]->getGlobalIndex();
377 >                b = atoms[j]->getGlobalIndex();
378 >                exclude_.addPair(a, b);
379 >            }
380 >        }
381 >    }        
382 >
383   }
384  
385   void SimInfo::removeExcludePairs(Molecule* mol) {
# Line 410 | Line 423 | void SimInfo::removeExcludePairs(Molecule* mol) {
423          exclude_.removePair(b, d);
424          exclude_.removePair(c, d);        
425      }
426 +
427 +    Molecule::RigidBodyIterator rbIter;
428 +    RigidBody* rb;
429 +    for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
430 +        std::vector<Atom*> atoms = rb->getAtoms();
431 +        for (int i = 0; i < atoms.size() -1 ; ++i) {
432 +            for (int j = i + 1; j < atoms.size(); ++j) {
433 +                a = atoms[i]->getGlobalIndex();
434 +                b = atoms[j]->getGlobalIndex();
435 +                exclude_.removePair(a, b);
436 +            }
437 +        }
438 +    }        
439  
440   }
441  
# Line 645 | Line 671 | void SimInfo::setupFortranSim() {
671      }
672      
673      //setup fortran simulation
648    //gloalExcludes and molMembershipArray should go away (They are never used)
649    //why the hell fortran need to know molecule?
650    //OOPSE = Object-Obfuscated Parallel Simulation Engine
674      int nGlobalExcludes = 0;
675      int* globalExcludes = NULL;
676      int* excludeList = exclude_.getExcludeList();
# Line 835 | Line 858 | void SimInfo::setSnapshotManager(SnapshotManager* sman
858   }
859  
860   void SimInfo::setSnapshotManager(SnapshotManager* sman) {
861 <    //if (sman_ == sman_) {
862 <    //    return;
863 <    //}
864 <    
842 <    //delete sman_;
861 >    if (sman_ == sman) {
862 >        return;
863 >    }    
864 >    delete sman_;
865      sman_ = sman;
866  
867      Molecule* mol;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines