BData.h
00001 #ifndef gridripper_amr1d_initcond_BData_h
00002 #define gridripper_amr1d_initcond_BData_h
00003
00004 #include <gridripper/io/BDataReader.h>
00005 #include <gridripper/io/IOException.h>
00006 #include <gridripper/amr1d/InitCond.h>
00007 #include <gridripper/util/GrrProperties.h>
00008 #include <gridripper/Parameters.h>
00009 #include <gridripper/amr1d/interpolation/DataInterpolation.h>
00010 #include <gridripper/lang/IntArray.h>
00011
00012 namespace gridripper { namespace amr1d {
00013
00014 class PDE;
00015
00016 namespace initcond {
00017
00018 using namespace gridripper;
00019 using namespace gridripper::util;
00020 using namespace gridripper::io;
00021 using namespace gridripper::amr1d::interpolation;
00022
00035 class BData : public InitCond
00036 {
00037
00038 private:
00039 static const GReal_t EPSILON=1e-10;
00040 bool debug;
00041 BDataReader* bData;
00042 DataInterpolation* dint;
00043 DataInterpolation* dint2;
00044 std::string inputFile;
00045 tvalarray<GReal_t>* energyLosses;
00046 int xMultiplier;
00047 GReal_t theTime0;
00048 GReal_t theTime;
00049 tvalarray<int>* kxArray;
00050 tvalarray<GReal_t> theData;
00051 tvalarray<IntArray>* timeStepCounts;
00052 tvalarray<IntArray>* lastRegridTimes;
00053 std::string message;
00054
00055 public:
00062 BData(const std::string &args, const Parameters* p, const PDE& pde)
00063 throw(IOException&);
00064
00065 ~BData();
00066
00067 bool isOnInitialHypersurface() const;
00068
00069 bool isAppended(const std::string &f) const;
00070
00083 int init(tvalarray< tvector<Grid*> >& grids, PDE* pde, GReal_t dt, int r,
00084 int maxlevel, int bufzone, AMError* amerr, GReal_t maxerr)
00085 throw(InitCond::Exception&);
00086
00092 GReal_t getTime() const;
00093
00095 std::string getMessage() const;
00096
00097 private:
00110 int init0(tvalarray< tvector<Grid*> >& grids, PDE* pde, GReal_t dt, int r,
00111 int maxlevel);
00112
00113 static int gridSpacingAt(const tvalarray<int>& kxarr, int i);
00114
00115 int createInitialSubgrids(tvalarray< tvector<Grid*> >& grids, Grid* g,
00116 PDE* pde, GReal_t dt, int r,
00117 int finestl, int maxlevel, int dkx, int ikx0);
00118
00119 void init(Grid& g, int ikx, int dkx, PDE* pde);
00120
00121 };
00122
00123
00124 } } }
00125
00126 #endif