FEMTIC
Inversion.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_INVERSION
25 #define DBLDEF_INVERSION
26 
27 #include <iostream>
28 #include <complex>
29 #include "Forward3D.h"
30 #include "RougheningSquareMatrix.h"
32 
33 // Class of inversion
34 class Inversion{
35 
36 public:
40  };
41 
42  // Constructer
43  explicit Inversion();
44 
45  // Constructer
46  explicit Inversion( const int nModel, const int nData );
47 
48  // Destructer
49  virtual ~Inversion();
50 
51  // Calculate derivatives of EM field
52  void calculateDerivativesOfEMField( Forward3D* const ptrForward3D, const double freq, const int iPol );
53 
54  // Calculate sensitivity matrix
55  void calculateSensitivityMatrix( const int freqIDAmongThisPE, const double freq );
56 
57  // Allocate memory for sensitivity values
59 
60  // Release memory of sensitivity values
62 
63  // Output scaler sensitivity values to vtk file
65 
66  // Output scaler sensitivity values to binary file
67  void outputSensitivityScalarValuesToBinary( const int interNum ) const;
68 
69  // Perform inversion
70  virtual void inversionCalculation() = 0;
71 
72  // Delete out-of-core file all
74 
75  // Get number of model
76  int getNumberOfModel() const;
77 
78  // Output number of model to log file
79  void outputNumberOfModel() const;
80 
81 protected:
82  // Calculate constraining matrix
83  void calcConstrainingMatrix( DoubleSparseMatrix& constrainingMatrix ) const;
84 
85  // Copy model transforming jacobian matrix
86  void copyModelTransformingJacobian( const int numBlockNotFixed, const int numModel, double* jacobian ) const;
87 
88  // Multiply model transforming jacobian matrix
89  void multiplyModelTransformingJacobian( const int numData, const int numModel, const double* jacobian, double* matrix ) const;
90 
91 private:
92  // Copy constructer
93  Inversion( const Inversion& rhs ){
94  std::cerr << "Error : Copy constructer of the class Inversion is not implemented." << std::endl;
95  exit(1);
96  }
97 
98  // Copy assignment operator
99  Inversion& operator=( const Inversion& rhs ){
100  std::cerr << "Error : Assignment operator of the class Inversion is not implemented." << std::endl;
101  exit(1);
102  }
103 
104  // Number of model
106 
107  // Number of data
109 
110  // Derivatives of EM field
111  std::complex<double>* m_derivativesOfEMField[2];
112 
113  // Sensitivity values
115 
116 };
117 
118 #endif
Definition: DoubleSparseMatrix.h:29
Definition: Forward3D.h:37
Definition: Inversion.h:34
void releaseMemoryOfSensitivityScalarValues()
Definition: Inversion.cpp:278
void copyModelTransformingJacobian(const int numBlockNotFixed, const int numModel, double *jacobian) const
Definition: Inversion.cpp:685
void calcConstrainingMatrix(DoubleSparseMatrix &constrainingMatrix) const
Definition: Inversion.cpp:632
int getNumberOfModel() const
Definition: Inversion.cpp:734
void outputSensitivityScalarValuesToVtk() const
Definition: Inversion.cpp:288
virtual ~Inversion()
Definition: Inversion.cpp:63
void calculateSensitivityMatrix(const int freqIDAmongThisPE, const double freq)
Definition: Inversion.cpp:136
int m_numData
Definition: Inversion.h:108
void multiplyModelTransformingJacobian(const int numData, const int numModel, const double *jacobian, double *matrix) const
Definition: Inversion.cpp:695
std::complex< double > * m_derivativesOfEMField[2]
Definition: Inversion.h:111
InversionMethod
Definition: Inversion.h:37
@ GAUSS_NEWTON_MODEL_SPECE
Definition: Inversion.h:38
@ GAUSS_NEWTON_DATA_SPECE
Definition: Inversion.h:39
void calculateDerivativesOfEMField(Forward3D *const ptrForward3D, const double freq, const int iPol)
Definition: Inversion.cpp:80
void deleteOutOfCoreFileAll()
Definition: Inversion.cpp:713
void allocateMemoryForSensitivityScalarValues()
Definition: Inversion.cpp:259
double * m_sensitivityScalarValues
Definition: Inversion.h:114
Inversion(const Inversion &rhs)
Definition: Inversion.h:93
void outputNumberOfModel() const
Definition: Inversion.cpp:745
Inversion & operator=(const Inversion &rhs)
Definition: Inversion.h:99
Inversion()
Definition: Inversion.cpp:41
virtual void inversionCalculation()=0
int m_numModel
Definition: Inversion.h:105
void outputSensitivityScalarValuesToBinary(const int interNum) const
Definition: Inversion.cpp:421