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