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:
- This program was not compiled with
--double
- The program is running on a little-endian machine.
- The program's
-o
option was not used to change the output filename.