Lemma is an Electromagnetics API
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 Design Our design philosophy
  31. Software should be flexible, intuitive, and simple. Many times, less is more and offering
  32. Note that simple is not necessarily synonymous with easy, although we do strive to make Lemma
  33. as easy to use as possible without sacrificing our other goals.
  34. \subsubsection API An API? What's that?
  35. Lemma is not a program. It's an API, or an Application Programming Interface.
  36. This offers a lot of advantages over traditional programs.
  37. - First, its flexible. Its easy to put together components to do exactly what
  38. you want and nothing more.
  39. - Second, its extendible. If we have a class that does almost what you want, but is missing
  40. something, you can just extend a class.
  41. - Third, it limits the amount of file IO you might need to do. We deviate from the Unix philosophy
  42. of piping text streams between small applications, mainly because doing so is difficult on some
  43. operating systems (I'm looking at you Windows), as well as cumbersome when used in graphical
  44. user interfaces.
  45. - Four, it enforces a consistent design and feel across the project. Once becoming familiar with
  46. how Lemma objects are constructed, it becomes simple to use new building blocks. Think of the
  47. objects as Lego's, since they are all constructed to work together, you can build anything. If
  48. instead you have a mix of Lego, Lincoln Logs, and Tinker Toys you will be more more limited
  49. in how you can use the pieces together.
  50. \subsection Fortran Why not Fortran?
  51. We have lots of reasons for choosing C++ over Fortran, some of them better than others.
  52. - We know C++ better, and we like it better. Too many hours debugging old
  53. FORTRAN 77 subroutines has left us jaded.
  54. - Easy integration with existing libraries. For example Lemma has built in
  55. support for VTK, an extremely powerful visualization package. We also include
  56. MATLAB file IO readers, an XML parser, and YAML class serialization. Providing Fortran
  57. wrappers for all of this would be a huge undertaking.
  58. - Flexibility. Lemma is NOT a program, its an API that lets you build
  59. applications that fit your needs. This approach is a natural fit for object oriented (OO)
  60. programming and C++ is a much more natural choice for an OO project.
  61. In spite of advances in the language, Fortran is still more geared towards procedural
  62. programming paradigms (for better or worse).
  63. - Infinitely better interface. We leverage the Eigen
  64. <http://eigen.tuxfamily.org> linear algebra package
  65. to deliver expressive, fast code. Their benchmarks are right in line with
  66. fast BLAS and LAPACK implementations. If you honestly feel that
  67. \code
  68. DGEMM ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC )
  69. \endcode
  70. is superior to
  71. \code
  72. C = A*B.transpose();
  73. \endcode
  74. you are living in denial. Check out the benchmarks if you are still sceptical
  75. http://eigen.tuxfamily.org/index.php?title=Benchmark
  76. - We know Fortran has come a long way since FORTRAN 77, but hey, so has C++. Give it a
  77. chance.
  78. \subsection MATLAB Why not MATLAB?
  79. MATLAB is a closed source environment that is severely restrictive. The Lemma license is pro-business,
  80. we are happy if Lemma is used in commercial code and programs. MATLAB code is expensive and difficult to
  81. distribute in binary form. Also, the object oriented aspects of the MATLAB language feel a bit bolted on, and
  82. cumbersome to use. We prefer to avoid MATLAB for these reasons.
  83. \subsection Python How about Python?
  84. We like Python. While large 100% native Python applications are often very slow, it is easy to wrap fast C++ and
  85. Fortran routines around a Python interface. We actually plan on doing this in the future, and it is likely that at
  86. some point this may be a common way to use Lemma. Lots of great visualization
  87. solutions exist in Python (including VTK) and it is a great programming environment. The hard
  88. part is that Eigen relies heavily on Expression templates that cannot be
  89. trivially wrapped into a python interface. So any python interface would have
  90. to be carefully constructed. We would welcome help in this department.
  91. In the mean-time our API is elegant and easy to use.
  92. */
  93. /** @} */
  94. }