#include <vector>
#include <cuda.h>
#include <cuda_runtime.h>

#define DIM 1024
#define tX 16
#define tY 16
#define PI 3.1415926535897932f
#define MAX_TEMP 1.0f
#define MIN_TEMP 0.0001f
#define SPEED 0.25f
using namespace std;

class CHeatTrasfer{
	vector<float*> deviceMatrices;
	vector<float*> hostMatrices;
	int x,y;
public:
	float *frontTex;
	float *backTex;
	// void cpy(float* srcDevice,float* destHost);
	void blend(float* in, bool swaped);
	void cpy_const(float* dest);
	~CHeatTrasfer();
	CHeatTrasfer(int x1,int y1){x=x1;y=y1;}
	float* reserveDeviceFloatMatrix();
	float* reserveHostFloatMatrix();
	void cudaCopy(float* src,float* dest,cudaMemcpyKind mem);
	float* reserveMatrix(bool device);
	void setTo(float v,float* dev_mem);
	int getTotalSize(){return x*y*sizeof(float);}
	dim3 getNBlocks(){
		return dim3(x/tX,y/tY);
	}
	float* initConstTemp();
	dim3 getNThreads(){
		return dim3(tX,tY);
	}
	void setUpTextureMemmory(float* dev_const,float* dev_front,float* dev_back);
};