Conversation
This Branch adds the ability for the user to define promote arbitrary slices (both scalar masks and vector masks) into a Custom Quantity. Implementation follows xfong's implementation in the https://github.com/seeder-research/umagnus fork.
Previous was old version (no functional changes, just comments)
mx3 file went to wrong folder on new PR.
|
|
||
|
|
||
| mask := newScalarMask(Nx, Ny, Nz) | ||
| for i:=0; i<Nx; i++{ |
There was a problem hiding this comment.
Perhaps having a CUDA kernel that generates a slice containing all the cell indices (similar to the functions from #289) could be useful for large simulations. In the example here, one could then use .Comp(0), promote that to a quantity, and then operate on that quantity to efficiently build the mask.
But there were some unresolved comments on #289, so it's probably best to limit this PR to the slice-to-Quantity conversion and keep this idea for a potential future PR.
There was a problem hiding this comment.
Something like this would be very useful at some point, especially because using .set() and .get() can end up being somewhat slow due to the extra overhead, for large simulations. Set isn't too bad by itself, but if a user wants to do something like Region.getcell to compare to a value, then .set() it gets really bogged down
|
I also think this feature is sufficiently useful to rename the file |
Fixes following comments: Relaxes changed to short Runs. Relax was not needed, just a convenience during testing, and Run() finishes the test faster. Renamed to customquantity.go Description clarified that slices can be created using NewScalarMask and NewVectorMask, and that the slices should match the grid size. Remove a superfluous multiplication by 1 that was left over from initial testing
Remind users that custom Quantities are not limited to 256 regions
added Loadfile to description
This branch adds the ability for the user to promote arbitrary slices (which can be made using NewScalarMask and NewVectorMask) into a custom Quantity. The implementation is backported from @XuebingZhao 's umagnus fork. Currently, custom fields can only be made from existing Quantities, Const or Constvector , limiting the amount of spatially varying Quantities that are possible.