00001
00002
00003 #ifndef _included_GridTable_h
00004 #define _included_GridTable_h
00005
00011 #include "DAGHParams.h"
00012
00013 #include "GridBox.h"
00014 #include "GridBoxList.h"
00015
00016 #include "PackedGridDataBucket.h"
00017
00018 #include "CommServer.h"
00019
00020 #include <list>
00021
00022 #include <iosfwd>
00023 #include <cstdlib>
00024
00025 #define GridTableNULL ((GridTable *) 0)
00026
00031 class GridTable
00032 {
00033 friend std::ostream& operator<<(std::ostream&, const GridTable&);
00034
00035 public:
00036 const short gfid;
00037
00038 private:
00039 short numtsteps;
00040 short numlevels;
00041 std::list<GridDataBucketVoid*>* _data;
00042 std::list<GridDataBucketVoid*>* _ghosts;
00043
00044 static std::list<GridDataBucketVoid*>* _nulldata;
00045
00046 private:
00047
00048 GridTable(const GridTable&);
00049 void operator = (const GridTable&);
00050
00051 public:
00052 inline GridTable(const int gf,
00053 const int levs,
00054 const int ntsteps)
00055 : gfid(gf), numtsteps(ntsteps), numlevels(levs),
00056 _data(0), _ghosts(0)
00057 { _data = new std::list<GridDataBucketVoid*>[numtsteps];
00058 _ghosts = new std::list<GridDataBucketVoid*>[numtsteps*numlevels]; }
00059
00060 inline ~GridTable()
00061 { if (_data) delete [] _data; if (_ghosts) delete [] _ghosts; }
00062
00063 inline std::list<GridDataBucketVoid*>& data(const int t)
00064 { return (_data[t]); }
00065
00066 inline std::list<GridDataBucketVoid*>& ghosts(const int t, const int l)
00067 { return (_ghosts[t*numlevels+l]); }
00068
00069 void resettable();
00070
00071
00072 int send(const unsigned tag, GridDataBucketVoid* gdbkt,
00073 const int dest);
00074 };
00075
00076 std::ostream& operator<<(std::ostream&, const GridTable&);
00077
00078 #endif