Lemma is an Electromagnetics API
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

LayeredEarthEM.cpp 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 07/14/2016 03:14:50 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 <random>
  18. #include "FDEM1D"
  19. using namespace Lemma;
  20. int main() {
  21. std::random_device rd;
  22. std::mt19937 gen(rd());
  23. std::discrete_distribution<> d({0,0,40, 10, 10, 40});
  24. int nl = d(gen);
  25. std::uniform_real_distribution<> dis(0, 1);
  26. VectorXcr con = VectorXcr(nl);
  27. VectorXr thick = VectorXr(nl-2);
  28. con(0) = 0;
  29. for ( int i=1; i<nl; ++i ) {
  30. con(i) = Complex(dis(gen), dis(gen));
  31. }
  32. for ( int i=0; i<nl-2; ++i ) {
  33. thick(i) = dis(gen);
  34. }
  35. auto Obj = LayeredEarthEM::NewSP();
  36. Obj->SetNumberOfLayers(nl);
  37. Obj->SetLayerConductivity(con);
  38. Obj->SetLayerThickness(thick);
  39. auto model2 = LayeredEarthEM::DeSerialize(Obj->Serialize());
  40. std::cout << *Obj << std::endl;
  41. //std::cout << model->GetNumberOfLayers() << std::endl;
  42. //std::cout << model2->GetNumberOfLayers() << std::endl;
  43. }