FuncInitCond.h
00001 #ifndef gridripper_amr1d_FuncInitCond_h
00002 #define gridripper_amr1d_FuncInitCond_h
00003
00004 #include "InitCond.h"
00005 #include "FieldWrapper.h"
00006 #include <gridripper/Parameters.h>
00007
00008 namespace gridripper { namespace amr1d {
00009
00017 class FuncInitCond: public InitCond
00018 {
00019 private:
00020 bool numericalConstraintSettingNeeded;
00021 int mostRefinedGridMaxI;
00022 GReal_t mostRefinedGridDeltaX;
00023
00028 int interpolatedLevel;
00029
00030 protected:
00036 FuncInitCond(string& args, const Parameters* p)
00037 throw(InitCond::Exception&);
00038
00039 public:
00052 int init(tvalarray< tvector<Grid*> >& grids, PDE* pde, GReal_t dt, int r,
00053 int maxlevel, int bufzone, AMError* amerr, double maxerr)
00054 throw(InitCond::Exception&);
00055
00061 virtual GReal_t getTime() const {
00062 return 0.0;
00063 }
00064
00071 int getInterpolatedLevel() const {
00072 return interpolatedLevel;
00073 }
00074
00081 void setInterpolatedLevel(int l);
00082
00083 protected:
00090 virtual void init(PDE* pde, GReal_t x, FieldWrapper& phi)
00091 throw(InitCond::Exception&) =0;
00092
00097 int getMostRefinedGridMaxI() const {
00098 return mostRefinedGridMaxI;
00099 }
00100
00105 GReal_t getMostRefinedGridDeltaX() const {
00106 return mostRefinedGridDeltaX;
00107 }
00108
00113 virtual bool isNumericalConstraintSettingNeeded() const {
00114 return numericalConstraintSettingNeeded;
00115 }
00116
00122 void setNumericalConstraintSettingNeeded(bool v) {
00123 numericalConstraintSettingNeeded = v;
00124 }
00125
00131 virtual void endInit() {
00132 }
00133
00134 private:
00135 void parseArgs(const Parameters*, string& args)
00136 throw(IllegalArgumentException&);
00137
00138 void init(Grid* g, PDE* pde) throw(InitCond::Exception&);
00139
00154 int createInitialSubgrids(tvalarray< tvector<Grid*> >& grids, Grid* g,
00155 PDE* pde, GReal_t dt, int r,
00156 int finestl, int maxlevel, int bufzone,
00157 AMError* amerr, double maxerr)
00158 throw(InitCond::Exception&);
00159 };
00160
00161 } }
00162
00163 #endif