Lemma is an Electromagnetics API
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

tutorial.dox 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. namespace Lemma{
  2. /**
  3. \page Tutorial
  4. A basic tutorial outlining the goals of Lemma, how to acquire and use it, and how to extend it
  5. for your own purposes.
  6. - \subpage Intro - Introduction to the project
  7. - \subpage Compiling - how to compile the library
  8. - \subpage Memory - our implementation of garbage collection, and what it means to you
  9. - \subpage Minimal - compiling your first minimal Lemma application
  10. - \subpage EmSources - Electromagnetic sources
  11. \page Intro
  12. <div class="lemmamainmenu">
  13. \b Intro
  14. | \ref Compiling "Compiling"
  15. | \ref Memory "Memory management"
  16. | \ref Minimal "Minimal programme"
  17. | \ref EmSources "EM Sources"
  18. </div>
  19. \section C Why C++?
  20. We get this a lot as most EM software seems to be written in Fortran or Matlab.
  21. C++ has developed into a fast powerful language appropriate for scientific computing.
  22. The language is undeniably complex and can be intimidating (lots of bad C++ code is out there).
  23. However, it is also possible to generate high performance, intuitive, flexible software using
  24. C++. In Lemma we take advantage of several recent changes to the language such that our public
  25. interface is simple to use, does not require manual memory management, and lets scientists focus on
  26. the problem at hand. The biggest hurdle for newcomers is often getting used to the object oriented
  27. approach we have taken. Rather than provide programs performing specific tasks Lemma exposes a
  28. flexible application programming interface (API) which can be though of as building blocks used
  29. to construct programs or projects.
  30. \subsection API An API? What's that?
  31. Lemma is not a program. It's an API, or an Application Programming Interface.
  32. This offers a lot of advantages over traditional programs.
  33. - First, its flexible. Its easy to put together components to do exactly what
  34. you want and nothing more.
  35. - Second, its extendible. If we have a class that does almost what you want, but is missing
  36. something, you can just extend a class.
  37. - Third, it limits the amount of file IO you might need to do. We deviate from the Unix philosophy
  38. of piping text streams between small applications, mainly because doing so is difficult on some
  39. operating systems (I'm looking at you Windows), as well as cumbersome when used in graphical
  40. user interfaces.
  41. - Four, it enforces a consistent design and feel across the project. Once becoming familiar with
  42. how Lemma objects are constructed, it becomes simple to use new building blocks. Think of the
  43. objects as Lego's, since they are all constructed to work together, you can build anything. If
  44. instead you have a mix of Lego, Lincoln Logs, and Tinker Toys you will be more more limited
  45. in how you can use the pieces together.
  46. \subsection Fortran Why not Fortran?
  47. We have lots of reasons for choosing C++ over Fortran, some of them better than others.
  48. - We know C++ better, and we like it better. Too many hours debugging old
  49. FORTRAN 77 subroutines has left us jaded.
  50. - Easy integration with existing libraries. For example Lemma has built in
  51. support for VTK, an extremely powerful visualization package. We also include
  52. MATLAB file IO readers, an XML parser, and YAML class serialization. Providing Fortran
  53. wrappers for all of this would be a huge undertaking.
  54. - Flexibility. Lemma is NOT a program, its an API that lets you build
  55. applications that fit your needs. This approach is a natural fit for object oriented (OO)
  56. programming and C++ is a much more natural choice for an OO project.
  57. In spite of advances in the language, Fortran is still more geared towards procedural
  58. programming paradigms (for better or worse).
  59. - Infinitely better interface. We leverage the Eigen
  60. <http://eigen.tuxfamily.org> linear algebra package
  61. to deliver expressive, fast code. Their benchmarks are right in line with
  62. fast BLAS and LAPACK implementations. If you honestly feel that
  63. \code
  64. DGEMM ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC )
  65. \endcode
  66. is superior to
  67. \code
  68. C = A*B.transpose();
  69. \endcode
  70. you are living in denial. Check out the benchmarks if you are still sceptical
  71. http://eigen.tuxfamily.org/index.php?title=Benchmark
  72. - We know Fortran has come a long way since FORTRAN 77, but hey, so has C++. Give it a
  73. chance.
  74. \subsection MATLAB Why not MATLAB?
  75. MATLAB is a closed source environment that is severely restrictive. The Lemma license is pro-business,
  76. we are happy if Lemma is used in commercial code and programs. MATLAB code is expensive and difficult to
  77. distribute in binary form. Also, the object oriented aspects of the MATLAB language feel a bit bolted on, and
  78. cumbersome to use. We prefer to avoid MATLAB for these reasons.
  79. \subsection Python How about Python?
  80. We like Python. While large 100% native Python applications are often very slow, it is easy to wrap fast C++ and
  81. Fortran routines around a Python interface. We actually plan on doing this in the future, and it is likely that at
  82. some point this may be a common way to use Lemma. Lots of great visualization
  83. solutions exist in Python (including VTK) and it is a great programming environment. The hard
  84. part is that Eigen relies heavily on Expression templates that cannot be
  85. trivially wrapped into a python interface. So any python interface would have
  86. to be carefully constructed. We would welcome help in this department.
  87. In the mean-time our API is elegant and easy to use.
  88. */
  89. /** @} */
  90. }