|
@@ -47,6 +47,37 @@ namespace Lemma {
|
47
|
47
|
// Description: DeSerializing constructor (locked)
|
48
|
48
|
//--------------------------------------------------------------------------------------
|
49
|
49
|
KernelV0::KernelV0 (const YAML::Node& node, const ctor_key&) : LemmaObject(node) {
|
|
50
|
+ //node["PulseType"] = "FID";
|
|
51
|
+ Larmor = node["Larmor"].as<Real>();
|
|
52
|
+ Temperature = node["Temperature"].as<Real>();
|
|
53
|
+ tol = node["tol"].as<Real>();
|
|
54
|
+ minLevel = node["minLevel"].as<int>();
|
|
55
|
+ maxLevel = node["maxLevel"].as<int>();
|
|
56
|
+ Taup = node["Taup"].as<Real>();
|
|
57
|
+ PulseI = node["PulseI"].as<VectorXr>();
|
|
58
|
+ Interfaces = node["Interfaces"].as<VectorXr>();
|
|
59
|
+ Size = node["IntegrationSize"].as<Vector3r>();
|
|
60
|
+ Origin = node["IntegrationOrigin"].as<Vector3r>();
|
|
61
|
+
|
|
62
|
+ if (node["SigmaModel"]) {
|
|
63
|
+ if (node["SigmaModel"].Tag() == "LayeredEarthEM") {
|
|
64
|
+ SigmaModel = LayeredEarthEM::DeSerialize(node["SigmaModel"]);
|
|
65
|
+ } else {
|
|
66
|
+ SigmaModel = LayeredEarthEM::DeSerialize( YAML::LoadFile( node["SigmaModel"].as<std::string>() ));
|
|
67
|
+ }
|
|
68
|
+ }
|
|
69
|
+
|
|
70
|
+ if (node["Coils"]) {
|
|
71
|
+ for ( auto coil : node["Coils"] ) {
|
|
72
|
+ std::cout << "coil " << coil.first << coil.second << std::endl;
|
|
73
|
+ if ( coil.second.Tag() == "PolygonalWireAntenna" ) {
|
|
74
|
+ TxRx[ coil.first.as<std::string>() ] = PolygonalWireAntenna::DeSerialize( coil.second );
|
|
75
|
+ } else {
|
|
76
|
+ TxRx[ coil.first.as<std::string>() ] =
|
|
77
|
+ PolygonalWireAntenna::DeSerialize( YAML::LoadFile(coil.second.as<std::string>()) );
|
|
78
|
+ }
|
|
79
|
+ }
|
|
80
|
+ }
|
50
|
81
|
|
51
|
82
|
} // ----- end of method KernelV0::KernelV0 (constructor) -----
|
52
|
83
|
|
|
@@ -77,25 +108,33 @@ namespace Lemma {
|
77
|
108
|
node.SetTag( GetName() );
|
78
|
109
|
|
79
|
110
|
// Coils Transmitters & Receivers
|
80
|
|
- for ( auto txm : TxRx) {
|
81
|
|
- node[txm.first] = txm.second->Serialize();
|
|
111
|
+ if (!TxRx.empty()) {
|
|
112
|
+ for ( auto txm : TxRx) {
|
|
113
|
+ node["Coils"][txm.first] = txm.second->Serialize();
|
|
114
|
+ }
|
82
|
115
|
}
|
83
|
116
|
|
84
|
117
|
// LayeredEarthEM
|
85
|
|
- node["SigmaModel"] = SigmaModel->Serialize();
|
|
118
|
+ if (SigmaModel != nullptr) {
|
|
119
|
+ node["SigmaModel"] = SigmaModel->Serialize();
|
|
120
|
+ }
|
86
|
121
|
|
|
122
|
+ node["PulseType"] = "FID";
|
87
|
123
|
node["Larmor"] = Larmor;
|
88
|
124
|
node["Temperature"] = Temperature;
|
89
|
125
|
node["tol"] = tol;
|
90
|
126
|
node["minLevel"] = minLevel;
|
91
|
127
|
node["maxLevel"] = maxLevel;
|
92
|
128
|
node["Taup"] = Taup;
|
93
|
|
-
|
94
|
129
|
node["PulseI"] = PulseI;
|
95
|
130
|
node["Interfaces"] = Interfaces;
|
|
131
|
+ node["IntegrationSize"] = Size;
|
|
132
|
+ node["IntegrationOrigin"] = Origin;
|
96
|
133
|
|
97
|
|
- for ( int ilay=0; ilay<Interfaces.size()-1; ++ilay ) {
|
98
|
|
- node["Kern-" + to_string(ilay) ] = static_cast<VectorXcr>(Kern.row(ilay));
|
|
134
|
+ if (Kern.array().abs().any() > 1e-16) {
|
|
135
|
+ for ( int ilay=0; ilay<Interfaces.size()-1; ++ilay ) {
|
|
136
|
+ node["K0"]["layer-" + to_string(ilay) ] = static_cast<VectorXcr>(Kern.row(ilay));
|
|
137
|
+ }
|
99
|
138
|
}
|
100
|
139
|
return node;
|
101
|
140
|
} // ----- end of method KernelV0::Serialize -----
|
|
@@ -132,9 +171,8 @@ namespace Lemma {
|
132
|
171
|
// Class: KernelV0
|
133
|
172
|
// Method: DeSerialize
|
134
|
173
|
//--------------------------------------------------------------------------------------
|
135
|
|
- void KernelV0::CalculateK0 (const std::vector< std::string>& Tx, const std::vector<std::string >& Rx,
|
136
|
|
- bool vtkOutput ) {
|
137
|
|
-
|
|
174
|
+ void KernelV0::CalculateK0 (const std::vector< std::string>& Tx,
|
|
175
|
+ const std::vector<std::string >& Rx, bool vtkOutput ) {
|
138
|
176
|
// Set up
|
139
|
177
|
Larmor = SigmaModel->GetMagneticFieldMagnitude()*GAMMA; // in rad 2246.*2.*PI;
|
140
|
178
|
|
|
@@ -174,7 +212,8 @@ namespace Lemma {
|
174
|
212
|
std::cout << "Calculating K0 kernel\n";
|
175
|
213
|
Kern = MatrixXcr::Zero( Interfaces.size()-1, PulseI.size() );
|
176
|
214
|
for (ilay=0; ilay<Interfaces.size()-1; ++ilay) {
|
177
|
|
- std::cout << "Layer " << ilay << "\tfrom " << Interfaces(ilay) <<" to "<< Interfaces(ilay+1) << std::endl;
|
|
215
|
+ std::cout << "Layer " << ilay << "\tfrom " << Interfaces(ilay) <<" to "
|
|
216
|
+ << Interfaces(ilay+1) << std::endl;
|
178
|
217
|
Size(2) = Interfaces(ilay+1) - Interfaces(ilay);
|
179
|
218
|
Origin(2) = Interfaces(ilay);
|
180
|
219
|
IntegrateOnOctreeGrid( vtkOutput );
|
|
@@ -205,7 +244,6 @@ namespace Lemma {
|
205
|
244
|
EvaluateKids2( Size, 0, cpos, VectorXcr::Ones(PulseI.size()), oct, curse );
|
206
|
245
|
|
207
|
246
|
for (int iq=0; iq<PulseI.size(); ++iq) {
|
208
|
|
-
|
209
|
247
|
// Fill in leaf data
|
210
|
248
|
vtkDoubleArray* kr = vtkDoubleArray::New();
|
211
|
249
|
kr->SetNumberOfComponents(1);
|
|
@@ -245,7 +283,6 @@ namespace Lemma {
|
245
|
283
|
hri->SetNumberOfComponents(3);
|
246
|
284
|
hri->SetName("Im($\\mathbf{\\mathcal{H}}_R$)");
|
247
|
285
|
hri->SetNumberOfTuples( oct->GetNumberOfLeaves() );
|
248
|
|
-
|
249
|
286
|
//Real LeafVol(0);
|
250
|
287
|
for (auto leaf : LeafDict) {
|
251
|
288
|
kr->InsertTuple1( leaf.first, std::real(leaf.second(iq)) );
|
|
@@ -309,7 +346,6 @@ namespace Lemma {
|
309
|
346
|
hri->Delete();
|
310
|
347
|
|
311
|
348
|
}
|
312
|
|
-
|
313
|
349
|
curse->Delete();
|
314
|
350
|
oct->Delete();
|
315
|
351
|
#else
|
|
@@ -337,7 +373,6 @@ namespace Lemma {
|
337
|
373
|
|
338
|
374
|
// Compute Mn0
|
339
|
375
|
Vector3r Mn0 = ComputeMn0(1.0, B0);
|
340
|
|
- //std::cout << "Mn0\t" << Mn0.transpose() << std::endl;
|
341
|
376
|
Real Mn0Abs = Mn0.norm();
|
342
|
377
|
|
343
|
378
|
// Compute phase delay
|