Table of Contents


snapsort - sort particles of an N-body snapshot


snapsort in=in_file out=out_file [parameter=value] ...


snapsort sorts the bodies of a snapshot by a user-specified ranking. Optionally, a different sort engine can be invoked.


The following parameters are recognized.
Input data is read from in_file, which must be in snapshot(5NEMO) format. Default: required.
Sorted output data is written to out_file. No default.
Expression used to compute the rank of each body. See bodytrans(1NEMO) for the form of body_rank. Default: etot.
Only frames within time_range will be sorted. Default: all.
Select the sort engine to use. Sorry, no minimum match here. If the code has been compiled with standard the flogger software (see $NEMO/usr/lib/sort), a number of sort engines are available (see below). Else, only the standard qsort(3) is available. Default: [qsort].

Sort Engines

The default UNIX engine qsort (a quick sort) is always available. If your friendly NEMO manager has compiled in a number of additional ones, the following list may be a complete one: (to get your current local list, run snapsort with debug=1, which will display the names it’s trying. Use some foolish name for sort= to get it to display all of them, and then fail.
  sort=    comments
  qsort           Standard UNIX sqort(3)
  bubble          any 1st semester course in CS
  heap         contributed by der Mouse
  insert     insertion sort, any 1st semester course in CS
  merge         roughly patterned after Knuth Vol. 3
  quick           C.A.R. Hoare’s recursive sort as given in K&R 2 pg 87
  shell           D.L. Shell as given in K&R 2 pg 62

See Also

snapshot(5NEMO) , qsort(3)



Joshua E. Barnes.


~src/nbody/trans/snapsort.c    program code ~usr/lib/sort/*_sort.c    additional sort routines;


2-jun-88    V1.0 original version          JEB
21-dec-92    V1.4 selectable sort engine (sort=)    PJT

Table of Contents