Page 9 - Demo
P. 9


                                    Interface to FORTRAN%uf09f %uf09f RCP Consult 2023-2025 Page 9The 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,\_Circular.f90\in function}=StoneCircularVI// 2. Use global names in FORTRAN source file FLIM(2){Stone: Circular cross section} = FUNC(2)DEFFUNC(2,FORTRAN,FortranStone,\_Circular.f90\in function}=StoneCircularGN// 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,\_Circular.f90\arguments in function}=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.The second function shows using of global namesreal*8 function StoneCircularGN(ier) bind(C,name='StoneCircularGN') implicit none!! Include file with internal STRUREL definitionsinclude 'strurel.hf'!GCC$ ATTRIBUTES DLLEXPORT::StoneCircularGNinteger, intent(out) :: ier!# Uses global names of Variables and Parameters to access their values.!# The sequence is arbitrary. STRUREL is case sensitive but FORTRAN not.StoneCircularGN = PAR1*DACOS(-1.D0)/4*Strength*Diameter**2-PAR2*Loadier=0end function
                                
   3   4   5   6   7   8   9   10   11   12   13