Skip to content

Latest commit

 

History

History

fs2d

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

fs2d-scl.diderot: function sampler, 2D scalar synthetic fields

This programs generates synthetic scalar 2D data on regular grids, and the grids have specific location and orientation in world space. The input arguments here make it easy to sample the same underlying function on grids with differing orientation, resolution, and shear. By using one strand per function evaluation, this is not an efficient use of Diderot, but it can be nice to have a controlled place to test the evaluation of Diderot expressions, especially since it prints out the NRRD header that contains all the orientation meta-data to locate the sampling grid in a world-space.

The -which option will determine which function is sampled; look for ("x" == which) below to see the start of the function definitions. This program is unusual in that its printed output needs to be captured in order to have a NRRD header that records the orientation of the sampling grid, so using the program involves redirection. To get a self-contained parab.nrrd containing a parabola function

./fs2d-scl -which parab | unu save -f nrrd -o parab.nrrd
rm out.nrrd

As noted in the comments, the NRRD header generated by this program assumes:

  1. This program was not compiled with --double
  2. The program is running on a little-endian machine.
  3. The program's -o option was not used to change the output filename.