|
Go to the documentation of this file. 1 #ifndef NPSTAT_LININTERPOLATEDTABLEND_HH_
2 #define NPSTAT_LININTERPOLATEDTABLEND_HH_
18 #include "geners/CPP11_auto_ptr.hh"
30 template < class Numeric, class Axis=UniformAxis>
33 template < typename Num2, typename Axis2>
37 typedef Numeric value_type;
38 typedef Axis axis_type;
55 const std::vector<Axis>& axes,
56 const std::vector<std::pair<bool,bool> >& extrapolationType,
57 const char* functionLabel=0);
61 const char* functionLabel=0);
65 const Axis& yAxis, bool leftY, bool rightY,
66 const char* functionLabel=0);
70 const Axis& yAxis, bool leftY, bool rightY,
71 const Axis& zAxis, bool leftZ, bool rightZ,
72 const char* functionLabel=0);
76 const Axis& yAxis, bool leftY, bool rightY,
77 const Axis& zAxis, bool leftZ, bool rightZ,
78 const Axis& tAxis, bool leftT, bool rightT,
79 const char* functionLabel=0);
83 const Axis& yAxis, bool leftY, bool rightY,
84 const Axis& zAxis, bool leftZ, bool rightZ,
85 const Axis& tAxis, bool leftT, bool rightT,
86 const Axis& vAxis, bool leftV, bool rightV,
87 const char* functionLabel=0);
105 Numeric operator()( const double& x0, const double& x1) const;
106 Numeric operator()( const double& x0, const double& x1,
107 const double& x2) const;
108 Numeric operator()( const double& x0, const double& x1,
109 const double& x2, const double& x3) const;
110 Numeric operator()( const double& x0, const double& x1,
111 const double& x2, const double& x3,
112 const double& x4) const;
117 inline unsigned dim() const { return dim_;}
118 inline const std::vector<Axis>& axes() const { return axes_;}
119 inline const Axis& axis( const unsigned i) const
120 { return axes_.at(i);}
121 inline unsigned long length() const { return data_. length();}
122 bool leftInterpolationLinear( unsigned i) const;
123 bool rightInterpolationLinear( unsigned i) const;
124 std::vector<std::pair<bool,bool> > interpolationType() const;
125 inline const std::string& functionLabel() const
126 { return functionLabel_;}
137 double* coords, unsigned coordsBufferSize) const;
153 {functionLabel_ = newlabel ? newlabel : "";}
161 template < typename ConvertibleToUn signed>
163 ConvertibleToUnsigned axisNumber, const Axis& replacementAxis,
164 bool newAxisLeftLinear, bool newAxisRightLinear,
165 const char* functionLabel=0) const;
189 template < class Functor1, class Functor2>
191 unsigned axisNumber, const Axis& replacementAxis,
192 bool newAxisLeftLinear, bool newAxisRightLinear,
194 const char* functionLabel=0) const;
201 { return !(* this == r);}
205 inline gs::ClassId classId() const { return gs::ClassId(* this);}
206 bool write(std::ostream& of) const;
209 static const char* classname();
210 static inline unsigned version() { return 1;}
211 static LinInterpolatedTableND* read(
212 const gs::ClassId& id, std::istream& in);
215 LinInterpolatedTableND();
217 LinInterpolatedTableND(
218 const ArrayND<Numeric>& data,
219 const std::vector<Axis>& axes,
220 const char* leftInterpolation,
221 const char* rightInterpolation,
222 const std::string& label);
224 bool allConstInterpolated() const;
226 ArrayND<Numeric> data_;
227 std::vector<Axis> axes_;
228 std::string functionLabel_;
229 char leftInterpolationLinear_[CHAR_BIT* sizeof( unsigned long)];
230 char rightInterpolationLinear_[CHAR_BIT* sizeof( unsigned long)];
232 bool allConstInterpolated_;
234 template < class Functor1>
235 static double solveForRatioArg( double xmin, double xmax,
236 double rmin, double rmax,
237 double fval, Functor1 invg);
239 template < class Functor1>
240 static void invert1DResponse( const ArrayND<Numeric>& fromSlice,
241 const Axis& fromAxis, const Axis& toAxis,
242 bool newLeftLinear, bool newRightLinear,
244 const double* rawx, const double* rawf,
246 ArrayND<Numeric>* toSlice);
250 #include "npstat/nm/LinInterpolatedTableND.icc"
Arbitrary-dimensional array template.
unsigned long length() const Definition: ArrayND.hh:320
Definition: LinInterpolatedTableND.hh:32
unsigned dim() const Definition: LinInterpolatedTableND.hh:117
LinInterpolatedTableND(const Axis &xAxis, bool leftX, bool rightX, const Axis &yAxis, bool leftY, bool rightY, const char *functionLabel=0)
void setFunctionLabel(const char *newlabel) Definition: LinInterpolatedTableND.hh:152
bool operator!=(const LinInterpolatedTableND &r) const Definition: LinInterpolatedTableND.hh:200
LinInterpolatedTableND(const Axis &xAxis, bool leftX, bool rightX, const Axis &yAxis, bool leftY, bool rightY, const Axis &zAxis, bool leftZ, bool rightZ, const char *functionLabel=0)
LinInterpolatedTableND(const Axis &xAxis, bool leftX, bool rightX, const Axis &yAxis, bool leftY, bool rightY, const Axis &zAxis, bool leftZ, bool rightZ, const Axis &tAxis, bool leftT, bool rightT, const Axis &vAxis, bool leftV, bool rightV, const char *functionLabel=0)
LinInterpolatedTableND(const Axis &xAxis, bool leftX, bool rightX, const char *functionLabel=0)
void getCoords(unsigned long linearIndex, double *coords, unsigned coordsBufferSize) const
const ArrayND< Numeric > & table() const Definition: LinInterpolatedTableND.hh:131
CPP11_auto_ptr< LinInterpolatedTableND > invertRatioResponse(unsigned axisNumber, const Axis &replacementAxis, bool newAxisLeftLinear, bool newAxisRightLinear, Functor1 invg, Functor2 invh, const char *functionLabel=0) const
CPP11_auto_ptr< LinInterpolatedTableND > invertWRTAxis(ConvertibleToUnsigned axisNumber, const Axis &replacementAxis, bool newAxisLeftLinear, bool newAxisRightLinear, const char *functionLabel=0) const
bool operator==(const LinInterpolatedTableND &) const
bool isUniformlyBinned() const
bool isWithinLimits(const double *point, unsigned dim) const
Numeric operator()(const double *point, unsigned dim) const
LinInterpolatedTableND(const std::vector< Axis > &axes, const std::vector< std::pair< bool, bool > > &extrapolationType, const char *functionLabel=0)
LinInterpolatedTableND(const LinInterpolatedTableND< Num2, Axis > &)
Numeric operator()(const double &x0) const
LinInterpolatedTableND(const Axis &xAxis, bool leftX, bool rightX, const Axis &yAxis, bool leftY, bool rightY, const Axis &zAxis, bool leftZ, bool rightZ, const Axis &tAxis, bool leftT, bool rightT, const char *functionLabel=0)
Definition: AbsArrayProjector.hh:14
Definition: SimpleFunctors.hh:58
Definition: SimpleFunctors.hh:89
|