|
@@ -10,11 +10,9 @@
|
10
|
10
|
/**
|
11
|
11
|
* @file
|
12
|
12
|
* @date 10/08/2014 03:04:56 PM
|
13
|
|
- * @version $Id$
|
14
|
13
|
* @author Trevor Irons (ti)
|
15
|
|
- * @email Trevor.Irons@xri-geo.com
|
16
|
|
- * @copyright Copyright (c) 2014, XRI Geophysics, LLC
|
17
|
|
- * @copyright Copyright (c) 2014, Trevor Irons
|
|
14
|
+ * @email Trevor.Irons@utah.edu
|
|
15
|
+ * @copyright Copyright (c) 2014, 2018 Trevor Irons
|
18
|
16
|
*/
|
19
|
17
|
|
20
|
18
|
#include "TEMReceiver.h"
|
|
@@ -23,36 +21,29 @@ namespace Lemma {
|
23
|
21
|
|
24
|
22
|
|
25
|
23
|
// ==================== FRIEND METHODS =====================
|
26
|
|
-#ifdef HAVE_YAMLCPP
|
|
24
|
+
|
27
|
25
|
std::ostream &operator << (std::ostream &stream, const TEMReceiver &ob) {
|
28
|
|
- stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
|
29
|
|
- return stream;
|
30
|
|
- }
|
31
|
|
-#else
|
32
|
|
- std::ostream &operator<<(std::ostream &stream, const TEMReceiver& ob) {
|
33
|
|
- stream << *(ReceiverPoints*)(&ob);
|
|
26
|
+ stream << ob.Serialize() << "\n";
|
34
|
27
|
return stream;
|
35
|
28
|
}
|
36
|
|
-#endif
|
37
|
29
|
|
38
|
30
|
// ==================== LIFECYCLE =======================
|
39
|
31
|
|
40
|
32
|
//--------------------------------------------------------------------------------------
|
41
|
33
|
// Class: TEMReceiver
|
42
|
34
|
// Method: TEMReceiver
|
43
|
|
- // Description: constructor (protected)
|
|
35
|
+ // Description: constructor (locked)
|
44
|
36
|
//--------------------------------------------------------------------------------------
|
45
|
|
- TEMReceiver::TEMReceiver (const std::string& name) : ReceiverPoints(name), moment(1), referenceTime(0) {
|
|
37
|
+ TEMReceiver::TEMReceiver ( const ctor_key& key ) : FieldPoints(key), moment(1), referenceTime(0) {
|
46
|
38
|
|
47
|
39
|
} // ----- end of method TEMReceiver::TEMReceiver (constructor) -----
|
48
|
40
|
|
49
|
|
-#ifdef HAVE_YAMLCPP
|
50
|
41
|
//--------------------------------------------------------------------------------------
|
51
|
42
|
// Class: TEMReceiver
|
52
|
43
|
// Method: TEMReceiver
|
53
|
44
|
// Description: constructor (protected)
|
54
|
45
|
//--------------------------------------------------------------------------------------
|
55
|
|
- TEMReceiver::TEMReceiver (const YAML::Node& node) : ReceiverPoints(node) {
|
|
46
|
+ TEMReceiver::TEMReceiver (const YAML::Node& node, const ctor_key& key) : FieldPoints(node, key) {
|
56
|
47
|
|
57
|
48
|
moment = node["moment"].as<Real>();
|
58
|
49
|
referenceTime = node["referenceTime"].as<Real>();
|
|
@@ -63,17 +54,14 @@ namespace Lemma {
|
63
|
54
|
noiseSTD = node["noiseSTD"].as<VectorXr>();
|
64
|
55
|
//location = node["location"].as<Vector3r>();
|
65
|
56
|
} // ----- end of method TEMReceiver::TEMReceiver (constructor) -----
|
66
|
|
-#endif
|
67
|
57
|
|
68
|
58
|
//--------------------------------------------------------------------------------------
|
69
|
59
|
// Class: TEMReceiver
|
70
|
60
|
// Method: New()
|
71
|
61
|
// Description: public constructor
|
72
|
62
|
//--------------------------------------------------------------------------------------
|
73
|
|
- TEMReceiver* TEMReceiver::New() {
|
74
|
|
- TEMReceiver* Obj = new TEMReceiver("TEMReceiver");
|
75
|
|
- Obj->AttachTo(Obj);
|
76
|
|
- return Obj;
|
|
63
|
+ std::shared_ptr<TEMReceiver> TEMReceiver::NewSP() {
|
|
64
|
+ return std::make_shared<TEMReceiver> ( ctor_key() );
|
77
|
65
|
}
|
78
|
66
|
|
79
|
67
|
|
|
@@ -81,6 +69,7 @@ namespace Lemma {
|
81
|
69
|
// Class: TEMReceiver
|
82
|
70
|
// Method: Clone
|
83
|
71
|
//--------------------------------------------------------------------------------------
|
|
72
|
+/*
|
84
|
73
|
TEMReceiver* TEMReceiver::Clone() {
|
85
|
74
|
TEMReceiver* Copy = TEMReceiver::New();
|
86
|
75
|
Copy->SetNumberOfReceivers( this->NumberOfReceivers );
|
|
@@ -96,6 +85,7 @@ namespace Lemma {
|
96
|
85
|
Copy->noiseSTD = this->noiseSTD;
|
97
|
86
|
return Copy;
|
98
|
87
|
} // ----- end of method TEMReceiver::Clone -----
|
|
88
|
+*/
|
99
|
89
|
|
100
|
90
|
//--------------------------------------------------------------------------------------
|
101
|
91
|
// Class: TEMReceiver
|
|
@@ -108,25 +98,6 @@ namespace Lemma {
|
108
|
98
|
|
109
|
99
|
//--------------------------------------------------------------------------------------
|
110
|
100
|
// Class: TEMReceiver
|
111
|
|
- // Method: Delete
|
112
|
|
- // Description: public destructor
|
113
|
|
- //--------------------------------------------------------------------------------------
|
114
|
|
- void TEMReceiver::Delete() {
|
115
|
|
- this->DetachFrom(this);
|
116
|
|
- }
|
117
|
|
-
|
118
|
|
- //--------------------------------------------------------------------------------------
|
119
|
|
- // Class: TEMReceiver
|
120
|
|
- // Method: Release
|
121
|
|
- // Description: destructor (protected)
|
122
|
|
- //--------------------------------------------------------------------------------------
|
123
|
|
- void TEMReceiver::Release() {
|
124
|
|
- delete this;
|
125
|
|
- }
|
126
|
|
-
|
127
|
|
-
|
128
|
|
- //--------------------------------------------------------------------------------------
|
129
|
|
- // Class: TEMReceiver
|
130
|
101
|
// Method: SetWindows
|
131
|
102
|
//--------------------------------------------------------------------------------------
|
132
|
103
|
void TEMReceiver::SetWindows ( const VectorXr& centres, const VectorXr& widths, const TIMEUNITS& Units ) {
|
|
@@ -185,15 +156,15 @@ namespace Lemma {
|
185
|
156
|
// Method: SampleNoise
|
186
|
157
|
//--------------------------------------------------------------------------------------
|
187
|
158
|
VectorXr TEMReceiver::SampleNoise ( ) {
|
188
|
|
-
|
189
|
|
- /* we have C++-11 now! No Boost!
|
|
159
|
+
|
|
160
|
+ /* we have C++-11 now! No Boost!
|
190
|
161
|
boost::mt19937 rng(time(0));
|
191
|
162
|
boost::normal_distribution<> nd(0.0, 1.0);
|
192
|
163
|
boost::variate_generator<boost::mt19937&, boost::normal_distribution<> > var_nor(rng, nd);
|
193
|
164
|
*/
|
194
|
165
|
|
195
|
166
|
std::random_device rd;
|
196
|
|
- std::mt19937 gen(rd());
|
|
167
|
+ std::mt19937 gen(rd());
|
197
|
168
|
std::normal_distribution<> d(0.0, 1.00);
|
198
|
169
|
|
199
|
170
|
VectorXr noise = VectorXr::Zero( windowCentres.size() );
|
|
@@ -251,7 +222,7 @@ namespace Lemma {
|
251
|
222
|
// Method: SetLocation
|
252
|
223
|
//--------------------------------------------------------------------------------------
|
253
|
224
|
void TEMReceiver::SetRxLocation ( const Vector3r& loc ) {
|
254
|
|
- this->SetNumberOfReceivers(1); // Valgrind doesn't like??
|
|
225
|
+ this->SetNumberOfPoints(1); // Valgrind doesn't like??
|
255
|
226
|
this->SetLocation(0, loc);
|
256
|
227
|
//location = loc;
|
257
|
228
|
return ;
|
|
@@ -296,14 +267,13 @@ namespace Lemma {
|
296
|
267
|
} // ----- end of method TEMReceiver::GetReferenceTime -----
|
297
|
268
|
|
298
|
269
|
|
299
|
|
-#ifdef HAVE_YAMLCPP
|
300
|
270
|
//--------------------------------------------------------------------------------------
|
301
|
271
|
// Class: TEMReceiver
|
302
|
272
|
// Method: Serialize
|
303
|
273
|
//--------------------------------------------------------------------------------------
|
304
|
274
|
YAML::Node TEMReceiver::Serialize ( ) const {
|
305
|
|
- YAML::Node node = ReceiverPoints::Serialize();
|
306
|
|
- node.SetTag( this->Name );
|
|
275
|
+ YAML::Node node = FieldPoints::Serialize();
|
|
276
|
+ node.SetTag( GetName() );
|
307
|
277
|
node["moment"] = moment;
|
308
|
278
|
node["referenceTime"] = referenceTime;
|
309
|
279
|
node["component"] = enum2String(component);
|
|
@@ -320,14 +290,12 @@ namespace Lemma {
|
320
|
290
|
// Class: TEMReceiver
|
321
|
291
|
// Method: DeSerialize
|
322
|
292
|
//--------------------------------------------------------------------------------------
|
323
|
|
- TEMReceiver* TEMReceiver::DeSerialize ( const YAML::Node& node ) {
|
324
|
|
- TEMReceiver* Object = new TEMReceiver(node);
|
325
|
|
- Object->AttachTo(Object);
|
326
|
|
- DESERIALIZECHECK( node, Object )
|
327
|
|
- return Object ;
|
328
|
|
-
|
|
293
|
+ std::shared_ptr<TEMReceiver> TEMReceiver::DeSerialize ( const YAML::Node& node ) {
|
|
294
|
+ if (node.Tag() != "TEMReceiver") {
|
|
295
|
+ throw DeSerializeTypeMismatch( "TEMReceiver", node.Tag());
|
|
296
|
+ }
|
|
297
|
+ return std::make_shared<TEMReceiver> ( node, ctor_key() );
|
329
|
298
|
} // ----- end of method TEMReceiver::DeSerialize -----
|
330
|
|
-#endif
|
331
|
299
|
|
332
|
300
|
} // ----- end of Lemma name -----
|
333
|
301
|
|