--- trunk/src/brains/BlockSnapshotManager.cpp 2008/01/23 21:22:18 1214 +++ trunk/src/brains/BlockSnapshotManager.cpp 2008/01/23 21:22:37 1215 @@ -58,19 +58,22 @@ namespace oopse { RealType physMem = physmem_total(); RealType rssMem = residentMem(); RealType avaliablePhysMem = physMem - rssMem; + int bytesPerStuntDouble = DataStorage::getBytesPerStuntDouble(storageLayout); int bytesPerFrame = (nRigidBodies_ + nAtoms_) * bytesPerStuntDouble; - int frameCapacity = int (avaliablePhysMem / bytesPerFrame); - - nSnapshotPerBlock_ = frameCapacity /blockCapacity_ ; + // total number of frames that can fit in memory + RealType frameCapacity = avaliablePhysMem / bytesPerFrame; + + // number of frames in each block given the need to hold multiple blocks + // in memory at the same time: + nSnapshotPerBlock_ = int(frameCapacity) / blockCapacity_; reader_ = new DumpReader(info, filename); nframes_ = reader_->getNFrames(); - int nblocks = nframes_ / nSnapshotPerBlock_; - if (nframes_ % nSnapshotPerBlock_ != 0) { + if (nframes_ % int(nSnapshotPerBlock_) != 0) { ++nblocks; } @@ -82,8 +85,19 @@ namespace oopse { snapshots_.insert(snapshots_.begin(), nframes_, static_cast(NULL)); - // std::cout << "physmem = " << int(physMem) << "\trssMem = "<< int(rssMem) << "\t availablePhysMem = " << int(avaliablePhysMem) <readFrame(frame); - currentSnapshot_ = oldSnapshot; + + // What was this for? It doesn't make sense! + //currentSnapshot_ = oldSnapshot; + return snapshot; }