# | 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 | + | 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; | |
# | Line 206 | Line 225 | namespace oopse { | |
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 | ||
# | Line 214 | Line 236 | namespace oopse { | |
236 | return reader_->getNFrames(); | |
237 | } | |
238 | ||
239 | + | void BlockSnapshotManager::needCOMprops(bool ncp) { |
240 | + | reader_->setNeedCOMprops(ncp); |
241 | + | } |
242 | + | |
243 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |