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 2015 by tim, Sun Feb 13 21:18:27 2005 UTC vs.
Revision 2114 by tim, Thu Mar 10 23:56:42 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 >    Molecule::CutoffGroupIterator cgIter;
384 >    CutoffGroup* cg;
385 >    for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; cg = mol->nextCutoffGroup(cgIter)) {
386 >        std::vector<Atom*> atoms = cg->getAtoms();
387 >        for (int i = 0; i < atoms.size() -1 ; ++i) {
388 >            for (int j = i + 1; j < atoms.size(); ++j) {
389 >                a = atoms[i]->getGlobalIndex();
390 >                b = atoms[j]->getGlobalIndex();
391 >                exclude_.addPair(a, b);
392 >            }
393 >        }
394 >    }  
395 >
396   }
397  
398   void SimInfo::removeExcludePairs(Molecule* mol) {
# Line 410 | Line 436 | void SimInfo::removeExcludePairs(Molecule* mol) {
436          exclude_.removePair(b, d);
437          exclude_.removePair(c, d);        
438      }
439 +
440 +    Molecule::RigidBodyIterator rbIter;
441 +    RigidBody* rb;
442 +    for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
443 +        std::vector<Atom*> atoms = rb->getAtoms();
444 +        for (int i = 0; i < atoms.size() -1 ; ++i) {
445 +            for (int j = i + 1; j < atoms.size(); ++j) {
446 +                a = atoms[i]->getGlobalIndex();
447 +                b = atoms[j]->getGlobalIndex();
448 +                exclude_.removePair(a, b);
449 +            }
450 +        }
451 +    }        
452 +
453 +    Molecule::CutoffGroupIterator cgIter;
454 +    CutoffGroup* cg;
455 +    for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; cg = mol->nextCutoffGroup(cgIter)) {
456 +        std::vector<Atom*> atoms = cg->getAtoms();
457 +        for (int i = 0; i < atoms.size() -1 ; ++i) {
458 +            for (int j = i + 1; j < atoms.size(); ++j) {
459 +                a = atoms[i]->getGlobalIndex();
460 +                b = atoms[j]->getGlobalIndex();
461 +                exclude_.removePair(a, b);
462 +            }
463 +        }
464 +    }  
465  
466   }
467  
# Line 835 | Line 887 | void SimInfo::setSnapshotManager(SnapshotManager* sman
887   }
888  
889   void SimInfo::setSnapshotManager(SnapshotManager* sman) {
890 <    if (sman_ == sman_) {
891 <        return;
892 <    }
890 >    //if (sman_ == sman_) {
891 >    //    return;
892 >    //}
893      
894 <    delete sman_;
894 >    //delete sman_;
895      sman_ = sman;
896  
897      Molecule* mol;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines