~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to bindings/f95/readme_f95.txt

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Fortran 95 bindings for PLplot
 
2
------------------------------
 
3
 
 
4
dd. 25 november 2005
 
5
 
 
6
Introduction
 
7
------------
 
8
The Fortran 95 bindings for PLplot have been set up with the following
 
9
considerations in mind:
 
10
- reuse the bindings for FORTRAN 77 if possible
 
11
- provide alternative calls for the various routines to take advantage
 
12
  of the features of Fortran 95, most notably, to simplify the interface
 
13
- provide a module that takes care of all the details
 
14
 
 
15
Fortran 90 versus Fortran 95
 
16
----------------------------
 
17
Because the Fortran 95 standard is supported by most if not all current
 
18
Fortran compilers, it seemed logical to target this standard, rather
 
19
than Fortran 90. The differences are small enough though not to matter
 
20
too much for PLplot.
 
21
 
 
22
To stress that Fortran 95 is the target, we use .f95 as the extension
 
23
for the examples. Note that the extension is not important for
 
24
most compilers: it merely indicates that the freeform source format is
 
25
used.
 
26
 
 
27
PLplot module
 
28
-------------
 
29
The PLplot module defines:
 
30
- Several parameters for use with the PLplot library
 
31
- Interfaces for all the routines that can be used with Fortran 95
 
32
  programs
 
33
- Several alternative interfaces for various routines
 
34
 
 
35
The parameters are:
 
36
- PLFLT or PLF for short
 
37
  This is the KIND parameter for all floating-point variables and values
 
38
  used by the PLplot library. See the example below for its use
 
39
 
 
40
- PL_PARSE_FULL
 
41
  A parameter used in the call to PLPARSEOPTS
 
42
 
 
43
- PL_PI
 
44
  The approximation of the number "pi". It is used in many examples
 
45
  and because it is often defined in other modules as well, we have
 
46
  given it a more specific name.
 
47
  Should you prefer "PI" (or "pi") then use the module like this:
 
48
 
 
49
     program myprog
 
50
        use plplot, pi => pl_pi
 
51
        ...
 
52
 
 
53
- PL_GRID_CSA, PL_GRID_DTLI, PL_GRID_NNI, PL_GRID_NNIDW, PL_GRID_NNLI,
 
54
  PL_GRID_NNAIDW
 
55
  Parameters that select the gridding algorithm for PLGRIDDATA
 
56
 
 
57
- PL_JUST_NONE, PL_JUST_OPTIMAL, PL_JUST_SAME, PL_JUST_ISOMETRIC:
 
58
  The justification of axes in PLENV. The names should be more or
 
59
  less self-explanatory.
 
60
 
 
61
- PL_AXIS_NOTHING    - no decoration for the axis
 
62
  PL_AXIS_BOX_ONLY   - only the axles
 
63
  PL_AXIS_NORMAL     = ordinary axes
 
64
  PL_AXIS_ATZERO     = include lines through 0-coordinates
 
65
  PL_AXIS_MAJORGRID  = include grid for major tickmarks
 
66
  PL_AXIS_MINORGRID  = include grid for major and minor tickmarks
 
67
  PL_AXIS_LOGX       = use logarithmic X axis
 
68
  PL_AXIS_LOGY       = use logarithmic Y axis
 
69
  PL_AXIS_LOGXY      = both axes logarithmic
 
70
 
 
71
  You can combine the logarithmic options with the others
 
72
  (except PL_AXIS_NOTHING and PL_AXIS_BOX_ONLY) by simply
 
73
  adding them: PL_AXIS_LOGX+AXIS_MAJORGRID for instance
 
74
 
 
75
To illustrate the alternative interfaces for various routines,
 
76
here are the possibilities to call PLBIN
 
77
 
 
78
The C API reads:
 
79
 
 
80
void
 
81
plbin(PLINT nbin, PLFLT *x, PLFLT *y, PLINT center);
 
82
 
 
83
Because in Fortran 95, the size of the array can be queried via the SIZE
 
84
intrinsic function, we can drop the nbin argument. And while C has no
 
85
specific logical data type, Fortran has. So there are four ways to call
 
86
PLBIN from Fortran 95:
 
87
 
 
88
   logical                        :: center
 
89
   integer                        :: icenter, nbin
 
90
   real(kind=plflt), dimension(:) :: x, y
 
91
 
 
92
   !
 
93
   ! Fortran 95, method 1 (compatible with FORTRAN 77)
 
94
   !
 
95
   icenter = 1
 
96
   nbin    = size(x)
 
97
   call plbin( nbin, x, y, icenter )
 
98
 
 
99
   !
 
100
   ! Fortran 95, method 2
 
101
   !
 
102
   center = .true.
 
103
   call plbin( x, y, center )  ! Drop the argument nbin, use a logical for center
 
104
 
 
105
   !
 
106
   ! Fortran 95, method 3
 
107
   !
 
108
   icenter = 1
 
109
   call plbin( x, y, icenter )  ! No nbin, use an integer for center
 
110
 
 
111
   !
 
112
   ! Fortran 95, method 4
 
113
   !
 
114
   center = .true.
 
115
   call plbin( nbin, x, y, center )  ! Use nbin, use a logical for center
 
116
 
 
117
Method 2 is preferred, as it is most "Fortran 95" in character.
 
118