Component Manual for the Neutron Ray-Tracing Package McStas, version 3.8.6

B.  Libraries and constants

The McStas Library contains a number of built-in functions and conversion constants which are useful when constructing components. These are stored in the share directory of the MCSTAS library.

Within these functions, the ’Run-time’ part is available for all component/instrument descriptions. The other parts are dynamic, that is they are not pre-loaded, but only imported once when a component requests it using the %include McStas keyword. For instance, within a component C code block, (usually SHARE or DECLARE):

1    %include "read_table-lib"

will include the ’read_table-lib.h’ file, and the ’read_table-lib.c’ (unless the --no-runtime option is used with mcstas). Similarly,

1    %include "read_table-lib.h"

will only include the ’read_table-lib.h’. The library embedding is done only once for all components (like the SHARE section). For an example of implementation, see Res_monitor.

In this Appendix, we present a short list of both each of the library contents and the run-time features.

B.1 Run-time calls and functions (mcstas-r)
B.1.1 Neutron propagation
B.1.2 Coordinate and component variable retrieval
B.1.3 Coordinate transformations
B.1.4 Mathematical routines
B.1.5 Output from detectors
B.1.6 Ray-geometry intersections
B.1.7 Random numbers
B.2 Reading a data file into a vector/matrix (Table input, read_table-lib)
B.3 Monitor_nD Library
B.4 Adaptive importance sampling Library
B.5 Vitess import/export Library
B.6 Constants for unit conversion etc.