00001 #ifndef _LEVELDATA_H_
00002 #define _LEVELDATA_H_
00003
00004 #include "BoxLayout.H"
00005 #include "BLIterator.H"
00006 #include "CH_Timer.H"
00007 #include <map>
00008
00009
00010
00011
00012
00013 template <class T=double, unsigned int C=1, unsigned char D=1, unsigned char E=1>
00014 class LevelData
00015 {
00016
00017 public:
00018
00019 LevelData();
00020
00021
00022 LevelData(const BoxLayout a_boxLayout, int a_ghostSize=0, int a_coarseningFactor=1);
00023
00024
00025 ~LevelData();
00026
00027
00028
00029
00030
00031
00032
00033
00034 Box getGhostBox(const Box& a_validBox, const int a_idir, const int& a_side);
00035
00036 void define(const BoxLayout a_boxLayoutm, int a_ghostSize=0, int a_coarseningFactor=1);
00037
00038
00039 const RectMDArray<T, C, D, E>& operator[](int a_index) const;
00040
00041
00042 const RectMDArray<T, C, D, E>& operator[](Point& a_pt) const;
00043
00044 RectMDArray<T, C, D, E>& operator[](int a_index);
00045
00046 RectMDArray<T, C, D, E>& operator[](Point& a_pt);
00047
00048 BoxLayout getBoxLayout() const {return m_boxLayout;};
00049
00050
00051
00052
00053
00054 void exchange();
00055
00056
00057 void copyTo(LevelData& a_dest, bool a_copyGhost=false) const;
00058
00059 Point getNeighbor(const Point& a_p, const Point& a_dir);
00060
00061
00062 int getGhostSize() const;
00063
00064
00065 void operator+=(const LevelData<T>& a_src);
00066
00067
00068 void setVal(const T & a_val);
00069
00070 void print() {
00071 cout << "GhostSize: " << m_ghostSize << endl;
00072 cout << "CoarseningFactor: " << m_coarseningFactor << endl << endl;
00073 cout << "BoxLayout: " << endl;
00074 m_boxLayout.print();
00075 }
00076
00077 private:
00078 BoxLayout m_boxLayout;
00079 vector<RectMDArray<T, C, D, E> > m_data;
00080 int m_ghostSize;
00081 int m_coarseningFactor;
00082
00083
00084
00085 LevelData(const LevelData<T>& a_levelData);
00086 LevelData& operator=(const LevelData<T>& a_levelData);
00087
00088 T mod(T& a_lhs, T& a_rhs) const;
00089
00090 void generateBoxes(const Box& a_box, const Point& a_point, Box& a_ghostCells, Box& a_neighborBox);
00091
00092
00093 void
00094 getPeriodicFlapNeighborInfo(Point & a_neighborPt,
00095 Box & a_neighborValid,
00096 Point & a_shiftdom,
00097 const Point & a_p,
00098 const int & a_idir,
00099 const int & a_iside) ;
00100
00101 void
00102 getPeriodicEdgeNeighborInfo(Point & a_neighborPt,
00103 Box & a_neighborValid,
00104 Point & a_shiftdom,
00105 const Point & a_p,
00106 const int & a_idir,
00107 const int & a_iside,
00108 const int & a_jdir,
00109 const int & a_jside) ;
00110
00111
00112 void
00113 getPeriodicCornerNeighborInfo(Point & a_neighborPt,
00114 Box & a_neighborValid,
00115 Point & a_shiftdom,
00116 const Point & a_p,
00117 const int & a_idir,
00118 const int & a_iside,
00119 const int & a_jdir,
00120 const int & a_jside,
00121 const int & a_kdir,
00122 const int & a_kside);
00123
00124 void exchangeSingleBox(const Point& a_p);
00125 };
00126 #include "LevelDataImplem.H"
00127
00128 #endif // _LEVELDATA_H_