|
@@ -11,75 +11,31 @@
|
11
|
11
|
@version $Id: layeredearthem.cpp 216 2015-03-09 02:26:49Z tirons $
|
12
|
12
|
**/
|
13
|
13
|
|
14
|
|
-#include "layeredearthem.h"
|
|
14
|
+#include "LayeredEarthEM.h"
|
15
|
15
|
|
16
|
16
|
namespace Lemma {
|
17
|
17
|
|
18
|
|
-#ifdef HAVE_YAMLCPP
|
19
|
18
|
std::ostream &operator << (std::ostream &stream, const LayeredEarthEM &ob) {
|
20
|
19
|
stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
|
21
|
20
|
return stream;
|
22
|
21
|
}
|
23
|
|
-#else
|
24
|
|
- std::ostream &operator<<(std::ostream &stream,
|
25
|
|
- const LayeredEarthEM &ob) {
|
26
|
|
- stream << *(LayeredEarth*)(&ob);
|
27
|
|
- //stream << "Class Name : "<< ob.Name << "\n";
|
28
|
|
- stream << std::setw(15) << "LayerNumber" << "\t"
|
29
|
|
- << std::setw(15) << "Thickness" << "\t"
|
30
|
|
- << std::setw(15) << "BottomInterface" << "\t"
|
31
|
|
- << std::setw(15) << "Conductivity" << "\t"
|
32
|
|
- << std::setw(15) << "Susceptibility" << "\t"
|
33
|
|
- << std::setw(15) << "Permitivity" << "\n";
|
34
|
|
- stream << std::setw(15) << " " << "\t"
|
35
|
|
- << std::setw(15) << "[m]" << "\t"
|
36
|
|
- << std::setw(15) << "[m]" << "\t"
|
37
|
|
- << std::setw(15) << "[Sm^-1]" << "\t"
|
38
|
|
- << std::setw(15) << "[]" << "\t"
|
39
|
|
- << std::setw(15) << "[F/m]" << "\n";
|
40
|
|
- for (int i=0; i< ob.NumberOfLayers; ++i) {
|
41
|
|
- stream << std::setw(15) << i << "\t"
|
42
|
|
- << std::setw(15) << ((LayeredEarth*)(&ob))->GetLayerThickness(i) << "\t"
|
43
|
|
- << std::setw(15) << ((LayeredEarth*)(&ob))->GetLayerDepth(i) << "\t"
|
44
|
|
- << std::setw(15) << ob.LayerConductivity(i) << "\t"
|
45
|
|
- << std::setw(15) << ob.LayerSusceptibility(i) << "\t"
|
46
|
|
- << std::setw(15) << ob.LayerPermitivity(i) << "\n";
|
47
|
|
- }
|
48
|
|
-
|
49
|
|
- return stream;
|
50
|
|
- }
|
51
|
|
-#endif
|
52
|
22
|
|
53
|
23
|
// ==================== LIFECYCLE ===================================
|
54
|
24
|
|
55
|
|
- LayeredEarthEM::LayeredEarthEM(const std::string &name) :
|
56
|
|
- LayeredEarth(name) {
|
|
25
|
+ LayeredEarthEM::LayeredEarthEM( ) : LayeredEarth() {
|
57
|
26
|
}
|
58
|
27
|
|
59
|
28
|
LayeredEarthEM::~LayeredEarthEM() {
|
60
|
|
- if (NumberOfReferences != 0) {
|
61
|
|
- throw DeleteObjectWithReferences(this);
|
62
|
|
- }
|
63
|
|
- }
|
64
|
|
-
|
65
|
|
- LayeredEarthEM* LayeredEarthEM::New() {
|
66
|
|
- LayeredEarthEM* Obj = new LayeredEarthEM("LayeredEarthEM");
|
67
|
|
- Obj->AttachTo(Obj);
|
68
|
|
- return Obj;
|
69
|
29
|
}
|
70
|
30
|
|
71
|
|
- void LayeredEarthEM::Delete() {
|
72
|
|
- this->DetachFrom(this);
|
|
31
|
+ std::shared_ptr<LayeredEarthEM> LayeredEarthEM::NewSP() {
|
|
32
|
+ std::shared_ptr<LayeredEarthEM> sp(new LayeredEarthEM( ), LemmaObjectDeleter() );
|
|
33
|
+ return sp;
|
73
|
34
|
}
|
74
|
35
|
|
75
|
|
- void LayeredEarthEM::Release() {
|
76
|
|
- delete this;
|
77
|
|
- }
|
78
|
|
-
|
79
|
|
- #ifdef HAVE_YAMLCPP
|
80
|
36
|
YAML::Node LayeredEarthEM::Serialize() const {
|
81
|
37
|
YAML::Node node = LayeredEarth::Serialize();
|
82
|
|
- node.SetTag( this->Name );
|
|
38
|
+ node.SetTag( GetName() );
|
83
|
39
|
node["LayerConductivity"] = LayerConductivity;
|
84
|
40
|
node["LayerSusceptibility"] = LayerSusceptibility;
|
85
|
41
|
node["LayerLowFreqSusceptibility"] = LayerLowFreqSusceptibility;
|
|
@@ -93,12 +49,11 @@ namespace Lemma {
|
93
|
49
|
node["LayerBreathPermitivity"] = LayerBreathPermitivity;
|
94
|
50
|
return node;
|
95
|
51
|
}
|
96
|
|
- #endif
|
97
|
52
|
|
98
|
53
|
// ==================== OPERATIONS ===================================
|
99
|
54
|
void LayeredEarthEM::EvaluateColeColeModel(const Real& omega) {
|
100
|
55
|
|
101
|
|
- for (int ilay=0; ilay<NumberOfLayers; ++ilay) {
|
|
56
|
+ for (int ilay=0; ilay<GetNumberOfLayers(); ++ilay) {
|
102
|
57
|
if ( LayerTauSusceptibility(ilay) > 1e-10) {
|
103
|
58
|
LayerSusceptibility(ilay) = LayerHighFreqSusceptibility(ilay) + (LayerLowFreqSusceptibility(ilay) -
|
104
|
59
|
LayerHighFreqSusceptibility(ilay)) /
|
|
@@ -122,9 +77,8 @@ namespace Lemma {
|
122
|
77
|
}
|
123
|
78
|
}
|
124
|
79
|
|
125
|
|
- LayeredEarthEM* LayeredEarthEM::Clone() {
|
126
|
|
- LayeredEarthEM* copy = LayeredEarthEM::New();
|
127
|
|
-
|
|
80
|
+ std::shared_ptr<LayeredEarthEM> LayeredEarthEM::Clone() {
|
|
81
|
+ auto copy = LayeredEarthEM::NewSP();
|
128
|
82
|
copy->LayerConductivity = this->LayerConductivity;
|
129
|
83
|
copy->LayerSusceptibility = this->LayerSusceptibility;
|
130
|
84
|
copy->LayerLowFreqSusceptibility = this->LayerLowFreqSusceptibility;
|
|
@@ -136,24 +90,22 @@ namespace Lemma {
|
136
|
90
|
copy->LayerHighFreqPermitivity = this->LayerHighFreqPermitivity;
|
137
|
91
|
copy->LayerTauPermitivity = this->LayerTauPermitivity;
|
138
|
92
|
copy->LayerBreathPermitivity = this->LayerBreathPermitivity;
|
139
|
|
- copy->NumberOfLayers = this->NumberOfLayers;
|
|
93
|
+ copy->SetNumberOfLayers( this->GetNumberOfLayers() );
|
140
|
94
|
copy->NumberOfInterfaces = this->NumberOfInterfaces;
|
141
|
95
|
copy->LayerThickness = this->LayerThickness;
|
142
|
|
-
|
143
|
96
|
return copy;
|
144
|
|
-
|
145
|
97
|
}
|
146
|
98
|
|
147
|
99
|
// ==================== ACCESS ==================================
|
148
|
100
|
|
149
|
101
|
void LayeredEarthEM::SetLayerConductivity(const VectorXcr &sig) {
|
150
|
|
- if (sig.size() != this->NumberOfLayers )
|
|
102
|
+ if (sig.size() != this->GetNumberOfLayers() )
|
151
|
103
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
152
|
104
|
LayerConductivity = sig;
|
153
|
105
|
}
|
154
|
106
|
|
155
|
107
|
void LayeredEarthEM::SetLayerConductivity(const int& ilay, const Complex &sig) {
|
156
|
|
- if (ilay > this->NumberOfLayers || ilay < 1 )
|
|
108
|
+ if (ilay > this->GetNumberOfLayers() || ilay < 1 )
|
157
|
109
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
158
|
110
|
LayerConductivity[ilay] = sig;
|
159
|
111
|
}
|
|
@@ -167,55 +119,55 @@ namespace Lemma {
|
167
|
119
|
*/
|
168
|
120
|
|
169
|
121
|
void LayeredEarthEM::SetLayerHighFreqSusceptibility(const VectorXr &sus) {
|
170
|
|
- if (sus.size() != this->NumberOfLayers )
|
|
122
|
+ if (sus.size() != this->GetNumberOfLayers() )
|
171
|
123
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
172
|
124
|
LayerHighFreqSusceptibility = sus;
|
173
|
125
|
}
|
174
|
126
|
|
175
|
127
|
void LayeredEarthEM::SetLayerLowFreqSusceptibility(const VectorXr &sus) {
|
176
|
|
- if (sus.size() != this->NumberOfLayers )
|
|
128
|
+ if (sus.size() != this->GetNumberOfLayers() )
|
177
|
129
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
178
|
130
|
LayerLowFreqSusceptibility = sus;
|
179
|
131
|
}
|
180
|
132
|
|
181
|
133
|
void LayeredEarthEM::SetLayerBreathSusceptibility(const VectorXr &sus) {
|
182
|
|
- if (sus.size() != this->NumberOfLayers )
|
|
134
|
+ if (sus.size() != this->GetNumberOfLayers() )
|
183
|
135
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
184
|
136
|
LayerBreathSusceptibility = sus;
|
185
|
137
|
}
|
186
|
138
|
|
187
|
139
|
void LayeredEarthEM::SetLayerTauSusceptibility(const VectorXr &sus) {
|
188
|
|
- if (sus.size() != this->NumberOfLayers )
|
|
140
|
+ if (sus.size() != this->GetNumberOfLayers() )
|
189
|
141
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
190
|
142
|
LayerTauSusceptibility = sus;
|
191
|
143
|
}
|
192
|
144
|
|
193
|
145
|
void LayeredEarthEM::SetLayerHighFreqPermitivity(const VectorXr &per) {
|
194
|
|
- if (per.size() != this->NumberOfLayers )
|
|
146
|
+ if (per.size() != this->GetNumberOfLayers() )
|
195
|
147
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
196
|
148
|
LayerHighFreqPermitivity = per;
|
197
|
149
|
}
|
198
|
150
|
|
199
|
151
|
void LayeredEarthEM::SetLayerLowFreqPermitivity(const VectorXr &per) {
|
200
|
|
- if (per.size() != this->NumberOfLayers )
|
|
152
|
+ if (per.size() != this->GetNumberOfLayers() )
|
201
|
153
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
202
|
154
|
LayerLowFreqPermitivity = per;
|
203
|
155
|
}
|
204
|
156
|
|
205
|
157
|
void LayeredEarthEM::SetLayerBreathPermitivity(const VectorXr &per) {
|
206
|
|
- if (per.size() != this->NumberOfLayers )
|
|
158
|
+ if (per.size() != this->GetNumberOfLayers() )
|
207
|
159
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
208
|
160
|
LayerBreathPermitivity = per;
|
209
|
161
|
}
|
210
|
162
|
|
211
|
163
|
void LayeredEarthEM::SetLayerTauPermitivity(const VectorXr &per) {
|
212
|
|
- if (per.size() != this->NumberOfLayers )
|
|
164
|
+ if (per.size() != this->GetNumberOfLayers() )
|
213
|
165
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
214
|
166
|
LayerTauPermitivity = per;
|
215
|
167
|
}
|
216
|
168
|
|
217
|
169
|
void LayeredEarthEM::SetLayerThickness(const VectorXr &thick) {
|
218
|
|
- if (thick.size() != this->NumberOfLayers - 2)
|
|
170
|
+ if (thick.size() != this->GetNumberOfLayers() - 2)
|
219
|
171
|
throw EarthModelParametersDoNotMatchNumberOfLayers( );
|
220
|
172
|
LayerThickness = thick;
|
221
|
173
|
}
|
|
@@ -231,7 +183,7 @@ namespace Lemma {
|
231
|
183
|
|
232
|
184
|
// Otherwise
|
233
|
185
|
this->NumberOfLayers = nlay;
|
234
|
|
-
|
|
186
|
+ this->NumberOfInterfaces = nlay-1;
|
235
|
187
|
|
236
|
188
|
// Resize all layers
|
237
|
189
|
|
|
@@ -244,7 +196,6 @@ namespace Lemma {
|
244
|
196
|
// Conducitivy set to zero
|
245
|
197
|
LayerConductivity = VectorXcr::Zero(NumberOfLayers);
|
246
|
198
|
|
247
|
|
-
|
248
|
199
|
////////////////////////////////////
|
249
|
200
|
// Susceptibility set to One (free space)
|
250
|
201
|
LayerSusceptibility = VectorXcr::Ones(NumberOfLayers);
|
|
@@ -359,3 +310,6 @@ namespace Lemma {
|
359
|
310
|
return this->LayerBreathPermitivity;
|
360
|
311
|
}
|
361
|
312
|
}
|
|
313
|
+
|
|
314
|
+/* vim: set tabstop=4 expandtab: */
|
|
315
|
+/* vim: set filetype=cpp: */
|