📄 sparsematrixongpu1.h
字号:
// SparseMatrixOnGPU.h: interface for the SparseMatrixOnGPU class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SPARSEMATRIXONGPU_H__1A9DDFC2_5A56_4D10_AB10_C6003C7988C2__INCLUDED_)
#define AFX_SPARSEMATRIXONGPU_H__1A9DDFC2_5A56_4D10_AB10_C6003C7988C2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "extgl.h"
/////////////////////////////////////////////////////////////////////////////////
//// 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 : Sparse Matrix Solvers on the CPU: Conjugate Gradients and Multigrid
//// --Jeff Bolz, Ian Farmer, Eitan Grinspun and Peter Schroder
//// --SIGGRAPH2003
//// Current Platform:
//// Driver Version:
//// Object :
//// 1:Sparse Matrix Vector Multiply
//// Ax = y
//// 2:Reduction Operation
//// scalar = x.y
//// Focus: Sparse Matrix Vector Multiplication-
//// Another Way to Out which on Texture Shader
/////////////////////////////////////////////////////////////////////////////////
class CBolzMatrix
{
private:
int _iDim; ////Dimesension of Matrix
int _iMaxPassNum; //// Pass Number to multiply a vector
/////////////////////////////////
////Texture size for No.1
int _iWidth, _iHeight;
////The following three are the same layout---No.1
unsigned int AiiTexID; ///////Aii of A
unsigned int RTexID; ///////Indirectional Texture for Aij and CTexID
////Texture size for No.2
int _iIndexWidth, _iIndexHeight;
////The following two are the same layout---No.2
unsigned int AijTexID; ///////Aij of A(non-zero element except Aii)
unsigned int CTexID; ///////Indirectional Texture for aj in accordance with Aij
/////////////////////////////////
GLenum _iTextureTarget;
/////////////////////////////////
public:
bool _bInitialized;
bool _bFloat;
int _iChannelsNum;
public:
CBolzMatrix();
virtual ~CBolzMatrix();
/////////////////////////////////
void SetData(float *A, int DimSize);
void SetDataAnotherWay(float *A, int DimSize);
// Returns the Matrix's size
inline int GetDim() const {return _iDim;}
// Returns the Max Number of these rows
inline int GetPassNum() const {return _iMaxPassNum;}
// Returns the Matrix's Data Texture Size
inline int GetWidth() const {return _iWidth;}
inline int GetHeight() const {return _iHeight; }
// Returns the Matrix's Packed Index Texture Size
inline int GetIndexWidth() const {return _iIndexWidth;}
inline int GetIndexHeight() const {return _iIndexHeight; }
// Returns the texture ID for matrix operation
inline unsigned int GetAiiTextureID() const { return AiiTexID; }
inline unsigned int GetAijTextureID() const { return AijTexID; }
inline unsigned int GetRTextureID() const { return RTexID; }
inline unsigned int GetCTextureID() const { return CTexID; }
//////////////////////////////////////////////////////////////
//// Modified Method by Youquan Liu 2004/1/8
//////////////////////////////////////////////////////////////
void SetMultiData(float *A, int DimSize);
};
#endif // !defined(AFX_SPARSEMATRIXONGPU_H__1A9DDFC2_5A56_4D10_AB10_C6003C7988C2__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -