--- trunk/src/brains/BlockSnapshotManager.cpp 2005/04/15 22:04:00 507 +++ trunk/src/brains/BlockSnapshotManager.cpp 2008/01/23 21:22:37 1215 @@ -55,22 +55,25 @@ namespace oopse { nAtoms_ = info->getNGlobalAtoms(); nRigidBodies_ = info->getNGlobalRigidBodies(); - double physMem = physmem_total(); - double rssMem = residentMem(); - double avaliablePhysMem = physMem - rssMem; + 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; } @@ -214,4 +237,8 @@ namespace oopse { return reader_->getNFrames(); } + void BlockSnapshotManager::needCOMprops(bool ncp) { + reader_->setNeedCOMprops(ncp); + } + }