Pārlūkot izejas kodu

Clean up of IO and cout

master
T-bone 7 gadus atpakaļ
vecāks
revīzija
cdef920345
2 mainītis faili ar 3 papildinājumiem un 53 dzēšanām
  1. 3
    52
      examples/KernelV0-2.cpp
  2. 0
    1
      src/KernelV0.cpp

+ 3
- 52
examples/KernelV0-2.cpp Parādīt failu

@@ -24,7 +24,6 @@ using namespace Lemma;
24 24
 int main(int argc, char** argv) {
25 25
 
26 26
     if (argc<3) {
27
-        //std::cout << "./KernelV0-2 earth.yaml tx.yaml  rx.yaml \n";
28 27
         std::cout << "./KernelV0-2 Kernel.yaml TxString RxString  \n";
29 28
         return(EXIT_SUCCESS);
30 29
     }
@@ -32,60 +31,12 @@ int main(int argc, char** argv) {
32 31
     std::cout << "Using kernel paramaters: " << argv[1] << std::endl;
33 32
     auto Kern = KernelV0::DeSerialize( YAML::LoadFile(argv[1]) );
34 33
 
35
-//     std::cout << "Using earth model: " << argv[1] << std::endl;
36
-//     auto earth = LayeredEarthEM::DeSerialize( YAML::LoadFile(argv[2]) );
37
-//
38
-//     std::cout << "Using transmitter: " << argv[2] << std::endl;
39
-//     auto Tx = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[3]) );
40
-//
41
-//     std::cout << "Using receivers: " << argv[3] << std::endl;
42
-//     auto Rx1 = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[4]) );
43
-
44
-#if 0
45
-    auto Kern = KernelV0::NewSP();
46
-        //Kern->PushCoil( "Coil 1", Tx );
47
-        //Kern->PushCoil( "Coil 2", Rx1 );
48
-        //Kern->SetLayeredEarthEM( earth );
49
-
50
-        Kern->SetIntegrationSize( (Vector3r() << 200, 200., 100).finished() );
51
-        Kern->SetIntegrationOrigin( (Vector3r() << -100, -100, .5).finished() );
52
-        Real tol(1e-11); // 13
53
-        Kern->SetTolerance( tol ); // 1e-12
54
-
55
-//         Kern->AlignWithAkvoDataset( YAML::LoadFile(argv[2]) );
56
-
57
-        Kern->SetPulseDuration(0.020);
58
-        VectorXr I(36);
59
-        // off from VC by 1.075926340216996
60
-        // Pulses from Wyoming Red Buttes exp 0
61
-        I << 397.4208916184016, 352.364477036168, 313.0112765842783, 278.37896394065376, 247.81424224324982,
62
-             220.77925043190442, 196.76493264105017, 175.31662279234038, 156.0044839325404, 138.73983004230124,
63
-             123.42064612625474, 109.82713394836259, 97.76534468972267, 87.06061858367781, 77.56000002944572, 69.1280780096311,
64
-             61.64250263640252, 54.99473044877554, 49.091182970515476, 43.84634004556388, 39.184136917167976, 35.03619319797924,
65
-             31.347205894128976, 28.06346770557137, 25.139117042424758, 22.53420773366429, 20.214205433283347,
66
-             18.144318026099942, 16.299965972298878, 14.652633628829891, 13.184271405688083, 11.870540177313893,
67
-             10.697057141915716, 9.64778948429609, 8.709338689612677, 7.871268012862094;
68
-        //Kern->SetPulseCurrent( VectorXr::LinSpaced( 1, 10, 200 )  ); // nbins, low, high
69
-        Kern->SetPulseCurrent( I ); // nbins, low, high
70
-
71
-        //VectorXr interfaces = VectorXr::LinSpaced( 41, .5, 45.5 ); // nlay, low, high
72
-        //VectorXr interfaces = VectorXr::LinSpaced( 61, .5, 45.5 ); // nlay, low, high
73
-        VectorXr interfaces = VectorXr::LinSpaced( 58, .5, 45.5 ); // nlay, low, high
74
-        Real thick = .1;
75
-        for (int ilay=1; ilay<interfaces.size(); ++ilay) {
76
-            interfaces(ilay) = interfaces(ilay-1) + thick;
77
-            thick *= 1.085;
78
-        }
79
-        Kern->SetDepthLayerInterfaces( interfaces ); // nlay, low, high
80
-
81
-    // We could, I suppose, take the earth model in here? For non-linear that
82
-    // may be more natural to work with?
83
-#endif
84
-
85 34
     std::vector<std::string> tx = {std::string(argv[2])};
86 35
     std::vector<std::string> rx = {std::string(argv[3])};
87 36
     Kern->CalculateK0( tx, rx, false ); // 3rd argument is vtk output
88 37
 
38
+    // TODO fix python post-processing so this is not necessary
39
+    // Save in simplified format for easy python plotting
89 40
     std::ofstream dout = std::ofstream(std::string("Rx-")+std::string(argv[3])+std::string(".dat"));
90 41
     dout << "# Transmitters: ";
91 42
     for (auto lp : tx) {
@@ -104,8 +55,8 @@ int main(int argc, char** argv) {
104 55
         dout << Kern->GetKernel().imag() << std::endl;
105 56
         dout.close();
106 57
 
58
+    // Save YAML kernel
107 59
     std::ofstream out = std::ofstream(std::string("Rx-")+std::string(argv[2])+std::string(".yaml"));
108
-    //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
109 60
     out << *Kern;
110 61
     out.close();
111 62
 

+ 0
- 1
src/KernelV0.cpp Parādīt failu

@@ -69,7 +69,6 @@ namespace Lemma {
69 69
 
70 70
         if (node["Coils"]) {
71 71
             for ( auto coil : node["Coils"] ) {
72
-                std::cout << "coil " << coil.first << coil.second << std::endl;
73 72
                 if ( coil.second.Tag() == "PolygonalWireAntenna" ) {
74 73
                     TxRx[ coil.first.as<std::string>() ] = PolygonalWireAntenna::DeSerialize( coil.second );
75 74
                 } else {

Notiek ielāde…
Atcelt
Saglabāt