Lemma is an Electromagnetics API
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CircularLoop.cpp 1.6KB

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 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. auto wire = PolygonalWireAntenna::NewSP();
  32. wire->SetNumberOfPoints(np);
  33. wire->SetNumberOfTurns(nt);
  34. Real da = 2.*PI / (Real)(np-1);
  35. for (int ip=0; ip<np-1; ++ip) {
  36. wire->SetPoint(ip, cx+rad*std::sin(da*static_cast<Real>(ip)),
  37. cy+rad*std::cos(da*static_cast<Real>(ip)), -1e-3);
  38. }
  39. wire->SetPoint(np-1, cx, cy+rad, -1e-3);
  40. std::cout << *wire << std::endl;
  41. //auto wire2 = wire->Clone();
  42. //std::cout << "copy\n" << *wire2 << std::endl;
  43. }