ptfuncs.h

Go to the documentation of this file.
00001 #ifndef PTFUNCS_H_
00002 #define PTFUNCS_H_
00003 
00004 #include <cmath>
00005 
00006 namespace gplib
00007   {
00008     /*! /file
00009      * This header file provides some function to calculate phase tensor quantities that are used in MTTensor and PTensorMTData
00010      */
00011 
00012 
00013     /** \addtogroup mttools MT data analysis, processing and inversion */
00014     /* @{ */
00015 
00016     //! return the phase tensor rotation angle as a function of the four phase tensor elements
00017     double inline Alpha_phi(const double phi11, const double phi12,
00018         const double phi21, const double phi22)
00019       {
00020         return 0.5 * atan2(phi12 + phi21, phi11 - phi22);
00021       }
00022     //! return the phase tensor skew angle as a function of the four phase tensor elements
00023     double inline Beta_phi(const double phi11, const double phi12,
00024         const double phi21, const double phi22)
00025       {
00026         return 0.5 * atan2(phi12 - phi21, phi11 + phi22);
00027       }
00028     //! return the phase tensor rotational invariant \f$ \Pi_1 \f$ as a function of the four phase tensor elements
00029     double inline Pi1(const double phi11, const double phi12,
00030         const double phi21, const double phi22)
00031       {
00032         return 0.5 * sqrt(std::pow(phi11 - phi22, 2) + std::pow(phi12 + phi21, 2));
00033       }
00034     //! return the phase tensor rotational invariant \f$ \Pi_2 \f$ as a function of the four phase tensor elements
00035     double inline Pi2(const double phi11, const double phi12,
00036         const double phi21, const double phi22)
00037       {
00038         return 0.5 * sqrt(std::pow(phi11 + phi22, 2) + std::pow(phi12 - phi21, 2));
00039       }
00040     //! return the phase tensor strike angle as a function of the four phase tensor elements
00041     double inline PhiStrike(const double phi11, const double phi12,
00042         const double phi21, const double phi22)
00043       {
00044         return Alpha_phi(phi11, phi12, phi21, phi22) - Beta_phi(phi11, phi12,
00045             phi21, phi22);
00046       }
00047     //! Return the maximum principal component of the phase tensor
00048     double inline PhiMax(const double phi11, const double phi12,
00049         const double phi21, const double phi22)
00050       {
00051         return Pi2(phi11, phi12, phi21, phi22)
00052             + Pi1(phi11, phi12, phi21, phi22);
00053       }
00054     //! Return the mimum principal component of the phase tensor
00055     double inline PhiMin(const double phi11, const double phi12,
00056         const double phi21, const double phi22)
00057       {
00058         return Pi2(phi11, phi12, phi21, phi22)
00059             - Pi1(phi11, phi12, phi21, phi22);
00060       }
00061     //! Return the trace of the phase tensor
00062     double inline trPhi(const double phi11, const double phi12,
00063         const double phi21, const double phi22)
00064       {
00065         return phi11 + phi22;
00066       }
00067     //! Return the skew of the phase tensor
00068     double inline skPhi(const double phi11, const double phi12,
00069         const double phi21, const double phi22)
00070       {
00071         return phi12 - phi21;
00072       }
00073     //! Return the determinant of the phase tensor
00074     double inline detPhi(const double phi11, const double phi12,
00075         const double phi21, const double phi22)
00076       {
00077         return phi11 * phi22 - phi12 * phi21;
00078       }
00079 
00080     double inline Phi1(const double phi11, const double phi12,
00081         const double phi21, const double phi22)
00082       {
00083         return trPhi(phi11, phi12, phi21, phi22) / 2.;
00084       }
00085 
00086     double inline Phi2(const double phi11, const double phi12,
00087         const double phi21, const double phi22)
00088       {
00089         return sqrt(std::abs(detPhi(phi11, phi12, phi21, phi22)));
00090       }
00091 
00092     double inline GetPhi2Sq(const double phi11, const double phi12,
00093         const double phi21, const double phi22)
00094       {
00095         return detPhi(phi11, phi12, phi21, phi22);
00096       }
00097 
00098     double inline GetPhi3(const double phi11, const double phi12,
00099         const double phi21, const double phi22)
00100       {
00101         return skPhi(phi11, phi12, phi21, phi22) / 2.;
00102       }
00103     //! Return the ellipticity of the phase tensor
00104     double inline GetPhiEllip(const double phi11, const double phi12,
00105         const double phi21, const double phi22)
00106       {
00107         return (PhiMax(phi11, phi12, phi21, phi22) - PhiMin(phi11, phi12,
00108             phi21, phi22)) / (PhiMax(phi11, phi12, phi21, phi22) + PhiMin(
00109             phi11, phi12, phi21, phi22));
00110       }
00111   /* @} */
00112   }
00113 #endif /*PTFUNCS_H_*/

Generated on Tue May 4 16:52:14 2010 for GPLIB++ by  doxygen 1.5.8