OpendTect-6_4  6.4
gridder2d.h
Go to the documentation of this file.
1 #ifndef gridder2d_h
2 #define gridder2d_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Y.C.Liu & K. Tingdahl
9  Date: January 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 
16 #include "algomod.h"
17 #include "arrayndalgo.h"
18 #include "mathfunc.h"
19 #include "factory.h"
20 #include "coord.h"
21 #include "positionlist.h"
22 
23 class DAGTriangleTree;
24 template <class T> class LinSolver;
26 
27 
33 {
34 public:
35  mDefineFactoryInClass(Gridder2D,factory);
36 
37 
38  virtual ~Gridder2D();
39  virtual Gridder2D* clone() const = 0;
40  virtual bool operator==(const Gridder2D&) const;
45  virtual bool wantsAllPoints() const { return true; }
47  virtual bool isPointUsable(const Coord& cpt,
48  const Coord& dpt) const;
52  virtual void setGridArea(const Interval<float>&,
53  const Interval<float>&) {}
58  bool setPoints(const TypeSet<Coord>&);
59  /*<!Points are assumed to remain in mem through
60  getValue(). Points should correspond to the
61  values in setValues. Don't re-set it unless they
62  have changed, as it may lead to substantial
63  computations. */
64  bool setPoints(const TypeSet<Coord>&,TaskRunner*);
65  const TypeSet<Coord>* getPoints() const { return points_; }
66  virtual void setTrend(PolyTrend::Order);
67  /*<!Not a processing parameter, requires the input data
68  (points & values) to be set. Needs to be called again
69  each time either the values are changed */
70  bool setValues(const TypeSet<float>&);
71  /*<!Values are assumed to remain in mem at
72  getValue(). Values should correspond to the
73  coords in setPoints */
74  virtual float getValue(const Coord&,const TypeSet<double>* weights=0,
75  const TypeSet<int>* relevantpoints=0) const;
77 
78  virtual void fillPar(IOPar&) const;
79  virtual bool usePar(const IOPar&);
80 
81  virtual bool allPointsAreRelevant() const =0;
82 
83  virtual bool getWeights(const Coord&,
84  TypeSet<double>& weights,
85  TypeSet<int>& relevantpoints) const =0;
90  virtual bool areWeightsValuesDependent() const { return false;}
91 
92 protected:
93  Gridder2D();
94  Gridder2D(const Gridder2D&);
95 
99 
101 
102  virtual bool pointsChangedCB(CallBacker*) { return true; }
103  virtual void valuesChangedCB(CallBacker*) {}
104  float getDetrendedValue(int idx) const;
105  /*<!Input values corrected from the trend*/
106  bool isAtInputPos(const Coord&,int&idx) const;
107 };
108 
109 
116 public:
117  mDefaultFactoryInstantiation( Gridder2D,
119  "InverseDistance", tr("Inverse distance") );
120 
123 
124  Gridder2D* clone() const;
125 
126  static uiString searchRadiusErrMsg();
127  static const char* sKeySearchRadius() { return "SearchRadius"; }
128 
129  bool operator==(const Gridder2D&) const;
130 
131  void setSearchRadius(float);
132  float getSearchRadius() const { return radius_; }
133 
134  bool wantsAllPoints() const { return false; }
135  bool allPointsAreRelevant() const;
136  bool isPointUsable(const Coord&,const Coord&) const;
137  bool getWeights(const Coord&,TypeSet<double>& weights,
138  TypeSet<int>& relevantpoints) const;
139 
140  bool usePar(const IOPar&);
141  void fillPar(IOPar&) const;
142 
143 protected:
144 
145  float radius_;
146 };
147 
148 
156 public:
157  mDefaultFactoryInstantiation( Gridder2D,
159  "Triangulated", tr("Triangulation") );
160 
163  const TriangulatedGridder2D&);
165  Gridder2D* clone() const;
166 
167 
168  void setGridArea(const Interval<float>&,
169  const Interval<float>&);
170 
171  bool allPointsAreRelevant() const;
172  bool getWeights(const Coord&,TypeSet<double>& weights,
173  TypeSet<int>& relevantpoints) const;
174 
175 protected:
176 
181 
183 
184  bool pointsChangedCB(CallBacker*);
185 };
186 
187 
188 
195 public:
196  mDefaultFactoryInstantiation( Gridder2D,
198  "RadialBasicFunction",
199  tr("Radial Basis Function") );
200 
205  Gridder2D* clone() const;
206 
207  static const char* sKeyIsMetric() { return "IsMetric"; }
208 
209  bool operator==(const Gridder2D&) const;
210 
211  void setMetricTensor(double m11,double m12,double m22);
212 
213  bool allPointsAreRelevant() const;
214  bool getWeights(const Coord&,TypeSet<double>& weights,
215  TypeSet<int>& relevantpoints) const;
216  bool areWeightsValuesDependent() const { return true; }
217  float getValue(const Coord&,const TypeSet<double>* weights=0,
218  const TypeSet<int>* relevantpoints=0) const;
219 
220 protected:
221 
222  bool ismetric_;
223  double m11_;
224  double m12_;
225  double m22_;
226 
229 
230  bool updateSolver();
231  //will be removed after 6.2
232 
233  bool updateSolver(TaskRunner*);
234  bool updateSolution();
235  double getRadius(const Coord& pos1,const Coord& pos2) const;
236  static double evaluateRBF(double radius,double scale=1.);
237 
238  bool pointsChangedCB(CallBacker*);
239  void valuesChangedCB(CallBacker*);
240  bool setWeights(const Coord&,TypeSet<double>& weights,
241  TypeSet<int>* usedpoints=0) const;
242 };
243 
244 #endif
double m22_
Definition: gridder2d.h:225
#define mExpClass(module)
Definition: commondefs.h:160
PolyTrend * trend_
Definition: gridder2d.h:98
Uses Radial Basic Function to predict the values.
Definition: gridder2d.h:193
bool wantsAllPoints() const
If false, points should be tested with isPointUsable.
Definition: gridder2d.h:134
virtual void valuesChangedCB(CallBacker *)
Definition: gridder2d.h:103
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
const TypeSet< float > * values_
Definition: gridder2d.h:96
Reference: "Parallel Incremental Delaunay Triangulation", by Kohout J.2005.
Definition: delaunay.h:36
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
const TypeSet< Coord > * getPoints() const
Definition: gridder2d.h:65
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
DAGTriangleTree * triangles_
Definition: gridder2d.h:177
double m11_
Definition: gridder2d.h:223
Generic interface for 2D gridding.
Definition: gridder2d.h:32
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
bool areWeightsValuesDependent() const
Definition: gridder2d.h:216
TypeSet< int > usedpoints_
Definition: gridder2d.h:100
double m12_
Definition: gridder2d.h:224
#define mDefaultFactoryInstantiation(baseclss, clss, keywrd, usernm)
Definition: factory.h:289
Triangle2DInterpolator * interpolator_
Definition: gridder2d.h:178
Definition: uistring.h:89
LinSolver< double > * solv_
Definition: gridder2d.h:228
A cartesian coordinate in 2D space.
Definition: coord.h:25
bool ismetric_
Definition: gridder2d.h:222
float getSearchRadius() const
Definition: gridder2d.h:132
virtual bool areWeightsValuesDependent() const
Definition: gridder2d.h:90
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Class that can execute a task.
Definition: task.h:169
Uses Delaunay triangulation to find a points neighbors and does inverse distance between the neighbor...
Definition: gridder2d.h:154
const TypeSet< Coord > * points_
Definition: gridder2d.h:97
LinSolver - Solves linear systems of equations on the form A*x=B. A is a matrix of the size N*N...
Definition: gridder2d.h:24
Interval< float > yrg_
Definition: gridder2d.h:180
static const char * sKeyIsMetric()
Definition: gridder2d.h:207
virtual void setGridArea(const Interval< float > &, const Interval< float > &)
Definition: gridder2d.h:52
Uses inverse distance method for 2D gridding.
Definition: gridder2d.h:114
static const char * sKeySearchRadius()
Definition: gridder2d.h:127
#define mDefineFactoryInClass(T, funcname)
Definition: factory.h:426
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
TypeSet< double > * globalweights_
Definition: gridder2d.h:227
float radius_
Definition: gridder2d.h:145
Interval< float > xrg_
Definition: gridder2d.h:179
virtual bool wantsAllPoints() const
If false, points should be tested with isPointUsable.
Definition: gridder2d.h:45
virtual bool pointsChangedCB(CallBacker *)
Definition: gridder2d.h:102
Coord center_
Definition: gridder2d.h:182
Order
Definition: arrayndalgo.h:1061
Polynomial trend with order 0 (mean), 1 (linear) or 2 (parabolic) The trend is derived from a set of ...
Definition: arrayndalgo.h:1054
For a given triangulated geometry(set of points), interpolating any point located in or nearby the go...
Definition: delaunay.h:187

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019