Re: [fluka-discuss]: source user rotuine

From: Paola Sala <paola.sala_at_mi.infn.it>
Date: Sun, 5 Jan 2020 12:59:59 +0100

Dear Raksha
Routines written in C can be linked, either with Flair, or by generating
first an object file with the C compiler, then adding it to the linking
procedure, such as
cc -c -o myroutine.o myroutine.c
$FLUPRO/flutil/lfluka -m fluka -o myfluka myroutine.o

We are working on preparing C++ templates for the user routine, they are
not ready at the moment.

The simplest way, for the moment, would be to call your C routine from
within one of the standard fortran user routines, passing to it the needed
quantities. In this case, please remember to add and underscore (_) at the
end of the C routine name. Ex:
in source.f
  call myroutine (iflag)
in your C file
   void myroutine_(int iflag)

Hope this helps
Paola

>
> Dear Experts,
>
> I am a beginner in FLUKA. My query is regarding the source sub-routine.
> In Flair, I saw the option of "Add" user routine in "Fortran/c or
> c++/Object/Library" for compiling the user-routine.
> My question is, how to write the sub-routine in c-language ?
> I also read that the c-routines can be linked. How can this be done ?
> Kindly throw light in this regard.
> Is there a sample user-routine present in c-language ?
>
> Thanks and regards,
> Raksha Rajput.
>
>
>
> __________________________________________________________________________
> You can manage unsubscription from this mailing list at
> https://www.fluka.org/fluka.php?id=acc_info
>


Paola Sala
INFN Milano
tel. Milano +39-0250317374
tel. CERN +41-227679148

__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Sun Jan 05 2020 - 14:27:57 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 05 2020 - 14:28:09 CET