Last version:
FLUKA 2023.3.4, April 10th 2024
(last respin 2023.3.4)
flair-2.3-0d 13-Sep-2023

News:

-- Fluka Release
( 10.04.2024 )

FLUKA 2023.3.4 has been released.


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–2024

Informativa cookies