#include <iostream>
#include "../imagebufferallocator.h"
#include "../wstackinggridder.h"
#include "../../fftwmultithreadenabler.h"
#include <unistd.h>
int main(int argc, char* argv[])
{
        size_t width = 4000, height = 4000;
        double pixelScale = 1.0/60.0*(M_PI/180.0);          
        size_t threadCount = sysconf(_SC_NPROCESSORS_ONLN); 
        
        
        long int pageCount = sysconf(_SC_PHYS_PAGES), pageSize = sysconf(_SC_PAGE_SIZE);
        int64_t memSize = (int64_t) pageCount * (int64_t) pageSize;
        
        
        std::vector<double> image(width*height, 0.0);
        size_t sourceX = width/2 - width/17, sourceY = height/2-height/21;
        image[sourceX + sourceY*width] = 100.0;
        
        ImageBufferAllocator allocator;
        
        
        
        
        
        
        
        
        
        
        WStackingGridder gridder(width, height, pixelScale, pixelScale, threadCount, &allocator, 15, 201);
         
        
        
        
        
        
        
        
        
        
        {
                std::cerr << "Error; w-layers do not all fit in memory at once.\n";
                return -1;
        }
        
        
        
        
        
        
        
        
        
        double
                u = 100.0 , 
                v =  10.0 ,
                w =  10.0 ;
                
        for(size_t i=0; i!=20; ++i, u/=2.0, v/=2.0, w/=2.0)
        {
                std::complex<float> value;
                std::cout << "uvw = (" << u << ", " << v << ", " << w << "), visibility = " << value << '\n';
        }
}