Examples: 3D Jacobi using SDAG and Parameter marshalling, from Bigsim
[charm.git] / tests / charm++ / loadbalancing / jacobi2D / Jacobi2D.h
1
2 #include <vector>
3 using std::vector;
4 #include "pup_stl.h"
5
6 #include "Jacobi2D.decl.h"
7
8 #define  MIGRATE_STEPS              10
9
10  class TheMain: public CBase_TheMain  {
11   public: enum {NUM_CHUNKS=20};
12   public: enum {CHUNK_SIZE=64};
13   public: TheMain(CkArgMsg *);
14   public: virtual void pup(PUP::er &p);
15  };
16
17 typedef float arr_t[TheMain::CHUNK_SIZE+2][TheMain::CHUNK_SIZE+2];
18 PUPbytes(arr_t)
19
20  class JacobiChunk: public CBase_JacobiChunk  {
21   public: JacobiChunk(CkMigrateMessage *m) {}
22   private: float data[TheMain::CHUNK_SIZE+2][TheMain::CHUNK_SIZE+2];
23   private: int numIters;
24   private: int numGot;
25   private: int numDone;
26   private: int numNeighbors;
27   private: float maxDelta;
28   private: double startTime;
29   public: JacobiChunk();
30   public: void setStartTime(double t);
31   public: void startNextIter();
32   public: void getLeft(float left[]);
33   public: void getRight(float right[]);
34   public: void getTop(float top[]);
35   public: void getBottom(float bottom[]);
36   public: void refine();
37   public: void done(float delta);
38   public: virtual void pup(PUP::er &p);
39   public: void stepping(CkReductionMsg *m);
40   public: 
41     virtual void ResumeFromSync();
42     virtual void UserSetLBLoad();
43  };
44