Regridder.h

00001 #ifndef gridripper_amr1d_Regridder_h
00002 #define gridripper_amr1d_Regridder_h
00003 
00004 #include <gridripper/config.h>
00005 #include <gridripper/tvalarray.h>
00006 
00007 namespace gridripper { namespace amr1d {
00008 
00009 class Grid;
00010 class Integrator;
00011 class IntervalList;
00012 
00020 class Regridder
00021 {
00022     friend class Grid;
00023 
00024 public:
00025     virtual ~Regridder() { }
00026 
00027     virtual Regridder* newRegridder(const Grid& p) =0;
00028 
00029     virtual Regridder* cloneRegridder() =0;
00030 
00038     virtual bool isDynamic() {
00039         return false;
00040     }
00041 
00046     virtual bool isFlagged(int i) {
00047         return false;
00048     }
00049 
00055     virtual void setFlagged(int i, bool v);
00056 
00057     virtual int getInvFreqUnit() =0;
00058 
00059     virtual bool isErrorEstimated() =0;
00060 
00061     virtual void setLastRegridTime(int t) =0;
00062 
00063     virtual int getLastRegridTime() =0;
00064 
00065     virtual bool checkRegriddingIsDue(Grid& g, int maxAllowedLevel,
00066                                       bool onInitialHypersurface,
00067                                       int r, int ir,
00068                                       int errorCheckFreq,
00069                                       int regridFreq) =0;
00070 
00075     virtual void init(int maxi) {
00076     }
00077 
00083     virtual void checkErrors(Integrator* integrator, double critical) {
00084     }
00085 
00101     virtual IntervalList* getIntervalList(const Grid& grid,
00102             tvalarray<Grid*>& newSubSubgrids, int minl, int maxl,
00103             int numvel, int margin, int bufzoneradius, int tsc) =0;
00104 
00108     virtual void beginTimeStep(const Grid& baseg) =0;
00109 
00113     virtual void endTimeStep(GReal_t t) =0;
00114 
00115 protected:
00121     virtual bool hasUncoveredFlaggedPoint(const Grid& grid,
00122                                           const tvalarray<Grid*>& subGrids,
00123                                           int margin) =0;
00124 
00132     static void blur(const Grid& g, tvalarray<unsigned char>& pf, int i);
00133 
00140     int getFirstIndexForRefinement(const Grid& g,
00141                                    const tvalarray<unsigned char>& pf) const;
00142 
00150     int findIntervalEndForRefinement(const Grid& g,
00151                                      const tvalarray<unsigned char>& pf,
00152                                      int i) const;
00153 
00154     int intervalRefinedSize(const Grid& g, const IntervalList* iv, int r)
00155             const;
00156 
00157     int gridIndexLeftOf(const Grid& g, int i, int dmax);
00158 
00159     int gridIndexRightOf(const Grid& g, int i, int dmax);
00160 
00161     static void fixSubgridNearBounds(const Grid& g,
00162                                      IntervalList* l, IntervalList* r,
00163                                      int margin);
00164 };
00165 
00166 } } // namespace gridripper::amr1d
00167 
00168 #endif /* gridripper_amr1d_Regridder_h */

Generated on Wed Jun 17 18:46:47 2009 for GridRipper by  doxygen 1.5.6