1 ;;; Compiled by f2cl version:
2 ;;; ("f2cl1.l,v 1.221 2010/05/26 19:25:52 rtoy Exp $"
3 ;;; "f2cl2.l,v 1.37 2008/02/22 22:19:33 rtoy Exp $"
4 ;;; "f2cl3.l,v 1.6 2008/02/22 22:19:33 rtoy Exp $"
5 ;;; "f2cl4.l,v 1.7 2008/02/22 22:19:34 rtoy Exp $"
6 ;;; "f2cl5.l,v 1.204 2010/02/23 05:21:30 rtoy Exp $"
7 ;;; "f2cl6.l,v 1.48 2008/08/24 00:56:27 rtoy Exp $"
8 ;;; "macros.l,v 1.114 2010/05/17 01:42:14 rtoy Exp $")
10 ;;; Using Lisp CMU Common Lisp CVS Head 2010-05-25 18:21:07 (20A Unicode)
12 ;;; Options: ((:prune-labels nil) (:auto-save t) (:relaxed-array-decls t)
13 ;;; (:coerce-assigns :as-needed) (:array-type ':array)
14 ;;; (:array-slicing t) (:declare-common nil)
15 ;;; (:float-format double-float))
20 (defun newmsh (mode xi xiold z dmz valstr slope accum nfxpnt fixpnt
)
21 (declare (type (array double-float
(*)) fixpnt accum slope valstr dmz z xiold
23 (type (f2cl-lib:integer4
) nfxpnt mode
))
26 :element-type
'f2cl-lib
:integer4
27 :displaced-to
(colord-part-0 *colord-common-block
*)
28 :displaced-index-offset
5))
31 :element-type
'double-float
32 :displaced-to
(colbas-part-0 *colbas-common-block
*)
33 :displaced-index-offset
224))
36 :element-type
'double-float
37 :displaced-to
(colest-part-0 *colest-common-block
*)
38 :displaced-index-offset
40))
41 :element-type
'double-float
42 :displaced-to
(colest-part-0 *colest-common-block
*)
43 :displaced-index-offset
160))
46 :element-type
'f2cl-lib
:integer4
47 :displaced-to
(colest-part-1 *colest-common-block
*)
48 :displaced-index-offset
0))
51 :element-type
'f2cl-lib
:integer4
52 :displaced-to
(colest-part-1 *colest-common-block
*)
53 :displaced-index-offset
40)))
54 (symbol-macrolet ((precis (aref (colout-part-0 *colout-common-block
*) 0))
55 (iout (aref (colout-part-1 *colout-common-block
*) 0))
56 (iprint (aref (colout-part-1 *colout-common-block
*) 1))
57 (k (aref (colord-part-0 *colord-common-block
*) 0))
58 (ncomp (aref (colord-part-0 *colord-common-block
*) 1))
59 (mstar (aref (colord-part-0 *colord-common-block
*) 2))
60 (kd (aref (colord-part-0 *colord-common-block
*) 3))
61 (mmax (aref (colord-part-0 *colord-common-block
*) 4))
63 (n (aref (colapr-part-0 *colapr-common-block
*) 0))
64 (nold (aref (colapr-part-0 *colapr-common-block
*) 1))
65 (nmax (aref (colapr-part-0 *colapr-common-block
*) 2))
66 (nz (aref (colapr-part-0 *colapr-common-block
*) 3))
67 (ndmz (aref (colapr-part-0 *colapr-common-block
*) 4))
68 (mshflg (aref (colmsh-part-0 *colmsh-common-block
*) 0))
69 (mshnum (aref (colmsh-part-0 *colmsh-common-block
*) 1))
70 (mshlmt (aref (colmsh-part-0 *colmsh-common-block
*) 2))
71 (mshalt (aref (colmsh-part-0 *colmsh-common-block
*) 3))
72 (iguess (aref (colnln-part-0 *colnln-common-block
*) 4))
73 (aleft (aref (colsid-part-0 *colsid-common-block
*) 40))
74 (aright (aref (colsid-part-0 *colsid-common-block
*) 41))
76 (wgtmsh colest-wgtmsh
)
80 (ntol (aref (colest-part-1 *colest-common-block
*) 80)))
81 (f2cl-lib:with-multi-array-data
82 ((xi double-float xi-%data% xi-%offset%
)
83 (xiold double-float xiold-%data% xiold-%offset%
)
84 (z double-float z-%data% z-%offset%
)
85 (dmz double-float dmz-%data% dmz-%offset%
)
86 (valstr double-float valstr-%data% valstr-%offset%
)
87 (slope double-float slope-%data% slope-%offset%
)
88 (accum double-float accum-%data% accum-%offset%
)
89 (fixpnt double-float fixpnt-%data% fixpnt-%offset%
))
90 (prog ((lcarry 0) (l 0) (tsum 0.0) (accr 0.0) (lnew 0) (lold 0)
91 (accl 0.0) (in 0) (nmax2 0) (nmx 0) (naccum 0) (degequ 0.0)
92 (avrg 0.0) (temp 0.0) (iflip 0) (slphmx 0.0) (jz 0) (jj 0)
93 (oneovh 0.0) (hiold 0.0) (x 0.0) (hd6 0.0) (kstore 0) (n2 0)
94 (dx 0.0) (nregn 0) (nmin 0) (iright 0) (xright 0.0) (xleft 0.0)
95 (ileft 0) (np1 0) (j 0) (i 0) (noldp1 0) (nfxp1 0)
96 (d2 (make-array 40 :element-type
'double-float
))
97 (d1 (make-array 40 :element-type
'double-float
))
98 (dummy (make-array 1 :element-type
'double-float
)))
99 (declare (type (array double-float
(1)) dummy
)
100 (type (array double-float
(40)) d1 d2
)
101 (type double-float xleft xright dx hd6 x hiold oneovh slphmx
102 temp avrg degequ accl accr tsum
)
103 (type (f2cl-lib:integer4
) nfxp1 noldp1 i j np1 ileft iright
104 nmin nregn n2 kstore jj jz iflip
105 naccum nmx nmax2 in lold lnew l
107 (setf nfxp1
(f2cl-lib:int-add nfxpnt
1))
108 (f2cl-lib:computed-goto
(label180 label100 label50 label20 label10
)
113 (if (< iguess
2) (go label40
))
114 (setf noldp1
(f2cl-lib:int-add nold
1))
116 (f2cl-lib:fformat iout
117 ("~%" " THE FORMER MESH (OF" 1 (("~5D"))
118 " SUBINTERVALS)," 100
119 ("~%" 8 (("~12,6,0,'*,F"))) "~%")
121 (do ((i 1 (f2cl-lib:int-add i
1))
123 ((> i noldp1
) (nreverse %ret
))
124 (declare (type f2cl-lib
:integer4 i
))
126 (f2cl-lib:fref xiold-%data%
131 (if (/= iguess
3) (go label40
))
132 (setf n
(the f2cl-lib
:integer4
(truncate nold
2)))
134 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
2))
137 (setf i
(f2cl-lib:int-add i
1))
139 (setf (f2cl-lib:fref xi-%data%
(i) ((1 1)) xi-%offset%
)
140 (f2cl-lib:fref xiold-%data%
145 (setf np1
(f2cl-lib:int-add n
1))
146 (setf (f2cl-lib:fref xi-%data%
(1) ((1 1)) xi-%offset%
) aleft
)
147 (setf (f2cl-lib:fref xi-%data%
(np1) ((1 1)) xi-%offset%
) aright
)
150 (if (< n nfxp1
) (setf n nfxp1
))
151 (setf np1
(f2cl-lib:int-add n
1))
152 (setf (f2cl-lib:fref xi-%data%
(1) ((1 1)) xi-%offset%
) aleft
)
155 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
160 (if (= j nfxp1
) (go label60
))
162 (f2cl-lib:fref fixpnt-%data%
169 (* (/ (- xright aleft
) (- aright aleft
))
172 (if (> nmin
(f2cl-lib:int-add
(f2cl-lib:int-sub n nfxpnt
) j
))
173 (setf nmin
(f2cl-lib:int-add
(f2cl-lib:int-sub n nfxpnt
) j
)))
174 (setf iright
(f2cl-lib:max0
(f2cl-lib:int-add ileft
1) nmin
))
176 (setf (f2cl-lib:fref xi-%data%
(iright) ((1 1)) xi-%offset%
)
178 (setf nregn
(f2cl-lib:int-sub iright ileft
1))
179 (if (= nregn
0) (go label80
))
182 (f2cl-lib:dfloat
(f2cl-lib:int-add nregn
1))))
183 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
187 (setf (f2cl-lib:fref xi-%data%
188 ((f2cl-lib:int-add ileft i
))
191 (+ xleft
(* (f2cl-lib:dfloat i
) dx
)))))
198 (setf n2
(f2cl-lib:int-mul
2 n
))
199 (if (<= n2 nmax
) (go label120
))
200 (if (= mode
2) (go label110
))
201 (setf n
(the f2cl-lib
:integer4
(truncate nmax
2)))
205 (f2cl-lib:fformat iout
("~%" " EXPECTED N TOO LARGE " "~%")))
209 (if (= mshflg
0) (go label140
))
211 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
217 (f2cl-lib:fref xiold-%data%
218 ((f2cl-lib:int-add i
1))
221 (f2cl-lib:fref xiold-%data%
228 (f2cl-lib:fref xiold-%data%
(i) ((1 1)) xiold-%offset%
)
231 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
232 var-9 var-10 var-11 var-12 var-13 var-14 var-15 var-16
)
234 (f2cl-lib:array-slice valstr double-float
(kstore) ((1 1)))
235 (f2cl-lib:array-slice asave
239 dummy xiold nold z dmz k ncomp mmax m mstar
4 dummy
0)
240 (declare (ignore var-2 var-3 var-4 var-5 var-6 var-7 var-8
241 var-9 var-10 var-11 var-12 var-13 var-14
245 (setf x
(+ x
(* 4.0 hd6
)))
247 (f2cl-lib:int-add kstore
(f2cl-lib:int-mul
3 mstar
)))
249 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
250 var-9 var-10 var-11 var-12 var-13 var-14 var-15 var-16
)
252 (f2cl-lib:array-slice valstr double-float
(kstore) ((1 1)))
253 (f2cl-lib:array-slice asave
257 dummy xiold nold z dmz k ncomp mmax m mstar
4 dummy
0)
258 (declare (ignore var-2 var-3 var-4 var-5 var-6 var-7 var-8
259 var-9 var-10 var-11 var-12 var-13 var-14
263 (setf kstore
(f2cl-lib:int-add kstore mstar
))
268 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
271 (setf x
(f2cl-lib:fref xi-%data%
(i) ((1 1)) xi-%offset%
))
275 (f2cl-lib:fref xi-%data%
276 ((f2cl-lib:int-add i
1))
279 (f2cl-lib:fref xi-%data%
(i) ((1 1)) xi-%offset%
))
281 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
285 (if (= j
3) (setf x
(+ x hd6
)))
287 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
288 var-9 var-10 var-11 var-12 var-13 var-14 var-15
291 (f2cl-lib:array-slice valstr
295 (f2cl-lib:array-slice asave
299 dummy xiold nold z dmz k ncomp mmax m mstar
4 dummy
0)
300 (declare (ignore var-2 var-3 var-4 var-5 var-6 var-7 var-8
301 var-9 var-10 var-11 var-12 var-13 var-14
305 (setf kstore
(f2cl-lib:int-add kstore mstar
))
313 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
316 (setf (f2cl-lib:fref xi-%data%
(j) ((1 1)) xi-%offset%
)
319 (f2cl-lib:fref xiold-%data%
(i) ((1 1)) xiold-%offset%
)
320 (f2cl-lib:fref xiold-%data%
321 ((f2cl-lib:int-add i
1))
325 (setf (f2cl-lib:fref xi-%data%
326 ((f2cl-lib:int-add j
1))
329 (f2cl-lib:fref xiold-%data%
330 ((f2cl-lib:int-add i
1))
334 (setf j
(f2cl-lib:int-add j
2))))
338 (if (= nold
1) (go label100
))
339 (if (<= nold
(f2cl-lib:int-mul
2 nfxpnt
)) (go label100
))
342 (- (f2cl-lib:fref xiold-%data%
(2) ((1 1)) xiold-%offset%
)
343 (f2cl-lib:fref xiold-%data%
(1) ((1 1)) xiold-%offset%
)))
344 (horder 1 d1 hiold dmz ncomp k
)
346 (- (f2cl-lib:fref xiold-%data%
(3) ((1 1)) xiold-%offset%
)
347 (f2cl-lib:fref xiold-%data%
(2) ((1 1)) xiold-%offset%
)))
348 (horder 2 d2 hiold dmz ncomp k
)
349 (setf (f2cl-lib:fref accum-%data%
(1) ((1 1)) accum-%offset%
) 0.0)
350 (setf (f2cl-lib:fref slope-%data%
(1) ((1 1)) slope-%offset%
) 0.0)
353 (- (f2cl-lib:fref xiold-%data%
(3) ((1 1)) xiold-%offset%
)
354 (f2cl-lib:fref xiold-%data%
358 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
361 (setf jj
(f2cl-lib:fref jtol
(j) ((1 40))))
362 (setf jz
(f2cl-lib:fref ltol
(j) ((1 40))))
364 (setf (f2cl-lib:fref slope-%data%
(1) ((1 1)) slope-%offset%
)
366 (f2cl-lib:fref slope-%data%
(1) ((1 1)) slope-%offset%
)
371 (- (f2cl-lib:fref d2
(jj) ((1 40)))
372 (f2cl-lib:fref d1
(jj) ((1 40)))))
373 (f2cl-lib:fref wgtmsh
(j) ((1 40)))
377 (f2cl-lib:fref z-%data%
381 (f2cl-lib:fref root
(j) ((1 40))))))))
383 (* (f2cl-lib:fref slope-%data%
(1) ((1 1)) slope-%offset%
)
384 (- (f2cl-lib:fref xiold-%data%
(2) ((1 1)) xiold-%offset%
)
385 (f2cl-lib:fref xiold-%data%
389 (setf (f2cl-lib:fref accum-%data%
(2) ((1 1)) accum-%offset%
) slphmx
)
391 (f2cl-lib:fdo
(i 2 (f2cl-lib:int-add i
1))
396 (f2cl-lib:fref xiold-%data%
397 ((f2cl-lib:int-add i
1))
400 (f2cl-lib:fref xiold-%data%
404 (if (= iflip -
1) (horder i d1 hiold dmz ncomp k
))
405 (if (= iflip
1) (horder i d2 hiold dmz ncomp k
))
409 (f2cl-lib:fref xiold-%data%
410 ((f2cl-lib:int-add i
1))
413 (f2cl-lib:fref xiold-%data%
414 ((f2cl-lib:int-sub i
1))
417 (setf (f2cl-lib:fref slope-%data%
(i) ((1 1)) slope-%offset%
)
419 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
422 (setf jj
(f2cl-lib:fref jtol
(j) ((1 40))))
424 (f2cl-lib:int-add
(f2cl-lib:fref ltol
(j) ((1 40)))
426 (f2cl-lib:int-sub i
1)
429 (setf (f2cl-lib:fref slope-%data%
(i) ((1 1)) slope-%offset%
)
431 (f2cl-lib:fref slope-%data%
439 (- (f2cl-lib:fref d2
(jj) ((1 40)))
440 (f2cl-lib:fref d1
(jj) ((1 40)))))
441 (f2cl-lib:fref wgtmsh
(j) ((1 40)))
445 (f2cl-lib:fref z-%data%
449 (f2cl-lib:fref root
(j) ((1 40))))))))
452 (f2cl-lib:fref slope-%data%
(i) ((1 1)) slope-%offset%
)
454 (f2cl-lib:fref xiold-%data%
455 ((f2cl-lib:int-add i
1))
458 (f2cl-lib:fref xiold-%data%
462 (setf slphmx
(f2cl-lib:dmax1 slphmx temp
))
463 (setf (f2cl-lib:fref accum-%data%
464 ((f2cl-lib:int-add i
1))
468 (f2cl-lib:fref accum-%data%
(i) ((1 1)) accum-%offset%
)
471 (setf iflip
(f2cl-lib:int-sub iflip
))))
474 (f2cl-lib:fref accum-%data%
475 ((f2cl-lib:int-add nold
1))
478 (f2cl-lib:dfloat nold
)))
479 (setf degequ
(/ avrg
(f2cl-lib:dmax1 slphmx precis
)))
483 (f2cl-lib:fref accum-%data%
484 ((f2cl-lib:int-add nold
1))
489 (f2cl-lib:fformat iout
490 ("~%" " MESH SELECTION INFO," "~%"
491 " DEGREE OF EQUIDISTRIBUTION = " 1
493 " PREDICTION FOR REQUIRED N =" 1 (("~8D"))
497 (if (< avrg precis
) (go label100
))
498 (if (>= degequ
0.5) (go label100
))
500 (the f2cl-lib
:integer4
501 (truncate (f2cl-lib:max0
(+ nold
1) naccum
) 2)))
502 (setf nmax2
(the f2cl-lib
:integer4
(truncate nmax
2)))
503 (setf n
(f2cl-lib:min0 nmax2 nold nmx
))
505 (setf noldp1
(f2cl-lib:int-add nold
1))
506 (if (< n nfxp1
) (setf n nfxp1
))
507 (setf mshnum
(f2cl-lib:int-add mshnum
1))
508 (if (< n nold
) (setf mshnum mshlmt
))
509 (if (> n
(the f2cl-lib
:integer4
(truncate nold
2))) (setf mshalt
1))
510 (if (= n
(the f2cl-lib
:integer4
(truncate nold
2)))
511 (setf mshalt
(f2cl-lib:int-add mshalt
1)))
516 (setf (f2cl-lib:fref xi-%data%
(1) ((1 1)) xi-%offset%
) aleft
)
517 (setf (f2cl-lib:fref xi-%data%
518 ((f2cl-lib:int-add n
1))
522 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
525 (if (= i nfxp1
) (go label250
))
526 (f2cl-lib:fdo
(j lold
(f2cl-lib:int-add j
1))
532 (f2cl-lib:fref fixpnt-%data%
(i) ((1 1)) fixpnt-%offset%
)
533 (f2cl-lib:fref xiold-%data%
(j) ((1 1)) xiold-%offset%
))
539 (f2cl-lib:fref accum-%data%
545 (f2cl-lib:fref fixpnt-%data%
549 (f2cl-lib:fref xiold-%data%
553 (f2cl-lib:fref slope-%data%
554 ((f2cl-lib:int-sub lnew
1))
562 (f2cl-lib:fref accum-%data%
571 (f2cl-lib:int-sub n in nfxp1
)
573 (setf (f2cl-lib:fref xi-%data%
574 ((f2cl-lib:int-add in nregn
1))
577 (f2cl-lib:fref fixpnt-%data%
584 (f2cl-lib:fref accum-%data%
589 (setf nregn
(f2cl-lib:int-sub n in
))
591 (if (= nregn
0) (go label300
))
595 (f2cl-lib:dfloat
(f2cl-lib:int-add nregn
1))))
596 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
599 (setf in
(f2cl-lib:int-add in
1))
600 (setf temp
(+ temp tsum
))
601 (f2cl-lib:fdo
(l lold
(f2cl-lib:int-add l
1))
607 (f2cl-lib:fref accum-%data%
616 (setf (f2cl-lib:fref xi-%data%
(in) ((1 1)) xi-%offset%
)
618 (f2cl-lib:fref xiold-%data%
619 ((f2cl-lib:int-sub lold
1))
624 (f2cl-lib:fref accum-%data%
625 ((f2cl-lib:int-sub lold
1))
628 (f2cl-lib:fref slope-%data%
629 ((f2cl-lib:int-sub lold
1))
633 (setf in
(f2cl-lib:int-add in
1))
639 (setf np1
(f2cl-lib:int-add n
1))
641 (f2cl-lib:fformat iout
642 ("~%" " THE NEW MESH (OF" 1 (("~5D"))
643 " SUBINTERVALS), " 100
644 ("~%" 8 (("~12,6,0,'*,F"))) "~%")
646 (do ((i 1 (f2cl-lib:int-add i
1))
648 ((> i np1
) (nreverse %ret
))
649 (declare (type f2cl-lib
:integer4 i
))
651 (f2cl-lib:fref xi-%data%
656 (setf nz
(f2cl-lib:int-mul mstar
(f2cl-lib:int-add n
1)))
657 (setf ndmz
(f2cl-lib:int-mul kd n
))
660 (return (values mode nil nil nil nil nil nil nil nil nil
)))))))
662 (in-package #-gcl
#:cl-user
#+gcl
"CL-USER")
663 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
664 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
665 (setf (gethash 'fortran-to-lisp
::newmsh
666 fortran-to-lisp
::*f2cl-function-info
*)
667 (fortran-to-lisp::make-f2cl-finfo
668 :arg-types
'((fortran-to-lisp::integer4
) (array double-float
(1))
669 (array double-float
(1)) (array double-float
(1))
670 (array double-float
(1)) (array double-float
(1))
671 (array double-float
(1)) (array double-float
(1))
672 (fortran-to-lisp::integer4
) (array double-float
(1)))
673 :return-values
'(fortran-to-lisp::mode nil nil nil nil nil nil nil
675 :calls
'(fortran-to-lisp::horder fortran-to-lisp
::approx
))))