⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vectorongpu.h

📁 PDE simulator on GPU.
💻 H
字号:
// VectorOnGPU.h: interface for the VectorOnGPU class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_VECTORONGPU_H__D62FF50C_521E_4497_83C2_00B441F44EAA__INCLUDED_)
#define AFX_VECTORONGPU_H__D62FF50C_521E_4497_83C2_00B441F44EAA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////////
//// General-Purpose Computation with GPU
////     By : Youquan Liu 
//// Website: http://lcs.ios.ac.cn/~lyq/
//// Date:   2003/8/4
//// Location: Labatory of Computer Science, Institute of Software, 
////            Chinese Academy of Sciences, P.R.China
////  Paper : Linear Algebra Operators for GPU Implementataion of Numerical Algorithms
////          --Jens Kruger and Rudiger Westermann
////          --SIGGRAPH2003
//// Current Platform: GeForce3
////   Driver Version: 44.03
//// Objects: 
////		  1:Matrix Vector Multiply
////               Ax = y
////          2:Reduction Operation
////               scalar = x.y
////          3:Matrix-Matrix Multiply
////               result[m][n] = A[m][l]*B[l][n]
////          4:Sparse Matrix Operation
////          5:Linear equations
/////////////////////////////////////////////////////////////////////////////////
#include "extgl.h"

class CVectorOnGPU  
{
private:
	GLenum   _iTextureTarget;
	int _iLength;
	int _iWidth,_iHeight;
	unsigned int _iTexID;
public:
	bool _bInitialized;
	bool _bFloat;
	int _iChannelsNum;
public:
	CVectorOnGPU();
	virtual ~CVectorOnGPU();

	void SetData(const float *M, const int DimSize);
	float* GetData(int &DimSize);
	void SetZero();
	void CopyData(CVectorOnGPU inputVector);
	// Returns the texture ID.  Useful in Cg applications.
	inline unsigned int GetTextureID() const { return _iTexID; }
	inline void SetTextureID(int Width, int Height, int Dim, unsigned int TexID) 
	{ 
		_iWidth = Width;
		_iHeight = Height;
		_iTexID = TexID;
		_iLength = Dim;
		return;
	}
	
	// Returns the texture size.
	inline int GetHeight() const   { return _iHeight; } 
	inline int GetWidth() const  {return _iWidth; }
	inline int GetChannelsNum() const {return _iChannelsNum;}
	// Returns the vector's dimension _iLength
	inline int GetVectorLength() const { return _iLength;}
	// Returns the texture target this texture is bound to.
	inline unsigned int GetTextureTarget() const { return _iTextureTarget; }

};

#endif // !defined(AFX_VECTORONGPU_H__D62FF50C_521E_4497_83C2_00B441F44EAA__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -