Clear region if previously defined#280
Clear region if previously defined#280JonathanMaes merged 3 commits intomumax:masterfrom RossKnapman:clear-region
Conversation
Say we have a thin film where m = Uniform(0, 0, 1), and we define a circular region 1 with m = Uniform (0, 0, -1). Let's say we now want region 1 to be centred at some new coordinates (x', y'). We "reset" the system by calling m = Uniform(0, 0, 1) again, then redefine the region by again calling DefRegion(1, Circle(...).Transl(...)), and set m to be Uniform (0, 0, -1) in the region. Currently, both circles at (x, y) and (x', y') will be seen in the output, as region 1 wasn't reset back to zero everywhere. This commit defines a new function clear(), and calls it when DefRegion(id, shape) is called. I ran into this problem when I was running a simulation in which I was using a for loop to loop through various positions of a specific texture, and output the energy of each configuration.
|
@RossKnapman Thanks for your contribution. Very useful feature indeed! Nevertheless, we mostly prefer not to break/change mumax3 default behaviour as it is stable for a couple of years now. Therefore, If @JeroenMulkers and @JLeliaert don't mind, I would suggest you to rework your pull request a tiny bit. In particular, introduce API call Also a few minor suggestions:
|
|
I agree with @godsic . We should not break backwards compatibility at this point. Furthermore, I would argue that what you describe as a problem is in fact intended behaviour. I do have another small comment on the clear function. In this function you 'clear' certain region ids by setting them to 0. This makes region 0 to be fundamentally different from the other regions, which was not the case before this commit. I do believe that having a |
|
@JeroenMulkers Region |
|
Thank you for your comments, and apologies for the delayed response; things have been getting particularly busy with my PhD work over the past week. I agree with the comment from @JeroenMulkers, that region 0 should not be made fundamentally different from the other regions. I will therefore implement the version of the function in which the user specifies the updated region ID. |
|
Okay, I have re-worked the code as suggested, and added some unit tests. I hope that the code is acceptable in its current form. However, I see two potential issues that I would like to ask for your opinion on. Firstly, the new function My second problem is that the |



Say we have a thin film where m = Uniform(0, 0, 1), and we define a
circular region 1 with m = Uniform (0, 0, -1). Let's say we now want
region 1 to be centred at some new coordinates (x', y'). We "reset" the
system by calling m = Uniform(0, 0, 1) again, then redefine the region
by again calling DefRegion(1, Circle(...).Transl(...)), and set m to be
Uniform (0, 0, -1) in the region. Currently, both circles at (x, y) and
(x', y') will be seen in the output, as region 1 wasn't reset back to
zero everywhere. This commit defines a new function clear(), and calls
it when DefRegion(id, shape) is called.
I ran into this problem when I was running a simulation in which I was
using a for loop to loop through various positions of a specific
texture, and output the energy of each configuration.