Looping inside a UDF
I want to calculate the sum of N no.of terms inside my udf and these terms are not associated with any cell of face variables, so cell loop and thread loop are of no use. I want some sort of "for loop" type device which I can use in a UDF to do this summation.
Thanks in advance. |
Hi,
Have you read the UDF manual? Here's what I found in 5 minutes, for example execute some loop at the end of each timestep: Code:
DEFINE_EXECUTE_AT_END(execute_at_end) |
Thanks for your suggestion, but I need to run the "for" loop inside a DEFINE_DPM_BOFY_FORCE udf, at that to during every iteration not after the iterations. So do you have any solution for that.
Thanks in advance |
A loop inside a DEFINE_ADJUST macro would execute at every iteration. Maybe you can define global variables and use them in both DEFINE_ADJUST and DEFINE_DPM_BODY_FORCE macros?
|
I would definitely try that, and thanks for your suggestion.
|
All times are GMT -4. The time now is 22:40. |