fishpack.asd 8.43 KB
Newer Older
rtoy's avatar
rtoy committed
1
2
3
4
5
6
7
8
9
10
11
;;; -*- Mode: lisp -*-
;;;
;;; This defsystem converts the FISHPACK Fortran routines
;;; to Lisp and compiling the result.
;;;

(defpackage #:fishpack-asd
  (:use :cl :asdf))

(in-package :fishpack-asd)

12
13
14
(defclass fishpack-fortran-file (cl-source-file)
  ()
  (:default-initargs :type "f"))
rtoy's avatar
rtoy committed
15

16
17
18
19
20
21
22
23
24
(defun fortran-compile (op c &key (array-slicing t) (array-type :array) package declare-common)
  (let ((file (component-pathname c)))
    (f2cl:f2cl-compile file
		       :output-file (first (output-files op c))
		       :array-slicing array-slicing
		       :array-type array-type
		       :package "FISHPACK"
		       :declare-common declare-common
		       )))
rtoy's avatar
rtoy committed
25

26
27
28
29
30
(defmethod perform ((op compile-op) (c fishpack-fortran-file))
  (fortran-compile op c :package "MINPACK"))

(defmethod perform ((op load-op) (c fishpack-fortran-file))
  (load (first (input-files op c))))
rtoy's avatar
rtoy committed
31
32
33
34


(defsystem fishpack
  :components
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  ((:module package
	    :pathname "fishpack"
	    :components
	    ((:file "package")))
   (:module fishpack
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "pimach")
	     (:file "merge")
	     (:file "cosgen"
		    :depends-on ("pimach"))
	     (:file "genbun"
		    :depends-on ("pimach" "poisd2" "poisp2" "poisn2"))
	     (:file "tri3")
	     (:file "trix")
	     (:file "hwscrt"
		    :depends-on ("trix" "tri3" "pimach"))
	     (:file "hwscyl")
	     (:file "hwsplr")
rtoy's avatar
rtoy committed
54
	     (:file "hwsssp" :depends-on ("hwsss1"))
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	     (:file "hwsss1")
	     (:file "hwscsp" :depends-on ("hwscs1"))
	     (:file "hwscs1" :depends-on ("epmach" "blktri" "store"))
	     (:file "hstcrt" :depends-on ("poistg"))
	     (:file "poistg" :depends-on ("postg2"))
	     (:file "postg2")
	     (:file "hstplr")
	     (:file "hstcyl")
	     (:file "hstssp")
	     (:file "hstcsp" :depends-on ("hstcs1"))
	     (:file "hstcs1")
	     (:file "sepx4" :depends-on ("chkpr4" "speli4"))
	     (:file "chkpr4")
	     (:file "speli4"
		    :depends-on ("chksn4" "tris4" "ortho4" "minso4" "defe4"))
	     (:file "chksn4")
	     (:file "tris4")
	     (:file "ortho4")
	     (:file "minso4")
rtoy's avatar
rtoy committed
74
75
	     (:file "defe4" :depends-on ("dx4" "dy4"))
	     (:file "dx4"
76
77
		    :perform (compile-op :around (op c)
					 (fortran-compile op c :declare-common t)))
rtoy's avatar
rtoy committed
78
79
80
	     (:file "dy4"
		    ;; Want common block defined before compiling dy4.
		    :depends-on ("dx4"))
81
	     (:file "epmach"
rtoy's avatar
rtoy committed
82
		    :depends-on ("store"))
83
	     (:file "blktri"
rtoy's avatar
rtoy committed
84
		    :depends-on ("compb" "blktr1" "prodp" "cprodp"))
85
86
87
88
89
90
	     ;; WARNING: compb passes an array of single-floats to
	     ;; PPADD, but PPADD is expecting an array of COMPLEX
	     ;; numbers.  None of the test programs trigger this, so
	     ;; it might not be a problem, but it is something to
	     ;; watch out for.  F2cl does not handle this case.
	     (:file "compb"
rtoy's avatar
rtoy committed
91
		    :depends-on ("indxb" "tevls" "ppadd" "epmach"))
92
93
	     (:file "blktr1"
		    :depends-on ("indxa" "indxb" "indxc"))
rtoy's avatar
rtoy committed
94
95
96
97
98
99
100
101
102
103
104
105
	     (:file "store"
		    :perform (compile-op :around (op c)
					 (fortran-compile op c :declare-common t)))
	     (:file "indxa"
		    :perform (compile-op :around (op c)
					 (fortran-compile op c :declare-common t)))
	     (:file "indxb"
		    ;; Want the common block defined before compiling indxb.
		    :depends-on ("indxa"))
	     (:file "indxc"
		    ;; Want the common block defined before compiling indxb.
		    :depends-on ("indxa"))
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	     (:file "tevls")
	     (:file "ppadd"
		    :depends-on ("psgf" "bsrh" "ppsgf"))
	     (:file "psgf")
	     (:file "bsrh")
	     (:file "ppsgf")
	     (:file "poisd2"
		    :depends-on ("cosgen" "trix" "merge"))
	     (:file "poisn2"
		    :depends-on ("cosgen" "trix" "tri3" "merge"))
	     (:file "poisp2"
		    :depends-on ("cosgen" "trix" "tri3" "merge"
					  "poisd2"))
	     (:file "prod")
	     (:file "cprod")
	     (:file "cprodp")
	     (:file "ppspf")
	     (:file "prodp")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack"))))
rtoy's avatar
rtoy committed
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  (dolist (test '("fishpack-test-hwscrt"
		  "fishpack-test-hwscrt"
		  "fishpack-test-hwscyl"
		  "fishpack-test-hwsplr"
		  "fishpack-test-hwsssp"
		  "fishpack-test-hwscsp"
		  "fishpack-test-hstcrt"
		  "fishpack-test-hstplr"
		  "fishpack-test-hstcyl"
		  "fishpack-test-hstssp"
		  "fishpack-test-hstcsp"
		  "fishpack-test-sepx4"
		  ))
  (oos 'test-op test)))
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289

;; Some tests of Fishpack.
;;
;; The results won't match the results printed for the NCAR Control
;; Data 7600, but they should be close.

;; Works
(defsystem fishpack-test-hwscrt
  :depends-on ("fishpack")
  :components
  ((:module hwscrt
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthwscrt")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hwscrt"))))
  (funcall (find-symbol "THWSCRT" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hwscyl
  :depends-on ("fishpack")
  :components
  ((:module hwscyl
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthwscyl")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hwscyl"))))
  (funcall (find-symbol "THWSCYL" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hwsplr
  :depends-on ("fishpack")
  :components
  ((:module hwsplr
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthwsplr")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hwsplr"))))
  (funcall (find-symbol "THWSPLR" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hwsssp
  :depends-on ("fishpack")
  :components
  ((:module hwsssp
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthwsssp")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hwsssp"))))
  (funcall (find-symbol "THWSSSP" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hwscsp
  :depends-on ("fishpack")
  :components
  ((:module hwscsp
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthwscsp")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hwscsp"))))
  (funcall (find-symbol "THWSCSP" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hstcrt
  :depends-on ("fishpack")
  :components
  ((:module hstcrt
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthstcrt")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hstcrt"))))
  (funcall (find-symbol "THSTCRT" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hstplr
  :depends-on ("fishpack")
  :components
  ((:module hstplr
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthstplr")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hstplr"))))
  (funcall (find-symbol "THSTPLR" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hstcyl
  :depends-on ("fishpack")
  :components
  ((:module hstcyl
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthstcyl")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hstcyl"))))
  (funcall (find-symbol "THSTCYL" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hstssp
  :depends-on ("fishpack")
  :components
  ((:module hstssp
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthstssp")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hstssp"))))
  (funcall (find-symbol "THSTSSP" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-hstcsp
  :depends-on ("fishpack")
  :components
  ((:module hstcsp
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tsthstcsp")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-hstcsp"))))
  (funcall (find-symbol "THSTCSP" (find-package '#:fishpack))))

;; Works
(defsystem fishpack-test-sepx4
  :depends-on ("fishpack")
  :components
  ((:module sepx4
	    :pathname "fishpack/ex/"
	    :default-component-class fishpack-fortran-file
	    :components
	    ((:file "tstsepx4" :depends-on ("cofx4"))
	     (:file "cofx4")))))

(defmethod perform ((op test-op) (c (eql (find-system "fishpack-test-sepx4"))))
  (funcall (find-symbol "TSEPX4" (find-package '#:fishpack))))