Page 9 - Demo
P. 9
Interface to FORTRAN%uf09f %uf09f RCP Consult 2023-2026 Page 9The assigned global names will have the very same names as in the Stochastic Model: Load, Strength, Diameter, PAR1, PAR2 and corresponding values. Each global vector will have 5 elements with corresponding values as ordered above.The state functions and user defined functions for this example can be expressed in the Symbolic language of STRUREL as shown below. // 1. Use vector input in FORTRAN source file FLIM(1){Stone: Circular cross section} = FUNC(1)DEFFUNC(1,FORTRAN,FortranStone,\// 2. Use global names in FORTRAN source file FLIM(2){Stone: Circular cross section} = FUNC(2)DEFFUNC(2,FORTRAN,FortranStone,\// 3. Use explicit arguments in FORTRAN source fileFLIM(3){Stone: Circular cross section} = FUNC(3)(Load,Strength,Diameter,PAR1,PAR2,PI)DEFFUNC(3,FORTRAN,FortranStone,\StoneCircularFA6. Fortran source fileThe FORTRAN source file must contain at least one double precision export functionprepared by rules described above. In our example three export functions need to be defined in free format source file %u2018Stone_Circular.f90%u2019 for processing by gfortranThe first one shows using of global vector elementsreal*8 function StoneCircularVI(ier) bind(C,name='StoneCircularVI') implicit none!! Include file with internal STRUREL definitionsinclude 'strurel.hf'!GCC$ ATTRIBUTES DLLEXPORT::StoneCircularVIinteger, intent(out) :: ier!# Uses only vector notation to access values of Variables and Parameters.!# The sequence in global vector v_XP_ is predefined by Stochastic Model.StoneCircularVI = v_XP_(4)*DACOS(-1.D0)/4*v_XP_(2)*v_XP_(3)**2-v_XP_(5)*v_XP_(1)ier=0end functionHere elements containing values from global vector v_XP_ can be accessed directly by an index, as is ordered in Stochastic Model of STRUREL. The corresponding definitions for handling with a global vector are provided in an include file %u2018strurel.hf%u2019. This file will be created automatically by STRUREL for each compilation of source file %u2018Stone_Circular.f90%u2019and is a mandatory object for usage of global vectors, global names and information variables inside of export function.

