Integrator.h

00001 #ifndef gridripper_amr1d_Integrator_h
00002 #define gridripper_amr1d_Integrator_h
00003 
00004 #include <gridripper/config.h>
00005 #include <gridripper/tvalarray.h>
00006 #include "Grad.h"
00007 #include "Sigma.h"
00008 #include <string>
00009 
00010 namespace gridripper { namespace amr1d {
00011 
00012 using namespace std;
00013 
00014 class PDE;
00015 class Grid;
00016 class GridInterpolator;
00017 class AMError;
00018 
00026 class Integrator
00027 {
00028     friend class Grid;
00029 
00030 private:
00031     tvalarray<double> errors;
00032 
00033     PDE& thePDE;
00034 
00035     Grid* theGrid;
00036 
00037     GReal_t deltaT;
00038 
00039     bool ownsInterpolator;
00040 
00041     GridInterpolator* interpolator;
00042 
00043     int interpolatorType;
00044 
00045     Sigma* theSigma;
00046 
00047 protected:
00048     Grad* gradOp;
00049     Grad* gradOp2;
00050 
00051 protected:
00052     int timeStepCount;
00053 
00054     Integrator(const Integrator& gi, Grid& g);
00055 
00056     Integrator(Grid* g, PDE& pde, const tvalarray<string>* optsarr,
00057                int deftype, Sigma* sigma);
00058 
00059     Integrator(Grid* g, PDE& pde, Grad* d, Grad* d2, int deftype,
00060                Sigma* sigma);
00061 
00062     void calcErrors(const AMError& amerr, const Grid& g, const Grid& g2,
00063                     double c);
00064 
00065 public:
00066     virtual ~Integrator();
00067 
00072     Grad& getGrad() const {
00073         return *gradOp;
00074     }
00075 
00080     const GridInterpolator* getInterpolator() const {
00081         return interpolator;
00082     }
00083 
00088     int getInterpolatorType() const {
00089         return interpolatorType;
00090     }
00091 
00099     int getInterpolationBufferSize() const {
00100         int t = interpolatorType;
00101         if(t == 5) {
00102             return 4;
00103         } else if(t == 3) {
00104             return 2;
00105         } else {
00106             return 0;
00107         }
00108     }
00109 
00114     virtual void integrate(int ir) =0;
00115 
00121     virtual void richardson(const AMError& amerr, int ir) =0;
00122 
00126     double getError(int i) const {
00127         return errors[i];
00128     }
00129 
00130     void setTimeStepCount(int tsc) {
00131         timeStepCount = tsc;
00132     }
00133 
00134     int getTimeStepCount() const {
00135         return timeStepCount;
00136     }
00137 
00143     virtual void getResult(int i, tvalarray<GReal_t>& w) const =0;
00144 
00149     virtual int getNumVelocity() const =0;
00150 
00156     virtual Integrator* createIntegrator(Grid& g, const Sigma* sigma) const =0;
00157 
00158     virtual Integrator* cloneIntegrator(Grid& g) const =0;
00159 
00160     const Sigma& getSigma() const {
00161         return *theSigma;
00162     }
00163 
00168     GReal_t getDeltaT() const {
00169         return deltaT;
00170     }
00171 
00176     void setDeltaT(GReal_t dt) {
00177         deltaT = dt;
00178     }
00179 
00184     Grid* getGrid() const {
00185         return theGrid;
00186     }
00187 
00192     PDE& getPDE() const {
00193         return thePDE;
00194     }
00195 
00196     void updateGrid(int ir);
00197 };
00198 
00199 } } // namespace gridripper::amr1d
00200 
00201 #endif /* gridripper_amr1d_Integrator_h */

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