DinverDCCore/TargetList.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 : 2004-10-21
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (ULg, Liège, Belgium)
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef TARGETLIST_H
00029 #define TARGETLIST_H
00030 
00031 #include <QGpCoreTools.h>
00032 #include <QGpCoreWave.h>
00033 #include <DinverCore.h>
00034 
00035 #include "DCReportBlock.h"
00036 #include "PoissonCondition.h"
00037 #include "ModalCurveTarget.h"
00038 #include "AutocorrTarget.h"
00039 #include "ValueTarget.h"
00040 #include "RefractionTarget.h"
00041 #include "MagnetoTelluricTarget.h"
00042 #include "ParamProfile.h"
00043 #include "DinverDCCoreDLLExport.h"
00044 
00045 namespace DinverDCCore {
00046 
00047 class ParamGroundModel;
00048 
00049 class DINVERDCCORE_EXPORT TargetList : public XMLClass
00050 {
00051   TRANSLATIONS("TargetList")
00052 public:
00053   TargetList();
00054   TargetList(const TargetList& o);
00055   virtual ~TargetList();
00056 
00057   virtual const QString& xml_tagName() const {return xmlTargetListTag;}
00058   static const QString xmlTargetListTag;
00059 
00060   void setParamProfiles(ParamGroundModel * gm, RealSpace& ps);
00061   inline bool isPoissonRatioOk(const GroundParameter * from);
00062   double misfit(int nDimensions, bool& ok);
00063   void surfaceMisfit(double& totalMisfit, double& totalWeight,
00064                       Seismic1DModel * surfModel,
00065                       int nDimensions, bool& ok);
00066   void refractionMisfit(double& totalMisfit, double& totalWeight,
00067                          Seismic1DModel * surfModel, const QVector<double>& pitch,
00068                          int nDimensions, bool& ok);
00069   void refractionMisfit(double& totalMisfit, double& totalWeight,
00070                          RefractionDippingModel * tiltModel,
00071                          int nDimensions, bool& ok);
00072   void magnetoTelluricMisfit(double& totalMisfit, double& totalWeight,
00073                              const Resistivity1DModel * model, double staticShift,
00074                              int nDimensions, bool& ok);
00075   inline void writeReport(ReportWriter * report) const;
00076 
00077   ModalCurveTarget& dispersionTarget() {return _dispersionTarget;}
00078   const ModalCurveTarget& dispersionTarget() const {return _dispersionTarget;}
00079 
00080   AutocorrTarget& autocorrTarget() {return _autocorrTarget;}
00081   const AutocorrTarget& autocorrTarget() const {return _autocorrTarget;}
00082 
00083   ModalCurveTarget& ellipticityCurveTarget() {return _ellipticityCurveTarget;}
00084   const ModalCurveTarget& ellipticityCurveTarget() const {return _ellipticityCurveTarget;}
00085 
00086   ValueTarget& ellipticityPeakTarget() {return _ellipticityPeakTarget;}
00087   const ValueTarget& ellipticityPeakTarget() const {return _ellipticityPeakTarget;}
00088 
00089   RefractionTarget& refractionVpTarget() {return _refractionVpTarget;}
00090   const RefractionTarget& refractionVpTarget() const {return _refractionVpTarget;}
00091 
00092   RefractionTarget& refractionVsTarget() {return _refractionVsTarget;}
00093   const RefractionTarget& refractionVsTarget() const {return _refractionVsTarget;}
00094 
00095   MagnetoTelluricTarget& magnetoTelluricTarget() {return _magnetoTelluricTarget;}
00096   const MagnetoTelluricTarget& magnetoTelluricTarget() const {return _magnetoTelluricTarget;}
00097 
00098   const Point& position() const {return _position;}
00099   void setPosition(const Point& p) {_position=p;}
00100 
00101   void setMisfitType(MisfitType t);
00102 
00103   bool isEmpty() const;
00104   void validateTargets();
00105   int dispersionSampleCount() const;
00106   inline bool isGroundModelParameter(const Parameter * p) const;
00107 protected:
00108   virtual void xml_writeProperties(XML_WRITECHILDREN_ARGS) const;
00109   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00110   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00111   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00112   virtual void xml_polishChild(XML_POLISHCHILD_ARGS);
00113   virtual void xml_polish(XML_POLISH_ARGS);
00114 private:
00115   friend class DCReportBlock;
00116 
00117   void initFactories();
00118   void initProfiles();
00119   void deleteFactories();
00120   double curveMisfit(const QList<ModalCurve>& curveList, ModalFactory& f,
00121                      const Target& target, int nDimensions);
00122   double curveMisfit(const QList<RefractionCurve>& curveList, RefractionFactory& f,
00123                      const Target& target, int nDimensions);
00124   double curveMisfit(const QList<MagnetoTelluricCurve>& curveList, MagnetoTelluricFactory& f,
00125                      const Target& target, int nDimensions);
00126   double logMisfit(const QList<ModalCurve>& curveList, ModalFactory& f,
00127                    const Target& target, int nDimensions);
00128   double determinantMisfit(const QList<ModalCurve>& curveList, Seismic1DModel * surfModel);
00129   double modelMisfit();
00130   inline bool surfaceWave() const;
00131   // Targets
00132   ModalCurveTarget _dispersionTarget;
00133   AutocorrTarget _autocorrTarget;
00134   ModalCurveTarget _ellipticityCurveTarget;
00135   ValueTarget _ellipticityPeakTarget;
00136   RefractionTarget _refractionVpTarget;
00137   RefractionTarget _refractionVsTarget;
00138   MagnetoTelluricTarget _magnetoTelluricTarget;
00139 
00140   // Computation storages
00141   DispersionFactory * _dispersionFactory;
00142   AutocorrFactory * _autocorrFactory;
00143   EllipticityFactory * _ellipticityFactory;
00144   RefractionFactory * _refractionVpFactory;
00145   RefractionFactory * _refractionVsFactory;
00146   MagnetoTelluricFactory * _magnetoTelluricFactory;
00147 
00148   // Ground structure
00149   ParamProfile * _vp, * _nu, * _vs, * _rho, * _pitch, * _res;
00150   Parameter * _magnetoTelluricStaticShift;
00151   PoissonCondition * _poissonCondition;
00152 
00153   // Position
00154   Point _position;
00155 
00156   Seismic1DModel * surfaceWaveModel();
00157 };
00158 
00159 inline bool TargetList::isGroundModelParameter(const Parameter * p) const
00160 {
00161   return p!= _magnetoTelluricStaticShift;
00162 }
00163 
00164 inline void TargetList::writeReport(ReportWriter * report) const
00165 {
00166   TRACE;
00167   DCReportBlock::write(report, *this,
00168                        _vp ? &_vp->resampledProfile() : 0,
00169                        _vs ? &_vs->resampledProfile() : 0,
00170                        _rho ? &_rho->resampledProfile() : 0,
00171                        _pitch ? &_pitch->resampledProfile() : 0,
00172                        _res ? &_res->resampledProfile() : 0);
00173 }
00174 
00175 inline bool TargetList::isPoissonRatioOk(const GroundParameter * from)
00176 {
00177   TRACE;
00178   if(_poissonCondition)
00179     return _poissonCondition->isOk(from);
00180   else
00181     return true;
00182 }
00183 
00184 } // namespace DinverDCCore
00185 
00186 #endif // TARGETLIST_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines