lambda.h

Go to the documentation of this file.
00001 
00002 /********************************************************************************
00003  * Lambda created by Eric Bohm 2006/7/23
00004  *
00005  *
00006  * 
00007 ********************************************************************************/
00008 
00009 //////////////////////////////////////////////////////////////////////////////
00010 //////////////////////////////////////////////////////////////////////////////
00011 //////////////////////////////////////////////////////////////////////////////
00012 /** \file lambda.h
00013  *
00014  */
00015 //////////////////////////////////////////////////////////////////////////////
00016 
00017 #ifndef _lambda_h_
00018 #define _lambda_h_
00019 
00020 #include "CLA_Matrix.h"
00021 #include "ckPairCalculator.h"
00022 extern Config config;
00023 extern int nstates;
00024 extern  PairCalcID pairCalcID1;
00025 extern  PairCalcID pairCalcID2;
00026 
00027 class Lambda : public CBase_Lambda{
00028  public:
00029   Lambda(){}
00030   Lambda(CkMigrateMessage *m){}
00031   Lambda(int lgrain, int ograin, int sgrain) : lambdaGrainSize(lgrain), orthoGrainSize(ograin), sGrainSize(sgrain) 
00032     {
00033       lPairCalcID2=pairCalcID2;
00034     }
00035   
00036   ~Lambda(){
00037   }
00038   // catch lambda for later non_minimization use
00039   void acceptAllLambda(CkReductionMsg *msg); 
00040 
00041   // catch lbresume reduction
00042   void lbresume(CkReductionMsg *msg); 
00043 
00044   // catch lambda for later non_minimization use
00045   void acceptSectionLambda(CkReductionMsg *msg); 
00046 
00047   void makeSections(int indexSize, int *indexZ);
00048 
00049   virtual void pup(PUP::er &p){
00050 ///    CBase_Lambda::pup(p);
00051     ArrayElement2D::pup(p);
00052     p | lambdaGrainSize;
00053     p | orthoGrainSize;
00054     p | sGrainSize;
00055     p | lPairCalcID2;
00056   }
00057 
00058  private:
00059   int lambdaGrainSize;
00060   int orthoGrainSize;
00061   int sGrainSize;
00062   PairCalcID lPairCalcID2;
00063 };
00064 
00065 /**
00066  * provide procnum mapping for Ortho
00067  */
00068 class LambdaMap : public CkArrayMap {
00069   public:
00070   LambdaMap(int NN,int _nLambda, int _stride):N(NN), nLambda(_nLambda), stride(_stride)
00071       {
00072         offset=0;
00073         if(nLambda<CkNumPes())
00074           offset=1;  //skip proc 0
00075       }
00076     virtual int procNum(int arrayHdl, const CkArrayIndex &iIndex){
00077       int *index=(int *) iIndex.data();
00078       return (stride*(N * index[0] + index[1]) + offset) % CkNumPes();
00079     }
00080   private:
00081     int N;
00082     int nLambda;
00083     int offset;
00084     int stride;
00085 };
00086 
00087 #endif // #ifndef _lambda_h_
00088 

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