#include "focal_volume_with_mc_interp.h"

int main(int argc, char** argv)
	{
	if(argc < 4)
		{
		cerr << "Usage: " << argv[0] << " <parameters file> <g_of_theta file> <output directory>\n";
		exit(-1);
		}
	string param_file = argv[1];
	string g_of_theta_file = argv[2];
	string outputdir = argv[3];

	focus3d_parameters p;
	if(!p.load(param_file)) {exit (-1);} // load the parameters file
	p.print();

	Array<complex<double>,3> E_focus1_x, E_focus1_y, E_focus1_z;
	Array<complex<double>,2> E_inc_x, E_inc_y, E_inc_z;

	E_focus1_x.resize(p.Nx,p.Ny,p.Nz); E_focus1_x = 0;
	E_focus1_y.resize(p.Nx,p.Ny,p.Nz); E_focus1_y = 0;
	E_focus1_z.resize(p.Nx,p.Ny,p.Nz); E_focus1_z = 0;

	E_inc_x.resize(p.Ntheta,p.Nphi);
	E_inc_y.resize(p.Ntheta,p.Nphi);
	E_inc_z.resize(p.Ntheta,p.Nphi);
	E_inc_x = 1.0;
	E_inc_y = 0.0;
	E_inc_z = 0.0;


	focus3d focus1(p);
	focus1.set_angular_weights(g_of_theta_file);
	focus1.set_incident_field(E_inc_x,E_inc_y,E_inc_z);
	focus1.calculate_focus(E_focus1_x,E_focus1_y,E_focus1_z);
	focus1.save_results(outputdir);

	return(0);
	}




