🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Save data in memory

User: "Prabin Pradhananga_22497"
Altair Community Member
Updated by unknown

Hi experts,

I wanted to know if there's some kind of UDF routine to temporarily store some kind of user-specific data in memory in udfHd opaque handle. For example, I call a UDF, then UDF performs some calculations and store the result temporarily in memory (may be udfHd opaque handle). Is this possible in acuSolve?

Thanks!

Sort by:
1 - 1 of 11
    User: "acupro"
    Altair Employee
    Accepted Answer
    Updated by acupro

    I want to store a data in udfHd so that when the UDF is closed, memory still has that value so that the next time another new UDF is called, it can be extracted same as the data in udfHd (opaque handle). I am planning to hook multiple UDFs in my code. This is different case and not related to my another question.

    Thanks.

    You can define multiple user functions in a single C file - compiling that single file will create the various user functions.  I am told that if you specify a static variable (for example - static Integer myData1) before the first function definition that Integer variable myData1 can be used, set, modified by any of the functions.  I think the header may be something like the following - but I need to verify that.  (Then myData1 would be available to any defined functions later in that file.)

    #include "acusim.h"
    #include "udf.h"

    static Integer myData1 ;

    UDF_PROTOTYPE( usrHSMult ) ; /* function prototype */