From 0d4f43d355de79178b1142e9735902cf641670b6 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 11 May 2009 00:27:49 +0000 Subject: Xfoil 6.97 --- plotlib/examples/Makefile | 151 ++++++++++++++++++++++++ plotlib/examples/Makefile.NT | 187 +++++++++++++++++++++++++++++ plotlib/examples/Readme-examples | 95 +++++++++++++++ plotlib/examples/cmap2.f | 222 +++++++++++++++++++++++++++++++++++ plotlib/examples/cmap3.f | 198 +++++++++++++++++++++++++++++++ plotlib/examples/colors.inc | 58 +++++++++ plotlib/examples/contest.f | 212 +++++++++++++++++++++++++++++++++ plotlib/examples/defmap.f | 133 +++++++++++++++++++++ plotlib/examples/gridtest.f | 108 +++++++++++++++++ plotlib/examples/masks.inc | 35 ++++++ plotlib/examples/spectrum.f | 143 ++++++++++++++++++++++ plotlib/examples/squares.f | 120 +++++++++++++++++++ plotlib/examples/squares2.f | 126 ++++++++++++++++++++ plotlib/examples/squaresdoublebuff.f | 140 ++++++++++++++++++++++ plotlib/examples/symbols.f | 124 +++++++++++++++++++ plotlib/examples/symbolsall.f | 148 +++++++++++++++++++++++ plotlib/examples/volts.f | 117 ++++++++++++++++++ plotlib/examples/volts_old.f | 112 ++++++++++++++++++ plotlib/examples/zoomtest.f | 123 +++++++++++++++++++ 19 files changed, 2552 insertions(+) create mode 100644 plotlib/examples/Makefile create mode 100644 plotlib/examples/Makefile.NT create mode 100644 plotlib/examples/Readme-examples create mode 100644 plotlib/examples/cmap2.f create mode 100644 plotlib/examples/cmap3.f create mode 100644 plotlib/examples/colors.inc create mode 100644 plotlib/examples/contest.f create mode 100644 plotlib/examples/defmap.f create mode 100644 plotlib/examples/gridtest.f create mode 100644 plotlib/examples/masks.inc create mode 100644 plotlib/examples/spectrum.f create mode 100644 plotlib/examples/squares.f create mode 100644 plotlib/examples/squares2.f create mode 100644 plotlib/examples/squaresdoublebuff.f create mode 100644 plotlib/examples/symbols.f create mode 100644 plotlib/examples/symbolsall.f create mode 100644 plotlib/examples/volts.f create mode 100644 plotlib/examples/volts_old.f create mode 100644 plotlib/examples/zoomtest.f (limited to 'plotlib/examples') diff --git a/plotlib/examples/Makefile b/plotlib/examples/Makefile new file mode 100644 index 0000000..8d37dda --- /dev/null +++ b/plotlib/examples/Makefile @@ -0,0 +1,151 @@ +#*********************************************************************** +# Module: Makefile (examples directory) +# +# Copyright (C) 1996 Harold Youngren, Mark Drela +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Report problems to: guppy@maine.com +# or drela@mit.edu +#*********************************************************************** + +######################################## +# makefile for Xplot11 library examples +######################################## + + +###================================================ +### This line includes your compiler/make options +### with definitions for compiler and flags + +include ../config.make + +###================================================ + +LIB = ../$(PLTLIB) + +#FC = ifort +#FFLAGS = -r8 + +PROGS = volts volts_old \ + symbols symbolsall \ + squares squaresdoublebuff \ + spectrum cmap2 cmap3 defmap \ + gridtest zoomtest contest + + +examples: $(PROGS) + + +test: $(PROGS) + +clean: + -/bin/rm *.o + -/bin/rm $(PROGS) + -/bin/rm plot*.ps + + + +#Test routines for package + +volts: volts.o + $(FC) -o volts volts.o $(LIB) $(LINKLIB) + +volts_old: volts_old.o + $(FC) -o volts_old volts_old.o $(LIB) $(LINKLIB) + +symbols: symbols.o + $(FC) -o symbols symbols.o $(LIB) $(LINKLIB) + +symbolsall: symbolsall.o + $(FC) -o symbolsall symbolsall.o $(LIB) $(LINKLIB) + +squares: squares.o + $(FC) -o squares squares.o $(LIB) $(LINKLIB) + +squaresdoublebuff: squaresdoublebuff.o + $(FC) -o squaresdoublebuff squaresdoublebuff.o $(LIB) $(LINKLIB) + +spectrum: spectrum.o + $(FC) -o spectrum spectrum.o $(LIB) $(LINKLIB) + +cmap2: cmap2.o + $(FC) -o cmap2 cmap2.o $(LIB) $(LINKLIB) + +cmap3: cmap3.o + $(FC) -o cmap3 cmap3.o $(LIB) $(LINKLIB) + +defmap: defmap.o + $(FC) -o defmap defmap.o $(LIB) $(LINKLIB) + +gridtest: gridtest.o + $(FC) -o gridtest gridtest.o $(LIB) $(LINKLIB) + +zoomtest: zoomtest.o + $(FC) -o zoomtest zoomtest.o $(LIB) $(LINKLIB) + +contest: contest.o + $(FC) -o contest contest.o $(LIB) $(LINKLIB) + + + +volts.o: volts.f + $(FC) -c $(FFLAGS) $< + +volts_old.o: volts_old.f + $(FC) -c $(FFLAGS) $< + +symbols.o: symbols.f + $(FC) -c $(FFLAGS) $< + +symbolsall.o: symbolsall.f + $(FC) -c $(FFLAGS) $< + +squares.o: squares.f + $(FC) -c $(FFLAGS) $< + +squaresdoublebuff.o: squaresdoublebuff.f + $(FC) -c $(FFLAGS) $< + +spectrum.o: spectrum.f + $(FC) -c $(FFLAGS) $< + +cmap2.o: cmap2.f + $(FC) -c $(FFLAGS) $< + +cmap3.o: cmap3.f + $(FC) -c $(FFLAGS) $< + +defmap.o: defmap.f + $(FC) -c $(FFLAGS) $< + +gridtest.o: gridtest.f + $(FC) -c $(FFLAGS) $< + +zoomtest.o: zoomtest.f + $(FC) -c $(FFLAGS) $< + +contest.o: contest.f + $(FC) -c $(FFLAGS) $< + +#May need to specify these on a brain-dead make system +#.f.o: $(FC) -c $(FFLAGS) $< +#.c.o: $(CC) -c $(CFLAGS) $< + + + + + + diff --git a/plotlib/examples/Makefile.NT b/plotlib/examples/Makefile.NT new file mode 100644 index 0000000..5647c43 --- /dev/null +++ b/plotlib/examples/Makefile.NT @@ -0,0 +1,187 @@ +#*********************************************************************** +# Module: Makefile (examples directory) +# +# Copyright (C) 1996 Harold Youngren, Mark Drela +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Report problems to: guppy@maine.com +# or drela@mit.edu +#*********************************************************************** + + + +######################################## +# makefile for Xplot11 library examples +######################################## + +PLTLIB = ..\libPlt.lib +#PLTLIB = ..\libPltDP.lib + +AR = lib + +#### Link libs +LINKLIB = gdi32.lib user32.lib + +###================================================ +### Compaq Visual Fortran compiler and flags, install commands +#FC = f77 +#CC = cl +### Defines for C interface +#DEFINE = -DUNDERSCORE -D_CVF +### Uncomment DP to make double-precision version +#DP = /realsize:64 +#FFLAGS = /Oxp $(DP) /threads +#CFLAGS = $(DEFINE) -MT +#LFLAGS = /libs:qwin /threads /LINK /NODEFAULTLIB:LIBC.LIB + +###================================================ +### Intel Fortran compiler and flags, install commands +FC = ifl.exe +LINK32 = xilink.exe +# +FC = ifl +CC = cl +### Defines for C interface +#DEFINE = -DUNDERSCORE +# Uncomment DP to make double-precision version +#DP = /4R8 +### use flags for processor optimization G5 G6 G7 for PII,PIII,P4 +FFLAGS = /O2 $(DP) /MT /4Yportlib -W0 +CFLAGS = $(DEFINE) -MT +LFLAGS = /MT /link /NODEFAULTLIB:LIBC.LIB + +###================================================ + + + +PROGS = symbols.exe symbolsall.exe \ + squares.exe squaresdoublebuff.exe \ + spectrum.exe cmap2.exe cmap3.exe defmap.exe \ + gridtest.exe zoomtest.exe contest.exe \ + volts.exe volts_old.exe + + +examples: $(PROGS) + + +test: $(PROGS) + +clean: + del *.obj + del $(PROGS) + del plot*.ps + + + +#Test routines for package + +volts.exe: volts.obj + $(FC) /Fevolts.exe volts.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +volts_old.exe: volts_old.obj + $(FC) /Fevolts_old.exe volts_old.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +symbols.exe: symbols.obj + $(FC) /Fesymbols.exe symbols.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +symbolsall.exe: symbolsall.obj + $(FC) /Fesymbolsall.exe symbolsall.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +squares.exe: squares.obj + $(FC) /Fesquares.exe squares.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +squares3.exe: squares3.obj + $(FC) squares3.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +squaresdoublebuff.exe: squaresdoublebuff.obj + $(FC) /Fesquaresdoublebuff.exe squaresdoublebuff.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +spectrum.exe: spectrum.obj + $(FC) /Fespectrum.exe spectrum.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +cmap2.exe: cmap2.obj + $(FC) /Fecmap2.exe cmap2.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +cmap3.exe: cmap3.obj + $(FC) /Fecmap3.exe cmap3.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +defmap.exe: defmap.obj + $(FC) /Fedefmap.exe defmap.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +gridtest.exe: gridtest.obj + $(FC) /Fegridtest.exe gridtest.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +zoomtest.exe: zoomtest.obj + $(FC) /Fezoomtest.exe zoomtest.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + +contest.exe: contest.obj + $(FC) /Fecontest.exe contest.obj $(PLTLIB) $(LINKLIB) $(LFLAGS) + + + +volts.obj: volts.f + $(FC) /c $(FFLAGS) volts.f + +volts_old.obj: volts_old.f + $(FC) /c $(FFLAGS) volts_old.f + +symbols.obj: symbols.f + $(FC) /c $(FFLAGS) symbols.f + +symbolsall.obj: symbolsall.f + $(FC) /c $(FFLAGS) symbolsall.f + +squares.obj: squares.f + $(FC) /c $(FFLAGS) squares.f + +squares3.obj: squares3.f + $(FC) /c $(FFLAGS) squares3.f + +squaresdoublebuff.obj: squaresdoublebuff.f + $(FC) /c $(FFLAGS) squaresdoublebuff.f + +spectrum.obj: spectrum.f + $(FC) /c $(FFLAGS) spectrum.f + +cmap2.obj: cmap2.f + $(FC) /c $(FFLAGS) cmap2.f + +cmap3.obj: cmap3.f + $(FC) /c $(FFLAGS) cmap3.f + +defmap.obj: defmap.f + $(FC) /c $(FFLAGS) defmap.f + +gridtest.obj: gridtest.f + $(FC) /c $(FFLAGS) gridtest.f + +zoomtest.obj: zoomtest.f + $(FC) /c $(FFLAGS) zoomtest.f + +contest.obj: contest.f + $(FC) /c $(FFLAGS) contest.f + +#May need to specify these on a brain-dead make system +#.f.obj: $(FC) /c $(FFLAGS) $< +#.c.obj: $(CC) /c $(CFLAGS) $< + + + + + + + + diff --git a/plotlib/examples/Readme-examples b/plotlib/examples/Readme-examples new file mode 100644 index 0000000..6d8276e --- /dev/null +++ b/plotlib/examples/Readme-examples @@ -0,0 +1,95 @@ +/*********************************************************************** + Module: Readme-examples + + Copyright (C) 1996 Harold Youngren, Mark Drela + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + Report problems to: guppy@maine.com + or drela@mit.edu +***********************************************************************/ + +Make the test programs under Unix by: + +change options in ../config.make to match your environment + % make + +Make the test programs under Windoze: + +You need Visual C and either the Compaq Visual Fortran compiler or the Intel +Fortran compiler. +compile and link with command in DOS window: + +C:\Xfoil\plotlib\examples: nmake /f Makefile.NT + + + + +Sample and test programs +------------------------- + +volts.f - demo program that draws a simple, labeled plot with axes. + +volts_old.f - demo program that draws a simple, labeled plot with axes. + (uses old "Versatec" plot calls) + +squares.f - draws a sine wave in colored boxes, has colored labels + +squaresdoublebuff.f - demo of double buffering, draws a sine wave in colored + boxes that cycle across the sine wave w/o flickering + +gridtest.f - tests the grid routines (obvious, aren't we...) + +symbols.f +symbolsall.f - display and test the vector fonts + +cmap2.f +cmap3.f - used for interactive viewing of RGB color components: + +zoomtest.f - test of zooming + +contest.f - test of contouring primitives for color, filled contours + +defmap.f - displays the default colormap produced by CALL COLORMAPDEFAULT + +spectrum.f - displays the "Spectrum" produced by + CALL COLORSPECTRUMHUES(ncols, RYGCBM_string) + in pie and bar form. + + Typical values for RYGCBM_string might be + 'RYG' + 'GYR' + 'MCY' + 'BMRY' + 'BCGYR', etc. + + Choosing strongly non-contiguous sequences like 'RCB' is OK, + but will make a horrid-looking Spectrum. + +sym/test.f - display current vector fonts + + + + + + + + + + + + + + diff --git a/plotlib/examples/cmap2.f b/plotlib/examples/cmap2.f new file mode 100644 index 0000000..c2ae015 --- /dev/null +++ b/plotlib/examples/cmap2.f @@ -0,0 +1,222 @@ +C*********************************************************************** +C Module: cmap.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + + + program cmap2 +c--------------------------------------------------------------- +c Color selection program. +c +c Displays a 2-D slice through the R-G-B color space, +c and gives the R,G,B components of a mouse-selected color. +c +c The cutting plane is parallel to the RG, RB, or GB plane. +c The position along the remaining B, G, or R axis is specified +c by the % saturation 0..100. +c +c--------------------------------------------------------------- +c + character*2 plane + character*1 axis, chkey +c + character*40 colorname +c + dimension x(5), y(5) + logical lok +c + ch = 0.03 +c + 1000 format(a) +c + 5 write(*,1050) + 1050 format(/' Enter cutting-plane orientation (RG, RB, or GB): ',$) + read (*,1000) plane +c + axis = ' ' + if(index('RGrg',plane(1:1)).NE.0 .AND. + & index('RGrg',plane(2:2)).NE.0 ) axis = 'B' + if(index('RBrb',plane(1:1)).NE.0 .AND. + & index('RBrb',plane(2:2)).NE.0 ) axis = 'G' + if(index('Gbgb',plane(1:1)).NE.0 .AND. + & index('Gbgb',plane(2:2)).NE.0 ) axis = 'R' +c +ccc if(index('RGB',axis).EQ.0) go to 5 + if(index('RGB',axis).EQ.0) then + call replot(4) + call plot(0.,0.,+999) + stop + endif +c +c + write(*,1100) axis + 1100 format( ' Enter % saturation along ',a1,' axis (0..100) : ', $) + read (*,*) isat +c + isat = max( 0,isat) + isat = min( 99,isat) +c + nc = 10 +c + sat = float(isat) / 100.0 +c +c +c---- R,G,B unit vectors for projection onto x-y cutting plane + xr = 0. + yr = 0. + zr = 0. +c + xg = 0. + yg = 0. + zg = 0. +c + xb = 0. + yb = 0. + zb = 0. +c + if(sat .lt. 0.50) then +c + if(index('R',axis).EQ.1) then + zr = 1.0 + xg = 1.0 + yb = 1.0 + endif +c + if(index('G',axis).EQ.1) then + yr = 1.0 + zg = 1.0 + xb = 1.0 + endif +c + if(index('B',axis).EQ.1) then + xr = 1.0 + yg = 1.0 + zb = 1.0 + endif +c + else +c + if(index('R',axis).EQ.1) then + zr = 1.0 + yg = 1.0 + xb = 1.0 + endif +c + if(index('G',axis).EQ.1) then + xr = 1.0 + zg = 1.0 + yb = 1.0 + endif +c + if(index('B',axis).EQ.1) then + yr = 1.0 + xg = 1.0 + zb = 1.0 + endif +c + endif +c +C +C---Initialize the plot package before we get into color plotting... + CALL PLINITIALIZE +c + call PLOPEN(0.8,0,1) + call PLOT(5.5, 4.25, -3) + call NEWFACTOR(6.0) + call PLOT(-0.5,-0.5,-3) +c +c call plopen(-0.8,0,5) +c call plot(0.5,0.5,-3) +c call newfactor(1.4) +c + xdel = 1.0/float(nc) + ydel = 1.0/float(nc) +c + do 10 j = 1, nc + y0 = ydel*float(j-1) +c + do 105 i = 1, nc + x0 = xdel*float(i-1) +c + xx = x0 + 0.5*xdel + yy = y0 + 0.5*ydel + zz = sat +c + r = xx*xr + yy*yr + zz*zr + g = xx*xg + yy*yg + zz*zg + b = xx*xb + yy*yb + zz*zb +c + ir = int(256.0*r) + ig = int(256.0*g) + ib = int(256.0*b) +c + x(1) = x0 + y(1) = y0 + x(2) = x0 + xdel + y(2) = y0 + x(3) = x0 + xdel + y(3) = y0 + ydel + x(4) = x0 + y(4) = y0 + ydel + x(5) = x0 + y(5) = y0 + n = 5 +c + call NEWCOLORRGB(ir,ig,ib) + call POLYLINE(x,y,n,1) +c + 105 continue + 10 continue +c + call PLFLUSH +c + write(*,*) + write(*,*) 'Click on colors...' +C + 200 call GETCURSORXY(xx,yy,chkey) + zz = sat +c + r = xx*xr + yy*yr + zz*zr + g = xx*xg + yy*yg + zz*zg + b = xx*xb + yy*yb + zz*zb +c + ir = int(256.0*r) + ig = int(256.0*g) + ib = int(256.0*b) +c + write(*,1500) ir, ig, ib + 1500 format(1x,'R G B = ', i4,',',i4,',',i4) +c + if( lok(ir,ig,ib) ) then + go to 200 + endif +c + go to 5 + end + + + + logical function lok(ir,ig,ib) + lok = ir.LE.255 .AND. ig.LE.255 .AND. ib.LE.255 .AND. + & ir.GE.0 .AND. ig.GE.0 .AND. ib.GE.0 + return + end + diff --git a/plotlib/examples/cmap3.f b/plotlib/examples/cmap3.f new file mode 100644 index 0000000..ce9939f --- /dev/null +++ b/plotlib/examples/cmap3.f @@ -0,0 +1,198 @@ +C*********************************************************************** +C Module: cmap3.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + + + program cmap3 +c--------------------------------------------------------------- +c Color selection program. +c +c Displays a 2-D slice through the R-G-B color space, +c and gives the R,G,B components of a mouse-selected color. +c +c The cutting plane is perpendicular to the diagonal +c axis running from R,G,B = 0,0,0 (black), to +c R,G,B = 1,1,1 (white). The position of this cutting +c plane is specified by the % saturation 0..300. +c The plane passes through one or three pure-color +c corners for the specific saturations shown. +c +c 0% (0 0 0) black +c 100% (1 0 0), (0 1 0), (0 0 1) red , green , blue +c 200% (1 1 0), (1 0 1), (0 1 1) yellow, magenta, cyan +c 300% (1 1 1) white +c +c For 0-100% and 200-300%, the cutting plane is a triangle. +c For 100-200%, the plane is a hexagon. +c +c--------------------------------------------------------------- +c + dimension x(4), y(4) + logical lok + character*1 chkey +c + ch = 0.03 + call PLINITIALIZE +c + 1 continue +c + write(*,1100) + 1100 format(/' Enter % saturation (0..300) : ', $) + read (*,*) isat +c + if(isat.eq.0) go to 500 +c + isat = max( 1,isat) + isat = min(299,isat) +c + nc1 = 10 +c + nc = nc1 + if(isat.gt.100) nc = (nc1*isat)/ 100 + if(isat.gt.200) nc = (nc1*200 )/(300-isat) + 1 +c + sat = float(isat) / 100.0 +c +c +c---- R,G,B unit vectors for projection onto x-y cutting plane + xr = -sat + yr = -sat/sqrt(3.0) +c + xg = 0.0 + yg = sat*2.0/sqrt(3.0) +c + xb = sat + yb = -sat/sqrt(3.0) +c + call COLORMAPDEFAULT +c + call PLOPEN(0.8,0,1) +c + call PLOT(5.5, 4.25, -3) + call NEWFACTOR(3.0) +c +c + area = sat * 2.0*sqrt(3.0) +c + xdel = sat* 2.0 /float(nc) + ydel = sat*sqrt(3.0)/float(nc) +c + do 10 j = 1, nc + y0 = yr + ydel*float(j-1) +c + do 105 i = 1, nc-j+1 + x0 = xr + xdel*(float(i-1) + 0.5*float(j-1)) +c + xx = x0 + 0.5*xdel + yy = y0 + ydel/3.0 +c + r = ((xg-xb)*(yy-yb) - (yg-yb)*(xx-xb))/area + g = ((xb-xr)*(yy-yr) - (yb-yr)*(xx-xr))/area + b = ((xr-xg)*(yy-yg) - (yr-yg)*(xx-xg))/area +c + ir = int(256.0*r) + ig = int(256.0*g) + ib = int(256.0*b) +c + if( lok(ir,ig,ib) ) then + x(1) = x0 + y(1) = y0 + x(2) = x0 + xdel + y(2) = y0 + x(3) = x0 + xdel*0.5 + y(3) = y0 + ydel + x(4) = x0 + y(4) = y0 + n = 4 +c + call NEWCOLORRGB(ir,ig,ib) + call POLYLINE(x,y,n,1) + endif +c +c + if(i.eq.nc-j+1) go to 105 + + xx = x0 + xdel + yy = y0 + 2.0*ydel/3.0 +c + r = ((xg-xb)*(yy-yb) - (yg-yb)*(xx-xb))/area + g = ((xb-xr)*(yy-yr) - (yb-yr)*(xx-xr))/area + b = ((xr-xg)*(yy-yg) - (yr-yg)*(xx-xg))/area +c + ir = int(256.0*r) + ig = int(256.0*g) + ib = int(256.0*b) +c + if( lok(ir,ig,ib) ) then + x(1) = x0 + xdel + y(1) = y0 + x(2) = x0 + xdel*1.5 + y(2) = y0 + ydel + x(3) = x0 + xdel*0.5 + y(3) = y0 + ydel + x(4) = x0 + xdel + y(4) = y0 + n = 4 +c + call NEWCOLORRGB(ir,ig,ib) + call POLYLINE(x,y,n,1) + endif +c + 105 continue + 10 continue +c + call PLFLUSH +c + write(*,*) 'Click on colors...' +C + 200 call GETCURSORXY(xx,yy,chkey) +c + r = ((xg-xb)*(yy-yb) - (yg-yb)*(xx-xb))/area + g = ((xb-xr)*(yy-yr) - (yb-yr)*(xx-xr))/area + b = ((xr-xg)*(yy-yg) - (yr-yg)*(xx-xg))/area +c + ir = int(256.0*r) + ig = int(256.0*g) + ib = int(256.0*b) +c + write(*,1500) ir, ig, ib + 1500 format(1x,'R G B = ', i4,',',i4,',',i4) +c + if( lok(ir,ig,ib) ) then + go to 200 + endif +c + go to 1 +c + 500 call PLOT(0.0,0.0,+999) + stop +C + end + + + + logical function lok(ir,ig,ib) + lok = ir.LE.255 .AND. ig.LE.255 .AND. ib.LE.255 .AND. + & ir.GE.0 .AND. ig.GE.0 .AND. ib.GE.0 + return + end + diff --git a/plotlib/examples/colors.inc b/plotlib/examples/colors.inc new file mode 100644 index 0000000..08d8657 --- /dev/null +++ b/plotlib/examples/colors.inc @@ -0,0 +1,58 @@ +C*********************************************************************** +C Module: colors.inc +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Library General Public +C License as published by the Free Software Foundation; either +C version 2 of the License, or (at your option) any later version. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Library General Public License for more details. +C +C You should have received a copy of the GNU Library General Public +C License along with this library; if not, write to the Free +C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** +C +C +C****************************************** +C Default color definitions for Xplot11 +C For use as arguments to NEWCOLOR, e.g. +C +C CALL NEWCOLOR(GREEN) +C +C +C Alternatively, can also use... +C +C CALL NEWCOLORNAME('GREEN') +C +C****************************************** +C + Integer BLACK, + & WHITE, + & RED, + & ORANGE, + & YELLOW, + & GREEN, + & CYAN, + & BLUE, + & VIOLET, + & MAGENTA +C + parameter (BLACK = 1) + parameter (WHITE = 2) + parameter (RED = 3) + parameter (ORANGE = 4) + parameter (YELLOW = 5) + parameter (GREEN = 6) + parameter (CYAN = 7) + parameter (BLUE = 8) + parameter (VIOLET = 9) + parameter (MAGENTA = 10) diff --git a/plotlib/examples/contest.f b/plotlib/examples/contest.f new file mode 100644 index 0000000..c4f2e33 --- /dev/null +++ b/plotlib/examples/contest.f @@ -0,0 +1,212 @@ +C*********************************************************************** +C Module: contest.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + + program contest +C +C--- Test of Xplot11 quadrilateral and triangle contour primitives +C + CHARACTER CHR*2, HUES*10 + DIMENSION X(4), Y(4), Z(4) + DIMENSION XTRI(3), YTRI(3), ZTRI(3) +C + DIMENSION XCU(50), YCU(50) + DIMENSION XCL(50), YCL(50) + DIMENSION XP(50), YP(50), NE(50) +C + DATA X / 0., 1., 1., 0. / + DATA Y / 0., 0., 1., 1. / + DATA Z / 0., 1., 0., 2. / +C + IDEV = 3 + nlevel = 50 + ncolors = 64 + WRITE(*,*) ' ' + WRITE(*,*) 'Contour primitives test:' + WRITE(*,*) ' (contour fills on single square polygon)' + WRITE(*,*) ' ' + WRITE(*,*) 'Data points...' + do i = 1, 4 + write(*,*) i,' x = ',X(i),' y = ',Y(i),' z = ',Z(i) + end do +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) CHR + ips = -1 + if(CHR.ne.' ') then + READ(CHR,*,end=2000,err=2000) ips + endif + IDEV = 1 + IF(ips.eq.0) IDEV = 3 + IF(ips.ge.1) IDEV = 5 + ipslu = 0 +C +C--- Get contour data + ZL = 0. + ZU = 2. + write(*,*) ' ' + write(*,*) 'Contour limits ',ZL,' to ',ZU + write(*,*) 'Enter # of contour levels' + read (*,*) nlevel +C + ipslu = 0 + CALL PLINITIALIZE + HUES = 'ROYGCBM' +C +C---Set up colormap spectrum colors + if(ncolors.LE.1) ncolors = 0 + CALL COLORSPECTRUMHUES(ncolors,HUES) +C + do ITYP = 1, 2 +C + CALL PLOPEN(0.5,ipslu,IDEV) + + call newcolorname('green') + CALL PLOTABS(.75,.75,-3) + CALL PLCHAR (999.,999.,.1,'Contour test ',0.,-1) + if(ITYP.NE.2) then + WRITE(*,*) 'Polygon contoured and filled as quadrilateral' + CALL PLCHAR (999.,999.,.1,'Quadrilateral',0.,-1) + else + WRITE(*,*) 'Polygon contoured and filled as two triangles' + CALL PLCHAR (999.,999.,.1,'Two Triangles',0.,-1) + endif + CALL PLOT(0.,-0.5,-3) + CALL PLCHAR (999.,999.,.1,'Nlevels = ',0.,-1) + CALL PLNUMB (999.,999.,.1,FLOAT(nlevel),0.,-1) + CALL PLCHAR (999.,999.,.1,' Ncolors = ',0.,-1) + CALL PLNUMB (999.,999.,.1,FLOAT(ncolors),0.,-1) + CALL PLOT(2.,2.,-3) + call factor(4.) +C +C--- Set contour levels and increments + NCONT = NLEVEL + 1 + DZ = (ZU-ZL)/FLOAT(NCONT) +C + DO N = 1, NCONT + ZUPR = FLOAT(N)*DZ + ZLWR = FLOAT(N-1)*DZ +C +C--- Set color based on contour # + ICOL = (NCOLORS-1)*FLOAT(N-1)/FLOAT(NCONT-1) + 1 + CALL NEWCOLOR(-ICOL) +C +C--- Reset the line and area counters for each level + NA = 0 + NV = 0 + NCU = 0 + NCL = 0 +C + if(ITYP.NE.2) then +C +C--- Contour a quadrilateral + CALL CONTQUAD(X,Y,Z,ZUPR,ZLWR, + & NCU,XCU,YCU, + & NCL,XCL,YCL, + & NA,NE,NV,XP,YP) +C + else +C +C--- Triangle contouring, use two triangles, split quad on 1-3 diagonal + xtri(1) = x(1) + ytri(1) = y(1) + ztri(1) = z(1) + xtri(2) = x(2) + ytri(2) = y(2) + ztri(2) = z(2) + xtri(3) = x(3) + ytri(3) = y(3) + ztri(3) = z(3) + CALL CONTTRI(xtri,ytri,ztri,ZUPR,ZLWR, + & NCU,XCU,YCU, + & NCL,XCL,YCL, + & NA,NE,NV,XP,YP) + xtri(1) = x(3) + ytri(1) = y(3) + ztri(1) = z(3) + xtri(2) = x(4) + ytri(2) = y(4) + ztri(2) = z(4) + xtri(3) = x(1) + ytri(3) = y(1) + ztri(3) = z(1) + CALL CONTTRI(xtri,ytri,ztri,ZUPR,ZLWR, + & NCU,XCU,YCU, + & NCL,XCL,YCL, + & NA,NE,NV,XP,YP) + endif +C +C +C--- Plot the filled contour polygons + nv = 1 + DO IA = 1, NA + call polyline(xp(nv),yp(nv),ne(ia),1) + nv = nv+ne(ia) + END DO +C +C--- Plot the contour lines (w/o color in this case). +C Otherwise you could leave out the polygon fills and comment out the +C color change to BLACK to get colored line contours. +C + call newcolorname('BLACK') +C--- All lower contour lines + do nn = 1, ncl,2 + call plot(xcl(nn),ycl(nn),3) + call plot(xcl(nn+1),ycl(nn+1),2) + end do +C--- And the last upper line + if(N.EQ.NCONT) then + do nn = 1, ncu,2 + call plot(xcu(nn),ycu(nn),3) + call plot(xcu(nn+1),ycu(nn+1),2) + end do + endif +C + END DO + CALL PLFLUSH +C + read(*,1000) chr + CALL PLOT(0.,0.,-999) +C + end do + CALL PLOT(0.,0.,+999) +C + 1000 FORMAT(A) +C + 2000 STOP + END + + + + + + + + + + + + + + diff --git a/plotlib/examples/defmap.f b/plotlib/examples/defmap.f new file mode 100644 index 0000000..1223f10 --- /dev/null +++ b/plotlib/examples/defmap.f @@ -0,0 +1,133 @@ +C*********************************************************************** +C Module: defmap.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + + + program defmap +C +C Displays Default colormap in a bar +C +C + dimension xp(100), yp(100), x(100), y(100) +C + character*24 colorname, inp*2 +C + CH = 0.125 +C + PI = 4.0*ATAN(1.0) +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) INP + ips = -1 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ips + endif + IDEV = 1 + IF(ips.eq.0) IDEV = 3 + IF(ips.ge.1) IDEV = 5 + ipslu = 0 +C +C---- for REPLOT: X11 only + IDEVRP = 1 + CALL PLINITIALIZE +C +C---Now, how many colors... + ncolors = 10 +C + CALL PLOPEN(0.7,ipslu,IDEV) + CALL PLOTABS(1.5,1.0,-3) +c + call GETCOLOR(ICOL0) +C +c---- plot bar + dx = 1.0 + dy = 5.0/float(ncolors) + do ii = 1,ncolors + call NEWCOLOR(ii) +c + x0 = 0.0 + y0 = dy*float(ii-1) +c + xp(1) = x0 + yp(1) = y0 + xp(2) = x0+dx + yp(2) = y0 + xp(3) = x0+dx + yp(3) = y0+dy + xp(4) = x0 + yp(4) = y0+dy + xp(5) = xp(1) + yp(5) = yp(1) + call POLYLINE(xp,yp,5,1) +C + call GETCOLORRGB(ii,ired,igrn,iblu,colorname) +C + xplt = xp(2) + 3.0*ch + yplt = 0.5*(yp(2)+yp(3)) - 0.5*ch + call plnumb(xplt,yplt,ch,float(ii),0.0,-1) +C + xplt = xplt + 6.0*ch + call plchar(xplt,yplt,ch,colorname,0.0,24) +C + xplt = xplt + 26.0*ch + call NEWCOLORRGB(255,0,0) + call plnumb(xplt,yplt,ch,float(ired),0.0,-1) +C + xplt = xplt + 4.0*ch + call NEWCOLORRGB(0,255,0) + call plnumb(xplt,yplt,ch,float(igrn),0.0,-1) +C + xplt = xplt + 4.0*ch + call NEWCOLORRGB(0,0,255) + call plnumb(xplt,yplt,ch,float(iblu),0.0,-1) +c + end do +C + call NEWCOLOR(ICOL0) + xplt = 0.0 + yplt = yplt + dy + 2.0*ch + call plchar(xplt,yplt,1.5*ch,'Default Colormap',0.0,16) +C + CALL PLFLUSH +C + WRITE(*,*) 'Hit return to end test' + READ(5,1000) DUMMY + 1000 FORMAT(A) +C +C GO TO 1 +C + 2000 CALL PLOT(0.0,0.0,+999) + STOP + END + + + + + + + + + + + diff --git a/plotlib/examples/gridtest.f b/plotlib/examples/gridtest.f new file mode 100644 index 0000000..a045896 --- /dev/null +++ b/plotlib/examples/gridtest.f @@ -0,0 +1,108 @@ +C*********************************************************************** +C Module: gridtest.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C Example/Test of grid routine +C Sets up two plots, each containing a grid with a label and symbol line +C First plot comes up as B&W in portrait window +C Second plot comes up as color in larger landscape window +C + INCLUDE 'colors.inc' + CHARACTER INP*10 + DATA LMASK1, LMASK2 / -32640, -30584 / + DATA LMASK3, LMASK4/ -21846, Z'AAAAAAAA'/ +C +C---- number of grid intervals per axis annotation interval + NGR = 2 +C + XMIN=.1 + YMIN=.1 + XMAX=.9 + YMAX=.6 + XDEL = 0.1 + YDEL = 0.1 + XSF = 1.0 + YSF = 1.0 + NXG = NGR * INT((XMAX-XMIN)/XDEL + 0.001) + NYG = NGR * INT((YMAX-YMIN)/YDEL + 0.001) + DXG = XSF*XDEL / FLOAT(NGR) + DYG = YSF*YDEL / FLOAT(NGR) +C + CH = 0.03 + SH = 0.2*CH +C +C---What devices to plot to? + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) INP + IOUT = -1 + if(INP.NE.' ') READ(INP,*,end=2000,err=2000) IOUT + 2 IF(IOUT.LT.0) IDEV = 1 + IF(IOUT.EQ.0) IDEV = 3 + IF(IOUT.GE.1) IDEV = 5 +C +C---plot #1 in B&W portrait mode 0.5 of screen height + CALL PLINITIALIZE + CALL PLOPEN(-0.5,0,IDEV) + CALL PLOT(0.1,0.1,-3) + CALL NEWPEN(1) + CALL NEWFACTOR(10.) + CALL PLCHAR(0.2,0.2,1.2*CH,'TEST FOR GRID',0.0,13) + CALL PLSYMB(999.,0.2,CH,1,0.0,0) + CALL PLSYMB(0.2,0.2,CH,1,0.0,-1) + CALL PLGRID(0.0,0.0, NXG,DXG, NYG,DYG, LMASK4) + CALL PLFLUSH + PAUSE + CALL PLOT(0.,0.,-999) +C +C---plot #2 in landscape mode 0.7 of screen width +C (green grid with red lettering with blue symbol line) + CALL PLOPEN(0.7,0,IDEV) + CALL PLOT(0.1,0.1,-3) + CALL NEWFACTOR(10.) + CALL NEWPEN(1) + NXG = NGR * INT((XMAX-XMIN)/XDEL + 0.001) + NYG = NGR * INT((YMAX-YMIN)/YDEL + 0.001) + DXG = XSF*XDEL / FLOAT(NGR) + DYG = YSF*YDEL / FLOAT(NGR) + + call NEWCOLORNAME('green') + CALL PLGRID(0.0,0.0, NXG,DXG, NYG,DYG, LMASK2) + + CALL NEWPEN(1) + CALL NEWCOLORRGB(255,0,0) + CALL PLCHAR(0.2,0.2,1.2*CH,'TEST FOR GRID',0.0,13) + call NEWCOLOR(BLUE) + call NEWPEN(1) + CALL PLSYMB(999.,0.2,CH,1,0.0,0) + CALL PLSYMB(0.2,0.2,CH,1,0.0,-1) + CALL PLFLUSH + PAUSE + CALL PLCLOSE +C + 1000 FORMAT(A) + 2000 STOP + END + + + + diff --git a/plotlib/examples/masks.inc b/plotlib/examples/masks.inc new file mode 100644 index 0000000..a8248f3 --- /dev/null +++ b/plotlib/examples/masks.inc @@ -0,0 +1,35 @@ +C*********************************************************************** +C Module: masks.inc +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Library General Public +C License as published by the Free Software Foundation; either +C version 2 of the License, or (at your option) any later version. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Library General Public License for more details. +C +C You should have received a copy of the GNU Library General Public +C License along with this library; if not, write to the Free +C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** +C +C +C---- dot-pattern masks for use with PLGRID, NEWPAT, etc. +C +C mask0: _________________________ (solid) +C 1: ......................... +C 2: . . . . . . . . . . . . . +C 3: . . . . . . . +C 4: . . . . +C + data mask0, mask1, mask2, mask3, mask4 + & / -1 , -21846, -30584, -32640, -32768 / + diff --git a/plotlib/examples/spectrum.f b/plotlib/examples/spectrum.f new file mode 100644 index 0000000..fadf1f5 --- /dev/null +++ b/plotlib/examples/spectrum.f @@ -0,0 +1,143 @@ +C*********************************************************************** +C Module: spectrum.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + + + program spectrum +C +C Displays chosen COLORSPECTRUMDEFAULT colors in a circle and bar +C +C + dimension xp(100), yp(100) +C + CHARACTER*12 HUES + CHARACTER*4 INP + CH = 0.02 +C + PI = 4.0*ATAN(1.0) +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) INP + ips = -1 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ips + endif + IDEV = 1 + IF(ips.eq.0) IDEV = 3 + IF(ips.ge.1) IDEV = 5 + ipslu = 0 +C +C---- for REPLOT: X11 only + IDEVRP = 1 + CALL PLINITIALIZE +C +C---Now, how many colors... + WRITE(*,*) ' Enter number of colors' + READ(*,1000,end=2000) INP + ncolors = 128 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ncolors + endif +C + WRITE(*,*) ' Specify hue string (out of ROYGCBM)' + READ (*,1000) HUES + IF(HUES.EQ.' ') HUES = 'ROYGCBM' +C +C---Set up colormap spectrum colors + if(ncolors.LE.1) ncolors = 0 + CALL COLORSPECTRUMHUES(ncolors,HUES) +C +C---- radius of circle + rad = 3.0 +c + CALL PLOPEN(0.7,ipslu,IDEV) + CALL PLOT(1.3*rad,1.3*rad,-3) +c +c---- plot circle + do ii = 1,ncolors + call NEWCOLOR(-ii) + t0 = float(ii-1)/float(ncolors) ! + 0.167 + t1 = float(ii )/float(ncolors) ! + 0.167 +C + xp(1) = 0.0 + yp(1) = 0.0 + xp(2) = rad*cos(2.0*pi*t0) + yp(2) = rad*sin(2.0*pi*t0) + xp(3) = rad*cos(2.0*pi*(t0+0.25*(t1-t0))) + yp(3) = rad*sin(2.0*pi*(t0+0.25*(t1-t0))) + xp(4) = rad*cos(2.0*pi*(t0+0.50*(t1-t0))) + yp(4) = rad*sin(2.0*pi*(t0+0.50*(t1-t0))) + xp(5) = rad*cos(2.0*pi*(t0+0.75*(t1-t0))) + yp(5) = rad*sin(2.0*pi*(t0+0.75*(t1-t0))) + xp(6) = rad*cos(2.0*pi*t1) + yp(6) = rad*sin(2.0*pi*t1) + call POLYLINE(xp,yp,6,1) + end do +C + CALL PLOT(1.5*rad,-rad,-3) +C +c---- plot bar + dx = 1.0 + dy = 2.0*rad/float(ncolors) + do ii = 1,ncolors + call NEWCOLOR(-ii) +c + x0 = 0.0 + y0 = dy*float(ii-1) +c + xp(1) = x0 + yp(1) = y0 + xp(2) = x0+dx + yp(2) = y0 + xp(3) = x0+dx + yp(3) = y0+dy + xp(4) = x0 + yp(4) = y0+dy + call POLYLINE(xp,yp,4,1) + end do +C + CALL NEWCOLORNAME('black') + CALL PLOTABS(1.,.75,-3) + CALL PLCHAR (999.,999.,.1,'SPECTRUM ',0.,+10) + CALL PLCHAR (999.,999.,.1,HUES,0.,LEN(HUES)) + CALL PLOTABS(1.,0.5,-3) + CALL PLCHAR (999.,999.,.1,'Ncolors = ',0.,+10) + CALL PLNUMB (999.,999.,.1,FLOAT(ncolors),0.,-1) +C + CALL PLFLUSH + WRITE(*,*) 'Hit return to test replot' + READ(5,1000) DUMMY +C + CALL REPLOT(IDEVRP) + CALL PLFLUSH +C + WRITE(*,*) 'Hit return to end test' + READ(5,1000) DUMMY + 1000 FORMAT(A) +C +C GO TO 1 +C + 2000 CALL PLOT(0.0,0.0,+999) + STOP + END diff --git a/plotlib/examples/squares.f b/plotlib/examples/squares.f new file mode 100644 index 0000000..5cce511 --- /dev/null +++ b/plotlib/examples/squares.f @@ -0,0 +1,120 @@ +C*********************************************************************** +C Module: squares.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C---Test of filled polyline plotting +C Displays a sine wave of filled color rectangles + dimension xp(100), yp(100), x(100), y(100) +C + CHARACTER*4 INP + CH = 0.02 +C + x(1) = 0. + y(1) = 0. + x(2) = 0.5 + y(2) = 0. + x(3) = 0.5 + y(3) = 0.3 + x(4) = 0. + y(4) = 0.3 + x(5) = x(1) + y(5) = y(1) + n = 5 +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + WRITE(*,*) 'SQUARES Plot test' + WRITE(*,*) ' You may just for each question to take defaults' + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) INP + ips = -1 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ips + endif + IDEV = 1 + IF(ips.eq.0) IDEV = 3 + IF(ips.ge.1) IDEV = 5 + ipslu = 0 +C +C---- for REPLOT: X11 only + IDEVRP = 1 +C +C + CALL PLINITIALIZE +C +C---Now, how many colors... + WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)' + READ(*,1000,end=2000) INP + ncolors = 64 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ncolors + endif +C---Set up colormap spectrum colors + if(ncolors.LE.1) ncolors = 0 + CALL COLORSPECTRUMHUES(ncolors,'MBCGYR') +C +C + CALL PLOPEN(0.7,ipslu,IDEV) +C + CALL PLOT(0.5,0.5,-3) + do ii = 1,ncolors + call NEWCOLOR(-ii) + f = float(ii-1)/float(ncolors-1) + xx = 9.0*f + yy = 3.0*sin(2.0*3.1416*f) + do i = 1, n + xp(i) = x(i) + xx + yp(i) = 4.0 + y(i) + yy + end do + call POLYLINE(xp,yp,n,1) + end do +C + CALL NEWCOLORNAME('green') + CALL PLCHAR(0.,0.,10.*CH,'Test ',0.0,5) + CALL NEWCOLORRGB(0,0,255) + CALL PLCHAR(999.,999.,10.*CH,'of ',0.0,3) + CALL NEWCOLORNAME('yellow') + CALL PLCHAR(999.,999.,10.*CH,'Color ',0.0,6) + CALL NEWCOLORNAME('red') + CALL PLCHAR(999.,999.,10.*CH,'Fill',0.0,4) +C + CALL PLFLUSH +C + WRITE(*,*) 'Hit return to test replot' + READ(5,1000) DUMMY + CALL REPLOT(IDEVRP) + CALL PLFLUSH +C + WRITE(*,*) 'Hit return to end test' + READ(5,1000) DUMMY + 1000 FORMAT(A) +C + 2000 CALL PLCLOSE + STOP + END + + + + + + diff --git a/plotlib/examples/squares2.f b/plotlib/examples/squares2.f new file mode 100644 index 0000000..8345c4f --- /dev/null +++ b/plotlib/examples/squares2.f @@ -0,0 +1,126 @@ +C*********************************************************************** +C Module: squares.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C---Test of filled polyline plotting +C Displays a sine wave of filled color rectangles + dimension xp(100), yp(100), x(100), y(100) +C + CHARACTER*4 INP + CH = 0.02 +C + x(1) = 0. + y(1) = 0. + x(2) = 0.5 + y(2) = 0. + x(3) = 0.5 + y(3) = 0.3 + x(4) = 0. + y(4) = 0.3 + x(5) = x(1) + y(5) = y(1) + n = 5 +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + WRITE(*,*) 'SQUARES Plot test' + WRITE(*,*) ' You may just for each question to take defaults' + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) INP + ips = -1 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ips + endif + IDEV = 1 + IF(ips.eq.0) IDEV = 3 + IF(ips.ge.1) IDEV = 5 + ipslu = 0 +C +C---- for REPLOT: X11 only + IDEVRP = 1 +C +C + CALL PLINITIALIZE +C +C---Now, how many colors... + WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)' + READ(*,1000,end=2000) INP + ncolors = 64 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ncolors + endif +C---Set up colormap spectrum colors + if(ncolors.LE.1) ncolors = 0 + CALL COLORSPECTRUMHUES(ncolors,'MBCGYR') +C + DO III = -1,1,2 +C + CALL PLOPEN(float(III)*0.7,ipslu,IDEV) +C + CALL PLOT(0.5,0.5,-3) + do ii = 1,ncolors + call NEWCOLOR(-ii) + f = float(ii-1)/float(ncolors-1) + xx = 9.0*f + yy = 3.0*sin(2.0*3.1416*f) + do i = 1, n + xp(i) = x(i) + xx + yp(i) = 4.0 + y(i) + yy + end do + call POLYLINE(xp,yp,n,1) + end do +C + CALL NEWCOLORNAME('green') + CALL PLCHAR(0.,0.,10.*CH,'Test ',0.0,5) + CALL NEWCOLORRGB(0,0,255) + CALL PLCHAR(999.,999.,10.*CH,'of ',0.0,3) + CALL NEWCOLORNAME('yellow') + CALL PLCHAR(999.,999.,10.*CH,'Color ',0.0,6) + CALL NEWCOLORNAME('red') + CALL PLCHAR(999.,999.,10.*CH,'Fill',0.0,4) +C + CALL PLFLUSH +C + WRITE(*,*) 'Hit return to test replot' + READ(5,1000) DUMMY + END DO +C + WRITE(*,*) 'Hit return to end test' + READ(5,1000) DUMMY + 1000 FORMAT(A) +C + 2000 CALL PLCLOSE + STOP + END + + + + + + + + + + + + diff --git a/plotlib/examples/squaresdoublebuff.f b/plotlib/examples/squaresdoublebuff.f new file mode 100644 index 0000000..62d6d6a --- /dev/null +++ b/plotlib/examples/squaresdoublebuff.f @@ -0,0 +1,140 @@ +C*********************************************************************** +C Module: squares.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C---Test of filled polyline plotting +C Displays a sine wave of filled color rectangles + dimension xp(100), yp(100), x(100), y(100) +C + CHARACTER*4 INP, DUMMY + LOGICAL LDBUFF + CH = 0.02 +C + x(1) = 0. + y(1) = 0. + x(2) = 0.5 + y(2) = 0. + x(3) = 0.5 + y(3) = 0.3 + x(4) = 0. + y(4) = 0.3 + x(5) = x(1) + y(5) = y(1) + n = 5 +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + WRITE(*,*) 'SQUARES Plot test' + WRITE(*,*) ' You may just for each question to take defaults' + WRITE(*,*) ' ' + WRITE(*,*) ' Double buffer? (Y/n)' + READ(*,1000,end=2000) INP + LDBUFF = .NOT.(INP.EQ.'n' .OR. INP.EQ.'N') +C + IDEV = 1 + ipslu = 0 + relsize = 0.7 +ccc relsize = -0.7 +C +C---- for REPLOT: X11 only + IDEVRP = 1 +C +C + CALL PLINITIALIZE +C +C---Now, how many colors... + WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)' + READ(*,1000,end=2000) INP + ncolors = 64 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ncolors + endif +C---Set up colormap spectrum colors + if(ncolors.LE.1) ncolors = 0 + CALL COLORSPECTRUMHUES(ncolors,'MBCGYR') +C +C---Cycle the colors twice through the sinewave + 10 DO IX = 1, 2*ncolors+1 +C + CALL PLOPEN(relsize,ipslu,IDEV) +C---Set up double buffering for plotting + IF(LDBUFF) THEN + CALL DRAWTOBUFFER + ENDIF +C + CALL PLOT(0.5,0.5,-3) + do ii = 1,ncolors + iix = mod(ii-1+ix-1,ncolors) + 1 +cc write(*,*) 'ii,ix,iix ',ii,ix,iix + call NEWCOLOR(-iix) + f = float(ii-1)/float(ncolors-1) + xx = 9.0*f + yy = 3.0*sin(2.0*3.1416*f) + do i = 1, n + xp(i) = x(i) + xx + yp(i) = 4.0 + y(i) + yy + end do + call POLYLINE(xp,yp,n,1) + end do +C + CALL NEWCOLORNAME('green') + CALL PLCHAR(0.,0.,10.*CH,'Test ',0.0,5) + CALL NEWCOLORRGB(0,0,255) + CALL PLCHAR(999.,999.,10.*CH,'of ',0.0,3) + CALL NEWCOLORNAME('yellow') + CALL PLCHAR(999.,999.,10.*CH,'Color ',0.0,6) + CALL NEWCOLORNAME('red') + CALL PLCHAR(999.,999.,10.*CH,'Fill',0.0,4) +C +C---Display the buffered plot +c IF(LDBUFF) THEN +c CALL SHOWBUFFER +c ELSE + CALL PLFLUSH +c ENDIF +C +C---Timing loop hack to slow things down +c DO I = 1, 1000000 +c XXX = sin(float(i)) +c END DO +C +C---Stop every frame as a check +ccc READ(5,1000) DUMMY +c + END DO +C +ccc relsize = -relsize +C + WRITE(*,*) 'Hit return to end test, R to recycle' + READ(5,1000) DUMMY + IF(DUMMY.EQ.'r' .OR. DUMMY.EQ.'R') GO TO 10 + 1000 FORMAT(A) +C + 2000 CALL PLCLOSE + STOP + END + + + + + + diff --git a/plotlib/examples/symbols.f b/plotlib/examples/symbols.f new file mode 100644 index 0000000..91f75c0 --- /dev/null +++ b/plotlib/examples/symbols.f @@ -0,0 +1,124 @@ +C*********************************************************************** +C Module: symbols.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C---Test routine for Pltlib +C Displays a symbol set in color +C + CHARACTER*4 INP + CH = 0.02 +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + WRITE(*,*) 'SYMBOLS Plot test' + WRITE(*,*) ' You may just for each question to take defaults' + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) INP + ihard = -1 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ihard + endif + IDEV = 1 + IF(ihard.eq.0) IDEV = 3 + IF(ihard.ge.1) IDEV = 5 + ipslu = 0 +C +C---Initialize the plot package before we get into color plotting... + CALL PLINITIALIZE +C +C---Now, how many colors... + WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)' + READ(*,1000,end=2000) INP + ncolors = 32 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ncolors + endif +C---Set up colormap spectrum colors + if(ncolors.LE.1) ncolors = 1 + CALL COLORSPECTRUMHUES(ncolors,'MBCGYR') +C +C---Take the default window (portrait, 2/3 screen dimension) + CALL PLOPEN(0.,ipslu,IDEV) +C + CALL NEWFACTOR(5.0) + CALL PLOT(0.10,0.1,-3) +ccc CALL NEWCOLORNAME('black') +C +C---Plot the symbols in 8 columns of 32 characters each (256 total) + DO ISET=1, 8 +C + I0 = (ISET-1)*32 + 1 + IN = I0 + 31 +C + DO I=I0, IN + RNUM = FLOAT(I-1) + XX = 0.2*FLOAT(ISET-1) + YY = (36.-FLOAT(I-I0))*2.0*CH +C + ICOLOR = MOD(I-1,NCOLORS) + 1 +C WRITE(*,*) 'ICOLOR,ISYM ',ICOLOR,I-1 +C---Select one of the colormap spectrum colors (repeat, modulo ncolors) + IF(ncolors.GT.1) CALL NEWCOLOR(-icolor) + CALL PLNUMB(XX,YY-0.5*CH,CH,RNUM,0.0,-1) + CALL PLCHAR(XX+4.0*CH,YY,CH,char(I-1),0.0,1) + END DO + END DO +C +C---Put colored title at bottom of plot + CALL NEWCOLORNAME('blue') + CALL PLCHAR(0.,0.,2.*CH,'Xplot11 ',0.0,8) + CALL NEWCOLORNAME('green') + CALL PLCHAR(999.,999.,2.*CH,'PLCHAR ',0.0,7) + CALL NEWCOLORNAME('red') + CALL PLCHAR(999.,999.,2.*CH,'test',0.0,4) +C + CALL PLFLUSH + WRITE(*,*) 'Hit return to end test' + READ(5,1000) INP + 1000 FORMAT(A) +C + CALL PLEND +C GO TO 1 +C + 2000 CALL PLCLOSE + STOP + END + + + + + + + + + + + + + + + + + + + diff --git a/plotlib/examples/symbolsall.f b/plotlib/examples/symbolsall.f new file mode 100644 index 0000000..c220ba5 --- /dev/null +++ b/plotlib/examples/symbolsall.f @@ -0,0 +1,148 @@ +C*********************************************************************** +C Module: symbolsall.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C---Test routine for Pltlib +C Displays a symbol set in color +C + CHARACTER*4 INP, FNAME*80 + CH = 0.02 +C +C---Decide about what devices to plot to + WRITE(*,*) ' ' + WRITE(*,*) 'Font plot test' + WRITE(*,*) ' You may just for each question to take defaults' + WRITE(*,*) ' ' + 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS' + READ(*,1000,end=2000) INP + itype = -1 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) itype + endif + IDEV = 1 + IF(itype.eq.0) IDEV = 3 + IF(itype.ge.1) IDEV = 5 +C + WRITE(*,*) ' ' + WRITE(*,*) ' Enter 0 for default PSfile' + WRITE(*,*) ' #>0 for external PSfile on unit #' + WRITE(*,*) ' Enter -1 for separate PSfiles' + READ(*,1000,end=2000) INP + iunit = 0 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) iunit + endif + if(iunit.gt.0) then + WRITE(*,*) 'Enter file name for PSFILE' + READ(*,1000,end=2000) FNAME + OPEN(unit=iunit,file=FNAME,status='UNKNOWN') + endif +C +C---Initialize the plot package before we get into color plotting... + CALL PLINITIALIZE +C +C---Now, how many colors... + WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)' + READ(*,1000,end=2000) INP + ncolors = 32 + if(INP.ne.' ') then + READ(INP,*,end=2000,err=2000) ncolors + endif +C---Set up colormap spectrum colors + if(ncolors.LE.1) ncolors = 1 + CALL COLORSPECTRUMHUES(ncolors,'MBCGYR') +C +C---Loop through the four defined fonts and symbols + DO 1500 IFNT = 1, 4 +C +C---Take the default window (portrait, 2/3 screen dimension) + CALL PLOPEN(0.,iunit,IDEV) +C + CALL NEWFACTOR(5.0) + CALL PLOT(0.10,0.1,-3) +c CALL NEWCOLORNAME('black') +C +C---Plot the symbols in 8 columns of 32 characters each (256 total) + DO ISET=1, 8 +C + I0 = (ISET-1)*32 + 1 + IN = I0 + 31 +C + DO I=I0, IN + RNUM = FLOAT(I-1) + XX = 0.2*FLOAT(ISET-1) + YY = (36.-FLOAT(I-I0))*2.0*CH + ICOLOR = MOD(I-1,NCOLORS) + 1 +C WRITE(*,*) 'ICOLOR,ISYM ',ICOLOR,I-1 +C---Select one of the colormap spectrum colors (repeat, modulo ncolors) +c write(*,*) ncolors, icolor + IF(ncolors.GT.1) CALL NEWCOLOR(-icolor) + CALL PLNUMB(XX,YY-0.5*CH,CH,RNUM,0.0,-1) + IF(IFNT.EQ.1) CALL PLCHAR(XX+4.0*CH,YY,CH,char(I-1),0.0,1) + IF(IFNT.EQ.2) CALL PLSLAN(XX+4.0*CH,YY,CH,char(I-1),0.0,1) + IF(IFNT.EQ.3) CALL PLMATH(XX+4.0*CH,YY,CH,char(I-1),0.0,1) + IF(IFNT.EQ.4) CALL PLSYMB(XX+4.0*CH,YY,CH,(I-1),0.0,0) + END DO + END DO +C +C---Put colored title at bottom of plot + CALL NEWCOLORNAME('blue') + CALL PLCHAR(0.,0.,2.*CH,'Xplot11 ',0.0,8) + CALL NEWCOLORNAME('green') + IF(IFNT.EQ.1) CALL PLCHAR(999.,999.,2.*CH,'PLCHAR ',0.0,7) + IF(IFNT.EQ.2) CALL PLCHAR(999.,999.,2.*CH,'PLSLAN ',0.0,7) + IF(IFNT.EQ.3) CALL PLCHAR(999.,999.,2.*CH,'PLMATH ',0.0,7) + IF(IFNT.EQ.4) CALL PLCHAR(999.,999.,2.*CH,'PLSYMB ',0.0,7) + CALL NEWCOLORNAME('red') + CALL PLCHAR(999.,999.,2.*CH,'test',0.0,4) +C + CALL PLFLUSH + WRITE(*,*) 'Hit return to proceed...' + READ(5,1000) INP + 1000 FORMAT(A) +C + CALL PLEND +C + 1500 CONTINUE +C + 2000 CALL PLCLOSE + STOP + END + + + + + + + + + + + + + + + + + + + diff --git a/plotlib/examples/volts.f b/plotlib/examples/volts.f new file mode 100644 index 0000000..7e8cb69 --- /dev/null +++ b/plotlib/examples/volts.f @@ -0,0 +1,117 @@ +C*********************************************************************** +C Module: volts.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C +C...VOLTS +C Test of Xplot11 interface +C +C + CHARACTER RDLINE*60 + DIMENSION X(26),Y(26) + DATA X/0.,5.,15.,25.,30.,35.,40.,45.,50.,55.,60.,65.,70.,75.,80., + 1 85.,90.,95.,100.,105.,110.,115.,120.,125.,2*0./ +C + DATA Y/0.,10.,15.,10.,-10.,-50.,-80.,-110.,-130.,-145.,-155., + 1 -160.,-158.,-150.,-130.,-90.,-70.,-20.,20.,50.,70.,80.,85., + 2 90.,2*0./ +C +C + 5 FORMAT(A) +C +C...Alter actual data scales + DO 10 I=1,24 + X(I) = X(I) * 1000 + 10 Y(I) = Y(I) / 10000 +C + IPD = 1 + RELSIZ = -0.6 +C +C...Select type(s) of plot output + WRITE(*,40) + 40 FORMAT('Input plot device (1 screen, 2 PShardcopy, 3 both): ',$) + READ(*,5,end=1000) RDLINE + IF(RDLINE.NE.' ') READ(RDLINE,*,err=42) IPD +C +C...Get plot window size as fraction of root window + 42 WRITE(*,45) + 45 FORMAT('Enter window relative size ( gives -0.6): ',$) + READ(*,5,end=1000) RDLINE + IF(RDLINE.NE.' ') READ(RDLINE,*,err=50) RELSIZ +C + 50 CALL PLINITIALIZE + ipslu = 0 + CALL PLOPEN(RELSIZ,ipslu,IPD) +C + CALL NEWFACTOR(0.9) + CALL PLOT(1.05,1.05,-3) +C +C...Scale factors from array coordinates + CALL SCALE(X,7.,24,+1) + CALL SCALE(Y,7.,24,+1) +C + IMASK = -1 + IMASK = -30584 +C...Test for line mask +c WRITE(*,*) 'Enter line pattern bit mask (integer)' +c READ(*,*,end=1000) IMASK + call NEWPAT(IMASK) +C +C...Plot the array of points + CALL NEWPEN (3) + CALL NEWCOLORNAME('red') + CALL LINE (X,Y,24,1,+1,0) + MSKALL = -1 + call NEWPAT(MSKALL) +C +C...Label the axes + CALL NEWPEN (2) + CALL NEWCOLORNAME('orchid') + CALL AXIS (0.,0.,'NANOSECONDS',-11,7.,0.,X(25),X(26)) + CALL NEWCOLORRGB(0,255,255) + CALL AXIS (0.,0.,'MILLIVOLTS',+10,7.,90.,Y(25),Y(26)) +C +C...Plot legend + CALL NEWPEN (1) + CALL NEWCOLORNAME('cadetblue') + CALL PLCHAR (.5,.5,.1,'DX = ',0.,+5) + CALL PLNUMB (999.,999.,.1,X(26),0.,+3) + CALL PLNUMB (1.,.75,.1,X(26),0.,0) + CALL PLNUMB (1.,1.,.1,X(26),0.,-1) + CALL PLNUMB (1.,1.25,.1,X(26),0.,-4) +C +C...Titles + CALL NEWCOLORNAME('lime green') + CALL PLCHAR (2.3,6.5,.1,'VERSAPLOT SAMPLE',0.,+16) + CALL PLCHAR (1.5,6.75,.2,'TIME VS VOLTAGE',0.,+15) + CALL NEWCOLORNAME('black') +C + CALL PLEND + write(*,*) 'Hit return to exit' + READ(*,999) +C + 999 FORMAT(A) +1000 CALL PLCLOSE + STOP + END + + diff --git a/plotlib/examples/volts_old.f b/plotlib/examples/volts_old.f new file mode 100644 index 0000000..c6207d9 --- /dev/null +++ b/plotlib/examples/volts_old.f @@ -0,0 +1,112 @@ +C*********************************************************************** +C Module: volts_old.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + +C VOLTS +C +C Old-style Versatec calls test routine +C + LOGICAL LODD + DIMENSION X(26),Y(26),RED(9),BLUE(9),GREEN(9),NCOL(2) + DATA X/0.,5.,15.,25.,30.,35.,40.,45.,50.,55.,60.,65.,70.,75.,80., + 1 85.,90.,95.,100.,105.,110.,115.,120.,125.,2*0./ +C + DATA Y/0.,10.,15.,10.,-10.,-50.,-80.,-110.,-130.,-145.,-155., + 1 -160.,-158.,-150.,-130.,-90.,-70.,-20.,20.,50.,70.,80.,85., + 2 90.,2*0./ + DATA NCOL/0,8/ + DATA RED /0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0/ + DATA BLUE /0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0/ + DATA GREEN/0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0/ +C +C +C...ALTER ACTUAL DATA SCALES + DO 10 I=1,24 + X(I) = X(I) * 1000 + 10 Y(I) = Y(I) / 10000 +C + IDUM = 0 + ICNT = 0 + IPD = 6 + 100 CALL PLOTS (IDUM,0,IPD) +C + LODD = (MOD(ICNT,2).EQ.1) + CALL FACTOR (.9) + IF(IPD .EQ. 6) THEN + DO 20 I=1,NCOL(2) + IF(.NOT.LODD) CALL SETCOL(I-1,RED(I),GREEN(I),BLUE(I)) + IF(LODD) CALL SETCOL(I-1,RED(9-I),GREEN(9-I),BLUE(9-I)) + 20 CONTINUE + ENDIF +C + CALL PLOT (1.05,1.05,-3) +C + CALL SCALE (X,7.,24,+1) + CALL SCALE (Y,7.,24,+1) +C + CALL COLOR(2) + CALL NEWPEN (2) +cc CALL LINE (X,Y,24,1,1,0) + CALL LINE (X,Y,24,1,1,0) + CALL NEWPEN (1) + CALL COLOR(0) +C + CALL AXIS (0.,0.,'NANOSECONDS',-11,7.,0.,X(25),X(26)) + CALL AXIS (0.,0.,'MILLIVOLTS',+10,7.,90.,Y(25),Y(26)) +C + CALL SYMBOL (.5,.5,.1,'DX = ',0.,+5) + CALL NUMBER (999.,999.,.1,X(26),0.,+3) + CALL NUMBER (1.,.75,.1,X(26),0.,0) + CALL NUMBER (1.,1.,.1,X(26),0.,-1) + CALL NUMBER (1.,1.25,.1,X(26),0.,-4) +C + CALL COLOR(4) + CALL SYMBOL (2.3,6.5,.1,'VERSAPLOT SAMPLE',0.,+16) + CALL SYMBOL (1.5,6.75,.2,'TIME VS VOLTAGE',0.,+15) + CALL COLOR(0) + CALL PLOTOF +C + ICNT = ICNT+1 + CALL PLOT (0.,0.,-999) + WRITE(*,*) ' to cycle colors' + READ(*,*) + if(ICNT.LE.2) go to 100 + + CALL PLOT (0.,0.,999) + STOP + END + + + + + + + + + + + + + + + + diff --git a/plotlib/examples/zoomtest.f b/plotlib/examples/zoomtest.f new file mode 100644 index 0000000..1def4c5 --- /dev/null +++ b/plotlib/examples/zoomtest.f @@ -0,0 +1,123 @@ +C*********************************************************************** +C Module: zoomtest.f +C +C Copyright (C) 1996 Harold Youngren, Mark Drela +C +C This program is free software; you can redistribute it and/or modify +C it under the terms of the GNU General Public License as published by +C the Free Software Foundation; either version 2 of the License, or +C (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program; if not, write to the Free Software +C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +C +C Report problems to: guppy@maine.com +C or drela@mit.edu +C*********************************************************************** + + + PROGRAM ZOOMTEST +C +C---- dot-pattern masks for use with PLGRID, NEWPAT, etc. +C +C mask0: _________________________ (solid) +C 1: ......................... +C 2: . . . . . . . . . . . . . +C 3: . . . . . . . +C 4: . . . . +C + CHARACTER LINE*80 + LOGICAL LXYSAME, LCURSOR + data mask0, mask1, mask2, mask3, mask4 + & / -1 , -21846, -30584, -32640, -32768 / + + +C + IDEV = 1 + IPSLU = 0 + SIZE = 0.8 +C + CH = 0.020 +C + CALL PLINITIALIZE + CALL PLOPEN(0.78,IPSLU,IDEV) + CALL DRAWTOBUFFER + CALL NEWFACTOR(SIZE) +C + CALL PLOTABS(1.00,1.00,-3) +C + call PLGRID(0.0,0.0,22,0.5,17,0.5,MASK2) + call PLGRID(0.0,0.0,11,1.0, 9,1.0,MASK1) + call PLGRID(0.0,0.0, 3,5.0, 2,5.0,MASK0) + call PLSLAN(0.1,0.1,0.2,'abcDEF123',0.0,9) + CALL NEWCOLORNAME('green') + call PLCHAR(1.1,1.1,0.2,'321GHIjkl',0.0,9) + CALL NEWCOLORNAME('red') + call PLSLAN(2.1,2.1,0.2,'mnoPQR123',0.0,9) + CALL NEWCOLORNAME('blue') + call PLCHAR(3.1,3.1,0.2,'321STUvwx',0.0,9) + CALL NEWCOLORNAME('black') +c + CALL PLFLUSH +c + write(*,*) ' ' + write(*,*) 'The zoom can be done with same X,Y scales' + write(*,*) 'Either mouse or keyboard can set the zoom rectangle' + write(*,*) 'Enter XYsame, MouseInput flags (T/F):' + LXYSAME = .TRUE. + LCURSOR = .TRUE. + read(*,1000) LINE + if(LINE.NE.' ') THEN + read(LINE,*,err=10) LXYSAME,LCURSOR + endif + 10 write(*,*) ' ' +C + do k=1, 3 + call USETZOOM( LXYSAME , LCURSOR ) + call REPLOT(1) + enddo + pause + call CLRZOOM + call REPLOT(1) + pause +c + CALL PLOT(0.0,0.0,+999) + 1000 FORMAT(A) +C + END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3