Surface NMR forward modelling
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

KernelV0-2.cpp 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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::cout << "Kernel DeSerialized successful" << std::endl;
  27. std::vector<std::string> tx = {std::string(argv[2])};
  28. std::vector<std::string> rx = {std::string(argv[3])};
  29. std::cout << "argv[4]\t" << argv[4] << std::endl;
  30. if( std::string(argv[4]) == "true" || std::string(argv[4]) == "True") {
  31. std::cout << "Using VTK, output files may be very large" << std::endl;
  32. Kern->CalculateK0( tx, rx, true ); // 3rd argument is vtk output
  33. } else {
  34. std::cout << "not using VTK" << std::endl;
  35. Kern->CalculateK0( tx, rx, false ); // 3rd argument is vtk output
  36. }
  37. // TODO fix python post-processing so this is not necessary
  38. // Save in simplified format for easy python plotting
  39. // std::ofstream dout = std::ofstream(std::string("Tx")+std::string(argv[2])+std::string("Rx-")+std::string(argv[3])+std::string(".dat"));
  40. // dout << "# Transmitters: ";
  41. // for (auto lp : tx) {
  42. // dout << lp << "\t";
  43. // }
  44. // dout << "\n# Receivers: ";
  45. // for (auto lp : rx) {
  46. // dout << lp << "\t";
  47. // }
  48. // dout << "\n# Tolerance: " << Kern->GetTolerance() << std::endl;
  49. // dout << Kern->GetInterfaces().transpose() << std::endl;
  50. // dout << Kern->GetPulseDuration()*Kern->GetPulseCurrent().transpose() << std::endl;
  51. // dout << "#real\n";
  52. // dout << Kern->GetKernel().real() << std::endl;
  53. // dout << "#imag\n";
  54. // dout << Kern->GetKernel().imag() << std::endl;
  55. // dout.close();
  56. // Save YAML kernel
  57. std::ofstream out = std::ofstream(std::string("Tx-")+std::string(argv[2])+std::string("_Rx-")+std::string(argv[3])+std::string(".yaml"));
  58. out << *Kern;
  59. out.close();
  60. return EXIT_SUCCESS;
  61. }