36 CubeCachingAlgorithm::CacheResult
39 const Buffer &justRequested) {
41 if(allocated.size() && allocated[0] != NULL) {
47 int largestChunkDim = max( max( allocated[0]->sampleCount(),
48 allocated[0]->lineCount()),
49 allocated[0]->bandCount());
55 int numToKeep = (int)ceil(avgLargestDim / largestChunkDim) * 1;
58 int approxBytesPerChunk = allocated[0]->getByteCount();
60 int tenMB = 10 * 1024 * 1024;
61 if(numToKeep * approxBytesPerChunk > tenMB) {
62 numToKeep = tenMB / approxBytesPerChunk;
65 if(numToKeep < justUsed.size())
66 numToKeep = justUsed.size();
68 int numToToss = allocated.size() - numToKeep;
72 QListIterator<RawCubeChunk *> allocatedIterator(allocated);
74 while(numToToss > 0 && allocatedIterator.hasNext()) {
77 if(justUsed.indexOf(chunk) == -1) {
79 chunksToToss.append(chunk);
Buffer for reading and writing cube data.
int LineDimension() const
Returns the number of lines in the shape buffer.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
int BandDimension() const
Returns the number of bands in the shape buffer.
A section of raw data on the disk.
int SampleDimension() const
Returns the number of samples in the shape buffer.
This stores the results of the caching algorithm.
Namespace for ISIS/Bullet specific routines.
virtual CacheResult recommendChunksToFree(QList< RawCubeChunk *> allocated, QList< RawCubeChunk *> justUsed, const Buffer &justRequested)