00001
00007 #ifndef ALGROB_H
00008 #define ALGROB_H
00009
00010
00011 #include "PatchMap.h"
00012 #include "Rebalancer.h"
00013
00014 class AlgRecBisection : public Rebalancer
00015 {
00016 private:
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 public:
00027 Partition(): refno(0), load(0.0), node(-1), mapped(0) {};
00028 inline int operator==(const Partition &p) const { return origin[0]==p.origin[0] && origin[1]==p.origin[1] && origin[2]==p.origin[2] && corner[0]==p.corner[0] && corner[1]==p.corner[1] && corner[2]==p.corner[2]; }
00029 };
00030
00031 typedef struct {
00032 int id;
00033 int v[3];
00034 double load;
00035 int refno;
00036 int tv;
00037 } ComputeLoad;
00038
00039
00040 typedef struct {
00041 int v;
00042 int id;
00043 } VecArray;
00044
00045 enum {XDIR=0, YDIR, ZDIR};
00046
00047 ComputeLoad *computeLoad;
00048 VecArray *(vArray[3]);
00049 Partition *partitions;
00050 Partition top_partition;
00051 int npartition;
00052 int currentp, refno;
00053
00054 void strategy();
00055 void rec_divide(int, Partition&);
00056 void setVal(int x, int y, int z);
00057 int sort_partition(int x, int p, int r);
00058 void qsort(int x, int p, int r);
00059 void quicksort(int x);
00060 void mapPartitionsToNodes();
00061
00062
00063 public:
00064 AlgRecBisection(computeInfo *computeArray, patchInfo *patchArray,
00065 processorInfo *processorArray, int nComps,
00066 int nPatches, int nPes);
00067 };
00068
00069 #endif
00070
00071
00072
00073