00001 #ifndef gridripper_io_BDataReader_h 00002 #define gridripper_io_BDataReader_h 00003 00004 #include "BDataFlags.h" 00005 #include "DataInputStream.h" 00006 #include <gridripper/lang/IntArray.h> 00007 #include <gridripper/tvector.h> 00008 #include <iostream> 00009 00010 namespace gridripper { namespace io { 00011 00012 using namespace gridripper; 00013 using namespace std; 00014 00022 class BDataReader 00023 { 00024 private: 00025 istream* fileIn; 00026 DataInputStream* dataIn; 00027 double time; 00028 int numGridPoints; 00029 int numComponents; 00030 string tLabel; 00031 string xLabel; 00032 tvector<string> componentNames; 00033 int maxi; 00034 int xMultiplier; 00035 double xmin; 00036 double deltaX; 00037 tvalarray<int> kxArray; 00038 tvalarray<float> floatData; 00039 tvalarray<double> doubleData; 00040 tvalarray<IntArray> timeStepCounts; 00041 tvalarray<IntArray> lastRegridTimes; 00042 tvalarray<double> energyLosses; 00043 00044 public: 00049 BDataReader(const string& f) throw(IOException&); 00050 00051 ~BDataReader(); 00052 00058 bool read() throw(IOException&); 00059 00064 double getTime() const { 00065 return time; 00066 } 00067 00072 const string& getTimeLabel() const { 00073 return tLabel; 00074 } 00075 00080 const string& getXcoordLabel() const { 00081 return xLabel; 00082 } 00083 00088 int getMaxI() const { 00089 return maxi; 00090 } 00091 00097 int getXMultiplier() const { 00098 return xMultiplier; 00099 } 00100 00105 double getXMin() const { 00106 return xmin; 00107 } 00108 00113 double getDeltaX() const { 00114 return deltaX; 00115 } 00116 00121 int getNumGridPoints() const { 00122 return numGridPoints; 00123 } 00124 00129 int getNumComponents() const { 00130 return numComponents; 00131 } 00132 00138 const string& getComponentName(int i) const { 00139 return componentNames[i]; 00140 } 00141 00151 const tvalarray<int>& getKxArray() const { 00152 return kxArray; 00153 } 00154 00161 const tvalarray<float>& getFloatData() const { 00162 return floatData; 00163 } 00164 00171 const tvalarray<double>& getDoubleData() const { 00172 return doubleData; 00173 } 00174 00180 void getData(float* data, int pos) const; 00181 00187 void getData(double* data, int pos) const; 00188 00193 const tvalarray<IntArray>& getTimeStepCounts() { 00194 return timeStepCounts; 00195 } 00196 00201 const tvalarray<IntArray>& getLastRegridTimes() { 00202 return lastRegridTimes; 00203 } 00204 00209 const tvalarray<double>& getEnergyLosses() const { 00210 return energyLosses; 00211 } 00212 }; 00213 00214 } } // namespace gridripper::io 00215 00216 #endif /* gridripper_io_BDataReader_h */