Surface NMR forward modelling
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

KernelV0-2.cpp 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 11/11/2016 02:44:37 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2016, University of Utah
  15. * @copyright Copyright (c) 2016, Lemma Software, LLC
  16. */
  17. #include <Merlin>
  18. using namespace Lemma;
  19. int main(int argc, char** argv) {
  20. if (argc<5) {
  21. std::cout << "./KernelV0-2 Kernel.yaml TxString RxString vtkoutput<true/false> \n";
  22. return(EXIT_FAILURE);
  23. }
  24. std::cout << "Using kernel paramaters: " << argv[1] << std::endl;
  25. auto Kern = KernelV0::DeSerialize( YAML::LoadFile(argv[1]) );
  26. std::vector<std::string> tx = {std::string(argv[2])};
  27. std::vector<std::string> rx = {std::string(argv[3])};
  28. std::cout << "argv[4]\t" << argv[4] << std::endl;
  29. if( std::string(argv[4]) == "true" || std::string(argv[4]) == "True") {
  30. std::cout << "Using VTK, output files may be very large" << std::endl;
  31. Kern->CalculateK0( tx, rx, true ); // 3rd argument is vtk output
  32. } else {
  33. std::cout << "not using VTK" << std::endl;
  34. Kern->CalculateK0( tx, rx, false ); // 3rd argument is vtk output
  35. }
  36. // TODO fix python post-processing so this is not necessary
  37. // Save in simplified format for easy python plotting
  38. // std::ofstream dout = std::ofstream(std::string("Tx")+std::string(argv[2])+std::string("Rx-")+std::string(argv[3])+std::string(".dat"));
  39. // dout << "# Transmitters: ";
  40. // for (auto lp : tx) {
  41. // dout << lp << "\t";
  42. // }
  43. // dout << "\n# Receivers: ";
  44. // for (auto lp : rx) {
  45. // dout << lp << "\t";
  46. // }
  47. // dout << "\n# Tolerance: " << Kern->GetTolerance() << std::endl;
  48. // dout << Kern->GetInterfaces().transpose() << std::endl;
  49. // dout << Kern->GetPulseDuration()*Kern->GetPulseCurrent().transpose() << std::endl;
  50. // dout << "#real\n";
  51. // dout << Kern->GetKernel().real() << std::endl;
  52. // dout << "#imag\n";
  53. // dout << Kern->GetKernel().imag() << std::endl;
  54. // dout.close();
  55. // Save YAML kernel
  56. std::ofstream out = std::ofstream(std::string("Tx-")+std::string(argv[2])+std::string("_Rx-")+std::string(argv[3])+std::string(".yaml"));
  57. out << *Kern;
  58. out.close();
  59. return EXIT_SUCCESS;
  60. }