-
Notifications
You must be signed in to change notification settings - Fork 5
/
psect.f
3800 lines (3145 loc) · 124 KB
/
psect.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
c Copyright (c) 2006 by James A. D. Connolly, Institute for Mineralogy and
c Petrography, Swiss Federal Insitute of Technology, CH-8092 Zurich,
c SWITZERLAND. All rights reserved.
c PSSECT - a program to generate postscript code for phase diagram sections.
c The input data format is consistent with the files generated by VERTEX.
c Please do not distribute any part of this source.
PROGRAM PSSECT
implicit none
include 'perplex_parameters.h'
integer jop0
logical first, err, readyn
external readyn
integer iam
common/ cst4 /iam
c-----------------------------------------------------------------------
c iam is a flag indicating the Perple_X program
iam = 7
c perplexwrap.f flags
getInput = .true.
sWarn = .false.
c version info
call vrsion (6)
iop0 = 0
outprt = .false.
first = .false.
c read input from unit n1 (terminal/disk).
c subroutine input1 also initializes:
c equilibrium counters; units n2 and n4;
c and the limits for numerical results.
call input1 (first,err)
c don't allow users to do anything
c other than gridded min or liquidus plotting
if (icopt.lt.5 .and. icopt.ne.2) then
call error (4,0d0,icopt,'PSVDRAW')
else if (icopt.eq.12) then
call error (72,0d0,icopt,'0-d infiltration results can only '
* //'plotted in tab file format')
end if
c read thermodynamic data on unit n2:
call input2 (first)
c read autorefine lists
call setau1
c read data for solution phases on n9:
call input9 (first)
call setau2
c read plot option file, set
c default transformation
call rdopt
c read the plot/blk files
call interm (.false.,err)
c organize variables
call getvar
c initialize the grid parameters
call setvar
c open output file
call psopen
c ask for options
write (*,1000)
if (readyn()) iop0 = 1
c get user options and read
c rest of plot file, draw data
call psdplt (jop0)
c george's data plotting routine
c option "plot_extra_data" = T
if (plopt(4)) call psdat
call psclos
close (n4)
1000 format ('Modify the default plot (y/n)?')
end
subroutine psdplt (jop0)
c----------------------------------------------------------------
c psdplt - subroutine to plot gridded minimization sections
implicit none
include 'perplex_parameters.h'
integer lop(15), iop1, iop5, iop6, iop7, jop0
character prompt*14
logical readyn
external readyn
integer icomp,istct,iphct,icp
common/ cst6 /icomp,istct,iphct,icp
logical oned
common/ cst82 /oned
c---------------------------------------------------------------
iop5 = 0
iop6 = 0
iop7 = 0
lop(8) = 0
c get some options
call psaxop (1,jop0,iop1)
if (iop0.eq.1) then
c restrict by assemblage
write (*,1150)
if (readyn()) then
c if icp < jbulk write warning:
if (icp.lt.jbulk) write (*,1400)
write (*,1140)
if (readyn()) then
iop5 = 1
prompt='present in the'
call rname (1,prompt)
end if
c restrict by phase presence
write (*,1120)
if (readyn()) then
iop6 = 1
prompt=' absent in all'
call rname (2,prompt)
end if
c restrict by phase absence
write (*,1130)
if (readyn()) then
iop7 = 1
prompt='present in all'
call rname (3,prompt)
end if
end if
end if
c gridded pseudosection construction
if (oned) then
call psgrd1 (jop0,iop5,iop6,iop7)
else if (icopt.ne.2) then
call psgrid (jop0,iop5,iop6,iop7)
else
call pscliq (jop0)
end if
call maktit
call psblrb (2)
1000 format (a)
1120 format (/,'Show only without phases (y/n)? ')
1130 format (/,'Show only with phases (y/n)? ')
1140 format (/,'Show only with assemblage (y/n)? ')
1150 format (/,'Restrict phase fields by phase identities (y/n)?',/,
* ' answer yes to:',/,
* ' - show fields that contain a specific assemblage',/,
* ' - show fields that do not contain specified phases',/,
* ' - show fields that contain any of a set of specified',
* ' phases ')
1400 format (/,'WARNING: You can not specify saturated phases or',
* ' phases determined by',/,'component saturation',
* ' constraints in these restrictions.',/)
end
subroutine check1 (iop5,iop6,iop7,id,n,ntot,imatch)
c----------------------------------------------------------------------
c checkr - subroutine to check exclusions by phase identity
c if imatch = 0 the assemblage id matches the criteria
c----------------------------------------------------------------------
implicit none
include 'perplex_parameters.h'
integer i, n, id(n), kex(k8), ntot, imatch, iop5, iop6, iop7,
* itic, itis, j
integer ixct, iex, ict, jex
common/ excl1 /ixct(3),iex(50,3),jex(50,3),ict(3)
c----------------------------------------------------------------------
imatch = 0
if (iop5.eq.1.or.iop6.eq.1.or.iop7.eq.1) then
imatch = 1
if (iop5.eq.1) then
if (ntot.lt.ixct(1)) goto 99
c initialize kex
do i = 1, ntot
kex(i) = 0
end do
c show only with assemblage:
itic = 0
do i = 1, ntot
c skip occurences of immiscible phases
do j = 1, itic
if (id(i).eq.kex(i)) exit
end do
if (j.le.itic) cycle
c if match then look at
c look for the next phase
call checki (1,id(i),kex(i))
if (kex(i).ne.0) itic = itic + 1
end do
c itic must = ixct if all phases match
if (itic.lt.ixct(1)) goto 99
c if here the assemblage contains
c all the phases requested:
ict(1) = ict(1) + 1
end if
if (iop6.eq.1) then
c reject fields that contain a phase:
do i = 1, ntot
call checki (2,id(i),itis)
if (itis.eq.0) cycle
c name matches a phase in the field
ict(2) = ict(2) + 1
goto 99
end do
c no match
end if
if (iop7.eq.1) then
do i = 1, ntot
call checki (3,id(i),itis)
if (itis.eq.0) cycle
c name matches a phase in the field
ict(3) = ict(3) + 1
goto 90
end do
c no match
goto 99
end if
90 imatch = 0
end if
99 end
subroutine psgrid (jop0,iop5,iop6,iop7)
c----------------------------------------------------------------------
c psgrid - subprogram to output bulk composition data.
c modified to place labels at field barycenters. G Helffrich,
c Bristol, March 24, 2006.
c----------------------------------------------------------------------
implicit none
include 'perplex_parameters.h'
character text*(lchar)
logical bad, readyn
integer k, iran(2,k3), jran(2,k3), i, hfill, nblen, maxvar, j,
* ipoly, idr(k5), iop5, iop6, jop0, nctr(k3), minvar,
* iop7, imatch, iend, ivar, ipoint, jj, ii, lex(k3), ntot,
* iax(l7,2), nax(2), ibeg, jbeg, jend, kk, ictr
double precision rline, x, y, x1, y1, x2, y2, x10, cctr(2,k3),
* y10, rfill, dy, dx, bctr(2,k3), cwidth, dfill
external readyn
integer jlow,jlev,loopx,loopy,jinc
common/ cst312 /jlow,jlev,loopx,loopy,jinc
character*10 xnams
common/ excl4 /xnams(50,3)
integer ixct, iex, ict, jex
common/ excl1 /ixct(3),iex(50,3),jex(50,3),ict(3)
integer icomp,istct,iphct,icp
common/ cst6 /icomp,istct,iphct,icp
double precision xmin,xmax,ymin,ymax,dcx,dcy,xlen,ylen
common/ wsize /xmin,xmax,ymin,ymax,dcx,dcy,xlen,ylen
integer jvar
double precision var,dvr,vmn,vmx
common/ cxt18 /var(l3),dvr(l3),vmn(l3),vmx(l3),jvar
integer ids,isct,icp1,isat,io2
common/ cst40 /ids(h5,h6),isct(h5),icp1,isat,io2
c----------------------------------------------------------------------
hfill = 0
c set up variance based fills:
maxvar = icp + isat + 2 - piopt(1)
minvar = icp + isat + 2 - piopt(2)
c scale from divariant
if (plopt(1).and.maxvar.gt.6) then
c scale, + 1 so highest variance isn't black
dfill = maxvar - minvar + 1d0
c scale, +1, so lowest variance isn't white unless
c it's divariant.
if (minvar.ne.2) dfill = dfill + 1d0
if (.not.plopt(2).and.plopt(1)) minvar = 2
else
c use 20% increments
dfill = 5d0
minvar = 3
end if
c true phase assemblage counter
do i = 1, 3
ict(i) = 0
end do
do i = 1, k3
lex(i) = 0
iran(1,i) = l7
iran(2,i) = 0
jran(1,i) = l7
jran(2,i) = 0
nctr(i) = 0
bctr(1,i) = 0d0
bctr(2,i) = 0d0
end do
dx = dvr(1)*jinc
dy = dvr(2)*jinc
rline = 2d0
cwidth = 0
do i = 1, loopx, jinc
x = xmin + (i-1)/jinc*dx
do j = 1, loopy, jinc
ipoly = iap(igrd(i,j))
ntot = iavar(3,ipoly)
c
do k = 1, ntot
idr(k) = idasls(k,ipoly)
end do
c check assemblage constraints
call check1 (iop5,iop6,iop7,idr,k5,ntot,imatch)
if (imatch.eq.1) then
c this node won't be drawn
igrd(i,j) = 0
lex(ipoly) = 0
cycle
end if
c flag the assemblage
lex(ipoly) = ipoly
c get range of centroids
if (j.gt.jran(2,ipoly)) jran(2,ipoly) = j
if (j.lt.jran(1,ipoly)) jran(1,ipoly) = j
if (i.gt.iran(2,ipoly)) iran(2,ipoly) = i
if (i.lt.iran(1,ipoly)) iran(1,ipoly) = i
c calculate barycenter
nctr(ipoly) = nctr(ipoly) + 1
bctr(1,ipoly) = bctr(1,ipoly) + i
bctr(2,ipoly) = bctr(2,ipoly) + j
rline = 0d0
cwidth = 0d0
y = ymin + (j-1)/jinc*dy
c ok, we're going to draw something
call getxy (i,j,x,y,x1,y1,x2,y2)
if (fill) then
c strip drawing
call watend (i,j,iend)
if (iend.eq.0) then
c at middle of strip
cycle
else if (iend.eq.1) then
c at bottom of strip
x10 = x1
y10 = y1
cycle
else if (iend.eq.3) then
c at top of strip
x1 = x10
y1 = y10
end if
c at top of strip, draw it variance based fill
ivar = icp + isat + 2 - ntot
if (ivar.eq.2) then
c divariant, no fill
call psrect (x1,x2,y1,y2,rline,cwidth,0)
else if (ntot.eq.0) then
c failed minimization
call psrecb (x1,x2,y1,y2,rline,cwidth)
else if (plopt(1).or.ivar.le.7) then
c scale fills according to max variance
rfill = 1d0 - dfloat(ivar - minvar + 1)/dfill
call psrecr (x1,x2,y1,y2,rline,cwidth,rfill)
else
c variance > 7
if (hfill.eq.0.and.ntot.ne.0) then
c write warning, ask fill style
write (*,1000)
if (readyn()) then
hfill = 2
else
hfill = 1
end if
end if
c use pattern fills
if (hfill.eq.1) call psrect (x1,x2,y1,y2,rline,
* cwidth,1+ivar)
end if
end if
end do
end do
c now draw the edges
do i = 1, loopx, jinc
x = xmin + (i-1)/jinc*dx
do j = 1, loopy, jinc
if (igrd(i,j).eq.0) cycle
y = ymin + (j-1)/jinc*dy
c ok, ready to draw something
call getxy (i,j,x,y,x1,y1,x2,y2)
c only draw boundaries that separate
c true phase assemblages.
call neebor (i,j,x1,y1,x2,y2)
end do
end do
if (label) then
c last label centroids:
do k = 1, iasct
c the assemblage doesn't occur if lex(k) = 0
c but this should be possible
if (lex(k).eq.0) cycle
call psbtxt (lex(k), text, iend)
if (nctr(k).lt.2) then
c write (*,*) 'skipping label for dot field: ',
c * text(1:nblen(text))
cycle
end if
c check whether the assemblage is stable in
c one or more than one disjoint fields before
c calculating the barycenter. the effect of a
c small, separated field might not shift the
c barycenter of a larger field enough to shift
c it out of the field extent.
nax(1) = 0
nax(2) = 0
ipoly = lex(k)
do ii = iran(1,k),iran(2,k),jinc
do jj = jran(1,k),jran(2,k),jinc
if (iap(igrd(ii,jj)).eq.ipoly) then
c add i,j indices to list used
call iasadd(ii,nax(1),iax(1,1))
call iasadd(jj,nax(2),iax(1,2))
end if
end do
end do
c if nothing matched, we're hosed
if (nax(1).eq.0 .and. nax(2).eq.0) then
write (*,*) 'uh-oh on assemblage',text(1:nblen(text))
cycle
end if
c determine number of contiguous ranges
c of i- and j-indices. the breaks will
c mark group edges.
ii = 1
do i = 2,nax(1)
if (iax(i,1)-iax(i-1,1) .gt. 1) ii = ii + 1
end do
jj = 1
do i = 2,nax(2)
if (iax(i,2)-iax(i-1,2) .gt. 1) jj = jj + 1
end do
if (ii*jj .le. 1) then
c there is only one contiguous group of points.
c compute barycenter, added by
c G Helffrich, Mar 24, 2009.
i = max(1,nint(bctr(1,k)/nctr(k)))
j = max(1,nint(bctr(2,k)/nctr(k)))
c test that it's ok
if (igrd(i,j).eq.0) then
ipoly = 0
else
ipoly = iap(igrd(i,j))
end if
if (ipoly.eq.lex(k)) then
x = xmin + (i-1)/jinc*dx
y = ymin + (j-1)/jinc*dy
call psflbl (x,y,lex(k),nblen(text),text)
cycle
end if
end if
if (ii*jj.gt.1) then
c there are discontiguous stability assemblages.
if (rlabel.lt.1d0) then
c ---------begin georges block-----------
c scan the range of the bounding polygon of the
c two (or more) fields to find a node
c with the assemblage
write (*,1010) max(ii,jj),text(1:nblen(text))
c process dimension with largest number
c of regions
if (ii.ge.jj) then
j = 1
iend = ii
else
j = 2
iend = jj
end if
else
c must be a really oddly-shaped region
c choose longest extent for subdivision
ii = iax(nax(1),1) - iax(1,1)
jj = iax(nax(2),2) - iax(1,2)
if (ii .gt. jj) then
j = 1
else
j = 2
end if
iend = 1
end if
ictr = 0
do kk=1,iend
c in group kk, find limiting extent of
c dimension
jj = 1
jbeg = iax(1,j)
jend = iax(nax(j),j)
do i=2,nax(j)
if (iax(i,j)-iax(i-1,j) .gt. 1) then
jj = jj + 1
if (jj.eq.kk) then
jbeg = iax(i,j)
cycle
end if
if (jj.gt.kk) then
jend = iax(i-1,j)
exit
end if
end if
end do
c find barycenter of elements within
c extent for label.
x = 0d0
y = 0d0
i = 0
if (iend .eq. 1) then
ibeg = iax(1,1)
iend = iax(nax(1),1)
jbeg = iax(1,2)
jend = iax(nax(2),2)
if (j.eq.1) then
iend = iax(max(1,nax(1)/2),1)
else
jend = iax(max(1,nax(2)/2),2)
end if
else if (j.eq.2) then
ibeg = iran(1,k)
iend = iran(2,k)
else
ibeg = jbeg
iend = jend
jbeg = jran(1,k)
jend = jran(2,k)
end if
do ii=ibeg,iend,jinc
do jj=jbeg,jend,jinc
if (iap(igrd(ii,jj)).eq.ipoly) then
i = i + 1
x = x + dfloat((ii-1)/jinc)
y = y + dfloat((jj-1)/jinc)
end if
end do
end do
if (iend-ibeg.lt.2.or.jend-jbeg.lt.2) then
c write (*,*) 'skipping label for dot field: ',
c * text(1:nblen(text))
cycle
end if
c george had ii = max(1,nint(x/i)) for
c grid spacing 1, changed 10/13/2018
c for grid spacing jinc. JADC
ii = 1 + nint(x/i)*jinc
jj = 1 + nint(y/i)*jinc
if (igrd(ii,jj).eq.0) then
write (*,*) 'for ',
* text(1:nblen(text)),', can this be?',ii,jj,
* xmin + dfloat((ii-1)/jinc)*dx,
* ymin + dfloat((jj-1)/jinc)*dy
cycle
end if
c in the money this time -- agrees?
ipoint = iap(igrd(ii,jj))
if (ipoint.ne.lex(k)) then
c write (*,*) '**oops - barycenter at ',x,y,
c * ' for ',text(1:nblen(text)),' region ',kk,' missed'
else
ictr = ictr + 1
cctr(1,ictr) = xmin + dfloat((ii-1)/jinc)*dx
cctr(2,ictr) = ymin + dfloat((jj-1)/jinc)*dy
if (ictr.gt.k3) exit
end if
end do
c now check that the barycenters are
c far enough apart:
do ii = 1, ictr
x = cctr(1,ii)
y = cctr(2,ii)
bad = .false.
do jj = ii+1, ictr
if ( dsqrt( ((x-cctr(1,jj))/xlen)**2
* +((y-cctr(2,jj))/ylen)**2).lt.rlabel) then
bad = .true.
exit
end if
end do
if (bad) cycle
call psflbl (x,y,lex(k),nblen(text),text)
end do
cycle
c ---------end george's block------------
end if
ipoly = lex(k)
c scan the range to find a node
c with the assemblage
if (jran(2,k).gt.2) then
c first try to find one at an i-value
c at half the j-range
jj = 1 + ((jran(2,k)-1)/jinc/2)*jinc
do ii = iran(1,k), iran(2,k), jinc
if (igrd(ii,jj).eq.0) cycle
if (iap(igrd(ii,jj)).eq.ipoly) then
ipoint = iap(igrd(ii,jj))
x = xmin + (ii-1)/jinc*dx
y = ymin + (jj-1)/jinc*dy
goto 50
end if
end do
end if
if (iran(2,k).gt.2) then
c next try to find one at an j-value
c at half the i-range
ii = 1 + ((iran(2,k)-1)/jinc/2)*jinc
do jj = jran(1,k), jran(2,k), jinc
if (igrd(ii,jj).eq.0) cycle
if (iap(igrd(ii,jj)).eq.ipoly) then
ipoint = iap(igrd(ii,jj))
x = xmin + (ii-1)/jinc*dx
y = ymin + (jj-1)/jinc*dy
goto 50
end if
end do
end if
c last try, scan the range to find a node
c with the assemblage
do ii = iran(1,k), iran(2,k), jinc
do jj = jran(1,k), jran(2,k), jinc
if (igrd(ii,jj).eq.0) cycle
if (iap(igrd(ii,jj)).eq.ipoly) then
ipoint = iap(igrd(ii,jj))
x = xmin + (ii-1)/jinc*dx
y = ymin + (jj-1)/jinc*dy
goto 50
end if
end do
end do
c no grid point found for the
c assemblage, perhaps the resetting of
c igrd to zero allows this?
write (*,*) 'uh-oh on assemblage', ipoly
cycle
c end if
c call label routine:
50 call psbtxt (ipoint, text, iend)
call psflbl (x,y,lex(k),iend,text)
end do
end if
c draw axes
call psaxes (jop0)
if (iop5.eq.1) write (*,*) ict(1),
* ' fields have the assemblage: ',
* (xnams(k,1),' ',k = 1, ixct(1))
if (iop6.eq.1) write (*,*) ict(2),
* ' fields do not have any of the phases: ',
* (xnams(k,2),' ',k = 1, ixct(2))
if (iop7.eq.1) write (*,*) ict(3),
* ' fields do have one of the phases: ',
* (xnams(k,3),' ',k = 1, ixct(3))
1000 format (/,'**warning ver099** the section contains phase fields',
* ' of variance > 6',/,'these will be drawn with pattern',
* ' fills that may look strange.',/,'Suppress phase ',
* 'field fills for fields with variance > 6 (y/n)? ')
1010 format ('There are ',i3,' fields for: ',a)
end
subroutine psflbl (x,y,lex,iend,text)
c----------------------------------------------------------------------
c----------------------------------------------------------------------
implicit none
include 'perplex_parameters.h'
character text*(lchar), lnm*6
integer iend, lex
double precision x,y,dx1,dy1
double precision xmin,xmax,ymin,ymax,dcx,dcy,xlen,ylen
common/ wsize /xmin,xmax,ymin,ymax,dcx,dcy,xlen,ylen
c----------------------------------------------------------------------
call pssctr (ifont,ascale,ascale, 0d0)
dx1 = .75d0*dcx*ascale
dy1 = .75d0*dcy*ascale
call pselip (x,y,.25d0*dcx,.25d0*dcy,1d0,0d0,0,0,1)
if (plopt(3)) then
c numeric field label lex(k)
write (lnm,'(i6)') lex
call unblnk (lnm)
call pstext (x+dx1,y+dy1,lnm,5)
else
c text field label
call pstext (x+dx1,y+dy1,text,iend)
end if
end
subroutine iasadd(m,n,tab)
c----------------------------------------------------------------------
c george's function for psgrid
c iasadd - routine to add m to an ordered table of n elements in tab.
implicit none
integer i,j,jlo,jhi,k,m,n,tab(*)
if (n.le.0) then
c nothing in table is a special case
tab(1) = m
n = 1
return
end if
if (n .eq. 1) then
c one item in table is too
if (m .eq. tab(1)) return
if (m .gt. tab(1)) then
tab(2) = m
else
tab(2) = tab(1)
tab(1) = m
end if
else
c do binary search for insertion point
j = n/2
jlo = 1
jhi = n
do
c quit if in table already
if (m .eq. tab(j)) return
if (m .gt. tab(j)) then
c lower half
jlo = j+1
else
c upper half
jhi = j-1
end if
c next check point -- insert if absent
k = (jlo+jhi)/2
if (j .eq. k .or. k .eq. 0) then
c move entries in table down, insert new
do i=n,k+1,-1
tab(i+1) = tab(i)
end do
tab(k+1) = m
exit
end if
j = k
end do
end if
c one more added
n = n + 1
end
subroutine psgrd1 (jop0,iop5,iop6,iop7)
c----------------------------------------------------------------------
c psgrd1 - subprogram draw 1d gridded minimization diagrams.
implicit none
include 'perplex_parameters.h'
logical readyn
character text*(lchar)
integer k, hfill, jop0,
* j, ipoly, idr(k5), iop5, iop6, jmin, jmax,
* iop7, imatch, iend, ivar, jj, ntot
double precision rline, x, y, x1, y1, x2, y2, xl,
* x10, rfill, dx
external readyn
integer jlow,jlev,loopx,loopy,jinc
common/ cst312 /jlow,jlev,loopx,loopy,jinc
integer icomp,istct,iphct,icp
common/ cst6 /icomp,istct,iphct,icp
double precision xmin,xmax,ymin,ymax,dcx,dcy,xlen,ylen
common/ wsize /xmin,xmax,ymin,ymax,dcx,dcy,xlen,ylen
integer jvar
double precision var,dvr,vmn,vmx
common/ cxt18 /var(l3),dvr(l3),vmn(l3),vmx(l3),jvar
integer ids,isct,icp1,isat,io2
common/ cst40 /ids(h5,h6),isct(h5),icp1,isat,io2
c----------------------------------------------------------------------
hfill = 0
c default fill mode by variance:
y1 = ymin
y2 = ymin + 4d0*dcy*cscale
y = (y1+y2)/2d0
dx = dvr(1)
x = xmin - dx
jmin = loopy
jmax = 0
do j = 1, loopy
x = x + dx
ipoly = iap(igrd(1,j))
ntot = iavar(3,ipoly)
c
do k = 1, ntot
idr(k) = idasls(k,ipoly)
end do
c check assemblage constraints
call check1 (iop5,iop6,iop7,idr,k5,ntot,imatch)
c get range of centroids
if (j.gt.jmax) jmax = j
if (j.lt.jmin) jmin = j
rline = 0d0
call gety (j,x,x1,x2)
if (fill) then
c strip drawing
call watend (1,j,iend)
if (iend.eq.0) then
c at middle of strip
cycle
else if (iend.eq.1) then
c at bottom of strip
x10 = x1
cycle
else if (iend.eq.3) then
c at top of strip
x1 = x10
end if
c going to draw something
c variance based fill
ivar = icp + isat - ntot
if (ivar.eq.0) then
c white (no fill)
call psrect (x1,x2,y1,y2,0d0,0d0,0)
else if (ivar.le.6) then
c for di-septa-variant use gray-scale
rfill = 1d0 - dfloat (ivar) * 0.2d0
call psrecr (x1,x2,y1,y2,0d0,0d0,rfill)
else
if (hfill.eq.0.and.ntot.gt.0) then
c write warning
write (*,1000)
c suppress > hexavariant fills
if (readyn()) then
hfill = 2