Quick launch:
Last version:
News:
--
Fluka Release
|
[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ back ] Instead of rewriting the FLUKA users routine in some language other than FORTRAN, the simplest approach is the one of calling from inside them user C/C++ functions from a custom external library. In doing this, the main problem is the one of passing the needed variables to the external function. Some of them are locally available inside the FORTRAN user subroutine or entry point, while others are placed inside global COMMON BLOCKS. In the first case, it's very simple to pass the variables to the C/C++ function; this operation can be performed through the function's arguments, provided to follow some simple rule. In the second case one has to include some header files in the C/C++ code, that make the FORTRAN COMMON BLOCKS available through C/C++ globally defined structures. Once the problem of the variables has been solved, the C/C++ library and the FLUKA FORTRAN user routines can be compiled separately, to obtain the required object files to be linked into the FLUKA executable. It is important to remember that, in order to avoid problems of undefined symbols when linking (the symbol's names follow different rules for C++ and fortran compilers), all the external C/C++ functions must be declared inside external "C" blocks.
Riccardo Brunetti (INFN, Italy); 9 May 2003
Last updated: 10th of October, 2008 |
© FLUKA Team 2000–2025