Search:

Return to previous page

Contents of file 'poincare/Makefile':




Deprecated: Function split() is deprecated in /storage/content/45/2011745/jonsson.eu/public_html/php/htmlicise.php on line 46
    1   #
    2   # Makefile designed for use with gcc
    3   #
    4   # Copyright (C) 1996-2011, Fredrik Jonsson <http://jonsson.eu>
    5   #
    6   #------------------------------------------------------------------------------
    7   PROJECT = poincare
    8   
    9   #
   10   # C-specific declarations:
   11   #
   12   CC     = gcc
   13   CCOPTS = -O2 -Wall -pedantic -ansi -std=iso9899:1990
   14   LNOPTS = -lm
   15   AWK    = awk
   16   
   17   #
   18   # TeX-specific / document preparing declarations:
   19   #
   20   TEX       = tex
   21   DVIPS     = dvips
   22   DVIPSOPTS = -D1200 -E
   23   METAPOST  = mpost
   24   
   25   all: $(PROJECT) examples
   26   
   27   $(PROJECT): $(PROJECT).o
   28   	$(CC) $(CCOPTS) -o $(PROJECT) $(PROJECT).o $(LNOPTS)
   29   
   30   $(PROJECT).o: $(PROJECT).c
   31   	$(CC) $(CCOPTS) -c $(PROJECT).c
   32   
   33   examples:
   34   	make example-a
   35   	make example-b
   36   	make example-c
   37   	make example-d
   38   	make example-stoke
   39   
   40   #
   41   # example-a:
   42   #
   43   #    This is simply an example of a Poincare map of a spiraling helicoidal
   44   #    trajectory of Stokes parameters. The hidden parts of the trajectory
   45   #    is drawn as solid gray, and labels for the components of the Stokes
   46   #    vector (s_1(t),s_2(t),s_3(t)) are displayed at the corresponding axes.
   47   #
   48   example-a:
   49   	make poincare
   50   	@echo 1|$(AWK) 'BEGIN {n=440; pi=3.1415926535;}{\
   51   	printf("p\n");\
   52   	for (k=0;k<=n;k++) {\
   53   		t=k/n; phi=t*16*pi; theta=t*pi;\
   54   		x=cos(phi)*sin(theta); y=sin(phi)*sin(theta); z=cos(theta);\
   55   		printf("%-6.4f %-6.4f %-6.4f\n",x,y,z);\
   56   	}\
   57   	printf("q\n");\
   58   	}END{}' > example-a.dat
   59   	@./poincare --verbose --normalize \
   60   		--inputfile example-a.dat  --outputfile example-a.mp \
   61   		--axislengths 0.3 1.7 0.3 2.4 0.3 1.5 \
   62   		--axislabels  "s_1(t)" bot "s_2(t)" bot "s_3(t)" rt \
   63   		--rotatephi 15.3  --rotatepsi -60.0 --shading 0.75 0.99 \
   64   		--rhodivisor 50  --phidivisor 80  --scalefactor 20.0 \
   65   		--paththickness 0.8 --arrowthickness 0.4
   66   	@$(METAPOST) example-a.mp
   67   	@$(TEX) -jobname=example-a '\input epsf\nopagenumbers\
   68   		\centerline{\epsfxsize=155mm\epsfbox{example-a.1}}\bye'
   69   	@$(DVIPS) $(DVIPSOPTS) example-a -o example-a.eps
   70   
   71   #
   72   # example-b:
   73   #
   74   #    This example figure is similar to example-a, but with labels added on the
   75   #    beginning and end points of the trajectory (LCP and RCP, respectively).
   76   #    In addition, the appearance of hidden parts of the trajectory has been
   77   #    changed to dashed black.
   78   #
   79   example-b:
   80   	make poincare
   81   	@echo 1|$(AWK) 'BEGIN {n=440; pi=3.1415926535;}{\
   82   	printf("p b urgt \"LCP\"\n");\
   83   	for (k=0;k<=n;k++) {\
   84   		t=k/n; phi=t*16*pi; theta=t*pi;\
   85   		x=cos(phi)*sin(theta); y=sin(phi)*sin(theta); z=cos(theta);\
   86   		printf("%-6.4f %-6.4f %-6.4f\n",x,y,z);\
   87   	}\
   88   	printf("q e lrgt \"RCP\"\n");\
   89   	}END{}' > example-b.dat
   90   	@./poincare --verbose --normalize --draw_hidden_dashed \
   91   		--inputfile example-b.dat  --outputfile example-b.mp \
   92   		--axislengths 0.3 1.7 0.3 2.4 0.3 1.5 \
   93   		--axislabels  "s_1(t)" bot "s_2(t)" bot "s_3(t)" rt \
   94   		--rotatephi 15.0 --rotatepsi -60.0 --shading 0.75 0.99 \
   95   		--rhodivisor 50  --phidivisor 80  --scalefactor 20.0 \
   96   		--paththickness 0.8 --arrowthickness 0.4
   97   	@$(METAPOST) example-b.mp
   98   	@$(TEX) -jobname=example-b '\input epsf\nopagenumbers\
   99   		\centerline{\epsfxsize=155mm\epsfbox{example-b.1}}\bye'
  100   	@$(DVIPS) $(DVIPSOPTS) example-b -o example-b.eps
  101   
  102   #
  103   # example-c:
  104   #
  105   #    In this example figure, several trajectories are mapped onto the same
  106   #    sphere. This is something useful for illustrating, for example, wave
  107   #    propagation in isotropic media, in which case the form of the Stokes
  108   #    trajectory is invariant under rotation around the s_3-axis of the
  109   #    coordinate system (s_1,s_2,s_3).
  110   #
  111   example-c:
  112   	make example-c-data-solid
  113   	make example-c-data-chopped
  114   	make example-c-solid
  115   	make example-c-chopped
  116   	make example-c-chopped-reversed
  117   	make example-c-chopped-dash
  118   
  119   example-c-data-solid:
  120   	make poincare
  121   	echo 1|$(AWK) 'BEGIN {jj=10; kk=90; pi=3.1415926535; ta=0.1; tb=0.9;}{\
  122   	for (j=1;j<=jj;j++) {\
  123   	   phia=(j/jj)*2*pi;\
  124   	   printf("p\n");\
  125   	   for (k=1;k<=kk;k++) {\
  126   	      t=ta+(k/kk)*(tb-ta); phi=phia+t*1.2*pi; theta=t*pi;\
  127   	      x=cos(phi)*sin(theta); y=sin(phi)*sin(theta); z=-cos(theta);\
  128   	      printf("%-6.4f %-6.4f %-6.4f\n",x,y,z);\
  129   	   }\
  130   	   printf("q\n");\
  131   	}\
  132   	}END{}' > example-cs.dat
  133   
  134   example-c-data-chopped:
  135   	make poincare
  136   	@echo 1|$(AWK) 'BEGIN {jj=10; kk=90; mm=4; pi=3.1415926535; \
  137   		ta=0.1; tb=0.9;}{\
  138   	for (j=1;j<=jj;j++) {\
  139   	   phia=(j/jj)*2*pi;\
  140   	   dkk=kk/mm;\
  141   	   for (m=1;m<=mm;m++) {\
  142   	   printf("p\n");\
  143   	   for (k=1+(m-1)*dkk;k<=1+m*dkk;k++) {\
  144   	      t=ta+(k/kk)*(tb-ta); phi=phia+t*1.2*pi; theta=t*pi;\
  145   	      x=cos(phi)*sin(theta); y=sin(phi)*sin(theta); z=-cos(theta);\
  146   	      printf("%-6.4f %-6.4f %-6.4f\n",x,y,z);\
  147   	   }\
  148   	   printf("q\n");\
  149   	   }\
  150   	}\
  151   	}END{}' > example-cc.dat
  152   
  153   example-c-solid:
  154   	@./poincare --verbose --normalize --bezier \
  155   		--inputfile example-cs.dat  --outputfile example-cs.mp \
  156   		--axislengths 0.3 1.7 0.3 2.4 0.3 1.5 \
  157   		--axislabels  "s_1(t)" bot "s_2(t)" bot "s_3(t)" urt \
  158   		--rotatephi 15.0  --rotatepsi -60.0 --shading 0.75 0.99 \
  159   		--rhodivisor 50  --phidivisor 80  --scalefactor 20.0 \
  160   		--paththickness 0.8 --arrowthickness 0.4 \
  161   		--arrowheadangle 20.0 --draw_paths_as_arrows
  162   	$(METAPOST) example-cs.mp
  163   	$(TEX) -jobname=example-cs '\input epsf\nopagenumbers\
  164   		\centerline{\epsfxsize=155mm\epsfbox{example-cs.1}}\bye'
  165   	$(DVIPS) $(DVIPSOPTS) example-cs -o example-cs.eps
  166   
  167   example-c-chopped:
  168   	@./poincare --verbose --normalize --bezier \
  169   		--inputfile example-cc.dat  --outputfile example-cc.mp \
  170   		--axislengths 0.3 1.7 0.3 2.4 0.3 1.5 \
  171   		--axislabels  "s_1(t)" bot "s_2(t)" bot "s_3(t)" rt \
  172   		--rotatephi 15.0  --rotatepsi -60.0 --shading 0.75 0.99 \
  173   		--rhodivisor 50  --phidivisor 80  --scalefactor 20.0 \
  174   		--paththickness 0.8 --arrowthickness 0.4 \
  175   		--arrowheadangle 20.0 --draw_paths_as_arrows
  176   	$(METAPOST) example-cc.mp
  177   	$(TEX) -jobname=example-cc '\input epsf\nopagenumbers\
  178   		\centerline{\epsfxsize=155mm\epsfbox{example-cc.1}}\bye'
  179   	$(DVIPS) $(DVIPSOPTS) example-cc -o example-cc.eps
  180   
  181   example-c-chopped-reversed:
  182   	@./poincare --verbose --normalize --bezier \
  183   		--inputfile example-cc.dat  --outputfile example-ccr.mp \
  184   		--axislengths 0.3 1.7 0.3 2.4 0.3 1.5 \
  185   		--axislabels  "s_1(t)" bot "s_2(t)" bot "s_3(t)" rt \
  186   		--rotatephi 15.0  --rotatepsi -60.0 --shading 0.75 0.99 \
  187   		--rhodivisor 50  --phidivisor 80  --scalefactor 20.0 \
  188   		--paththickness 0.8 --arrowthickness 0.4 \
  189   		--arrowheadangle 20.0 --draw_paths_as_arrows \
  190   		--reverse_arrow_paths
  191   	$(METAPOST) example-ccr.mp
  192   	$(TEX) -jobname=example-ccr '\input epsf\nopagenumbers\
  193   		\centerline{\epsfxsize=155mm\epsfbox{example-ccr.1}}\bye'
  194   	$(DVIPS) $(DVIPSOPTS) example-ccr -o example-ccr.eps
  195   
  196   example-c-chopped-dash:
  197   	@./poincare --verbose --normalize --bezier --draw_hidden_dashed \
  198   		--inputfile example-cc.dat  --outputfile example-cd.mp \
  199   		--axislengths 0.3 1.7 0.3 2.4 0.3 1.5 \
  200   		--axislabels  "s_1(t)" bot "s_2(t)" bot "s_3(t)" rt \
  201   		--rotatephi 15.0  --rotatepsi -60.0 --shading 0.75 0.99 \
  202   		--rhodivisor 50  --phidivisor 80  --scalefactor 20.0 \
  203   		--paththickness 0.8 --arrowthickness 0.4 \
  204   		--arrowheadangle 20.0 --draw_paths_as_arrows
  205   	$(METAPOST) example-cd.mp
  206   	$(TEX) -jobname=example-cd '\input epsf\nopagenumbers\
  207   		\centerline{\epsfxsize=155mm\epsfbox{example-cd.1}}\bye'
  208   	$(DVIPS) $(DVIPSOPTS) example-cd -o example-cd.eps
  209   
  210   #
  211   # example-d:
  212   #
  213   #    This example illustrates a set of closed trajectories, each
  214   #    being constructed out of concatenated pieces so as to create
  215   #    a plurality of arrow heads in each cycle. This example also
  216   #    illustrates how additional indicatory arrows may be included
  217   #    in the map by using the '--arrow' option repeatedly.
  218   #
  219   example-d:
  220   	make example-d-data
  221   	make example-d-solid
  222   
  223   example-d-data:
  224   	make poincare
  225   	echo 1|$(AWK) 'BEGIN {jj=5; kk=90; pi=3.1415926535; ta=0.0; tb=1.0;}{\
  226   	for (j=1;j<jj;j++) {\
  227   	   phia=(j/jj)*pi;\
  228   	   printf("p b urgt \"$$\(\\vartheta=%1.1f\)$$\"\n",phia);\
  229   	   for (k=0;k<=kk;k++) {\
  230   	      t=ta+(k/kk)*(tb-ta);\
  231   	      phi=t*2*pi+pi/2; theta=(j/jj)*pi+(pi/17)*sin(phia)*cos(5*phi);\
  232   	      x=cos(phi)*sin(theta); y=sin(phi)*sin(theta); z=-cos(theta);\
  233   	      printf("%-6.4f %-6.4f %-6.4f\n",x,y,z);\
  234   	   }\
  235   	   printf("q\n");\
  236   	}\
  237   	}END{}' > example-d.dat
  238   
  239   example-d-solid:
  240   	@./poincare --verbose --normalize --bezier \
  241   		--inputfile example-d.dat  --outputfile example-d.mp \
  242   		--axislengths 0.3 1.7 0.3 2.4 0.3 1.5 \
  243   		--axislabels  "s_1(t)" bot "s_2(t)" bot "s_3(t)" rt \
  244   		--rotatephi 15.0  --rotatepsi -60.0 --shading 0.75 0.99 \
  245   		--rhodivisor 50  --phidivisor 80  --scalefactor 20.0 \
  246   		--paththickness 0.8 --arrowthickness 0.4 \
  247   		--arrowheadangle 30.0 --draw_paths_as_arrows \
  248   		--arrow 1.0 0.7 -0.58 1.0 0.7 0.15 0 0.9 \
  249   		--arrow 0.28 0.9 0.52 0.3 0.9 1.5 0 0.9
  250   	$(METAPOST) example-d.mp
  251   	$(TEX) -jobname=example-d '\input epsf\nopagenumbers\
  252   		\centerline{\epsfxsize=155mm\epsfbox{example-d.1}}\bye'
  253   	$(DVIPS) $(DVIPSOPTS) example-d -o example-d.eps
  254   
  255   #
  256   # example-stoke:
  257   #    The following example of an application of the poincare program is taken
  258   #    from my PhD thesis [1], and illustrates how to append MetaPost code to
  259   #    the generated Poincare map, in this case an illustration of the inter-
  260   #    pretation of various parts of the Poincare sphere in terms of the polari-
  261   #    zation states, illustrated as the paths the point of the electrical field
  262   #    vector describes as one looks into the oncoming wave.
  263   #       In this particular example, the MetaPost code in the file 'polstate.mp'
  264   #    contains all illustrations of the polarization state interpretation, and
  265   #    is appended via the 'input polstate.mp;' statement in the end of the
  266   #    generated file 'stoke.mp' (by using the --auxsource option when involing
  267   #    the poincare program from the command line), which serves as a master
  268   #    source file when compiling the figure.
  269   #
  270   # [1] Fredrik Jonsson, "The Magneto-Optics of Magneto-Optic Media" (The Royal
  271   #     Institute of Technology, Stockholm, 2000), ISBN 91-7170-575-9.
  272   #
  273   example-stoke:
  274   	make poincare
  275   	@./poincare --verbose --normalize \
  276   		--axislengths 0.3 1.6 0.3 2.7 0.3 1.5 \
  277   		--axislabels  "S_1" bot "S_2" bot "S_3" rt \
  278   		--rotatephi 15.0  --rotatepsi -70.0 \
  279   		--shading 0.75 0.99 \
  280   		--rhodivisor 50  --phidivisor 80  --scalefactor 25.0 \
  281   		--outputfile stoke.mp --auxsource polstate.mp
  282   	$(METAPOST) stoke.mp
  283   	$(TEX) -jobname=stoke '\input epsf\nopagenumbers\
  284   		\centerline{\epsfxsize=155mm\epsfbox{stoke.1}}\bye'
  285   	$(DVIPS) $(DVIPSOPTS) stoke -o stoke.eps
  286   
  287   clean:
  288   	-rm -f *~ *.aux *.bbl *.dvi *.log *.blg *.toc *.lof *.plt *.1 *.mpx \
  289   		*.o poincare poincare.exe *.dat *.eps stoke.mp example-*.*
  290   
  291   archive:
  292   	make -ik clean
  293   	tar --gzip --directory=../ -cf ../$(PROJECT).tar.gz $(PROJECT)
  294   

Return to previous page

Generated by ::viewsrc::

Last modified Thursday 23 Jan 2014