Page 8 - Demo
P. 8


                                    Interface to C/C++%uf09f %uf09f RCP Consult 2023-2025 Page 8//* Include file with internal STRUREL definitions#include \Additionally, you may use diverse includes depending on your function code, like#include \The next block declares which functions will be manufactured as export namesextern \{//* Export functions definition for usage in STRUREL DllExport double StoneCircularVI(long *); DllExport double StoneCircularGN(long *); DllExport double StoneCircularFA(double, double, double, double, double, double, long *);}And finally, the code of three double functionsThe first one shows using of global vector elementsdouble StoneCircularVI(long *ier){/*Uses only vector notation to access values of Variables and Parameters.The sequence in input vector v_XP_ is predefined by Stochastic Model.*/ *ier=0; return v_XP_[3]*acos(-1.)/4*v_XP_[1]*pow(v_XP_[2],2)-v_XP_[4]*v_XP_[0];}Here 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.h%u2019. This file will be created automatically by STRUREL for each compilation of source file %u2018Stone_Circular.cpp%u2019and is a mandatory object for usage of global vectors, global names and information variables. Usually, it must be placed on top of the source text.The second function shows using of global namesdouble StoneCircularGN(long *ier){/*Uses global names of Variables and Parameters to access their values.The sequence is arbitrary. Both STRUREL and C/C++ are case sensitive.*/ *ier=0; return PAR1*acos(-1.)/4*Strength*pow(Diameter,2)-PAR2*Load;}The third function shows usage of formal argumentsdouble StoneCircularFA(double l, double s, double d, double p1, double p2, double pi, long *ier){/*Uses function argument values as defined in Symbolic Expressions.The sequence is predefined by definition of parameters of DEFFUNC.*/ *ier=0; return p1*pi/4*s*pow(d,2)-p2*l;}It is also allowed to use a mixed mode %u2013 global vector, global names and arguments in the same export function.Note: Function and argument names are arbitrary.
                                
   2   3   4   5   6   7   8   9   10   11   12