Page 8 - Demo
P. 8
Interface to C/C++%uf09f %uf09f RCP Consult 2023-2026 Page 86. C/C++ source fileThe C/C++ source file must contain at least one double export function prepared by rules described above. In our example three export functions need to be defined in source file %u2018Stone_Circular.cpp%u2019 for processing by selected compiler. The first we need to provide all required definitions for binding with STRUREL placed in an include file %u2018strurel.h%u2019.//* 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.*/

