Posted Fri, 07 Apr 2017 19:27:59 GMT by adacovsk
Hi again,

Thanks again for the PreTimeStep callback issue! However, I'm now having problems with IfmGetElementalRefDistrName  :'(

My code block is:

[quote]char *myStr = NULL;
IfmGetElementalRefDistrName(pDoc, 0,myStr);[/quote]

Results in:

[quote]Unhandled exception at 0x0000000180026193 (feflow7010k.dll) in feflow70q.exe: 0xC0000005: Access violation writing location 0x0000000180027e3e.[/quote]

I'm not sure what's wrong here. I've attached the debugger stuff.

Regards,

Adam
Posted Mon, 10 Apr 2017 10:50:34 GMT by Björn Kaiser
Thanks for the note Adam. It seems there is a bug related with UTF-8. We will fix it as soon as possible. In the meantime, I suggest to use ASCII-conform characters.
Posted Mon, 10 Apr 2017 12:04:49 GMT by Björn Kaiser
Adam, I made some further checks. Could you please provide a part (snippet) of you code? I am interested in the line where you use the API function IfmGetElementalRefDistrName. Please also provide the lines where you initialize the variables used for the API function. Thank you in advance.
Posted Mon, 10 Apr 2017 16:04:01 GMT by adacovsk
Hi Björn,

Attached is some barebones code that hopefully shows you the issue when you debug. I have model I test within FEFLOW with two distributions with the default names "Elemental Distribution 1" and "Elemental Distribution 2". Please remove the .txt extension for the files (couldn't attach otherwise).

Thanks!

Adam
Posted Thu, 27 Apr 2017 12:07:06 GMT by Björn Kaiser
Thanks for the snippet. You need to declare the string for [font=courier][color=blue]myStr[/color][/font] without deleting.

[font=courier][color=blue]
void CGuitest::gui(IfmDocument pDoc){
            if (num_ElementalRefDistr != 0){
                        char myStr[64] = {0};
                        DebugBreak();
                        IfmGetElementalRefDistrName(pDoc, 0, myStr);
                        DebugBreak();
                        string str(myStr);
                        QString str = QString::fromUtf8(myStr);
                        IfmInfo(pDoc,myStr);

                        //delete myStr;
            }
}
[/color][/font]

In addition, you need to give a name for the variable [font=courier][color=blue]myStr[/color][/font] in your code. The name give should correpsond to the name of the distribution you see in the GUI (e.g. "Elemental Distribution 1").

You must be signed in to post in this forum.