Last version:
FLUKA 2024.1.2, October 16th 2024
(last respin 2024.1.2)
flair-2.3-0e 06-May-2024

News:

-- Fluka Release
( 16.10.2024 )

FLUKA 2024.1.2 has been released.
New FLUKA reference, please read and cite it:
F. Ballarini et al., The FLUKA code: Overview and new developments, EPJ Nuclear Sci. Technol. 10, 16 (2024)


font_small font_med font_big print_ascii

 [ 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
Vasilis Vlachoudis (CERN, Geneve); 6 March 2008


Last updated: 10th of October, 2008

© FLUKA Team 2000–2025

Informativa cookies