Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef GridSearch_H
00030 #define GridSearch_H
00031
00032 #include "Point2D.h"
00033 #include "Function2Search.h"
00034
00035 namespace QGpCoreTools {
00036
00037 class GridFunction2;
00038
00039 class QGPCORETOOLS_EXPORT GridSearch : public Function2Search
00040 {
00041 public:
00042 GridSearch();
00043 ~GridSearch();
00044
00045 void setGrid(double minX, double maxX, double dX,
00046 double minY, double maxY, double dY);
00047
00048 int nx() const {return _nx;}
00049 int ny() const {return _ny;}
00050 double x(int i) const {return _x[i];}
00051 double y(int i) const {return _y[i];}
00052
00053 double globalMax();
00054 Function2MaximaIterator localMax(int nMax, double absThres=0.0, double relThres=0.0);
00055 void setRelativePrecision(double p) {_precisionX=p;_precisionY=p; _relative=true;}
00056 void setAbsolutePrecision(double p) {_precisionX=p;_precisionY=p; _relative=false;}
00057 protected:
00058 int _nx, _ny;
00059 double * _x, * _y;
00060 double _precisionX, _precisionY;
00061 private:
00062
00063 double refineMax(double minX, double maxX, double minY, double maxY);
00064 inline void checkForMax(double x, double y, double& maxVal, double& maxX, double& maxY);
00065
00066 double refineMax(double minX, double maxX);
00067 inline void checkForMax(double x, double& maxVal, double& maxX);
00068 };
00069
00070 }
00071
00072 #endif // GRIDSEARCH_H