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 #ifndef PROFILE_H
00029 #define PROFILE_H
00030
00031 #include <QGpCoreTools.h>
00032 #include "QGpCoreWaveDLLExport.h"
00033
00034 namespace QGpCoreWave {
00035
00036 class QGPCOREWAVE_EXPORT Profile
00037 {
00038 public:
00039 inline void operator=(const Profile& p);
00040 inline void setDepth(int i, double depth);
00041 inline void setValue(int i, double value);
00042 inline void clear();
00043 inline void resize(int n);
00044 inline void collectDepths(QVector<double>& depths) const;
00045 inline void writeReport(QDataStream& s) const;
00046 inline void readReport(QDataStream& s);
00047 void resample(const Profile& p, const QVector<double>& baseD);
00048 void resample(const QVector<double>& baseD);
00049 inline void resample(const QVector<double>& baseD1, const QVector<double>& baseD2);
00050 void setSamples(const QVector<double>& baseD);
00051 const QVector<double>& depths() const {return _depths;}
00052 const QVector<double>& values() const {return _values;}
00053 QVector<double>& values() {return _values;}
00054 static void report2plot(QDataStream& s, Point2D * points);
00055 double interpoleAt(double depth);
00056 double uniformAt(double depth);
00057 void average();
00058 void inverse();
00059 int count() const {return _depths.count();}
00060 void toStream(QTextStream& s, bool plotMode) const;
00061 Curve<Point2D> curve() const;
00062 void print() const;
00063 private:
00064 QVector<double> _depths;
00065 QVector<double> _values;
00066 };
00067
00068 inline void Profile::setDepth(int i, double depth)
00069 {
00070 TRACE;
00071 _depths[i]=depth;
00072 }
00073
00074 inline void Profile::setValue(int i, double value)
00075 {
00076 TRACE;
00077 _values[i]=value;
00078 }
00079
00080 inline void Profile::collectDepths(QVector<double>& depths) const
00081 {
00082 TRACE;
00083 depths << _depths;
00084 }
00085
00086 inline void Profile::clear()
00087 {
00088 TRACE;
00089 _depths.clear();
00090 _values.clear();
00091 }
00092
00093 inline void Profile::resize(int n)
00094 {
00095 TRACE;
00096 _depths.resize(n);
00097 _values.resize(n);
00098 }
00099
00100 inline void Profile::writeReport(QDataStream& s) const
00101 {
00102 TRACE;
00103 int n=_depths.count();
00104 s << n;
00105 for(int i=0;i<n;i++) {
00106 s << _depths.at(i);
00107 s << _values.at(i);
00108 }
00109 }
00110
00111 inline void Profile::readReport(QDataStream& s)
00112 {
00113 TRACE;
00114 int n;
00115 s >> n;
00116 if(n<0 || n>10000) {
00117
00118 return;
00119 }
00120 resize(n);
00121 double d,v;
00122 for(int i=0;i<n;i++) {
00123 s >> d >> v;
00124 setDepth(i, d);
00125 setValue(i, v);
00126 }
00127 }
00128
00129 inline void Profile::operator=(const Profile& p)
00130 {
00131 TRACE;
00132 _depths=p._depths;
00133 _values=p._values;
00134 }
00135
00136 inline void Profile::resample(const QVector<double>& baseD1, const QVector<double>& baseD2)
00137 {
00138 TRACE;
00139 resample(baseD1);
00140 resample(baseD2);
00141 }
00142
00143 }
00144
00145 #endif // PROFILE_H