This HTML automatically generated with rman for NEMO
Table of Contents

Name

bodytrans - test and optionally save body to scalar mapping

Synopsis

bodytrans expr=expression [parameter=value] ...

Description

bodytrans is a testbed for saving/debugging a user-specified mapping from a body(3NEMO) to a real or integer value. These mappings are given by an arbitrary C expression involving any of the variables m, x, y, z, vx, vy, vz, phi, ax, ay, az, aux, key, t, and i, using various math library functions, e.g. cbrt(), sqrt(), qbe(), sqr(), sin(), cos(), asin(), acos(), tan(), atan(), atan2(), exp(), dex(), log(), log10(), pow(), fabs(), floor(), ceil(), and rint(). (assuming 3 dimensional body’s, see ENVIRONMENT below).

Given such an expression, bodytrans invokes the C compiler, which is general but can be rather slow. To speed things up, an expression is first treated as a name and checked against a collection of precompiled expressions stored as ".o" (see a.out(5) )files. If the expression is a real/int expression, it will search for an object file btr_expr.o, bti_expr.o resp. If a match is found, the precompiled object is used instead. If bodytrans has been compiled with auto-saving object files a next search will be performed on the $NEMOOBJ/bodytrans/BTNAMES database. This contains a list of expressions and names of their object files, these object files were previously generated by any program which used the bodytrans(3NEMO) routines.

A number of precompiled transformations already exist, e.g.: x, y, z, vx, vy, vz, r, v, vr, vt, jtot, phi, etot, t, and i. A complete list may be deduced by looking in $NEMOOBJ/bodytrans/, which is the default repository. It is possible to customize your own transformations and collections; see $NEMO/src/nbody/core/bodysub/ for model routines.

If bodytrans has been compiled with auto-saving (the default), the object file will be saved in the standard repository directory $NEMOOBJ/bodytrans, and the corresponding database file-list BTNAMES will be updated. When using the same expression expr at a later time not only can the user then refer to the expression by it’s original expression, but also by its pseudo-name file (see keyword file and examples below).

For an alternative approach to use dynamic analysis routines, see mkbodyfunc(1falcON) and mkbodiesfunc(1falcON) .

Parameters

The following parameters are recognized.
expr=expression
Scalar-valued C-language expression specifying the transformation to test. If keyword file is present (see below) a mapping file of the name btX_file is tried before the expression is turned into a mapping file. Default: x.
type=type_name
Type of value returned; currently either real or int. Default: real.
mass=body_mass
Mass of body used to test mapping. Default: 0.125.
pos=position_vector
Position of body, specified by a comma-separated list of components. Default: 0.5,-0.5,1.0.
vel=velocity_vector
Velocity of body. Default: 0.1,0.2,-0.3.
phi=potential_value
Gravitational potential at position of body. Default: -1.2.
acc=acceleration_vector
Acceleration of body. Default: -0.5,0.7,0.1.
aux=auxiliary_value
Real auxiliary value associated with body. Default: 3.141592.
key=key_value
Integer key value associated with body. Default: 3.
t=time_value
Time value available to expression. Default: 2.5.
i=index_value
Body index available to expression. Default: 1.
alias=file_name
Tail of the filename under which the expr transformation is to be saved for later recovery. Note that the first four characters of the filename are already fixed and will be btX_, where X is either r or i, depending on the type (see above) of the expression. The full filename will hence be btX_file. [default: not used].
btnames=file_name
File containing a database of expression and filenames under which they are to be saved. When used, the program (re) creates all bodytrans(5) files and exits. [default: no used].
show=t|f
Show the currently saved bodytrans functions (from the BTNAMES files). [Default: f].

Example

The following command
    % bodytrans expr=x+y+z alias=sum
saves the mapping in an object file btr_sum.o, and can be later used as in:
    % snapprint snap-file x+y+z
or using this alias
    % snapprint snap-file sum
It is not necessary to provide a pseudonym using the keyword alias, although recommended if bodytrans is used. As an example, the command
    % bodytrans expr=x+y+z
could save the mapping in an object file btr__24, and can later be referred to as
    % snapprint snap-file x+y+z
or the more cryptic
    % snapprint snap-file _24
The relationship between _24 and x+y+z is saved in the file BTNAMES and resolved at run-time.

BTclean

There is a shell script BTclean that selectively cleans up object files listed in the BTNAMES file. A new ’BTNAMES’ file is generated. You can run it interactively (have to be NEMO user though) and answer some simple questions.

Environment

By default, body to scalar transformations are applied to bodies which have vectors of lenght 3 (see also vectmath(3NEMO) ). By adding -DTWODIM to the environment variable CFLAGS, newly created bodytrans variables are compiled with 2D bodies. Obviously it is very dangerous to mix 2D and 3D bodies, but the possibility exists.

See Also

body(3NEMO) , bodytrans(3NEMO) , vectmath(3NEMO) , snapshot(5NEMO) , mkbodyfunc(1falcON) , mkbodiesfunc(1falcON)

Author

Joshua E. Barnes, Peter Teuben

Files


~/src/nbody/core/bodytrans.c    code
~/src/nbody/core/bodysub/*    default standard bodytrans(5) files

History


xx-xxx-87    V1.0 Created         JEB
8-jul-89    V1.1 saving bodytrans mappings into user files    PJT
19-nov-89    V1.2 BTNAMES database used for saving    PJT
10-dec-91    some more doc    PJT
12-aug-92    documented CFLAGS usage     PJT
2-aug-06    V3.3 add show=    PJT


Table of Contents