! ! in your FDTD code. An example of such a call, as well as a list explaining ! the input variables is given below. ! ! ........................................................... ! The following is an example on how to call the PS Vector Field ! if (mod(n,20).eq.0 .and. n .lt. 800) then ! io = n/20 - 1 ! iolast = nstop/20 - 1 ! ! The following is for E field components ! PSFile='Esxup.PS' ! one file to get the appropriate scale ! tns = t*1.e+9 ! del1 = dely ! del2 = delz ! n1s = 40 ! n1e = 70 ! n2s = 1 ! n2e = nz ! iskip1 = 1 ! iskip2 = 1 ! Iplane = 2 ! Icut = 13 ! units = 'V/m' ! grid = .false. ! totalf =.true. ! ipost = 13 ! iscratch = 15 ! thick_bound = .true. ! glob_scale = .true. ! call PSVF (del1,N1s,N1e,Eys,iskip1, ! & del2,N2s,N2e,Ezs,iskip2, ! & Nx,Ny,Nz,Iplane,icut,PSfile,ipost,iscratch,totalf, ! & tns,delx,dely,delz,io,iolast,units,grid, ! & thick_bound,glob_scale) ! ! The variables are as follows: ! ! parameters: ! del1,del2: FDTD cell size in horizontal and vertical directions (in m) ! Ns1,Ne1: Starting and ending indices for horizontal vector. The word ! horizontal reffers to the direction on the postscript plot. ! Ns2,Ne2: Starting and ending indices for vertical vector. The word ! vertical reffers to the direction on the postscript plot. ! E1,E2: FDTD field values. They can be either Electric or Magnetic ! fields. E1 reffers to the horizontal component, and E2 ! reffers to the vertical component ! Iskip1,Iskip2: Skip values in horizontal and vertical directions ! Nx,Ny,Nz: Actual dimensions of field arrays E1,E2 in FDTD code ! Iplane: The plane cut (1 for x-y , 2 for y-z , 3 for x-z) ! Icut: The level of cut in the specified plane cut ! PSFile: File name of the PS output ! Ipost: Unit number for the PS file (i.e. open(unit=Ipost)). Make sure ! that this is not an open unit used in the FDTD code. ! Iscrach: Unit number for a scratch file that is internal to the postscript ! routine. Make sure that this is not an open unit used in the FDTD ! code. ! totalf: logical variable for the scattered (false) or total (true) field ! tns: Time in ns ! delx, dely,delz: cell sizes in x,y,z directions (in m) ! io: ! iolast: ! units: This is a string variable that can only be be either 'V/m' or 'A/m'. ! This option is used to detect if the vector plot is ! for electric or magnetic field. It is necessary to determine the ! shift and accurate number of FDTD grid points to be uesd. ! grid: = .true. if fine grid is desired. ! = .false. if fine grid is not desired. ! thick_bound = .true. if a thick boundary is to be plotted ! = .false. if a thin and dashed boundary is to plotted. ! glob_scale = true/false for whether or not to create a uniform ! vector scale for all the plots in the given postscript ! file. This flag is meaningful ! only when last_call = .true. !.....7................................................................2 subroutine PSVF(del1,N1s,N1e,E1,iskip1, & del2,N2s,N2e,E2,iskip2, & Nx,Ny,Nz,Iplane,icut,PSfile,ipost,iscratch,totalf, & tns,delx,dely,delz,io,iolast,units,grid, & thick_bound,glob_scale) ! input parameters: ! del1,del2: Steps in FDTD in horizontal and vertical directions ! Ns1,Ne1: Starting and ending indeces for horizontal vector ! Ns2,Ne2: Starting and ending indeces for vertical vector ! E1,E2: Horizontal and vertical vectors ! Iskip1,Iskip2: Skip values in horizontal and vertical directions ! Nx,Ny,Nz: Dimensions of E1,E2 in FDTD code ! Iplane: Identifier for plane cut (1 for x-y , 2 for y-z , 3 for x-z) ! Icut: Identifier for the level of cut in specified plane ! PSFile: File name of the PS output ! Ipost: Unit number for the PS file ! Output parameters: ! n11,n22: number of grid points in horizontal and vertical directions ! dp1,dp2: steps in horizontal and vertical directions ! vector: e1(1,1,icut),e2(1,1,icut), ... in sequence ! up to e1(n11,n22,icut),e2(n11,n22,icut) ! for xy plane as an example ! grid: on/off (true/false) ! totalf: logical variable for the scattered (false) or total (true) field ! implicit none parameter (maxelement=25000) character*15 psfile,units,cut_val,time_val character*80 title1,title2 logical first_call,last_call,new_page,landscape,grid,totalf logical third_comp,glob_scale,thick_bound integer*1 Ipost integer iplane,nx,ny,nz,xpatch,ypatch real xwidth,ywidth,psxloc,psyloc,psxsize,psysize real vector(maxelement),tns,cut,e1(nx,ny,nz),e2(nx,ny,nz) xpatch = (n1e-n1s)/iskip1 + 1 ypatch = (n2e-n2s)/iskip2 + 1 xwidth = del1 * iskip1 ywidth = del2 * iskip2 maxd = xpatch*ypatch if (maxd .gt. maxelement)then write(*,*) ' Error in PSVF routine' write(*,*) ' Increase the dimension of vector' write(*,*) ' from ', maxelement, ' to ', maxd stop end if if (third_comp) then k = 1 jj = n2s - iskip2 do j = 1,ypatch jj = jj + iskip2 ii = n1s - iskip1 do i = 1,xpatch ii = ii + iskip1 if (iplane .eq. 1) then ! x-y plane cut=delz*icut if(totalf) then vector(k) = e1(ii,jj,icut)+exi(ii,jj,icut) vector(k+1) = e2(ii,jj,icut)+eyi(ii,jj,icut) else vector(k) = e1(ii,jj,icut) vector(k+1) = e2(ii,jj,icut) endif end if if (iplane .eq. 2) then ! y-z plane cut=delx*icut vector(k) = e1(icut,ii,jj) vector(k+1) = e2(icut,ii,jj) c write(7,*) ii,jj,e1(icut,ii,jj),e2(icut,ii,jj) end if if (iplane .eq. 3) then ! x-z plane cut=dely*icut vector(k) = e1(jj,icut,ii) ! Ez vector(k+1) = e2(jj,icut,ii) ! Ex end if k = k + 2 end do end do else k = 1 jj = n2s - iskip2 do j = 1,ypatch jj = jj + iskip2 ii = n1s - iskip1 do i = 1,xpatch ii = ii + iskip1 if (iplane .eq. 1) then ! x-y plane cut=delz*icut if(totalf) then vector(k) = e1(jj,ii,icut)+exi(jj,ii,icut) vector(k+1) = e2(jj,ii,icut)+eyi(jj,ii,icut) else vector(k) = e1(jj,ii,icut) vector(k+1) = e2(jj,ii,icut) endif end if if (iplane .eq. 2) then ! y-z plane cut=delx*icut vector(k) = e1(icut,jj,ii) vector(k+1) = e2(icut,jj,ii) c write(7,*) ii,jj,e1(icut,jj,ii),e2(icut,jj,ii) end if if (iplane .eq. 3) then ! x-z plane cut=dely*icut vector(k) = e1(ii,icut,jj) vector(k+1) = e2(ii,icut,jj) end if k = k + 2 end do end do end if ! ..... write(cut_val,100) cut cut_val =cut_val//' m' write(time_val,100) tns time_val = time_val//' ns' 100 format(f7.3) if (iplane .eq. 1 ) title1 = 'x-y plane' ! 'BIG TITLE' if (iplane .eq. 2 ) title1 = 'y-z plane' ! 'BIG TITLE' if (iplane .eq. 3 ) title1 = 'x-z plane' ! 'BIG TITLE' title2 = 'Absolute value of field' ! 'small title' c psxloc = 4.25 ! for one plot per page c psyloc = 5.5 c psxsize = 7. c psysize = 10. ! 4 plots on one page psxsize = 3.0 psysize = 4.0 if (mod(io,4).eq.0) then ! left top c write (*,*) ' mmm ', io,mod(io,4) new_page=.true. psxloc = 2.125 psyloc = 8.25 elseif (mod(io,4).eq.1) then ! right top new_page=.false. psxloc = 6.15 psyloc = 8.25 elseif (mod(io,4).eq.2) then ! left bottom new_page=.false. psxloc = 2.125 psyloc = 2.75 elseif (mod(io,4).eq.3) then !right bottom new_page=.false. psxloc = 6.15 psyloc = 2.75 end if if (io .eq. 0) then new_page=.true. first_call=.true. last_call=.false. elseif (io .lt. iolast) then first_call=.false. last_call=.false. elseif (io .eq. iolast) then first_call=.false. last_call=.true. end if landscape=.false. call psvector(xpatch,ypatch,xwidth,ywidth,vector,iplane, x third_comp,ipost,iscratch, x title1,title2,cut_val,time_val,psfile, x first_call,last_call,new_page,landscape, x psxloc,psyloc,psxsize,psysize,units,grid, x thick_bound,glob_scale) return end !.....7...............................................................2 ! include 'program2.f' c------------------------------------------------------------------ c xpatch = number of vectors in the x direction c ypatch = number of vectors in the y direction c xwidth = width of a cell in the x direction c ywidth = width of a cell in the y direction c NOTE: xwidth and ywidth SHOULD be in meters, but they c dont have to. The only different is in the legend. c c vector - An array consisting of Ex and Ey as such c vector(1) = Ex(1) c vector(2) = Ey(1) ------------------- c vector(3) = Ex(2) | | | | Y c vector(4) = Ey(2) | 4 | 5 | 6 | ^ c vector(5) = Ex(3) | | | | | c vector(6) = Ey(3) ------------------- | c vector(7) = Ex(4) | | | | -----> X c vector(8) = Ey(4) | 1 | 2 | 3 | c vector(9) = Ex(5) | | | | c vector(10)= Ey(5) ------------------- c iplane = 1 if plot is a x-y cut c = 2 if plot is a z-y cut c = 3 if plot is a x-z cut c for any other value, no axis will be drawn c third_comp = .true. if the third component of the cut points out c of the page c = .false. if the third component of the cut points into c the page. c EXAMPLE if iplane=1 and third_comp=.true. then the c z-axis points out of the page. c Note: third_comp is meaningful only if 0 < iplane < 4. c title1,title2, titles (string variables) to go on top of vector c plot. c cut_val = string to indicate the third value. c example: if iplane=3 cut_val would be "30 cm" and in the c postscript file it would appear as "y = 30 cm". c Special Feature: if the first character is ~, then nothing c will be printed c time_val = string to indicate the time. c example: "30.5 ns", "200 steps" would yield "t = 30.5 ns" c and "t = 200 steps" respectively. c Special Feature: if the first character is ~, then nothing c will be printed c postfile = name of postscript file. c first_call = .true. if it is the first time that the subroutine c has been called (for a given postfile) c = .false. if the subroutine has been called beforei c (for a given postfile). c last_call = .true. if it is the last time that the subroutine c will be called (for a given postfile). c = .false. if the subroutine will be called again c (for a given postfile). c last_call is significant for making a uniform vector c scale across all plots. c new_page = .true. if a new page is desired (ignored if c first_call is .true.) c = .false. if no new page is desired (i.e. user wants c to place multiple plots on same page). c landscape = .true. if landscape orientation is desired c = .false. if portrait orientation is desired. c NOTE: this flag is effective only when first_page=.true. c or new_page=.true. c psxloc = the x location (in inch) of where on the paper to draw c the vectors (center alignment). c psyloc = the y location (in inch) of where on the paper to draw c the vectors (center alignment). c psxsize = constraining size (in inch) in x dircetion of the plot. c psysize = constraining size (in inch) in y dircetion of the plot. c units = string discribing the units of the vector. c grid = .true. if the fine (dashed) grid is desired. c = .false. if the find (dashed) grid is not desired. c thick_bound = .true. if a thick boundary is to be plotted c = .false. if a thin and dashed boundary is to plotted. c glob_scale = true/false for whether or not to create a uniform c vector scale for all the plots in the given postscript c file. This flag is meaningful c only when last_call = .true. c------------------------------------------------------------------ subroutine psvector(xpatch,ypatch,xwidth,ywidth,vector,iplane, x third_comp,ipost,iscratch, x title1,title2,cut_val,time_val, x postfile,first_call,last_call,new_page, x landscape,psxloc,psyloc,psxsize,psysize, x units,grid,thick_bound,glob_scale) implicit none integer maxelement,iplane,ipost,iscratch parameter (maxelement=25000) integer xpatch,ypatch real xwidth,ywidth,psxloc,psyloc,psxsize,psysize real vector(maxelement) character*15 postfile,units,cut_val,time_val character*80 title1,title2 logical first_call,last_call,new_page,landscape,grid logical glob_scale,third_comp,thick_bound integer loop,pagenumber real bigx,bigy,dummy1,dummy2,locscale,sizescale,pi180 real dummy3 integer pulse,const character*80 trash real min_e_scale,min_h_scale character*15 units2 pi180 = 4*atan(1.0)/180.0 pagenumber = 0 c check for under-dimensioning. if (xpatch*ypatch*2.gt.maxelement) then print *, 'DIMENSIONING ERROR IN psvector !!!!!!!!!!!' print *, 'PLEASE INCREASE (maxelement) to at least', & 2*xpatch*ypatch stop end if c make sure units = 'A/m' or 'V/m' this determines whether data is c magnetic or electric field if ((units.ne.'V/m').and.(units.ne.'A/m')) then print *, 'Currently, psvector, is designed to work only', & 'with (A/m) or (V/m)' print *, 'You have units = ',units stop end if c determine the scale for the drawing. const strips c out one cell from the x and y direction. By setting const to 0 for both the c electric and magnetic fields, it is effectively defunct. const = 0 if (units.eq.'V/m') then if (thick_bound) then const = 1 end if end if if ((psxsize/(real(xpatch-const)*xwidth)).lt. - (psysize/(real(ypatch-const)*ywidth))) then locscale = psxsize/(real(xpatch-const)*xwidth) else locscale = psysize/(real(ypatch-const)*ywidth) end if c determine the largest field in x and in y bigx = 0.0 bigy = 0.0 do 10 loop = 1, 2*xpatch*ypatch,2 if (abs(vector(loop)).gt.bigx) bigx=abs(vector(loop)) if (abs(vector(loop+1)).gt.bigy) bigy=abs(vector(loop+1)) 10 continue c determine the scale for the vectors on the drawing c be careful to avoid a division by 0 error. if ((bigx.eq.0.0).and.(bigy.eq.0.0)) then sizescale = 1.E+30 else if (bigx.eq.0.0) then sizescale = locscale/bigy *.85 * ywidth else if (bigy.eq.0.0) then sizescale = locscale/bigx *.85 * xwidth else if (xwidth/bigx.lt.ywidth/bigy) then sizescale = locscale/bigx *.85 * xwidth else sizescale = locscale/bigy *.85 * ywidth end if end if 99 format(a) c open postscript file, and write vital subroutines. if (first_call) then open (unit=ipost,file=postfile,status='UNKNOWN') write(ipost,99)'%!PS-Adobe-2.0' write(ipost,99)'%%BoundingBox: 0 0 612 792' write(ipost,99) write(ipost,99)'/inch {72 mul} def' write(ipost,99) write(ipost,99)'/landscape {90 rotate 0 inch -8.5 inch '// x 'translate} def' write(ipost,99) write(ipost,99)'/grid %xctr,yctr,#x_pulses,#y_pulses,'// x 'width_x_pulse,width_y_pulse,' write(ipost,99)' %border_line_width,cell_line_width,'// x 'grid_flag' write(ipost,99)'{ 9 dict begin' write(ipost,99)' newpath' write(ipost,99)'%----- declare variables ------' write(ipost,99)' /grid_flag exch def' write(ipost,99)' /cell_line_width exch def' write(ipost,99)' /border_line_width exch def' write(ipost,99)' /width_y_pulse exch inch def' write(ipost,99)' /width_x_pulse exch inch def' write(ipost,99)' /num_y_pulses exch def' write(ipost,99)' /num_x_pulses exch def' write(ipost,99)' inch exch inch exch' write(ipost,99)' newpath' write(ipost,99)' moveto' write(ipost,99)'%----- draw the border ------' write(ipost,99)' width_x_pulse num_x_pulses mul -2 div' write(ipost,99)' width_y_pulse num_y_pulses mul -2 div' write(ipost,99)' rmoveto' write(ipost,99)' 0 width_y_pulse num_y_pulses mul rlineto' write(ipost,99)' width_x_pulse num_x_pulses mul 0 rlineto' write(ipost,99)' 0 width_y_pulse num_y_pulses '// x ' mul -1 mul rlineto' write(ipost,99)' closepath' write(ipost,99)' border_line_width setlinewidth' write(ipost,99)' currentpoint stroke moveto' write(ipost,99)'%------ draw horizontal lines -------' write(ipost,99)' grid_flag 1 eq {' write(ipost,99)' gsave [.5 2] 0 setdash' write(ipost,99)' cell_line_width setlinewidth' write(ipost,99)' gsave' write(ipost,99)' 1 1 num_y_pulses 1 sub' write(ipost,99)' { pop' write(ipost,99)' 0 width_y_pulse rmoveto ' write(ipost,99)' gsave' write(ipost,99)' width_x_pulse num_x_pulses '// x 'mul 0 rlineto stroke' write(ipost,99)' grestore' write(ipost,99)' } for' write(ipost,99)' grestore' write(ipost,99)'%------ draw vertical lines --------' write(ipost,99)' 1 1 num_x_pulses 1 sub' write(ipost,99)' { pop' write(ipost,99)' width_x_pulse 0 rmoveto' write(ipost,99)' gsave' write(ipost,99)' 0 width_y_pulse num_y_pulses '// x 'mul rlineto stroke' write(ipost,99)' grestore' write(ipost,99)' } for grestore' write(ipost,99)'} if' write(ipost,99)' end' write(ipost,99)'} def' write(ipost,99) write(ipost,99)'/vector % x,y,length,angle. (distances'// x ' are in inches, angles in degrees)' write(ipost,99)'{ 4 dict begin' write(ipost,99)' newpath' write(ipost,99)' /angle exch def' write(ipost,99)' /length exch inch def' write(ipost,99)' gsave' write(ipost,99)' inch exch inch exch' write(ipost,99)' moveto ' write(ipost,99)' angle rotate' c removing the following commented line will make the vector center aligned. c write(ipost,99)' length -2 div 0 rmoveto' write(ipost,99)' length .6 mul 0 rlineto' write(ipost,99)' .015 length mul setlinewidth' write(ipost,99)' currentpoint stroke moveto' write(ipost,99)' 0 -.15 length mul rlineto' write(ipost,99)' length .4 mul length .15 mul rlineto' write(ipost,99)' length -.4 mul length .15 mul rlineto' write(ipost,99)' closepath' write(ipost,99)' 0 setgray fill' write(ipost,99)' grestore' write(ipost,99)' end' write(ipost,99)'} def' write(ipost,99) write(ipost,99)'/draw_axis %xpos,ypos,iplane,3rd_axis' write(ipost,99)' %3rd_axis = 0/1 then the third'// x ' axis points in/out of page' write(ipost,99)'{7 dict begin' write(ipost,99)'/third_axis exch def' write(ipost,99)'/iplane exch def' write(ipost,99)'/ypos exch def' write(ipost,99)'/xpos exch def' write(ipost,99)'gsave' write(ipost,99)'/len 0.3 def' write(ipost,99) write(ipost,99)' xpos ypos translate' write(ipost,99)' newpath % make the corner' write(ipost,99)' len .015 mul setlinewidth' write(ipost,99)' 2 0 moveto' write(ipost,99)' 0 0 lineto' write(ipost,99)' 0 2 lineto stroke' write(ipost,99)' 0 0 len 90 vector' write(ipost,99)' 0 0 len 0 vector' write(ipost,99)' iplane 1 eq{' write(ipost,99)' third_axis 1 eq' write(ipost,99)' {/str1 (x) def' write(ipost,99)' /str2 (y) def}' write(ipost,99)' {/str1 (y) def' write(ipost,99)' /str2 (x) def} ifelse} if' write(ipost,99)' iplane 2 eq{' write(ipost,99)' third_axis 1 eq' write(ipost,99)' {/str1 (y) def' write(ipost,99)' /str2 (z) def}' write(ipost,99)' {/str1 (z) def' write(ipost,99)' /str2 (y) def} ifelse} if' write(ipost,99)' iplane 3 eq{' write(ipost,99)' third_axis 1 eq' write(ipost,99)' {/str1 (z) def' write(ipost,99)' /str2 (x) def}' write(ipost,99)' {/str1 (x) def' write(ipost,99)' /str2 (z) def} ifelse} if' write(ipost,99)' /Helvetica findfont 12 scalefont setfont ' write(ipost,99)' len inch str1 stringwidth pop 2 div add -2'// x ' moveto str1 show' write(ipost,99)' str2 stringwidth pop -2 div len inch 6 add'// x ' moveto str2 show' write(ipost,99)'grestore end} def' write(ipost,99) write(ipost,99)'%----- Main Program (data) ------' write(ipost,99)'/Helvetica findfont 12 scalefont setfont' write(ipost,99)'%%Page: 1 1' if (landscape) write(ipost,99)'landscape' pagenumber = 1 else open (unit=ipost,err=990,file=postfile,status='OLD') goto 21 990 print *, 'File '//postfile//' does not exist' print *, 'Do not call the PSVECTOR subroutine with '// x 'first_call=.false. if you never' print *, 'called it before with the argument postfile = '// x postfile stop c put the pointer at the end of the file. Then go back two lines. 21 continue 27 read(ipost,99,end=19) trash goto 27 19 write(ipost,99) 'xxx' backspace(unit=ipost) backspace(unit=ipost) read(ipost,221) trash,pagenumber 221 format(a28,i7) backspace(unit=ipost) end if if ((.not.first_call).and.(new_page)) then pagenumber = pagenumber + 1 write(ipost,*) write(ipost,*) 'showpage' write(ipost,203) pagenumber,pagenumber 203 format('%%Page: ',i4,' ',i4) if (landscape) write(ipost,99)'landscape' end if c print all the vectors, but first print header information to c postscript file, for purpose of making constant vector scale write(ipost,99)'%~~Scale Info Beneath.' if (units.eq.'A/m') then write(ipost,204) xpatch*ypatch,'Magnetic',sizescale else write(ipost,204) xpatch*ypatch,'Electric',sizescale end if 204 format('%== Number of Vectors: ',i8,' Type:',a8,' Sizescale: ', x e9.4) do 20 loop = 1,xpatch*ypatch*2,2 pulse = mod(loop/2 , xpatch) + 1 bigx = (real(pulse) - real(xpatch+1)/2.0) *locscale *xwidth pulse = (loop/2) /xpatch + 1 bigy = (real(pulse) - real(ypatch+1)/2.0) *locscale *ywidth bigx = bigx + psxloc bigy = bigy + psyloc dummy1 = sqrt(vector(loop)**2 + vector(loop+1)**2) dummy1 = dummy1 * sizescale dummy2 = atan2(vector(loop+1),vector(loop))/pi180 write(ipost,100) bigx,bigy,dummy1,dummy2 100 format (4f8.2,' vector') 20 continue c print the scale information write(ipost,99) write(ipost,*) psxloc-locscale*xwidth*real(xpatch-const)/2.0, x ' inch ',psyloc-locscale*ywidth*real(ypatch-const)/2.0-.4, x ' inch moveto' write(ipost,210) 1./ (sizescale * 2.54),units 210 format ('(Vector Scale: 1 cm = ',e9.4,' ',a5,') show') write(ipost,*) psxloc-locscale*xwidth*real(xpatch-const)/2.0, x ' inch ',psyloc-locscale*ywidth*real(ypatch-const)/2.0-.2, x ' inch moveto' write(ipost,205) 1./(locscale*2.54) 205 format ('(Scale: 1 cm (diagram) = ',e8.3,' cm (actual)) show') c print the grid. c Atef note the .8 is the linewidth of the border, .2 is linewidth of the grid. if (grid) then if (thick_bound) then write(ipost,110) psxloc,psyloc,xpatch-const,ypatch-const, - locscale*xwidth,locscale*ywidth,.8,.2,1 else write(ipost,99)'gsave [4 2 1 2] 0 setdash' write(ipost,110) psxloc,psyloc,xpatch-const,ypatch-const, - locscale*xwidth,locscale*ywidth,.4,.2,1 write(ipost,99)'grestore' end if else if (thick_bound) then write(ipost,110) psxloc,psyloc,xpatch-const,ypatch-const, - locscale*xwidth,locscale*ywidth,.8,.2,0 else write(ipost,99)'gsave [4 2 1 2] 0 setdash' write(ipost,110) psxloc,psyloc,xpatch-const,ypatch-const, - locscale*xwidth,locscale*ywidth,.4,.2,0 write(ipost,99)'grestore' end if end if 110 format(2f10.4,2i4,4f10.4,i3,' grid') c print the time and third coordinate information write(ipost,99) if (time_val(1:1).ne.'~') then write(ipost,*)psxloc-locscale*xwidth*real(xpatch-const)/2.0-.1, - ' inch ',psyloc-locscale*ywidth*real(ypatch-const)/ - 2.0,' inch 12 add moveto' pulse = 15 call strlen(time_val,pulse) write(ipost,99)'(t = '//time_val(1:pulse)//') dup '// x 'stringwidth pop -1 mul 0 rmoveto show' end if if ((cut_val(1:1).ne.'~').and.(iplane.ge.1).and.(iplane.le.3)) x then if (iplane.eq.1) trash='z = ' if (iplane.eq.2) trash='x = ' if (iplane.eq.3) trash='y = ' write(ipost,*)psxloc-locscale*xwidth*real(xpatch-const)/2.-.1, - ' inch ',psyloc-locscale*ywidth*real(ypatch-const)/ - 2.0,' inch moveto' pulse = 15 call strlen(cut_val,pulse) write(ipost,99) '('//trash(1:4)//cut_val(1:pulse)//') dup '// - 'stringwidth pop -1 mul 0 rmoveto show' end if c print the axis. if ((iplane.ge.1).and.(iplane.le.3)) then write(ipost,99) pulse = 0 if (third_comp) pulse = 1 write(ipost,*)psxloc-locscale*xwidth*real(xpatch-const)/2.0-.5, - ' inch ',psyloc-locscale*ywidth*real(ypatch-const) - /2.0+.4,' inch ',iplane,pulse,' draw_axis' end if c print the titles write(ipost,99)'gsave' pulse = 80 call strlen(title1,pulse) if ((pulse.gt.1).or.(title1(1:pulse).ne.' ')) then write(ipost,99)' /Helvetica findfont 16 scalefont setfont' write(ipost,*)' ', psxloc,' inch',psyloc+locscale*ywidth* - real(ypatch-const)/2.0,' inch 30 add moveto' write(ipost,99)' ('//title1(1:pulse)//')' write(ipost,99)' dup stringwidth pop -.5 mul 0 rmoveto show' end if pulse = 80 call strlen(title2,pulse) if ((pulse.gt.1).or.(title2(1:pulse).ne.' ')) then write(ipost,99)' /Helvetica findfont 14 scalefont setfont' write(ipost,*)' ', psxloc,' inch',psyloc+locscale*ywidth* - real(ypatch-const)/2.0,' inch 10 add moveto' write(ipost,99)' ('//title2(1:pulse)//')' write(ipost,99)' dup stringwidth pop -.5 mul 0 rmoveto show' end if write(ipost,99)'grestore' if(last_call) then write(ipost,99) write(ipost,99)'showpage' if (glob_scale) then print *, '--- Please Wait, Synchronizing '//postfile min_e_scale = 1.e+30 min_h_scale = 1.e+30 rewind(unit=ipost) open (unit=iscratch,status='SCRATCH') c begin infinite loop 22 read(ipost,99,end=999) trash pulse = 80 call strlen(trash,pulse) write(iscratch,99) trash(1:pulse) if (trash(1:3).eq.'%~~') then read (ipost,207) trash,pulse,trash,trash,dummy1 207 format(a23,i8,a7,a21,e9.4) if ((trash(1:8).eq.'Magnetic').and. x (dummy1.lt.min_h_scale)) then min_h_scale = dummy1 end if if ((trash(1:8).eq.'Electric').and. x (dummy1.lt.min_e_scale)) then min_e_scale = dummy1 end if backspace(unit=ipost) read(ipost,99) trash pulse = 80 call strlen(trash,pulse) write(iscratch,99) trash(1:pulse) end if c end infintite loop goto 22 c transfer from the scratch file back to the postscript file 999 rewind(unit=iscratch) rewind(unit=ipost) cc begin infinite loop 23 read(iscratch,99,end=998) trash pulse = 80 call strlen(trash,pulse) write(ipost,99) trash(1:pulse) if (trash(1:3).eq.'%~~') then read (iscratch,207) trash,pulse,trash,trash,dummy1 if (trash(1:8).eq.'Magnetic') then dummy2 = min_h_scale / dummy1 units2 = 'A/m' else dummy2 = min_e_scale / dummy1 units2 = 'V/m' end if write(ipost,204) pulse,trash, dummy2 * dummy1 do 60 loop=1,pulse read(iscratch,240) bigx,bigy,dummy1,dummy3,trash write(ipost,100) bigx,bigy,dummy1*dummy2,dummy3 60 continue 240 format (4f8.2,a20) do 65 loop=1,2 read(iscratch,99) trash pulse = 80 call strlen(trash,pulse) write(ipost,99) trash(1:pulse) 65 continue read(iscratch,99) trash if (units2.eq.'A/m') then write(ipost,210) 1./ (min_h_scale * 2.54),units2 else write(ipost,210) 1./ (min_e_scale * 2.54),units2 end if end if goto 23 c end infinite loop 998 close(unit=iscratch) print *, 'Done Synchronizing '//postfile end if else write(ipost,220) pagenumber 220 format('% The current page number is',i7) end if close (unit=ipost) return end c---------------------------------------------- c Purpose of Subroutine: c find the length of a string c max length of string is given by the c parameter max. c---------------------------------------------- subroutine strlen(trash,num) implicit none integer num,max parameter(max=80) character*80 trash c num=max do while ((num.gt.1).and.(trash(num:num).eq.' ')) num = num - 1 end do return end