Lemma is an Electromagnetics API
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DCIPElectrode.cpp 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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/10/2014 12:31:01 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email Trevor.Irons@xri-geo.com
  14. * @copyright Copyright (c) 2014, XRI Geophysics, LLC
  15. * @copyright Copyright (c) 2014, Trevor Irons
  16. */
  17. #include "DCIPElectrode.h"
  18. #include "DCSurvey.h"
  19. using namespace Lemma;
  20. int main() {
  21. //DCIPElectrode* Electrode1 = DCIPElectrode::New();
  22. DCIPElectrode* Electrode2 = DCIPElectrode::New();
  23. DCIPElectrode* Electrode3 = DCIPElectrode::New();
  24. DCIPElectrode* Electrode4 = DCIPElectrode::New();
  25. DCIPElectrode* Electrode5 = DCIPElectrode::New();
  26. DCIPElectrode* Electrode6 = DCIPElectrode::New();
  27. DCIPElectrode* Electrode7 = DCIPElectrode::New();
  28. DCIPElectrode* Electrode8 = DCIPElectrode::New();
  29. DCIPElectrode* Electrode9 = DCIPElectrode::New();
  30. //Electrode1->SetLocation( Vector3r( 23.23, 18.1, -45 ) );
  31. Electrode2->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  32. Electrode3->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  33. Electrode4->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  34. Electrode4->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  35. Electrode5->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  36. Electrode6->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  37. Electrode7->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  38. Electrode8->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  39. Electrode9->SetLocation( Vector3r( 13.23, 18.1, -25 ) );
  40. //: std::cout << *Electrode1 << std::endl;
  41. // std::ofstream ofstr("DCIPElectrode.yaml");
  42. // ofstr << *Electrode1;
  43. // ofstr.close();
  44. /*
  45. //std::ifstream ifstr("DCIPElectrode.yaml");
  46. std::ifstream ifstr("test.yaml");
  47. YAML::Node node = YAML::Load(ifstr);
  48. DCIPElectrode* Ex = DCIPElectrode::DeSerialize(node);
  49. std::cout << *Ex << std::endl;
  50. */
  51. //exit(1);
  52. //std::cout << *Electrode << std::endl;
  53. //std::cout << *Electrode2 << std::endl;
  54. // Set up a Survey
  55. DCSurvey* Survey = DCSurvey::New();
  56. // Instead we should just put location in, and then survey acts as factory?
  57. DCIPElectrode* Electrode1 = Survey->PoundElectrode( Vector3r( 13.23, 18.1, -25 ), "L0-E0" );
  58. Survey->PoundElectrode( Electrode2 , "L0-E1" );
  59. Survey->PoundElectrode( Electrode3 , "L0-E2" );
  60. Survey->PoundElectrode( Electrode4 , "L0-E3" );
  61. Survey->PoundElectrode( Electrode5 , "L0-E4" );
  62. Survey->PoundElectrode( Electrode6 , "L0-E5" );
  63. Survey->PoundElectrode( Electrode7 , "L0-E6" );
  64. Survey->PoundElectrode( Electrode8 , "L0-E7" );
  65. Survey->PoundElectrode( Electrode9 , "L0-E8" );
  66. int J0 = Survey->AddInjection( Electrode1, Electrode2, 1.0 );
  67. Survey->AddMeasurement(J0, Electrode3, Electrode4 );
  68. Survey->AddMeasurement(J0, Electrode5, Electrode6 );
  69. Survey->AddMeasurement(J0, Electrode6, Electrode7 );
  70. Survey->AddMeasurement(J0, "L0-E7", "L0-E8" );
  71. int J1 = Survey->AddInjection( Electrode2, Electrode3, 1.0 );
  72. Survey->AddMeasurement(J1, Electrode3, Electrode4 );
  73. Survey->AddMeasurement(J1, Electrode5, Electrode6 );
  74. Survey->AddMeasurement(J1, Electrode6, Electrode7 );
  75. int J2 = Survey->AddInjection( Electrode3, Electrode4, 1.0 );
  76. Survey->AddMeasurement(J2, Electrode3, Electrode4 );
  77. Survey->AddMeasurement(J2, Electrode5, Electrode6 );
  78. Survey->AddMeasurement(J2, Electrode6, Electrode7 );
  79. //Survey->AddMeasurement(L1, L2)
  80. std::cout << *Survey << std::endl;
  81. std::ofstream outstr("DC.yaml");
  82. outstr << *Survey << std::endl;
  83. outstr.close();
  84. Survey->Delete();
  85. //TODO recheck DeSerialize make sure we are filling in all the Tag vectors
  86. std::ifstream ifstr2("DC.yaml");
  87. YAML::Node node2 = YAML::Load(ifstr2);
  88. DCSurvey* Survey2 = DCSurvey::DeSerialize(node2);
  89. std::cout << "==============================================================\n";
  90. std::cout << *Survey2 << std::endl;
  91. return(EXIT_SUCCESS);
  92. }