FEMTIC
ObservedDataStationNMT2.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------------------
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2021 Yoshiya Usui
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //-------------------------------------------------------------------------------------------------------
24 #ifndef DBLDEF_OBSERVED_DATA_NMT2
25 #define DBLDEF_OBSERVED_DATA_NMT2
26 
27 #include <vector>
28 #include <complex>
29 
30 #include "ObservedDataStation.h"
32 #include "Forward3D.h"
33 #include "CommonParameters.h"
34 #include "MeshDataTetraElement.h"
35 
36 // Observed data of NMT station ( triangle area )
38  public:
39  // Constructer
40  explicit ObservedDataStationNMT2();
41 
42  // Destructer
43  virtual ~ObservedDataStationNMT2();
44 
45  // Read data from input file
46  virtual void inputObservedData( std::ifstream& inFile );
47 
48  // Find elements including dipole
50 
51  // Calulate difference of voltages
52  void calculateVoltageDifferences( const Forward3D* const ptrForward3D, const int rhsVectorIDOfVoltageDifference1st, const int rhsVectorIDOfVoltageDifference2nd );
53 
54  // Calulate Impedance tensor
55  void calculateImpedanceTensor( const double freq, const ObservedDataStationPoint* const ptrStationOfMagneticField, int& icount );
56 
57  // Initialize difference of voltages
58  void initializeVoltageDifferences( const int iPol );
59 
60  // Initialize Impedance tensor and errors
62 
63  // Allocate memory for the calculated impedance tensors and errors
64  virtual void allocateMemoryForCalculatedValues();
65 
66  // Output calculated values of impedance tensors
67  virtual void outputCalculatedValues() const;
68 
69  // Calulate interpolator vector of voltage difference
70  void calcInterpolatorVectorOfVoltageDifference( Forward3D* const ptrForward3D );
71 
72  // Calulate sensitivity matrix of Impedance tensors
73  virtual void calculateSensitivityMatrix( const double freq, const int nModel,
74  const ObservedDataStationPoint* const ptrStationOfMagneticField,
75  const std::complex<double>* const derivativesOfEMFieldExPol,
76  const std::complex<double>* const derivativesOfEMFieldEyPol,
77  double* const sensitivityMatrix, const bool forceSDToOne = false ) const;
78 
79  // Calculate data vector of this PE
80  virtual void calculateResidualVectorOfDataThisPE( const double freq, const int offset, double* vector ) const;
81 
82  // Calulate sum of square of misfit
83  virtual double calculateErrorSumOfSquaresThisPE() const;
84 
85  // Get location of the station
86  const CommonParameters::locationDipole& getLocationOfStation( const int iDipole ) const;
87 
88  // Get Z coordinate of the point
89  double getZCoordOfPoint( const int iDipole , const int num ) const;
90 
91  protected:
93  XX = 0,
94  XY,
95  YX,
96  YY
97  };
98 
99  // Location of the station
101 
102  std::complex<double>* m_ZxxObserved;
103  std::complex<double>* m_ZxyObserved;
104  std::complex<double>* m_ZyxObserved;
105  std::complex<double>* m_ZyyObserved;
106 
111 
112  std::complex<double>* m_ZxxCalculated;
113  std::complex<double>* m_ZxyCalculated;
114  std::complex<double>* m_ZyxCalculated;
115  std::complex<double>* m_ZyyCalculated;
116 
121 
126 
127  private:
128  std::complex<double> m_voltageCalculated[2][2];
129 
130  // Total number of elemenst including dipole
132 
133  // Elements including dipoles
135 
136  // Faces including dipoles
138 
139  // local coordinate values of the location of start point of line segment
141 
142  // local coordinate values of the location of end point of line segment
144 
146  //CommonParameters::VolumeCoords* m_volumeCoordinateValuesStartPoint[2];
147 
149  //CommonParameters::VolumeCoords* m_volumeCoordinateValuesEndPoint[2];
150 
151  // Volume coordinate values of the location of start point of line segment for tetrahedral mesh
153 
154  // Volume coordinate values of the location of start point of line segment for tetrahedral mesh
156 
157  //int m_columnNumberOfVoltageDifferenceInRhsMatrix[2];
159 
160  // Copy constructer
162 
163  // Copy assignment operator
165 };
166 
167 #endif
Definition: Forward3D.h:37
Definition: ObservedDataStationNMT2.h:37
CommonParameters::DoubleComplexValues * m_ZxxResidual
Definition: ObservedDataStationNMT2.h:117
CommonParameters::InitComplexValues * m_dataIDOfZyx
Definition: ObservedDataStationNMT2.h:124
virtual ~ObservedDataStationNMT2()
Definition: ObservedDataStationNMT2.cpp:80
virtual void calculateSensitivityMatrix(const double freq, const int nModel, const ObservedDataStationPoint *const ptrStationOfMagneticField, const std::complex< double > *const derivativesOfEMFieldExPol, const std::complex< double > *const derivativesOfEMFieldEyPol, double *const sensitivityMatrix, const bool forceSDToOne=false) const
Definition: ObservedDataStationNMT2.cpp:747
CommonParameters::DoubleComplexValues * m_ZxxSD
Definition: ObservedDataStationNMT2.h:107
CommonParameters::DoubleComplexValues * m_ZyySD
Definition: ObservedDataStationNMT2.h:110
CommonParameters::locationDipole m_location[2]
Definition: ObservedDataStationNMT2.h:100
CommonParameters::InitComplexValues * m_dataIDOfZyy
Definition: ObservedDataStationNMT2.h:125
CommonParameters::InitComplexValues * m_dataIDOfZxy
Definition: ObservedDataStationNMT2.h:123
void initializeImpedanceTensorsAndErrors()
Definition: ObservedDataStationNMT2.cpp:560
CommonParameters::locationXY * m_localCoordinateValuesStartPoint[2]
Definition: ObservedDataStationNMT2.h:140
int m_rhsVectorIDOfVoltageDifference[2]
Definition: ObservedDataStationNMT2.h:158
virtual double calculateErrorSumOfSquaresThisPE() const
Definition: ObservedDataStationNMT2.cpp:898
CommonParameters::DoubleComplexValues * m_ZxyResidual
Definition: ObservedDataStationNMT2.h:118
const CommonParameters::locationDipole & getLocationOfStation(const int iDipole) const
Definition: ObservedDataStationNMT2.cpp:918
int * m_elementsIncludingDipole[2]
Definition: ObservedDataStationNMT2.h:134
ImpedanceTensorComponentNMT2
Definition: ObservedDataStationNMT2.h:92
@ XX
Definition: ObservedDataStationNMT2.h:93
@ YY
Definition: ObservedDataStationNMT2.h:96
@ XY
Definition: ObservedDataStationNMT2.h:94
@ YX
Definition: ObservedDataStationNMT2.h:95
std::complex< double > * m_ZxxCalculated
Definition: ObservedDataStationNMT2.h:112
int * m_facesIncludingDipole[2]
Definition: ObservedDataStationNMT2.h:137
std::complex< double > * m_ZyxObserved
Definition: ObservedDataStationNMT2.h:104
ObservedDataStationNMT2 & operator=(const ObservedDataStationNMT2 &rhs)
void calculateImpedanceTensor(const double freq, const ObservedDataStationPoint *const ptrStationOfMagneticField, int &icount)
Definition: ObservedDataStationNMT2.cpp:472
void calcInterpolatorVectorOfVoltageDifference(Forward3D *const ptrForward3D)
Definition: ObservedDataStationNMT2.cpp:729
CommonParameters::DoubleComplexValues * m_ZyyResidual
Definition: ObservedDataStationNMT2.h:120
ObservedDataStationNMT2(const ObservedDataStationNMT2 &rhs)
CommonParameters::AreaCoords * m_areaCoordinateValuesStartPoint[2]
Definition: ObservedDataStationNMT2.h:152
virtual void allocateMemoryForCalculatedValues()
Definition: ObservedDataStationNMT2.cpp:583
std::complex< double > * m_ZyxCalculated
Definition: ObservedDataStationNMT2.h:114
CommonParameters::AreaCoords * m_areaCoordinateValuesEndPoint[2]
Definition: ObservedDataStationNMT2.h:155
CommonParameters::DoubleComplexValues * m_ZyxSD
Definition: ObservedDataStationNMT2.h:109
std::complex< double > * m_ZxyObserved
Definition: ObservedDataStationNMT2.h:103
virtual void inputObservedData(std::ifstream &inFile)
Definition: ObservedDataStationNMT2.cpp:219
void findElementsIncludingDipoles()
Definition: ObservedDataStationNMT2.cpp:314
void initializeVoltageDifferences(const int iPol)
Definition: ObservedDataStationNMT2.cpp:552
std::complex< double > * m_ZyyCalculated
Definition: ObservedDataStationNMT2.h:115
virtual void outputCalculatedValues() const
Definition: ObservedDataStationNMT2.cpp:688
ObservedDataStationNMT2()
Definition: ObservedDataStationNMT2.cpp:37
std::complex< double > * m_ZyyObserved
Definition: ObservedDataStationNMT2.h:105
void calculateVoltageDifferences(const Forward3D *const ptrForward3D, const int rhsVectorIDOfVoltageDifference1st, const int rhsVectorIDOfVoltageDifference2nd)
Definition: ObservedDataStationNMT2.cpp:443
std::complex< double > * m_ZxxObserved
Definition: ObservedDataStationNMT2.h:102
int m_numElementsIncludingDipole[2]
Definition: ObservedDataStationNMT2.h:131
CommonParameters::locationXY * m_localCoordinateValuesEndPoint[2]
Definition: ObservedDataStationNMT2.h:143
virtual void calculateResidualVectorOfDataThisPE(const double freq, const int offset, double *vector) const
Definition: ObservedDataStationNMT2.cpp:879
std::complex< double > * m_ZxyCalculated
Definition: ObservedDataStationNMT2.h:113
CommonParameters::DoubleComplexValues * m_ZyxResidual
Definition: ObservedDataStationNMT2.h:119
double getZCoordOfPoint(const int iDipole, const int num) const
Definition: ObservedDataStationNMT2.cpp:927
CommonParameters::DoubleComplexValues * m_ZxySD
Definition: ObservedDataStationNMT2.h:108
std::complex< double > m_voltageCalculated[2][2]
Definition: ObservedDataStationNMT2.h:128
CommonParameters::InitComplexValues * m_dataIDOfZxx
Definition: ObservedDataStationNMT2.h:122
Definition: ObservedDataStationPoint.h:33
Definition: ObservedDataStation.h:35
Definition: CommonParameters.h:99
Definition: CommonParameters.h:64
Definition: CommonParameters.h:69
Definition: CommonParameters.h:59
Definition: CommonParameters.h:38