00001
00005
00006 #ifndef _ORBLB_H_
00007 #define _ORBLB_H_
00008
00009 #include "CentralLB.h"
00010 #include "OrbLB.decl.h"
00011
00012 void CreateOrbLB();
00013 BaseLB *AllocateOrbLB(void);
00014
00015 class OrbLB : public CentralLB {
00016 public:
00017
00018 class Partition {
00019 public:
00020 int refno;
00021 double load;
00022 int origin[3];
00023 int corner[3];
00024 int count;
00025 int node, mapped;
00026 CkVec<int> bkpes;
00027 public:
00028 Partition(): refno(0), load(0.0), node(-1), mapped(0) {};
00029 };
00030
00031 private:
00032 struct ComputeLoad {
00033 int id;
00034 int v[3];
00035 double load;
00036 int refno;
00037 double tv;
00038 Partition * partition;
00039 };
00040
00041
00042 struct VecArray {
00043 int v;
00044 int id;
00045 };
00046
00047 enum {XDIR=0, YDIR, ZDIR};
00048
00049 LDStats* statsData;
00050 int P;
00051 ComputeLoad *computeLoad;
00052 int nObjs;
00053 VecArray *(vArray[3]);
00054 Partition *partitions;
00055 Partition top_partition;
00056 int npartition;
00057 int currentp, refno;
00058
00059 void strategy();
00060 void rec_divide(int, Partition&);
00061 void setVal(int x, int y, int z);
00062 int sort_partition(int x, int p, int r);
00063 void qsort(int x, int p, int r);
00064 void quicksort(int x);
00065 void mapPartitionsToNodes();
00066
00067 public:
00068 double overLoad;
00069
00070 public:
00071 OrbLB(const CkLBOptions &);
00072 OrbLB(CkMigrateMessage *m):CentralLB(m) { lbname = "OrbLB"; }
00073
00074 void work(LDStats* stats);
00075 CmiBool QueryBalanceNow(int step);
00076 };
00077
00078
00079 #endif
00080