| 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 | 
  | 
     | 
| 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 | 
  | 
 | 
| 116 | 
  | 
    } | 
| 117 | 
  | 
  } | 
| 118 | 
  | 
 | 
| 119 | 
+ | 
   Snapshot* BlockSnapshotManager::getSnapshot(int id) {  | 
| 120 | 
+ | 
    currentSnapshot_ = snapshots_[id];  | 
| 121 | 
+ | 
    return snapshots_[id];  | 
| 122 | 
+ | 
  } | 
| 123 | 
+ | 
 | 
| 124 | 
  | 
  int BlockSnapshotManager::getNActiveBlocks() { | 
| 125 | 
  | 
#ifdef __RWSTD    | 
| 126 | 
  | 
    int count = 0; | 
| 225 | 
  | 
    Snapshot* oldSnapshot = currentSnapshot_; | 
| 226 | 
  | 
    currentSnapshot_ = snapshot;    | 
| 227 | 
  | 
    reader_->readFrame(frame); | 
| 228 | 
< | 
    currentSnapshot_ = oldSnapshot; | 
| 228 | 
> | 
 | 
| 229 | 
> | 
    // What was this for?  It doesn't make sense! | 
| 230 | 
> | 
    //currentSnapshot_ = oldSnapshot; | 
| 231 | 
> | 
 | 
| 232 | 
  | 
    return snapshot; | 
| 233 | 
  | 
  } | 
| 234 | 
  | 
 |