~ubuntu-branches/ubuntu/feisty/libctl/feisty

« back to all changes in this revision

Viewing changes to examples/README

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette
  • Date: 2002-04-17 10:36:45 UTC
  • Revision ID: james.westby@ubuntu.com-20020417103645-29vomjspk4yf4olw
Tags: upstream-2.1
ImportĀ upstreamĀ versionĀ 2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Example program using libctl.  This consists of:
 
2
 
 
3
main.c: skeleton main program.  To create a real program using libctl,
 
4
        you will only need to make slight changes to this file.
 
5
 
 
6
example.scm: a sample specification file that contains
 
7
        a few parameters similar to what you might give to a
 
8
        photonic crystal program.  This uses the geometry
 
9
        classes and utilities in utils/libgeom.
 
10
 
 
11
example.c: example of a main subroutine (called by main.c) which
 
12
        demonstrates how the input/output variables are automatically
 
13
        read/written.
 
14
 
 
15
run.ctl: example control file that creates some data for the program
 
16
        to read.
 
17
 
 
18
Makefile: makefile for the example program.  (Also a good starting point
 
19
        for the Makefile of a real program using libctl.)
 
20
 
 
21
So, to compile and run everything, you simply type:
 
22
 
 
23
make
 
24
example run.ctl
 
25
 
 
26
Since run.ctl does not call (run), this drops you into Guile's
 
27
interactive mode, where you can start typing in Scheme commands.  For
 
28
example, you can try:
 
29
 
 
30
(help)  ; prints help on data structures and variables defined by
 
31
        ; the specification file
 
32
 
 
33
k-points   ; prints the value of the k-points variable (set by run.ctl)
 
34
 
 
35
(run)   ; runs the example program (exports the input variables,
 
36
        ; calls run_program in main.c, and imports the output variables).
 
37
 
 
38
Type Ctrl-D or (quit) to exit.
 
39
 
 
40
Another pair of interesting files to look at, after you have run make,
 
41
are ctl-io.c and ctl-io.h.  These files are automatically generated
 
42
from the specifications file.  They define the data structures
 
43
corresponding to the input/output variables, and handle importing and
 
44
exporting variable values between C and Scheme.
 
45
 
 
46
Have fun!