CP_State_Plane.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////
00002 //////////////////////////////////////////////////////////////////////////////
00003 //////////////////////////////////////////////////////////////////////////////
00004 /** \file CP_State_Plane.h
00005  *
00006  */
00007 //////////////////////////////////////////////////////////////////////////////
00008  
00009 #ifndef _PLANE_H_
00010 #define _PLANE_H_
00011 
00012 //////////////////////////////////////////////////////////////////////////////
00013 
00014 #include "charm++.h"
00015 #include "../../include/debug_flags.h"
00016 #include "ckmulticast.h"
00017 #include "RTH.h"
00018 #include "StructFactorCache.h"
00019 #include "StructureFactor.h"
00020 void getSplitDecomp(int *,int *,int *,int , int ,int );
00021 
00022 //////////////////////////////////////////////////////////////////////////////
00023 
00024 
00025 //////////////////////////////////////////////////////////////////////////////
00026 //////////////////////////////////////////////////////////////////////////////
00027 //////////////////////////////////////////////////////////////////////////////
00028 class ProductMsg : public CkMcastBaseMsg, public CMessage_ProductMsg {
00029  public:
00030         int datalen, hops;
00031         int subplane;
00032         double *data;
00033         int idx;
00034 };
00035 //////////////////////////////////////////////////////////////////////////////
00036 //////////////////////////////////////////////////////////////////////////////
00037 //////////////////////////////////////////////////////////////////////////////
00038 //////////////////////////////////////////////////////////////////////////////
00039 class CompAtmForcMsg: public CkMcastBaseMsg, public CMessage_CompAtmForcMsg {
00040  public:
00041    int nZmat;
00042    int iterNL;
00043    double *zmat;
00044    void init(int _nzmat, double *_zmat, int _iterNL)
00045      {
00046        nZmat = _nzmat;
00047        iterNL = _iterNL;
00048        CmiMemcpy(zmat, _zmat, sizeof(double)* nZmat);
00049      }
00050    friend class CMessage_CompAtmForcMsg;
00051 };
00052 //////////////////////////////////////////////////////////////////////////////
00053 
00054 //////////////////////////////////////////////////////////////////////////////
00055 //////////////////////////////////////////////////////////////////////////////
00056 //////////////////////////////////////////////////////////////////////////////
00057 class NLDummyMsg: public CMessage_NLDummyMsg {
00058  public:
00059   int iteration;
00060 };
00061 //////////////////////////////////////////////////////////////////////////////
00062 
00063 
00064 //////////////////////////////////////////////////////////////////////////////
00065 //////////////////////////////////////////////////////////////////////////////
00066 //////////////////////////////////////////////////////////////////////////////
00067 class GHartDummyMsg: public CMessage_GHartDummyMsg {
00068 };
00069 //////////////////////////////////////////////////////////////////////////////
00070 
00071 
00072 //////////////////////////////////////////////////////////////////////////////
00073 //////////////////////////////////////////////////////////////////////////////
00074 //////////////////////////////////////////////////////////////////////////////
00075 class EnlCookieMsg : public CkMcastBaseMsg, public CMessage_EnlCookieMsg {
00076  public:
00077   int foo;
00078 };
00079 //////////////////////////////////////////////////////////////////////////////
00080 
00081 
00082 //////////////////////////////////////////////////////////////////////////////
00083 //////////////////////////////////////////////////////////////////////////////
00084 //////////////////////////////////////////////////////////////////////////////
00085 class RSDummyResume: public CMessage_RSDummyResume {
00086 };
00087 //////////////////////////////////////////////////////////////////////////////
00088 
00089 
00090 //////////////////////////////////////////////////////////////////////////////
00091 //////////////////////////////////////////////////////////////////////////////
00092 //////////////////////////////////////////////////////////////////////////////
00093 class GSAtmMsg: public CMessage_GSAtmMsg {
00094 };
00095 //////////////////////////////////////////////////////////////////////////////
00096 
00097 
00098 //////////////////////////////////////////////////////////////////////////////
00099 //////////////////////////////////////////////////////////////////////////////
00100 //////////////////////////////////////////////////////////////////////////////
00101 class TMsg: public CMessage_TMsg {
00102 public:
00103         int datalen;
00104         complex *data;
00105 };
00106 //////////////////////////////////////////////////////////////////////////////
00107 
00108 
00109 //////////////////////////////////////////////////////////////////////////////
00110 //////////////////////////////////////////////////////////////////////////////
00111 //////////////////////////////////////////////////////////////////////////////
00112 class GSIFFTMsg: public CMessage_GSIFFTMsg {
00113 public:
00114         int size;
00115         int offset;
00116         complex *data;
00117 };
00118 //////////////////////////////////////////////////////////////////////////////
00119 
00120 
00121 //////////////////////////////////////////////////////////////////////////////
00122 //////////////////////////////////////////////////////////////////////////////
00123 //////////////////////////////////////////////////////////////////////////////
00124 class GSPPIFFTMsg: public CMessage_GSPPIFFTMsg {
00125 public:
00126         int size;
00127         int offset;
00128         int iterNL;
00129         complex *data;
00130 };
00131 //////////////////////////////////////////////////////////////////////////////
00132 
00133 
00134 //////////////////////////////////////////////////////////////////////////////
00135 //////////////////////////////////////////////////////////////////////////////
00136 //////////////////////////////////////////////////////////////////////////////
00137 class RhoGSFFTMsg: public CMessage_RhoGSFFTMsg {
00138 public:
00139         int size;
00140         int offset;   
00141         int offsetGx; 
00142         int iopt;
00143         int num;
00144         complex *data;
00145 };
00146 //////////////////////////////////////////////////////////////////////////////
00147 
00148 //////////////////////////////////////////////////////////////////////////////
00149 //////////////////////////////////////////////////////////////////////////////
00150 //////////////////////////////////////////////////////////////////////////////
00151 class RhoGHartMsg: public CMessage_RhoGHartMsg {
00152 public:
00153         int size;
00154         int senderIndex;
00155         int offset;
00156         int offsetGx; 
00157         int iter;
00158         int iopt;
00159         int num;
00160         complex *data;
00161 };
00162 //////////////////////////////////////////////////////////////////////////////
00163 
00164 //////////////////////////////////////////////////////////////////////////////
00165 //////////////////////////////////////////////////////////////////////////////
00166 //////////////////////////////////////////////////////////////////////////////
00167 class RhoRHartMsg: public CMessage_RhoRHartMsg {
00168 public:
00169         int size;
00170         int senderIndex;
00171         int iopt;
00172         int iter;
00173         complex *data;
00174 };
00175 //////////////////////////////////////////////////////////////////////////////
00176 
00177 
00178 
00179 //////////////////////////////////////////////////////////////////////////////
00180 //////////////////////////////////////////////////////////////////////////////
00181 //////////////////////////////////////////////////////////////////////////////
00182 class NLFFTMsg: public CMessage_NLFFTMsg {
00183 public:
00184         int size;
00185         int senderIndex;
00186         int step;
00187         complex *data;
00188 };
00189 //////////////////////////////////////////////////////////////////////////////
00190 
00191 
00192 
00193 
00194 //////////////////////////////////////////////////////////////////////////////
00195 //////////////////////////////////////////////////////////////////////////////
00196 //////////////////////////////////////////////////////////////////////////////
00197 class RhoRSFFTMsg: public CMessage_RhoRSFFTMsg {
00198 public:
00199     int size; 
00200     int senderIndex;
00201     int iopt;
00202     complex *data;
00203 };
00204 //////////////////////////////////////////////////////////////////////////////
00205 
00206 //////////////////////////////////////////////////////////////////////////////
00207 //////////////////////////////////////////////////////////////////////////////
00208 //////////////////////////////////////////////////////////////////////////////
00209 class RhoHartRSFFTMsg: public CMessage_RhoHartRSFFTMsg {
00210 public:
00211     int size; 
00212     int index;
00213     int senderBigIndex;
00214     int senderStrtLine;
00215     int iopt;
00216     complex *data;
00217 };
00218 //////////////////////////////////////////////////////////////////////////////
00219 
00220 //////////////////////////////////////////////////////////////////////////////
00221 //////////////////////////////////////////////////////////////////////////////
00222 //////////////////////////////////////////////////////////////////////////////
00223 class GSRedPsiMsg: public CMessage_GSRedPsiMsg {
00224 public:
00225     int size; 
00226     int senderIndex;
00227     complex *data;
00228 };
00229 //////////////////////////////////////////////////////////////////////////////
00230 
00231 
00232 
00233 //////////////////////////////////////////////////////////////////////////////
00234 //////////////////////////////////////////////////////////////////////////////
00235 //////////////////////////////////////////////////////////////////////////////
00236 class RSFFTMsg: public CMessage_RSFFTMsg {
00237 public:
00238     int size; 
00239     int senderIndex;
00240     int numPlanes;
00241     complex *data;
00242 };
00243 //////////////////////////////////////////////////////////////////////////////
00244 
00245 //////////////////////////////////////////////////////////////////////////////
00246 //////////////////////////////////////////////////////////////////////////////
00247 //////////////////////////////////////////////////////////////////////////////
00248 class RPPPFFTMsg: public CMessage_RPPPFFTMsg {
00249 public:
00250     int size; 
00251     int senderIndex;
00252     int numPlanes;
00253     complex *data;
00254 };
00255 //////////////////////////////////////////////////////////////////////////////
00256 
00257 
00258 //////////////////////////////////////////////////////////////////////////////
00259 //////////////////////////////////////////////////////////////////////////////
00260 //////////////////////////////////////////////////////////////////////////////
00261 class GStateOutMsg: public CMessage_GStateOutMsg {
00262 public:
00263     int size; 
00264     int senderIndex;
00265     complex *data;
00266     complex *vdata;
00267     int *k_x;
00268     int *k_y;
00269     int *k_z;
00270 };
00271 //////////////////////////////////////////////////////////////////////////////
00272 
00273 
00274 //////////////////////////////////////////////////////////////////////////////
00275 //////////////////////////////////////////////////////////////////////////////
00276 //////////////////////////////////////////////////////////////////////////////
00277 class CP_State_GSpacePlane: public CBase_CP_State_GSpacePlane {
00278  public:
00279         int halfStepEvolve;
00280         int redPlane;
00281         int registrationFlag;
00282         int istate_ind;
00283         int iplane_ind;
00284         int first_step; ///ontrol flags and functions reference by thread are public
00285         int iwrite_now;
00286         int iteration;
00287         int nrotation;
00288         int myatom_integrate_flag; // 0 after I launch, 1 after return of atoms
00289         int myenergy_reduc_flag;   // 0 after I launch eke, 1 after return of energy
00290         int exitFlag;
00291         int iRecvRedPsi;
00292         int iRecvRedPsiV;
00293         int iSentRedPsi;
00294         int iSentRedPsiV;
00295         int finishedCpIntegrate;
00296         int isuspend_energy;
00297         int isuspend_atms;
00298         int numChunks;
00299         int ees_nonlocal;
00300         int cleanExitCalled;
00301         int isuspendNLForces;
00302         int numRecvRedPsi;
00303         int iterRotation;
00304         double ake_old;
00305         bool acceptedVPsi;
00306         bool doneDoingIFFT;
00307         bool triggerNL;
00308         bool NLready;
00309         friend class CP_State_ParticlePlane;
00310         CP_State_GSpacePlane(int, size2d, int, int, int, int,int,int);
00311         CP_State_GSpacePlane(CkMigrateMessage *m);
00312         ~CP_State_GSpacePlane(); 
00313         void pup(PUP::er &);
00314         void initGSpace(int, complex *,int ,complex *,
00315                         int,int,int,int,int,int,int);
00316         void startNLEes(bool,int);
00317         void launchAtoms();
00318         void launchOrthoT();
00319         void syncpsi();
00320         void requirePsiV();
00321         void doFFT();
00322         void startNewIter ();
00323         void sendPsi();
00324         void sendPsiV();
00325         void screenOutputPsi();
00326         void sendLambda();
00327         void makePCproxies();
00328         void doneRedPsiIntegrate();
00329         void sendRedPsi();
00330         void combineForcesGetEke();
00331         void integrateModForce();
00332         void writeStateDumpFile();
00333         void isAtSync(int);
00334         void ResumeFromSync();
00335         bool weneedPsiV();
00336         void acceptNLForces ();
00337         void acceptNLForcesEes();
00338         bool doneNLForces();
00339         bool allDoneIFFT() {return allgdoneifft;}
00340         void doIFFT(GSIFFTMsg *);
00341         void acceptAtoms(GSAtmMsg *msg);
00342         void acceptEnergy(GSAtmMsg *msg);
00343         void gdoneIFFT(CkReductionMsg *msg);
00344         void gdonePsiV(CkReductionMsg *msg);
00345         void gdonePsi(CkReductionMsg *msg);
00346         bool allAcceptedPsiDone(){return(allAcceptedPsi);}
00347         void resumePsiV (CkReductionMsg *msg);
00348         void psiWriteComplete(CkReductionMsg *msg);
00349         void releaseSFComputeZ();
00350         void acceptNewPsi(CkReductionMsg *msg);
00351         void acceptNewPsi(partialResultMsg  *msg);
00352         void doNewPsi();
00353         void collectFileOutput(GStateOutMsg *msg);
00354         void acceptNewPsiV(CkReductionMsg *msg);
00355         void acceptNewPsiV(partialResultMsg *msg);
00356         void doNewPsiV();
00357         void acceptAllLambda(CkReductionMsg *msg);
00358         void psiCgOvlap(CkReductionMsg *msg);
00359         void acceptLambda(CkReductionMsg *msg);
00360         void acceptLambda(partialResultMsg *msg);
00361         void doLambda();
00362         void acceptRedPsi(GSRedPsiMsg *msg);  
00363         void computeCgOverlap();
00364         void run ();
00365         void sendFFTData ();
00366         void doIFFT ();
00367         void readFile();
00368         void computeEnergies(int p, double d);
00369         void startFFT(CkReductionMsg *msg);
00370         void sendRedPsiV();
00371         void acceptRedPsiV(GSRedPsiMsg *msg);
00372         void doneRedPsiVIntegrate();
00373  private:
00374         int forwardTimeKeep;
00375         int backwardTimeKeep;
00376         int ireset_cg;
00377         int numReset_cg;
00378         int istart_typ_cp;
00379         int countIFFT;
00380         int countFileOut;
00381         int countRedPsi;
00382         int countRedPsiV;
00383         int ecount;
00384         int countPsi;
00385         int countVPsi;
00386         int countLambda;
00387         int *countPsiO;
00388         int *countVPsiO;
00389         int *countLambdaO;
00390         int AllPsiExpected;
00391         int AllLambdaExpected;
00392         int itemp;
00393         int jtemp;
00394         bool needPsiV;
00395         bool allgdoneifft;
00396         bool initialized;
00397         bool allAcceptedPsi;
00398         bool acceptedPsi;
00399         bool allAcceptedVPsi;
00400         bool doneNewIter;
00401         bool acceptedLambda;
00402         double ehart_total;
00403         double enl_total;
00404         double eke_total;
00405         double fictEke_total;
00406         double fmagPsi_total;
00407         double fmagPsi_total_old;
00408         double fmagPsi_total0;
00409         double fovlap;
00410         double fovlap_old;
00411         double egga_total;
00412         double eexc_total;
00413         double eext_total;
00414         double ewd_total;
00415         double total_energy;
00416         double cpuTimeNow;
00417         int gSpaceNumPoints;
00418         GStateSlab gs; 
00419         int *tk_x,*tk_y,*tk_z;  // Temp memory for output (size could be 0)
00420         complex *tpsi;          // Temp memory for output (needs careful pup)
00421         complex *tvpsi;         // Temp memory for output
00422         CProxy_CP_State_RealSpacePlane real_proxy;
00423         CProxySection_StructureFactor sfCompSectionProxy;
00424         CProxySection_PairCalculator *lambdaproxy;
00425         CProxySection_PairCalculator *lambdaproxyother;
00426         CProxySection_PairCalculator *psiproxy;
00427         CProxySection_PairCalculator *psiproxyother;
00428         PairCalcID gpairCalcID1;
00429         PairCalcID gpairCalcID2;
00430 
00431         RTH_Runtime* run_thread; // why is this private?
00432 #ifdef _CP_GS_DEBUG_COMPARE_VKS_
00433         complex *savedvksBf;
00434         complex *savedforceBf;
00435 #endif
00436 #ifdef  _CP_GS_DEBUG_COMPARE_PSI_
00437         // place to keep data loaded from files for comparison
00438         complex *savedpsiBfp;
00439         complex *savedpsiBf;
00440         complex *savedpsiAf;
00441         complex *savedlambdaBf;
00442         complex *savedlambdaAf;
00443 #endif
00444         
00445 };
00446 //////////////////////////////////////////////////////////////////////////////
00447 
00448 
00449 //////////////////////////////////////////////////////////////////////////////
00450 //////////////////////////////////////////////////////////////////////////////
00451 //////////////////////////////////////////////////////////////////////////////
00452 class CP_State_RealSpacePlane : public CBase_CP_State_RealSpacePlane {
00453  public:
00454         CP_State_RealSpacePlane(size2d, int, int,int,int,int,int,int);
00455         CP_State_RealSpacePlane(CkMigrateMessage *m) {};
00456         ~CP_State_RealSpacePlane() { if(cookie!=NULL) delete [] cookie; };
00457         void doFFT(RSFFTMsg *);
00458         void doFFT();
00459         void doVksFFT();
00460         void doProduct(ProductMsg *);
00461         void doProductThenFFT();
00462         void sendFPsiToGSP();
00463         void run();
00464         void setNumPlanesToExpect(int num);
00465         void printData();
00466         void init(ProductMsg *);
00467         void doReduction();
00468         void ResumeFromSync();  
00469         void pup(PUP::er &);
00470         void rdoneVks(CkReductionMsg *msg);
00471         bool allVksDone()
00472           {
00473             return vksDone;
00474           }
00475  private:
00476         int forwardTimeKeep;
00477         int backwardTimeKeep;
00478         int iplane_ind;
00479         int iteration;
00480         int rhoRsubplanes;
00481         int ngrida;
00482         int ngridb;
00483         int ngridc;
00484         int count;
00485         int rsize;
00486         int csize;
00487         int countProduct;
00488         int numCookies;
00489         bool vksDone;
00490         RealStateSlab rs;
00491         CkSectionInfo *cookie;
00492         CProxy_CP_State_GSpacePlane gproxy;
00493         RTH_Runtime* run_thread;
00494 };
00495 //////////////////////////////////////////////////////////////////////////////
00496 
00497 
00498 //////////////////////////////////////////////////////////////////////////////
00499 //////////////////////////////////////////////////////////////////////////////
00500 //////////////////////////////////////////////////////////////////////////////
00501 class CP_Rho_RealSpacePlane : public CBase_CP_Rho_RealSpacePlane {
00502  public:        
00503         int listSubFlag;
00504         int cp_grad_corr_on;
00505         int ees_eext_on;
00506         int nplane_rho_x;
00507         int ngridcEext;
00508         int ngrida;
00509         int ngridb;
00510         int ngridc;
00511         int iplane_ind;
00512         int myNgridb;      // I don't have all ngridb lines of x now
00513         int myNplane_rho;  // I don't have all nplane_rho_x lines of y now
00514         int nptsExpndA;
00515         int nptsExpndB;
00516         int nptsA;
00517         int nptsB;
00518         int myBoff;
00519         int myAoff;
00520         int countDebug;
00521         int countFFTRyToGy;
00522         int rhoRsubplanes;
00523         int myTime;
00524         bool doneRhoReal;
00525         bool doneRHart;
00526         int recvCountFromGRho;
00527         int recvCountFromGHartExt;
00528         CP_Rho_RealSpacePlane(CkMigrateMessage *m){}
00529         CP_Rho_RealSpacePlane(int, size2d, bool,int,int,int);
00530         void init();
00531        ~CP_Rho_RealSpacePlane();
00532         void pup(PUP::er &);
00533         void acceptDensity(CkReductionMsg *);
00534         void launchEextRNlG();
00535         void energyComputation();
00536         void fftRhoRtoRhoG();
00537         void launchNLRealFFT();
00538         void sendPartlyFFTRyToGy(int iopt);
00539         void acceptRhoGradVksRyToGy(RhoGSFFTMsg *msg);
00540         void fftRhoRyToGy(int iopt);
00541         void sendPartlyFFTtoRhoG(int );
00542         void acceptGradRhoVks(RhoRSFFTMsg *);
00543         void sendPartlyFFTGxToRx(int );
00544         void acceptRhoGradVksGxToRx(RhoGSFFTMsg *msg);
00545         void GradCorr();
00546         void whiteByrdFFT();
00547         void acceptWhiteByrd(RhoRSFFTMsg *msg);
00548         void addWhiteByrdVks();
00549         void acceptHartVks(RhoHartRSFFTMsg *);
00550         void addHartEextVks();
00551         void RHartReport();
00552         void doMulticastCheck();
00553         void doMulticast();
00554         void exitForDebugging();
00555         void isAtSync(int iter){AtSync();};
00556         void ResumeFromSync();
00557         void sendPartlyFFTtoRhoGall();
00558         void acceptGradRhoVksAll(RhoRSFFTMsg *msg);
00559  private:
00560         int rhoKeeperId;
00561         int rhoGHelpers;
00562         int countGradVks[5]; // number of collections that have arrived
00563         int countIntRtoG[5]; // our internal transpose friends.
00564         int countIntGtoR[5]; // our internal transpose friends.
00565         int countWhiteByrd;  // number of collections that have arrived
00566         int countRHart;
00567         int countRHartValue;
00568         int doneGradRhoVks; // count 1,2,3 = x,y,z all done
00569         bool doneWhiteByrd;
00570         bool doneHartVks;
00571         double FFTscale;        
00572         double volumeFactor;        
00573         double probScale;             
00574         RhoRealSlab rho_rs; 
00575         //Comlib multicast proxy
00576         CProxySection_CP_State_RealSpacePlane realSpaceSectionProxy;
00577         CProxySection_CP_State_RealSpacePlane realSpaceSectionCProxy;
00578         CProxy_CP_Rho_GSpacePlane rhoGProxy_com;
00579         CProxy_CP_Rho_GSpacePlane rhoGProxyIGX_com;
00580         CProxy_CP_Rho_GSpacePlane rhoGProxyIGY_com;
00581         CProxy_CP_Rho_GSpacePlane rhoGProxyIGZ_com;
00582         RTH_Runtime* run_thread;
00583 };
00584 //////////////////////////////////////////////////////////////////////////////
00585 
00586 
00587 //////////////////////////////////////////////////////////////////////////////
00588 //////////////////////////////////////////////////////////////////////////////
00589 //////////////////////////////////////////////////////////////////////////////
00590 class CP_Rho_GSpacePlane:  public CBase_CP_Rho_GSpacePlane {
00591  public:
00592         CP_Rho_GSpacePlane(CkMigrateMessage *m) {}
00593         CP_Rho_GSpacePlane(int, size2d, int, int, bool);
00594         ~CP_Rho_GSpacePlane();
00595         void run();
00596         void init();
00597         void acceptRhoData(RhoGSFFTMsg *msg);
00598         void acceptRhoData(); // refine the name
00599         void ResumeFromSync();
00600         void divRhoVksGspace();
00601         void RhoGSendRhoR(int );
00602         void acceptWhiteByrd(RhoGSFFTMsg *);
00603         void acceptWhiteByrd();
00604         void pup(PUP::er &p);
00605         void isAtSync(int iter){AtSync();};
00606         int cp_grad_corr_on;
00607         int ees_eext_on;
00608         int ngridcEext;
00609         int rhoRsubplanes;
00610         int countDebug;
00611         void exitForDebugging();
00612         void acceptWhiteByrdAll(RhoGSFFTMsg *msg);
00613         void RhoGSendRhoRall(); 
00614         void launchNlG();
00615  private:
00616         CProxySection_CP_State_GSpacePlane nlsectproxy;
00617         int myTime;
00618         int recvCountFromRRho;
00619         int nPacked;
00620         int count_stuff;
00621         int count;
00622         int countWhiteByrd[4];
00623         int doneWhiteByrd;
00624         int rhoGHelpers;
00625         int iplane_ind;
00626         int *numSplit;
00627         int *istrtSplit;
00628         int *iendSplit;
00629         RhoGSlab rho_gs;
00630         CProxy_CP_Rho_RealSpacePlane rhoRealProxy0_com;
00631         CProxy_CP_Rho_RealSpacePlane rhoRealProxy1_com;
00632         CProxy_CP_Rho_RealSpacePlane rhoRealProxy2_com;
00633         CProxy_CP_Rho_RealSpacePlane rhoRealProxy3_com;
00634         CProxy_CP_Rho_RealSpacePlane rhoRealProxyByrd_com;
00635 };
00636 //////////////////////////////////////////////////////////////////////////////
00637 
00638 
00639 //////////////////////////////////////////////////////////////////////////////
00640 //////////////////////////////////////////////////////////////////////////////
00641 //////////////////////////////////////////////////////////////////////////////
00642 class CP_Rho_RHartExt:  public CBase_CP_Rho_RHartExt {
00643  public:
00644         int listSubFlag;
00645         int nplane_rho_x;
00646         int rhoRsubplanes;
00647         int registrationFlag;
00648         int launchFlag;
00649         int ngrida;
00650         int ngridb;
00651         int ngridc;
00652         int iplane_ind;
00653         int ees_eext_on;
00654         int natmTyp;
00655         int countFFT[2];
00656         int countIntRtoG;
00657         int countIntGtoR[2];
00658         int iteration;
00659         int iterAtmTyp;
00660         int csize;
00661         int nAtmTypRecv;
00662         int csizeInt;
00663         int myNgridb;
00664         int myBoff;
00665         int nptsB;
00666         int nptsExpndB;
00667         int myNplane_rho;
00668         int myAoff;
00669         int nptsA;
00670         int nptsExpndA;
00671         int countDebug;
00672         int recvCountFromGHartExt;
00673         int nchareHartAtmT;
00674         int natmTypTot;
00675         int atmTypoff;
00676 
00677         complex *atmSFC;
00678         double  *atmSFR;
00679         complex *atmForcC;
00680         double  *atmForcR;
00681 
00682         complex *atmEwdSFC;
00683         double  *atmEwdSFR;
00684         complex *atmEwdForcC;
00685         double  *atmEwdForcR;
00686 
00687         complex *atmSFCint;
00688         double  *atmSFRint;
00689         complex *atmForcCint;
00690         double  *atmForcRint;
00691 
00692         complex *atmEwdSFCint;
00693         double  *atmEwdSFRint;
00694         complex *atmEwdForcCint;
00695         double  *atmEwdForcRint;
00696 
00697         CProxy_CP_Rho_GHartExt rhoGHartProxy_com;
00698         CP_Rho_RHartExt(CkMigrateMessage *m) {}
00699         CP_Rho_RHartExt(int , int , int , int , int );
00700         ~CP_Rho_RHartExt();
00701         void init();
00702         void pup(PUP::er &p);
00703         void startEextIter();
00704         void computeAtmSF();
00705         void registrationDone(CkReductionMsg *msg);
00706         void fftAtmSfRtoG();
00707         void sendAtmSfRyToGy();
00708         void recvAtmSfRyToGy(RhoGHartMsg *msg);
00709         void sendAtmSfRhoGHart();
00710         void recvAtmForcFromRhoGHart(RhoRHartMsg *msg);
00711         void fftAtmForcGtoR(int flagEwd);
00712         void sendAtmForcGxToRx(int iopt);
00713         void recvAtmForcGxToRx(RhoGHartMsg *msg);
00714         void computeAtmForc(int);
00715         void exitForDebugging();
00716 };
00717 //////////////////////////////////////////////////////////////////////////////
00718 
00719 //////////////////////////////////////////////////////////////////////////////
00720 //////////////////////////////////////////////////////////////////////////////
00721 //////////////////////////////////////////////////////////////////////////////
00722 class CP_Rho_GHartExt:  public CBase_CP_Rho_GHartExt {
00723  public:
00724         CP_Rho_GHartExt(CkMigrateMessage *m) {}
00725         CP_Rho_GHartExt(size2d,int , int , int , int ,int );
00726         void init();
00727         ~CP_Rho_GHartExt();
00728         void pup(PUP::er &);
00729         void acceptData(RhoGHartMsg *msg);
00730         void HartExtVksG();
00731         void FFTVks();
00732         void sendVks();
00733         void acceptVks(int size, complex * inVks);
00734         void acceptAtmSFTot(int size, complex * inAtm);
00735         void recvAtmSFFromRhoRHart(RhoGHartMsg *msg);
00736         void FFTEesBck();
00737         void getHartEextEes();
00738         void FFTEesFwd(int );
00739         void sendAtmSF(int );
00740         void isAtSync(int iter){AtSync();};
00741         int rhoRsubplanes;
00742         int ngridaEext;
00743         int ngridbEext;
00744         int ngridcEext;
00745         int ees_eext_on;
00746         int natmTyp;
00747         int iterAtmTyp;
00748         int nsendAtmTyp;
00749         int numFullEext;
00750         int registrationFlag;
00751         int launchFlag;
00752         int CountDebug;
00753         complex *atmSF;
00754         complex *atmSFtot;
00755         double ehart_ret;
00756         double eext_ret;
00757         double ewd_ret;
00758         void registrationDone(CkReductionMsg *msg);
00759         void exitForDebugging();
00760  private:
00761         complex *atmSFtotRecv;
00762         complex *VksRecv;
00763         int countAtmSFtot;
00764         int countVksTot;
00765         int nchareHartAtmT;
00766         int natmTypTot;
00767         int atmTypoff;
00768         int recvCountFromRHartExt;
00769         RhoGSlab rho_gs;
00770         int atmSFHere;
00771         int densityHere;
00772         int countEextFFT;
00773         int iopt;
00774         int iteration;
00775         int ind_x;       // This chares index=thisIndex.x.
00776         int ind_xdiv;    // This chare is a subcollection of rhog(ind_xdiv).
00777         int ind_xrem;    // The subcollection index  0<= ind_rem < rhoGHelpers.
00778         int rhoGHelpers; // The number of subcolletions of each rhog(ind_xdiv).
00779         int istrt_lines;  // start of my subdivion of lines in rhog()
00780         int iend_lines;   // end of my subdivion of lines in rhog()
00781         int numLines;    // Number of lines in my subdivision
00782         CProxy_CP_Rho_RealSpacePlane rhoRealProxy_com;
00783         CProxy_CP_Rho_RHartExt       rhoRHartProxy_com0;
00784         CProxy_CP_Rho_RHartExt       rhoRHartProxy_com1;
00785         int **index_pack_tran;
00786 };
00787 //////////////////////////////////////////////////////////////////////////////
00788 
00789 
00790 //////////////////////////////////////////////////////////////////////////////
00791 //////////////////////////////////////////////////////////////////////////////
00792 //////////////////////////////////////////////////////////////////////////////
00793 class CP_State_ParticlePlane: public CBase_CP_State_ParticlePlane {
00794  public:
00795         CP_State_ParticlePlane(CkMigrateMessage *m) {}
00796         CP_State_ParticlePlane(int ,int ,int ,int ,int ,int ,int ,int ,int ,int ,
00797                                int ,int ,int ,int ,int );
00798         ~CP_State_ParticlePlane();
00799         void pup(PUP::er &);
00800         void startNLEes(int);
00801         void lPrioStartNLEes(NLDummyMsg *m);
00802         void computeZ(PPDummyMsg *m);
00803         void setEnlCookie(EnlCookieMsg *m);
00804         void ResumeFromSync();
00805         void reduceZ(int, int, complex *,complex *,complex *,complex *);
00806         void getForces(int, int, complex *);
00807 
00808         void createNLEesFFTdata();
00809         void FFTNLEesFwd();
00810         void sendToEesRPP();
00811         void recvFromEesRPP(GSPPIFFTMsg *msg);
00812         void FFTNLEesBck();
00813         void computeNLEesForces();
00814         void registrationDone(CkReductionMsg *msg);
00815 
00816         friend class CP_State_GSpacePlane;
00817         int myChareG;
00818         int iteration;
00819         int iterNL;
00820         int numNLiter;
00821         int ees_nonlocal;
00822         int ngridaNL;
00823         int ngridbNL;
00824         int ngridcNL;
00825         int gSpaceNumPoints;
00826         int numLines;
00827         int numFullNL;
00828         int natm_nl;
00829         int natm_nl_grp_max;
00830         int numSfGrps;
00831         int nstates;
00832         int nchareG;
00833         int Gstates_per_pe;
00834         int countNLIFFT;
00835         int sendDone;
00836         int registrationFlag;
00837  private:
00838         int calcReductionPlaneNum(int);
00839         void initKVectors(GStateSlab *);
00840         bool doneGettingForces;
00841         complex *myForces, *gspace, *projPsiG;
00842         complex *zmatrixSum, *zmatrix;
00843         double *dyp_re,*dyp_im;
00844         double enl;
00845         double enl_total;
00846         double totalEnergy;
00847         int *haveSFAtmGrp;
00848         int *count;
00849         int doneEnl;
00850         int doneForces;
00851         int zsize, energy_count;
00852         int sizeX, sizeY, sizeZ, gSpacePlanesPerChare;
00853         int reductionPlaneNum;
00854         complex *zmatrix_fx,*zmatrix_fy,*zmatrix_fz;
00855         complex *zmatrixSum_fx,*zmatrixSum_fy,*zmatrixSum_fz;
00856         CkSectionInfo enlCookie; 
00857         CProxySection_CP_State_ParticlePlane particlePlaneENLProxy;
00858         CProxy_CP_State_RealParticlePlane realPP_proxy;
00859 #ifdef _CP_GS_DEBUG_COMPARE_VKS_
00860         complex *savedprojpsiBf;
00861         complex *savedprojpsiBfsend;
00862         complex *savedprojpsiGBf;
00863 #endif
00864 
00865  public: 
00866 };
00867 //////////////////////////////////////////////////////////////////////////////
00868 
00869 
00870 //////////////////////////////////////////////////////////////////////////////
00871 //////////////////////////////////////////////////////////////////////////////
00872 //////////////////////////////////////////////////////////////////////////////
00873 class CP_State_RealParticlePlane: public CBase_CP_State_RealParticlePlane {
00874  public:
00875   // Variables
00876    int ees_nonlocal;
00877    int nChareR;           // Real Space chares=# C-planes
00878    int nChareG;           // G Space chares
00879    int Rstates_per_pe;    // Real Space topomap variable
00880    int myPlane;           // Real space plane number
00881 
00882    int rhoRTime;
00883    int numIterNl;         // # of non-local iterations per time step
00884    int countZ;
00885    int countEnl;
00886    int count;             // fft communication counter
00887    int iterNL;            // Nl iteration counter
00888    int itime;             // time step counter;
00889    int recvBlock;
00890  
00891    int ngridA;            // FFT grid size along a
00892    int ngridB;            // FFT grid size along b
00893    int ngridC;            // FFT grid size along c
00894    int planeSize;         // expanded plane size for FFTing
00895    int planeSizeT;        // true plane size 
00896    int csize;             // complex variable size for FFT
00897    int zmatSizeMax;       // zmatrix size for projector
00898    int reductionPlaneNum; // Reduction Plane number
00899    int itimeRed;
00900 
00901    int registrationFlag;
00902 
00903    bool launchFFT; 
00904    bool fftDataDone;
00905 
00906    double cp_enl;         // Non-local energy
00907    double cp_enlTot;      // Reduced Non-local energy
00908    double *projPsiR;      // real/final form of projector (after gx,gy FFTs)
00909    double *zmat;          // Non-local matrix
00910    double *zmatScr;      // Non-local matrix
00911    complex *projPsiC;     // complex/intermediate form of projector (before gx,gy FFTs)
00912 
00913   //-----------
00914   // Proxies
00915 
00916    CProxySection_CP_State_RealParticlePlane rPlaneSectProxy; // Section Red proxy zmat
00917    CProxySection_CP_State_RealParticlePlane rPlaneENLProxy;  // Section Red proxy cp_enl
00918    CkSectionInfo rPlaneRedCookie;   // Section Red cookie for zmat
00919    CkSectionInfo rEnlCookie;        // Section Red cookie for cp_enl
00920    CProxy_CP_State_ParticlePlane gPP_proxy;
00921 #ifdef _CP_GS_DEBUG_COMPARE_VKS_
00922   complex *savedprojpsiC;
00923   complex *savedProjpsiCScr;
00924   double *savedProjpsiRScr;
00925   double *savedzmat;
00926   double **savedmn;
00927   double **saveddmn_x;
00928   double **saveddmn_y;
00929   double **saveddmn_z;
00930   int **savedigrid;
00931 
00932 #endif
00933   //-----------
00934   // Functions
00935    CP_State_RealParticlePlane(CkMigrateMessage *m) {}
00936    CP_State_RealParticlePlane(int , int , int ,int , int ,int ,int,int);
00937    void init();
00938   ~CP_State_RealParticlePlane();
00939    void launchFFTControl(int );
00940    void pup(PUP::er &);
00941    void printEnlR(CkReductionMsg *m);
00942    void printEnlRSimp(double,int,int);
00943    void recvFromEesGPP(NLFFTMsg *);
00944    void FFTNLEesFwdR();
00945    void computeZmatEes();
00946    void recvZMatEes(CkReductionMsg *);
00947    void computeAtmForcEes(CompAtmForcMsg *msg);
00948    void FFTNLEesBckR();
00949    void sendToEesGPP();
00950    void setPlaneRedCookie(EnlCookieMsg *);
00951    void setEnlCookie(EnlCookieMsg *);
00952    int calcReductionPlaneNum(int );
00953    void registrationDone(CkReductionMsg *msg);
00954    void recvZMatEesSimp(int , double *,int,int,int);
00955 };
00956 //////////////////////////////////////////////////////////////////////////////
00957 
00958 
00959 //////////////////////////////////////////////////////////////////////////////
00960 #endif // #ifndef _PLANE_H_
00961 //////////////////////////////////////////////////////////////////////////////
00962 
00963 
00964 

Generated on Thu Dec 6 18:25:29 2007 for leanCP by  doxygen 1.5.3