ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/BlockSnapshotManager.cpp
(Generate patch)

Comparing trunk/src/brains/BlockSnapshotManager.cpp (file contents):
Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 1215 by xsun, Wed Jan 23 21:22:37 2008 UTC

# Line 58 | Line 58 | namespace oopse {
58        RealType physMem = physmem_total();
59        RealType rssMem = residentMem();
60        RealType avaliablePhysMem = physMem - rssMem;
61 +
62      
63        int bytesPerStuntDouble = DataStorage::getBytesPerStuntDouble(storageLayout);
64  
65        int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble;
66  
67 <      int frameCapacity = int (avaliablePhysMem / bytesPerFrame);
68 <    
69 <      nSnapshotPerBlock_ = frameCapacity /blockCapacity_ ;
67 >      // total number of frames that can fit in memory
68 >      RealType frameCapacity = avaliablePhysMem / bytesPerFrame;
69 >
70 >      // number of frames in each block given the need to hold multiple blocks
71 >      // in memory at the same time:
72 >      nSnapshotPerBlock_ = int(frameCapacity) / blockCapacity_;
73        reader_ = new DumpReader(info, filename);
74        nframes_ = reader_->getNFrames();
71
75        int nblocks = nframes_ / nSnapshotPerBlock_;
76 <      if (nframes_ % nSnapshotPerBlock_ != 0) {
76 >      if (nframes_ % int(nSnapshotPerBlock_) != 0) {
77          ++nblocks;
78        }  
79      
# Line 82 | Line 85 | namespace oopse {
85  
86        snapshots_.insert(snapshots_.begin(), nframes_, static_cast<Snapshot*>(NULL));  
87  
88 <      std::cout << "physmem = " << int(physMem) << "\trssMem =  "<< int(rssMem) << "\t availablePhysMem = " << int(avaliablePhysMem) <<std::endl;
89 <      std::cout << "nSnapshotPerBlock = " << nSnapshotPerBlock_ << "\t total block = " << nblocks << std::endl;
88 >      std::cout << "-----------------------------------------------------"<<std::endl;
89 >      std::cout << "BlockSnapshotManager memory report:" << std::endl;
90 >      std::cout << "\n";
91 >      std::cout << " Physical Memory available:\t" << (unsigned long)physMem <<  " bytes" <<std::endl;
92 >      std::cout << "    Resident Memory in use:\t" << (unsigned long)rssMem << " bytes" <<std::endl;
93 >      std::cout << "Memory available for OOPSE:\t" << (unsigned long)avaliablePhysMem << " bytes" <<std::endl;
94 >      std::cout << "     Bytes per StuntDouble:\t" << (unsigned long)bytesPerStuntDouble <<std::endl;
95 >      std::cout << "           Bytes per Frame:\t" << (unsigned long)bytesPerFrame <<std::endl;
96 >      std::cout << "            Frame Capacity:\t" << (unsigned long)frameCapacity <<std::endl;
97 >      std::cout << "      Frames in trajectory:\t" << (unsigned long)nframes_ <<std::endl;
98 >      std::cout << "       Snapshots per Block:\t" << (unsigned long)nSnapshotPerBlock_ <<std::endl;
99 >      std::cout << "    Total number of Blocks:\t" << (unsigned long)nblocks << std::endl;
100 >      std::cout << "-----------------------------------------------------"<<std::endl;
101      
102      }
103  
# Line 102 | Line 116 | namespace oopse {
116      }
117    }
118  
119 +
120 +  // virtual Snapshot* BlockSnapshotManager::getSnapshot(int id) {
121 +  //  currentSnapshot_ = snapshots[id];
122 +  //  return snapshots_[id];
123 +  //}
124 +
125    int BlockSnapshotManager::getNActiveBlocks() {
126   #ifdef __RWSTD  
127      int count = 0;
# Line 206 | Line 226 | namespace oopse {
226      Snapshot* oldSnapshot = currentSnapshot_;
227      currentSnapshot_ = snapshot;  
228      reader_->readFrame(frame);
229 <    currentSnapshot_ = oldSnapshot;
229 >
230 >    // What was this for?  It doesn't make sense!
231 >    //currentSnapshot_ = oldSnapshot;
232 >
233      return snapshot;
234    }
235  
# Line 214 | Line 237 | namespace oopse {
237      return reader_->getNFrames();
238    }
239  
240 +  void BlockSnapshotManager::needCOMprops(bool ncp) {
241 +    reader_->setNeedCOMprops(ncp);
242 +  }
243 +
244   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines