Main Page | Class List | File List

Common.h

00001 #ifndef Common_h
00002 #define Common_h
00003 
00004 #include "Vector.h"
00005 
00006 template <class T> class Grid {
00007         T* cells;
00008 
00009         IVector size;
00010 public:
00011         Grid( T *c, IVector t): size(t){
00012                 cells=c;
00013         }
00014 
00015         Grid(IVector t): size(t){
00016                 cells=new T[t.x*t.y*t.z];
00017         }
00018 
00019         T &operator[](int i){
00020                 return cells[i];
00021         }
00022 
00023         T& getCell(IVector &pos){
00024                 return cells[pos.x + pos.y*size.x + pos.z*size.x*size.y];
00025         }
00026 
00027 };
00028 
00029 
00030 #endif

Generated on Mon Jan 26 22:13:12 2004 for fluid3 by doxygen 1.3.5