00001
00002
00003
00004
00005
00006
00007
00008 #ifndef GPU_BASISFUNCTIONS
00009 #define GPU_BASISFUNCTIONS
00010
00011 #ifdef QMC_GPU
00012
00013 #include <iostream>
00014 #include <stdlib.h>
00015 #include <assert.h>
00016 #include <math.h>
00017 #include <vector>
00018 #include <string>
00019 #include "GPUGlobals.h"
00020 #include "GPUQMCFramebuffer.h"
00021 #include "Array1D.h"
00022 #include "Array2D.h"
00023 #include "Stopwatch.h"
00024 #include "QMCBasisFunction.h"
00025
00030 static GLuint bfParametersTexID;
00031
00035 class GPUQMCBasisFunction : public QMCBasisFunction, GPUGlobals
00036 {
00037 public:
00038
00039 GPUQMCBasisFunction();
00040
00049 GPUQMCBasisFunction(QMCBasisFunction bf, int numElectrons, int max_calcs);
00050
00056 void operator=(GPUQMCBasisFunction &rhs);
00057
00065 GLuint runCalculation(Array1D<Array2D<double>*> &X, int num, int start, int stop);
00066
00072 int getNumIterations();
00073
00074 GLuint getElectronicTexture();
00075
00079 ~GPUQMCBasisFunction();
00080
00081 private:
00082
00103 void setUpInputs();
00104
00111 string generateShader(int which);
00112
00119 string generateTranslationShader(bool is12);
00120
00125 void loadShaders();
00126
00131 void translate();
00132
00141 void drawPrimative(GLfloat maxs, GLfloat maxt, GLfloat sShift, GLfloat tShift);
00142
00149 void loadElectronPositions(Array1D<Array2D<double>*> &X, int start, int stop);
00150
00158 int mapping(int i, int j, int h, int w);
00159
00168 void unloadData(GPUQMCFramebuffer & which, int w, int h);
00169
00174 const static int nMats = 5;
00175
00179 const static int psi = 0;
00180 const static int grx = 1;
00181 const static int gry = 2;
00182 const static int grz = 3;
00183 const static int lap = 4;
00184
00189 int nRows, nCols;
00190
00195 int allocatedRows, allocatedCols;
00196
00201 int nElectrons, nBasisF;
00202
00207 int fxo_deltaOE, fxo_deltaBF;
00208
00213 int txt_deltaOE, txt_deltaBF;
00214
00218 int elecW, elecH;
00219
00223 int maxGaussians;
00224
00230 int basisfunctionParamsH;
00231
00233 static vector<CGprogram> fragProg;
00234 static vector<CGparameter> electronsCGP, paramsCGP;
00235
00237 static CGprogram fxo_to_txt_CG;
00238 static CGparameter fxo_to_txt_CGP;
00239
00240 GPUQMCFramebuffer basisFunctionsFB;
00241 GPUQMCFramebuffer outputFB;
00242
00246 GLuint electronsTexID;
00247
00251 GLfloat * cpuData;
00252 };
00253 #endif
00254 #endif