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 REFRACTIONDIPPINGMODEL_H
00030 #define REFRACTIONDIPPINGMODEL_H
00031
00032 #include <math.h>
00033 #include <QGpCoreTools.h>
00034 #include "Seismic1DModel.h"
00035 #include "QGpCoreWaveDLLExport.h"
00036
00037 namespace QGpCoreWave {
00038
00039 class TiltNode;
00040 class TiltPath;
00041
00042 class QGPCOREWAVE_EXPORT RefractionDippingModel : public GeophysicalModel
00043 {
00044 TRANSLATIONS("RefractionDippingModel");
00045 public:
00046 RefractionDippingModel();
00047 RefractionDippingModel(int nLayers);
00048 RefractionDippingModel(const RefractionDippingModel& o);
00049 ~RefractionDippingModel();
00050
00051 virtual GeophysicalModel * clone() const {return new RefractionDippingModel(*this);}
00052
00053 int layerCount() const {return _layerCount;}
00054 virtual bool isEmpty() const {return layerCount()==0;}
00055 double depthLeft(int iLayer) const {return _depthL[iLayer];}
00056 double setDepthLeft(int iLayer, double d) {return _depthL[iLayer]=d;}
00057 double depthRight(int iLayer) const {return _depthR[iLayer];}
00058 double setDepthRight(int iLayer, double d) {return _depthR[iLayer]=d;}
00059 double slowness(int iLayer) const {return _slow[iLayer];}
00060 double setSlowness(int iLayer, double s) {return _slow[iLayer]=s;}
00061
00062 void setXLeft(double x) {_xL=x;}
00063 double xLeft() const {return _xL;}
00064
00065 void setXRight(double x) {_xR=x;}
00066 double xRight() const {return _xR;}
00067
00068 void fromSeismic1DModel(const Seismic1DModel& ref, const QVector<double>& pitch,
00069 Seismic1DModel::SlownessType slowType);
00070
00071 enum Direction {LeftToRight, RightToLeft};
00072
00073 void begin();
00074 inline bool isCriticalLayer(Direction dir, int iLayer) const;
00075 double propagate(Direction dir, int iLayer, int iDeepestLayer, double& x) const;
00076 void end();
00077
00078 double travelTime(const TiltNode& src, const TiltNode& rec, int& minTimeLayer);
00079 Curve<Point2D> ray(const TiltNode& src, const TiltNode& rec);
00080
00081 static QString formatHelp();
00082 virtual QString toString() const;
00083 virtual bool fromStream(QTextStream& s, QString * comments=0);
00084 virtual void toStream(QTextStream& s) const;
00085 void fromStream(QDataStream& s);
00086 void toStream(QDataStream& s) const;
00087
00088 class RefractionContext : public GeophysicalContext
00089 {
00090 public:
00091 RefractionContext();
00092 RefractionDippingModel * model() const {return static_cast<RefractionDippingModel *>(_model);}
00093 virtual QString helpCode() const;
00094 };
00095
00096 virtual GeophysicalContext * expressionContext() const {return new RefractionContext;}
00097
00098 class RefractionStorage : public ExpressionStorage
00099 {
00100 public:
00101 RefractionStorage(RefractionContext * context) {_context=context;}
00102 virtual bool isReadOnly() const {return false;}
00103 protected:
00104 RefractionContext * _context;
00105 };
00106
00107 class VariableN : public RefractionStorage
00108 {
00109 public:
00110 VariableN(RefractionContext * context) : RefractionStorage(context) {}
00111 virtual bool isReadOnly() const {return true;}
00112 virtual QVariant value(const QString&) const;
00113 virtual void setValue(const QString&, const QVariant& ) {}
00114 };
00115
00116 class VariableDL : public RefractionStorage
00117 {
00118 public:
00119 VariableDL(RefractionContext * context) : RefractionStorage(context) {}
00120 virtual QVariant value(const QString& index) const;
00121 virtual void setValue(const QString&, const QVariant& );
00122 };
00123
00124 class VariableDR : public RefractionStorage
00125 {
00126 public:
00127 VariableDR(RefractionContext * context) : RefractionStorage(context) {}
00128 virtual QVariant value(const QString& index) const;
00129 virtual void setValue(const QString&, const QVariant& );
00130 };
00131
00132 class VariableV : public RefractionStorage
00133 {
00134 public:
00135 VariableV(RefractionContext * context) : RefractionStorage(context) {}
00136 virtual QVariant value(const QString& index) const;
00137 virtual void setValue(const QString&, const QVariant& );
00138 };
00139 private:
00140 void initMembers();
00141 void allocateData();
00142 void deleteData();
00143 bool setValue(double& var, const StringSection& field, int iLayer, const QString& varName, bool optional);
00144 double travelTime(const TiltPath *& srcPaths, const TiltPath *& recPaths, int& minTimeLayer);
00145 bool node2paths(const TiltNode& src, const TiltNode& rec,
00146 const TiltPath *& srcPaths, const TiltPath *& recPaths) const;
00147
00148
00149 int _layerCount;
00150
00151 double * _depthL;
00152
00153 double * _depthR;
00154
00155 double * _slow;
00156 double _xL, _xR;
00157
00158
00159 double * _minX;
00160 double * _maxX;
00161
00162
00163 double * _cosangle;
00164
00165 double * _sinangle;
00166
00167 double * _n;
00168
00169
00170
00171
00172
00173 double * _shift;
00174
00175
00176 double * _h;
00177
00178
00179 double ** _critl;
00180 double ** _critr;
00181 };
00182
00183 inline bool RefractionDippingModel::isCriticalLayer(Direction dir, int iLayer) const
00184 {
00185 TRACE;
00186 switch(dir) {
00187 case LeftToRight:
00188 return _critl[iLayer];
00189 break;
00190 default:
00191 return _critr[iLayer];
00192 break;
00193 }
00194 }
00195
00196 }
00197
00198 #endif // REFRACTIONDIPPINGMODEL_H