I'm aiming to make a large program that scans through a lot of simulated data.
In order to do this, I'm using circular buffers (or deques). However, I now need to build up the program with arrays of circular buffers.
I would do something like this in 1D (i.e. just using a single circular buffer):
Int_t ringSize = 100;
Int_t iMax = 20000; // in the physics simulation, iMax is extremely large, so I need to avoid arrays due to memory limits
boost::circular_buffer<double> y(ringSize);
// Fill up buffer to all zeros
for(Int_t i = 0; i < ringSize; i++)
{
y.push_back(0);
}
// Fill up buffer with desired values and print full buffer each iteration
for(Int_t i = 0; i < iMax; i++)
{
y.push_back(rand()/100000000);
for(Int_t j = 0; j < ringSize; j++)
{
cout << "y["<<j<<"] = " << y[j] << endl;
}
cout << endl;
}
How would I extend this so that I have a circular buffer inside an array, where the size of both the array and the circular buffer fixed length is declared at the start?
After this, how would I manipulate (i.e. fill, print) elements of each circular buffer?