EDEM crashed with API

Hi,
When I modified some code of my api, just delete some custom properties and added some values to preference file, and then when I run the simulation with new API, EDEM crashed. When I debug the code, the value of timestepdata.time was a wired value. I can't locate where was wrong. Thanks

Hi,
That's a perfectly valid value for the time, why do you think it's weird?
You would have to debug line by line to see where your issue is. If you're saying the only new bits of code are custom properties and reading prefs file values, start there. It's very easy to read in incorrect values in a preference file.
Richard
Hi Richard,
Because I saw time was a negative value.
Regards!

Ah, I missed that. Not sure I've seen a negative time value in EDEM before, impressive!
I'd still debug a line at a time and check all your values for the source of your error
Hi Richard
Thanks, because sometimes the simulation can finish, and crash happens at the beginning of simulation, I have debugged the code and the values read from the preference file were correct. That's why I am confused.
Regards!
Hi Richard
Thanks, because sometimes the simulation can finish, and crash happens at the beginning of simulation, I have debugged the code and the values read from the preference file were correct. That's why I am confused.
Regards!
I'm intrigued now. I'm not guaranteeing anything but if you can post your code I'll take a quick look

I'm intrigued now. I'm not guaranteeing anything but if you can post your code I'll take a quick look
Thanks Richard, I've attached the cpp file and preference file, please check out, just inform me if you need edem file.
Thanks Richard, I've attached the cpp file and preference file, please check out, just inform me if you need edem file.
Can you send the rest of the src? If you're following the usual API plugin style that would be the .h for that class and another .cpp for the macros

Can you send the rest of the src? If you're following the usual API plugin style that would be the .h for that class and another .cpp for the macros
I've added the rest of code and edem file which crashed.
Regards!

I can't see any attachments at all, anymore
Sorry, I upload again.
Sorry, I upload again.
Lines 323 to 326 you're adding to four components of the custom property "InitialOverlap" but it only has one element in the definition on line 740. That needs increasing to 4. That's leading to completely unknown behaviour because you're writing to memory that you have no idea about and the effects are completely unpredictable ...like negative time

Lines 323 to 326 you're adding to four components of the custom property "InitialOverlap" but it only has one element in the definition on line 740. That needs increasing to 4. That's leading to completely unknown behaviour because you're writing to memory that you have no idea about and the effects are completely unpredictable ...like negative time
Ah, I missed this, thanks for pointing out this problem.
Sorry, I upload again.
Lines 323 to 326 you're adding to four components of the custom property "InitialOverlap" but it only has one element in the definition on line 740. That needs increasing to 4. That's leading to completely unknown behaviour because you're writing to memory that you have no idea about and the effects are completely unpredictable ...like negative time
Hi,
That's a perfectly valid value for the time, why do you think it's weird?
You would have to debug line by line to see where your issue is. If you're saying the only new bits of code are custom properties and reading prefs file values, start there. It's very easy to read in incorrect values in a preference file.
Richard