00001
00002
00003
00004
00005
00006 #ifndef AMROC_GFMLEVELSET_H
00007 #define AMROC_GFMLEVELSET_H
00008
00022 template <class DataType, int dim>
00023 class GFMLevelSet : public controlable {
00024
00025 public:
00026 typedef GridFunction<DataType,dim> grid_fct_type;
00027 typedef GridData<DataType,dim> grid_data_type;
00028
00029 GFMLevelSet() : _PlotPhi(0), _Stationary(0), _Ghosts(0), _Dim(dim) {
00030 _Hierarchy = (GridHierarchy*) 0;
00031 }
00032
00033 virtual ~GFMLevelSet() {}
00034
00035
00036
00037
00038 virtual void SetGrid(grid_data_type& gdphi, const int& Level, const double& t) = 0;
00039
00040
00041 virtual void register_at(ControlDevice& Ctrl, const std::string& prefix) {
00042 LocCtrl = Ctrl.getSubDevice(prefix+"LevelSet");
00043 RegisterAt(LocCtrl,"PlotPhi",_PlotPhi);
00044 RegisterAt(LocCtrl,"Stationary",_Stationary);
00045 }
00046 virtual void register_at(ControlDevice& Ctrl) {
00047 register_at(Ctrl, "");
00048 }
00049 virtual void init() {}
00050 virtual void update() {}
00051 virtual void finish() {}
00052
00053 virtual void SetPhi(grid_fct_type& phi, const int Time, const int Level, double t) {
00054 forall (phi,Time,Level,c)
00055 SetGrid(phi(Time,Level,c),Level,t);
00056 end_forall
00057 START_WATCH
00058 Sync(phi,Time,Level);
00059 END_WATCH(LS_SYNC)
00060 START_WATCH
00061 ExternalBoundaryUpdate(phi,Time,Level);
00062 END_WATCH(BOUNDARIES_EXTERNAL)
00063 }
00064
00065 inline const int& PlotPhi() const { return _PlotPhi; }
00066 inline const int& Stationary() const { return _Stationary; }
00067 inline void SetStationary(int stat) { _Stationary = stat; }
00068
00069 virtual void SetupData(GridHierarchy* gh, const int& ghosts) {
00070 _Hierarchy = gh;
00071 _Ghosts = ghosts;
00072 }
00073
00074 GridHierarchy& GH() { return *_Hierarchy; }
00075 const GridHierarchy& GH() const { return *_Hierarchy; }
00076
00077 const int& NGhosts() const { return _Ghosts; }
00078 const int& Dim() const { return _Dim; }
00079
00080 protected:
00081 int _PlotPhi;
00082 int _Stationary;
00083 int _Ghosts;
00084 int _Dim;
00085 GridHierarchy* _Hierarchy;
00086 ControlDevice LocCtrl;
00087 };
00088
00089
00090 #endif