GPLIB++
MTTensor.cpp
Go to the documentation of this file.
1 #include "MTTensor.h"
2 
3 namespace gplib
4  {
6  Zxx(0), Zxy(0), Zyx(0), Zyy(0), dZxx(0), dZxy(0), dZyx(0), dZyy(0), frequency(0), rotangle(
7  0), Rx(0), Ry(0), Nu(0)
8  {
9  }
10 
11  MTTensor::MTTensor(const std::complex<double> &xx, const std::complex<double> &xy,
12  const std::complex<double> &yx, const std::complex<double> &yy, const double freq,
13  const double angle) :
14  Zxx(xx), Zxy(xy), Zyx(yx), Zyy(yy), dZxx(0), dZxy(0), dZyx(0), dZyy(0), frequency(
15  freq), rotangle(angle), Rx(0), Ry(0), Nu(0)
16  {
17  }
18 
20  {
21  if (this == &source)
22  return *this;
23  Zxx = source.Zxx;
24  Zxy = source.Zxy;
25  Zyx = source.Zyx;
26  Zyy = source.Zyy;
27  dZxx = source.dZxx;
28  dZxy = source.dZxy;
29  dZyx = source.dZyx;
30  dZyy = source.dZyy;
31  frequency = source.frequency;
32  rotangle = source.rotangle;
33  Rx = source.Rx;
34  Ry = source.Ry;
35  Nu = source.Nu;
36  return *this;
37  }
39  {
40  }
41 
42  void MTTensor::Rotate(double angle)
43  {
44  dcomp newxx, newxy, newyx, newyy;
45  const double ca2 = pow(cos(angle), 2);
46  const double sa2 = pow(sin(angle), 2);
47  const double casa = sin(angle) * cos(angle);
48  newxx = Zxx * ca2 - (Zxy + Zyx) * casa + Zyy * sa2;
49  newxy = Zxy * ca2 + (Zxx - Zyy) * casa - Zyx * sa2;
50  newyx = Zyx * ca2 + (Zxx - Zyy) * casa - Zxy * sa2;
51  newyy = Zyy * ca2 + (Zxy + Zyx) * casa + Zxx * sa2;
52  Zxx = newxx;
53  Zxy = newxy;
54  Zyx = newyx;
55  Zyy = newyy;
56  rotangle += angle;
57  }
58  }
void Rotate(double angle)
Rotate by the given angle in radian.
Definition: MTTensor.cpp:42
virtual ~MTTensor()
Definition: MTTensor.cpp:38
Stores MT-Tensor components at a single frequency, calculates derived quantities. ...
Definition: MTTensor.h:16
MTTensor & operator=(const MTTensor &source)
Definition: MTTensor.cpp:19