QGpCompatibility/CompatMultiModalData.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpCompatibility.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created : 2003-05-19
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (ULg, Liège, Belgium)
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef MULTIMODALDATA_H
00029 #define MULTIMODALDATA_H
00030 
00031 #include "QGpCompatibilityDLLExport.h"
00032 
00033 namespace QGpCompatibility {
00034 
00035 class CompatMultiModalCurves;
00036 
00037 /* Storage for measured multi modal curves, all sampled with the same omega set of value. Only one value per omega is accepted, an error estimate can be added to each point.
00038 
00039 The set of periods is the same for all modes, for higher modes which don't exist over a critical period, the slowness is set to 0. Missing values for a particular mode are interpolated from the closest value available for this mode. 
00040 */
00041 
00042 class QGPCOMPATIBILITY_EXPORT CompatMultiModalData
00043 {
00044 public:
00045   // Default constructor
00046   CompatMultiModalData();
00047   // Allocates an empty structure
00048   CompatMultiModalData(int modesCount,int omegasCount);
00049   // Allocates an empty structure based on an existing one with another number of modes
00050   CompatMultiModalData(const CompatMultiModalData* o,int modesCount, double invalidValue);
00051   // Set the values o as the measurements
00052   CompatMultiModalData(const CompatMultiModalCurves* o);
00053   // Destructor: get rid of all unused memory
00054   ~CompatMultiModalData();
00055   
00056   // I/O functions
00057   // -------------
00058   // Store in an inversion report
00059   void dataToReport(QDataStream& s);
00060   // Load from an inversion report
00061   void reportToData(QDataStream& s);
00062   // Version 3 of CompatInversionReport, statistical weight of all point
00063   void reportToDataWeight(QDataStream& s, bool loadIt);
00064   
00065   // Tracks stddev that fall below a defined threshold
00066   bool checkStdDev(double ratio);
00067   
00068   // Set the average of the ith value (measurements) of mode m
00069   void setMean(int i, int mode,double mean) {_measurements[mode][i]=mean;}
00070   // Returns the ith value(measurements) of mode m
00071   double measurement(int i, int mode) const {return _measurements[mode][i];}
00072   // Set the stddev of the ith value (measurements) of mode m
00073   void setStddev(int i, int mode,double stddev) {_stddev[mode][i]=stddev;}
00074   // Returns the stddev of the ith value (measurements) of mode m
00075   double stddev(int i, int mode) const {return _stddev[mode][i];}
00076   // Set the weith of the ith measurements of mode m
00077   void setWeight(int i, int m, double w) {_weight[m][i]=w;}
00078   // Returns the weith of the ith measurements of mode m
00079   double Weight(int i, int m) {return _weight[m][i];}
00080   // Returns the measurements of mode iMode
00081   QVector<double> * measurements(int iMode);
00082   // Returns the stddev of mode iMode
00083   QVector<double> * stddev(int iMode);
00084   // Returns the weight of mode iMode
00085   QVector<double> * weight(int iMode);
00086   // Compatibility with new framework
00087   ModalCurve curve(int iMode);
00088 
00089   // Compares the measurments of two objects
00090   bool isSameData(const CompatMultiModalData * o) const;
00091   // return the log comments
00092   QString & log() {return _log;}
00093   // add new lines to existing comments
00094   void addLog(QString& s) {_log+=s+"\n";}
00095   //Transfers values from the autocorrCurve sub-object to measurements
00096   void valuesToData(CompatMultiModalCurves * o); 
00097   // Tells whether curve pointed by pDisp is inside +/-devRatio*stddev
00098   bool insideDev(double devRatio, int iMode, Point2D * pDisp, int countPoints);
00099 protected:
00100   // Number of modes
00101   int _modesCount;
00102   // Number of frequencies
00103   int _omegasCount;
00104   
00105   // Storage for measured values
00106   double ** _measurements;  
00107   // Storage for their error estimates
00108   double ** _stddev;
00109   // Storage for error estimates weight
00110   double ** _weight;
00111   // Any comment on how the measurement curve was generated
00112   QString _log;
00113   
00114   // De-allocates the storage for measured values
00115   void deleteData();
00116   // Allocates the storage for measured values
00117   void allocatesData();
00118 };
00119 
00120 } // namespace QGpCompatibility
00121 
00122 #endif // COMPATMULTIMODALDATA_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines