GPLIB++
ptfuncs.h
Go to the documentation of this file.
1 #ifndef PTFUNCS_H_
2 #define PTFUNCS_H_
3 
4 #include <cmath>
5 
6 namespace gplib
7  {
8  /*! /file
9  * This header file provides some function to calculate phase tensor quantities that are used in MTTensor and PTensorMTData
10  */
11 
12 
13  /** \addtogroup mttools MT data analysis, processing and inversion */
14  /* @{ */
15 
16  //! return the phase tensor rotation angle as a function of the four phase tensor elements
17  double inline Alpha_phi(const double phi11, const double phi12,
18  const double phi21, const double phi22)
19  {
20  return 0.5 * atan2(phi12 + phi21, phi11 - phi22);
21  }
22  //! return the phase tensor skew angle as a function of the four phase tensor elements
23  double inline Beta_phi(const double phi11, const double phi12,
24  const double phi21, const double phi22)
25  {
26  return 0.5 * atan2(phi12 - phi21, phi11 + phi22);
27  }
28  //! return the phase tensor rotational invariant \f$ \Pi_1 \f$ as a function of the four phase tensor elements
29  double inline Pi1(const double phi11, const double phi12,
30  const double phi21, const double phi22)
31  {
32  return 0.5 * sqrt(std::pow(phi11 - phi22, 2) + std::pow(phi12 + phi21, 2));
33  }
34  //! return the phase tensor rotational invariant \f$ \Pi_2 \f$ as a function of the four phase tensor elements
35  double inline Pi2(const double phi11, const double phi12,
36  const double phi21, const double phi22)
37  {
38  return 0.5 * sqrt(std::pow(phi11 + phi22, 2) + std::pow(phi12 - phi21, 2));
39  }
40  //! return the phase tensor strike angle as a function of the four phase tensor elements
41  double inline PhiStrike(const double phi11, const double phi12,
42  const double phi21, const double phi22)
43  {
44  return Alpha_phi(phi11, phi12, phi21, phi22) - Beta_phi(phi11, phi12,
45  phi21, phi22);
46  }
47  //! Return the maximum principal component of the phase tensor
48  double inline PhiMax(const double phi11, const double phi12,
49  const double phi21, const double phi22)
50  {
51  return Pi2(phi11, phi12, phi21, phi22)
52  + Pi1(phi11, phi12, phi21, phi22);
53  }
54  //! Return the mimum principal component of the phase tensor
55  double inline PhiMin(const double phi11, const double phi12,
56  const double phi21, const double phi22)
57  {
58  return Pi2(phi11, phi12, phi21, phi22)
59  - Pi1(phi11, phi12, phi21, phi22);
60  }
61  //! Return the trace of the phase tensor
62  double inline trPhi(const double phi11, const double phi12,
63  const double phi21, const double phi22)
64  {
65  return phi11 + phi22;
66  }
67  //! Return the skew of the phase tensor
68  double inline skPhi(const double phi11, const double phi12,
69  const double phi21, const double phi22)
70  {
71  return phi12 - phi21;
72  }
73  //! Return the determinant of the phase tensor
74  double inline detPhi(const double phi11, const double phi12,
75  const double phi21, const double phi22)
76  {
77  return phi11 * phi22 - phi12 * phi21;
78  }
79 
80  double inline Phi1(const double phi11, const double phi12,
81  const double phi21, const double phi22)
82  {
83  return trPhi(phi11, phi12, phi21, phi22) / 2.;
84  }
85 
86  double inline Phi2(const double phi11, const double phi12,
87  const double phi21, const double phi22)
88  {
89  return sqrt(std::abs(detPhi(phi11, phi12, phi21, phi22)));
90  }
91 
92  double inline GetPhi2Sq(const double phi11, const double phi12,
93  const double phi21, const double phi22)
94  {
95  return detPhi(phi11, phi12, phi21, phi22);
96  }
97 
98  double inline GetPhi3(const double phi11, const double phi12,
99  const double phi21, const double phi22)
100  {
101  return skPhi(phi11, phi12, phi21, phi22) / 2.;
102  }
103  //! Return the ellipticity of the phase tensor
104  double inline GetPhiEllip(const double phi11, const double phi12,
105  const double phi21, const double phi22)
106  {
107  return (PhiMax(phi11, phi12, phi21, phi22) - PhiMin(phi11, phi12,
108  phi21, phi22)) / (PhiMax(phi11, phi12, phi21, phi22) + PhiMin(
109  phi11, phi12, phi21, phi22));
110  }
111  /* @} */
112  }
113 #endif /*PTFUNCS_H_*/
double Alpha_phi(const double phi11, const double phi12, const double phi21, const double phi22)
return the phase tensor rotation angle as a function of the four phase tensor elements ...
Definition: ptfuncs.h:17
double Pi2(const double phi11, const double phi12, const double phi21, const double phi22)
return the phase tensor rotational invariant as a function of the four phase tensor elements ...
Definition: ptfuncs.h:35
double detPhi(const double phi11, const double phi12, const double phi21, const double phi22)
Return the determinant of the phase tensor.
Definition: ptfuncs.h:74
double PhiStrike(const double phi11, const double phi12, const double phi21, const double phi22)
return the phase tensor strike angle as a function of the four phase tensor elements ...
Definition: ptfuncs.h:41
double PhiMin(const double phi11, const double phi12, const double phi21, const double phi22)
Return the mimum principal component of the phase tensor.
Definition: ptfuncs.h:55
double GetPhi3(const double phi11, const double phi12, const double phi21, const double phi22)
Definition: ptfuncs.h:98
double GetPhi2Sq(const double phi11, const double phi12, const double phi21, const double phi22)
Definition: ptfuncs.h:92
double Phi1(const double phi11, const double phi12, const double phi21, const double phi22)
Definition: ptfuncs.h:80
double PhiMax(const double phi11, const double phi12, const double phi21, const double phi22)
Return the maximum principal component of the phase tensor.
Definition: ptfuncs.h:48
double trPhi(const double phi11, const double phi12, const double phi21, const double phi22)
Return the trace of the phase tensor.
Definition: ptfuncs.h:62
double skPhi(const double phi11, const double phi12, const double phi21, const double phi22)
Return the skew of the phase tensor.
Definition: ptfuncs.h:68
double Pi1(const double phi11, const double phi12, const double phi21, const double phi22)
return the phase tensor rotational invariant as a function of the four phase tensor elements ...
Definition: ptfuncs.h:29
double GetPhiEllip(const double phi11, const double phi12, const double phi21, const double phi22)
Return the ellipticity of the phase tensor.
Definition: ptfuncs.h:104
double Beta_phi(const double phi11, const double phi12, const double phi21, const double phi22)
return the phase tensor skew angle as a function of the four phase tensor elements ...
Definition: ptfuncs.h:23
double Phi2(const double phi11, const double phi12, const double phi21, const double phi22)
Definition: ptfuncs.h:86