 texture <float4, cudaTextureType3D, cudaReadModeElementType> dataTex;
 
 const int N = 256;
+
+float spacing = 0.0245436930189;
+float origin = -3.12932085991;
 
 
 //Definitions of vectortype operators

}

void datagen (float4*** data) {
	float spacing = 0.0245436930189;
	float origin = -3.12932085991;
	for (int i=0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {


//Do 1 RK4 step.
__device__ float4 RK4step(float4 loc, double dt ) {
	float3 loc3d = make_float3((loc.x-origin)/spacing,(loc.y-origin)/spacing,(loc.z-origin)/spacing);
	float4 k1 = tex3D(dataTex, loc3d);
	float4 k2 = tex3D(dataTex, loc3d+(dt*0.5/spacing)*make_float3(k1));
	float4 k3 = tex3D(dataTex, loc3d+(dt*0.5/spacing)*make_float3(k2));
	float4 k4 = tex3D(dataTex, loc3d+(dt/spacing)*make_float3(k3));
	return dt/6.0*(k1 + 2.0*(k2 + k3) + k4);
}

