Trevor Irons 7 years ago
parent
commit
95bbad66c8
3 changed files with 14 additions and 6 deletions
  1. 2
    1
      examples/KernelV0-2.cpp
  2. 1
    1
      include/KernelV0.h
  3. 11
    4
      src/KernelV0.cpp

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

35
     std::vector<std::string> rx = {std::string(argv[3])};
35
     std::vector<std::string> rx = {std::string(argv[3])};
36
 
36
 
37
     std::cout << "argv[4]\t" << argv[4] << std::endl;
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
         Kern->CalculateK0( tx, rx, true ); // 3rd argument is vtk output
40
         Kern->CalculateK0( tx, rx, true ); // 3rd argument is vtk output
40
     } else {
41
     } else {
41
         std::cout << "not using VTK" << std::endl;
42
         std::cout << "not using VTK" << std::endl;

+ 1
- 1
include/KernelV0.h View File

139
                 bool vtkOutput=false );
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
         void AlignWithAkvoDataset( const YAML::Node& node ) ;
144
         void AlignWithAkvoDataset( const YAML::Node& node ) ;
145
 
145
 

+ 11
- 4
src/KernelV0.cpp View File

53
         tol = node["tol"].as<Real>();
53
         tol = node["tol"].as<Real>();
54
         minLevel = node["minLevel"].as<int>();
54
         minLevel = node["minLevel"].as<int>();
55
         maxLevel = node["maxLevel"].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>();
56
         Interfaces = node["Interfaces"].as<VectorXr>();
59
         Size = node["IntegrationSize"].as<Vector3r>();
57
         Size = node["IntegrationSize"].as<Vector3r>();
60
         Origin = node["IntegrationOrigin"].as<Vector3r>();
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
         if (node["SigmaModel"]) {
69
         if (node["SigmaModel"]) {
63
             if (node["SigmaModel"].Tag() == "LayeredEarthEM") {
70
             if (node["SigmaModel"].Tag() == "LayeredEarthEM") {
64
                 SigmaModel = LayeredEarthEM::DeSerialize(node["SigmaModel"]);
71
                 SigmaModel = LayeredEarthEM::DeSerialize(node["SigmaModel"]);
159
             std::cout << node["processed"] << std::endl;
166
             std::cout << node["processed"] << std::endl;
160
         }
167
         }
161
         if (node["pulseType"].as<std::string>() == "FID") {
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
         } else {
171
         } else {
165
             std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
172
             std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
166
         }
173
         }

Loading…
Cancel
Save