DinverDCCore/DCReportBlock.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of DinverDCCore.
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 : 2006-01-05
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (LGIT, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef DCREPORTBLOCK_H
00028 #define DCREPORTBLOCK_H
00029 
00030 #include <QGpCoreTools.h>
00031 #include <QGpCompatibility.h>
00032 #include <DinverCore.h>
00033 
00034 #include "DinverDCCoreDLLExport.h"
00035 #include "ModalStorageReader.h"
00036 
00037 namespace DinverDCCore {
00038 
00039 #define DCREPORTBLOCK_CURRENT_VERSION 2
00040 
00041   class TargetList;
00042   class TargetList2D;
00043 
00044 class DINVERDCCORE_EXPORT DCReportBlock
00045 {
00046   TRANSLATIONS("DCReportBlock")
00047 public:
00048   DCReportBlock(QDataStream& s);
00049   ~DCReportBlock();
00050 
00051   static void write(ReportWriter * report, const TargetList& tl,
00052                     const Profile * vp=0, const Profile * vs=0,
00053                     const Profile * rho=0, const Profile * pitch=0,
00054                     const Profile * res=0);
00055   static void write(ReportWriter * outReport, ReportReader * inReport);
00056   static void writeBeta(ReportWriter * outReport, ReportReader * inReport);
00057   static void writeNaViewer(ReportWriter * outReport, CompatInversionReport * inReport);
00058 
00059   void readProfiles(int version);
00060   Seismic1DModel * readSeismicModel();
00061   Resistivity1DModel * readElectricModel();
00062   void readModalStorages(int nStorages);
00063   QDataStream& stream() {return *_s;}
00064 
00065   inline bool profile(int i) const;
00066   bool vp() const {return profile(0);}
00067   bool vs() const {return profile(1);}
00068   bool rho() const {return profile(2);}
00069   bool pitch() const {return profile(3);}
00070   bool res() const {return profile(4);}
00071   bool dispersion() const {return profile(5);}
00072   bool autocorr() const {return profile(6);}
00073   bool ellipticity() const {return profile(7);}
00074   bool refractionVp() const {return profile(8);}
00075   bool refractionVs() const {return profile(9);}
00076   bool magnetoTelluric() const {return profile(10);}
00077 
00078   inline bool modalStorage(int i) const;
00079 
00080   void setStorageReader(ModalStorageReader * r) {delete _reader; _reader=r;};
00081   ModalStorageReader * storageReader() const {return _reader;};
00082 
00083   static Seismic1DModel * surfaceWaveModel(const QVector<double>& zProf,
00084                                          QVector<double>& vpProf,
00085                                          const QVector<double>& vsProf,
00086                                          const QVector<double>& rhoProf,
00087                                          const QVector<double> * nuMinProf=0,
00088                                          const QVector<double> * nuMaxProf=0);
00089   static Seismic1DModel * vspModel(const QVector<double>& zProf,
00090                                  const QVector<double>& vpProf,
00091                                  const QVector<double>& vsProf);
00092   static Seismic1DModel * vpModel(const QVector<double>& zProf,
00093                                 const QVector<double>& vpProf);
00094   static Seismic1DModel * vsModel(const QVector<double>& zProf,
00095                                 const QVector<double>& vsProf);
00096 private:
00097   static void writeOffsetTable(QDataStream& s);
00098   static void writeFactory(QDataStream& s, const ModalFactory& f);
00099   static void writeFactory(QDataStream& s, DCReportBlock& dcBlock, int nStorages);
00100   static void writeFactoryBeta(QDataStream& s, DCReportBlock& dcBlock, int nStorages);
00101   static void writeFactoryNaViewer(QDataStream& s, CompatMultiModalCurves * curves, int nStorages);
00102 
00103   QDataStream * _s;
00104   qint64 * _profileOffsets;
00105   qint64 * _modalStorageOffsets;
00106   ModalStorageReader * _reader;
00107 };
00108 
00109 inline bool DCReportBlock::profile(int i) const
00110 {
00111   TRACE;
00112   if(_profileOffsets[ i ] > 0) {
00113     _s->device()->seek(_profileOffsets[ i ] );
00114     return true;
00115   } else return false;
00116 }
00117 
00118 inline bool DCReportBlock::modalStorage(int i) const
00119 {
00120   TRACE;
00121   if(_modalStorageOffsets[ i ] > 0) {
00122     _s->device()->seek(_modalStorageOffsets[ i ] );
00123     return true;
00124   } else return false;
00125 }
00126 
00127 } // namespace DinverDCCore
00128 
00129 #endif // DCREPORTBLOCK_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines