Main Lemma Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CircularLoop.cpp 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 12/01/2017 09:38:57 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2017, University of Utah
  15. * @copyright Copyright (c) 2017, Trevor Irons & Lemma Software, LLC
  16. */
  17. #include <FDEM1D>
  18. using namespace Lemma;
  19. int main(int argc, char** argv) {
  20. if (argc < 6) {
  21. std::cout << "Usage:\n";
  22. std::cout << "CircularLoop <radius> <centreNorthing> <centreEasting>"
  23. << " <numTurns> <npoints>\n" ;
  24. exit(EXIT_SUCCESS);
  25. }
  26. Real rad = atof(argv[1]);
  27. Real cx = atof(argv[2]);
  28. Real cy = atof(argv[3]);
  29. int nt = atoi(argv[4]);
  30. int np = atoi(argv[5]);
  31. std::cout << rad << std::endl;
  32. auto wire = PolygonalWireAntenna::NewSP();
  33. wire->SetNumberOfPoints(np);
  34. wire->SetNumberOfTurns(nt);
  35. Real da = 2.*PI / (Real)(np-1);
  36. for (int ip=0; ip<np-1; ++ip) {
  37. wire->SetPoint(ip, cx+rad*std::sin(da*static_cast<Real>(ip)),
  38. cy+rad*std::cos(da*static_cast<Real>(ip)), -1e-3);
  39. }
  40. wire->SetPoint(np-1, cx, cy+rad, -1e-3);
  41. std::cout << *wire << std::endl;
  42. //auto wire2 = wire->Clone();
  43. //std::cout << "copy\n" << *wire2 << std::endl;
  44. }