Browse Source

Kernel calculation can now align with Akvo data from the YAML.

master
Trevor Irons 7 years ago
parent
commit
51634bdd79
3 changed files with 15 additions and 7 deletions
  1. 3
    2
      examples/KernelV0-2.cpp
  2. 1
    1
      include/KernelV0.h
  3. 11
    4
      src/KernelV0.cpp

+ 3
- 2
examples/KernelV0-2.cpp View File

@@ -23,7 +23,7 @@ using namespace Lemma;
23 23
 
24 24
 int main(int argc, char** argv) {
25 25
 
26
-    if (argc<3) {
26
+    if (argc<5) {
27 27
         std::cout << "./KernelV0-2 Kernel.yaml TxString RxString  vtkoutput<true/false> \n";
28 28
         return(EXIT_SUCCESS);
29 29
     }
@@ -35,7 +35,8 @@ int main(int argc, char** argv) {
35 35
     std::vector<std::string> rx = {std::string(argv[3])};
36 36
 
37 37
     std::cout << "argv[4]\t" << argv[4] << std::endl;
38
-    if( std::string(argv[4]) == "true") {
38
+    if( std::string(argv[4]) == "true" || std::string(argv[4]) == "True") {
39
+        std::cout << "Using VTK, output files may be very large" << std::endl;
39 40
         Kern->CalculateK0( tx, rx, true ); // 3rd argument is vtk output
40 41
     } else {
41 42
         std::cout << "not using VTK" << std::endl;

+ 1
- 1
include/KernelV0.h View File

@@ -139,7 +139,7 @@ namespace Lemma {
139 139
                 bool vtkOutput=false );
140 140
 
141 141
         /**
142
-         *  Aligns the kernel settings with an Akvo Processed dataset.
142
+         *  Aligns the kernel pulse settings with an Akvo Processed dataset.
143 143
          */
144 144
         void AlignWithAkvoDataset( const YAML::Node& node ) ;
145 145
 

+ 11
- 4
src/KernelV0.cpp View File

@@ -53,12 +53,19 @@ namespace Lemma {
53 53
         tol = node["tol"].as<Real>();
54 54
         minLevel = node["minLevel"].as<int>();
55 55
         maxLevel = node["maxLevel"].as<int>();
56
-        Taup = node["Taup"].as<Real>();
57
-        PulseI = node["PulseI"].as<VectorXr>();
58 56
         Interfaces = node["Interfaces"].as<VectorXr>();
59 57
         Size = node["IntegrationSize"].as<Vector3r>();
60 58
         Origin = node["IntegrationOrigin"].as<Vector3r>();
61 59
 
60
+        if (node["AlignWithAkvoData"]) {
61
+            // Match pulse info with dataset
62
+            AlignWithAkvoDataset( YAML::LoadFile( node["AlignWithAkvoData"].as<std::string>()));
63
+        } else {
64
+            // Read Pulse info direct from Kernel file
65
+            PulseI = node["PulseI"].as<VectorXr>();
66
+            Taup = node["Taup"].as<Real>();
67
+        }
68
+
62 69
         if (node["SigmaModel"]) {
63 70
             if (node["SigmaModel"].Tag() == "LayeredEarthEM") {
64 71
                 SigmaModel = LayeredEarthEM::DeSerialize(node["SigmaModel"]);
@@ -159,8 +166,8 @@ namespace Lemma {
159 166
             std::cout << node["processed"] << std::endl;
160 167
         }
161 168
         if (node["pulseType"].as<std::string>() == "FID") {
162
-            PulseI  = node["Pulse 1"]["current"].as<VectorXr>();
163
-            this->SetPulseDuration( node["pulseLength"].as<double>() );
169
+            PulseI  = node["Pulses"]["Pulse 1"]["current"].as<VectorXr>();
170
+            this->SetPulseDuration( node["pulseLength"][0].as<double>() );
164 171
         } else {
165 172
             std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
166 173
         }

Loading…
Cancel
Save