00001 #ifndef INTERPOLATOR_H
00002 #define INTERPOLATOR_H
00003
00004 #include <iostream>
00005 #include <fstream>
00006 #include <sstream>
00007 #include <string>
00008 #include <vector>
00009 #include <deque>
00010 #include <map>
00011 #include <utility>
00012
00013 using std::vector;
00014 using std::deque;
00015 using std::map;
00016 using std::ifstream;
00017 using std::istringstream;
00018 using std::string;
00019 using std::pair;
00020
00021 namespace Atlfast{
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 class Interpolator{
00056 public:
00057 Interpolator(string);
00058 double interpolate(deque<double>,bool performedchecks = false);
00059 double getValue(){return m_value;}
00060 void setDefault(double);
00061 void setDefault(int,double);
00062 void setDefault(string,double);
00063 void setDefault(int,double,double);
00064 void setDefault(string,double,double);
00065 void setContinuousBoundaries(){m_contBounds = true;}
00066 double getNearestValue(deque<double>);
00067 void dump();
00068 private:
00069 Interpolator(double,ifstream&, int&, int&, vector<int>&, int&);
00070 void Setup(ifstream&, int&, int&, vector<int>&, int&);
00071 void findLimits(deque<pair<double,double> >&);
00072 void nDimensionsToJump(ifstream&,int&,int&);
00073 bool inLimits(deque<double>,double&);
00074 void exitParseWithMessage(string, int, string);
00075 vector<pair<double,double> > m_pairs;
00076 vector<Interpolator> m_interpolators;
00077 double m_value;
00078 deque<pair<double,double> > m_limits;
00079 deque<pair<double,double> > m_defaults;
00080 map<string,int> m_levelnames;
00081 bool m_contBounds;
00082 };
00083
00084
00085
00086
00087 class ClosestInterpolators{
00088 public:
00089 ClosestInterpolators(double value);
00090 bool operator()(Interpolator&, Interpolator&);
00091 private:
00092 double m_value;
00093 };
00094
00095
00096
00097
00098 class ClosestDoublePairs{
00099 public:
00100 ClosestDoublePairs(double value);
00101 bool operator()(pair<double,double>&, pair<double,double>&);
00102 private:
00103 double m_value;
00104 };
00105
00106 }
00107
00108 #endif