Programming

From NA-Wiki

(Difference between revisions)
Jump to: navigation, search
(General programming topics)
 
(24 intermediate revisions not shown)
Line 2: Line 2:
* How to: Write .mat files from C and Fortran using [[MatIO|MatIO]].
* How to: Write .mat files from C and Fortran using [[MatIO|MatIO]].
-
* How to: Use [[Subversion for version control]] of your code
+
* How to: Use [[Subversion for version control]] of your code.
* How to: [[Use the GNU debugger]]
* How to: [[Use the GNU debugger]]
== General programming topics ==
== General programming topics ==
 +
* [[Doxygen intro]] - Generating documentation for C++ projects
* Why [[use Eclipse]] or a similar development environment?
* Why [[use Eclipse]] or a similar development environment?
 +
* [[Fortran 90 goes back to the seventies]] - This is how you can use Fortran 90 without having to use the <i>highly non-portable</i> MODULE system.
 +
<!-- * A [[minimal interface to matIO]] (and a wave eq solver that shows how simple it is!). -->
 +
* [[Mat plot vtk]] - Simple plotting of vectors and matrices from a C++ program
 +
* [[OpenMPI]] on your local dual-core machine!
 +
* [[Using uBLAS]] - A really solid vector/matrix library for C++ numerics
 +
* [[Gnuplot]] - How to do simple visualization of 1D/2D data.
-
== Fortran ==
+
== Misc. ==
-
 
+
* [[CPU specs for E6600]], the CPU in the summer 2007 Linux workstations
-
=== Fortran 90 goes back to the seventies ===
+
-
 
+
-
This is how you can use Fortran 90 without having to use the <i>highly non-portable</i> module system.  
+
-
There might be some reasons to use MODULE files but I cannot think of one right now. :-)
+
-
 
+
-
Include file:
+
-
<pre>
+
-
TYPE STUFFS
+
-
    REAL VALUE
+
-
END TYPE
+
-
INTEGER GLOBAL
+
-
COMMON /GLOBAL/ GLOBAL        ! GLOBAL variable is named global_ in .o file
+
-
INTERFACE FOO
+
-
    SUBROUTINE BAR(X)
+
-
    INTEGER X
+
-
    END SUBROUTINE
+
-
END INTERFACE
+
-
</pre>
+
-
 
+
-
Main program:
+
-
<pre>
+
-
PROGRAM TEST
+
-
    INCLUDE 'test.inc'
+
-
    PRINT*,'GLOBAL:',GLOBAL  ! GLOBAL=0 (or compiler dependent)
+
-
    CALL FOO(1)              ! CALL FOO(1.0) will not work.
+
-
                              ! We are in strongly typed land now!
+
-
    PRINT*,'GLOBAL:',GLOBAL  ! GLOBAL=1
+
-
END PROGRAM TEST
+
-
</pre>
+
-
 
+
-
("external") subroutine which access and
+
-
modify shared (global or common) data:
+
-
<pre>
+
-
SUBROUTINE BAR(X)
+
-
    INTEGER X
+
-
    INCLUDE 'test.inc'
+
-
    PRINT*,'INSIDE THE BAR'
+
-
    GLOBAL=GLOBAL+1
+
-
END SUBROUTINE
+
-
</pre>
+
-
 
+
-
Compile the test with
+
-
<pre>
+
-
f90 -c test.f90
+
-
f90 -c bar.f90
+
-
f90 -o test test.o bar.o
+
-
</pre>
+
-
I also recommend that you analyze the object files with the <tt>nm</tt> command.
+
== Links ==
== Links ==
Line 64: Line 23:
* [http://www.swc.scipy.org/ Software carpentry] - an on-line course on how to work more like a developer when you write your research code.
* [http://www.swc.scipy.org/ Software carpentry] - an on-line course on how to work more like a developer when you write your research code.
* Freely available software for linear algebra on the web [http://www.netlib.org/utk/people/JackDongarra/la-sw.html link].
* Freely available software for linear algebra on the web [http://www.netlib.org/utk/people/JackDongarra/la-sw.html link].
 +
* [http://www.netlib.org/lapack/lug/ LAPACK Users' Guide]
 +
* [http://www.matmech.com/fortran/ Freenode <tt>#Fortran</tt> IRC channel wiki] just started, feel free to help and join the channel.
 +
* [http://git.or.cz/course/svn.html Git crash course for Subversion users]

Latest revision as of 08:45, 2 June 2008

Contents

Howtos in programming

General programming topics

Misc.

Links

Personal tools