Surface NMR forward modelling
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

KernelV0-2.cpp 2.4KB

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