// 'Hello World!' program 

#include <iostream>
#include <stdio.h> 
#include <fstream>

//Link Cu file to c++ main 
extern "C" void setMNS(double x12, double x13, double x23, double m21, double m23, double Delta, bool kSquared);
extern "C" void GetProb(int Alpha, int Beta, double Path, double Density, double *Energy, int n, double *oscw);

//Main Program
int main()
{
//Define varibles and arrays
double x12=0.311, x13=0.0251, x23=0.5, m21=7.6e-5, m23=2.4e-3,  Delta=0;
bool kSquared=true; 

setMNS(x12, x13, x23, m21, m23, Delta, kSquared);

int Alpha=1,Beta=1;
double Path=295e3,  Density=2.6;
int n = 2000; //number of array elements 
int i; 
double Energy[n]; 
double oscw[n];
double gain = 0.001; 	//gain of energy per step 

for (i = 0; i<2000; i++){ 	//Array to fill Energy 
	Energy[i]=(i*0.001)+gain;
	}

//Get probabilty from CUDA program 
	GetProb(Alpha, Beta, Path, Density, Energy, n, oscw);

std::ofstream myfile; //start write to file
myfile.open("Prob.csv"); //open file to be written

for (int i=0; i<2000; i++){
myfile  <<Energy[i]<<","<<oscw[i]<< std::endl; //fill file with array elements
}

myfile.close();  //close files


  return 0;
}

