Lemma is an Electromagnetics API
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

utpolygonalantenna.cpp 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // ===========================================================================
  2. //
  3. // Filename: utpolygonalantennae.cpp
  4. //
  5. // Description: Unit test of PolygonalAntenna
  6. //
  7. // Version: 0.0
  8. // Created: 05/26/2010 04:30:56 PM
  9. // Revision: none
  10. // Compiler: Tested with g++, icpc, and MSVC 2000
  11. //
  12. // Author: Trevor Irons (ti)
  13. //
  14. // Organisation: Colorado School of Mines (CSM)
  15. // United States Geological Survey (USGS)
  16. //
  17. // Email: tirons@mines.edu, tirons@usgs.gov
  18. //
  19. // This program is free software: you can redistribute it and/or modify
  20. // it under the terms of the GNU General Public License as published by
  21. // the Free Software Foundation, either version 3 of the License, or
  22. // (at your option) any later version.
  23. //
  24. // This program is distributed in the hope that it will be useful,
  25. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. // GNU General Public License for more details.
  28. //
  29. // You should have received a copy of the GNU General Public License
  30. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  31. //
  32. // ===========================================================================
  33. #include "Lemma"
  34. using namespace Lemma;
  35. int main() {
  36. PolygonalWireAntenna *pa = PolygonalWireAntenna::New();
  37. pa->SetNumberOfPoints(5);
  38. pa->SetPoint(0, Vector3r( 0, 0, -1e-3));
  39. pa->SetPoint(1, Vector3r( 10, 0, -1e-3));
  40. pa->SetPoint(2, Vector3r( 10, 10, -1e-3));
  41. pa->SetPoint(3, Vector3r( 0, 10, -1e-3));
  42. pa->SetPoint(4, Vector3r( 0, 0, -1e-3));
  43. pa->SetNumberOfFrequencies(1);
  44. pa->SetFrequency(0,1000.);
  45. pa->SetCurrent(10.);
  46. pa->SetNumberOfTurns(1);
  47. Vector3r pos;
  48. pos << 23,23,23;
  49. pa->ApproximateWithElectricDipoles(pos);
  50. std::cout << "pos "<< pos.transpose() << " ndipoles="
  51. << pa->GetNumberOfDipoles() << std::endl;
  52. pos << 2,2,2;
  53. pa->ApproximateWithElectricDipoles(pos);
  54. std::cout << "pos "<< pos.transpose() << " ndipoles="
  55. << pa->GetNumberOfDipoles() << std::endl;
  56. pos << 1,1,1;
  57. pa->ApproximateWithElectricDipoles(pos);
  58. std::cout << "pos "<< pos.transpose() << " ndipoles="
  59. << pa->GetNumberOfDipoles() << std::endl;
  60. pa->Delete();
  61. }