Rolling Your Own Data Files

	Write a C or Fortran program that calculates a vector field of your choice, and have it output a title line (your choice) of less than 80 characters.   This line will appear in the Title Bar below the vector field grid and plot.  Then have the program output a set of lines with five data fields (x, y, u, v, c), four numbers and a character  c.  Here, x and y are a grid point and u and v are the x- and y-components of the vector field at that point.  Currently available choices for the control character c are 'b', 'r', 'g', or 'q'.

	In C, these data are output following the format

  FILE *fp;
  fp = fopen("myOutput.data","w");
  fprintf(fp,"This is my first title line\n");
  ... /* probably a loop here */
  fprintf(filep, "%12.7f%12.7f%12.7f%12.7f%c\n",
          x, y, u, v, c);
  ... /* end of loop */
  fclose(fp);
   
Note that  the character c is printed (without space) right after the data for v.  The actual grid points and their associated (green) vectors use the 'g' character.  The 'b' and 'r' choices allow you to plot blue and red dots (as in the dipole electric field example) to show positions of auxiliary objects or structures.  The data block (for the current plot) ends a line having c = 'q', such as

   0.0000000   0.0000000   0.0000000   0.0000000q

	This is then followed by a new block of data, if desired, for the next plot (initiated by the Next Plot button).  This also starts with a title line, followed by various lines of (x, y, u, v, c) data, and ends with its own c = 'q' line, as above.  

	Perhaps the easiest way to follow this description of a data file is to look at an example, dipoleElectricField.data, provided with this distribution.

	Similarly, in Fortran, the print and format statements would take the form

      open(unit=11,name="myOutput.data","w")
      write (11, 500)
  500 format('This is my first title line')      
      ...
      write (11, 505) x, y, u, v, c
  505 format(4f12.7,a1)
      ...
      close(unit=11)

	Have fun!

		Dick Silbar
		silbar@cantina.lanl.gov