Main Lemma Repository
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.

LayeredEarthEM.cpp 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. con(0) = 0;
  28. for ( int i=1; i<nl; ++i ) {
  29. con(i) = Complex(dis(gen), dis(gen));
  30. }
  31. std::cout << con << std::endl;
  32. auto model = LayeredEarthEM::NewSP();
  33. model->SetNumberOfLayers(nl);
  34. //model->SetLayerThickness( (VectorXr(4) << 10,10,10,10).finished() );
  35. //model->SetLayerConductivity( (VectorXcr(6) << .1, .10,.10,.10,.10,.10).finished() );
  36. auto model2 = LayeredEarthEM::DeSerialize(model->Serialize());
  37. std::cout << model->GetNumberOfLayers() << std::endl;
  38. std::cout << model2->GetNumberOfLayers() << std::endl;
  39. }