1
Example program using libctl. This consists of:
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.
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.
11
example.c: example of a main subroutine (called by main.c) which
12
demonstrates how the input/output variables are automatically
15
run.ctl: example control file that creates some data for the program
18
Makefile: makefile for the example program. (Also a good starting point
19
for the Makefile of a real program using libctl.)
21
So, to compile and run everything, you simply type:
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
30
(help) ; prints help on data structures and variables defined by
31
; the specification file
33
k-points ; prints the value of the k-points variable (set by run.ctl)
35
(run) ; runs the example program (exports the input variables,
36
; calls run_program in main.c, and imports the output variables).
38
Type Ctrl-D or (quit) to exit.
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.