ubermag / workshop

Workshop: Micromagnetics with Ubermag
BSD 3-Clause "New" or "Revised" License
27 stars 13 forks source link

Can we define field values "per index"? #36

Closed marijanbeg closed 4 years ago

marijanbeg commented 4 years ago

This is not directly possible, however, there are two possibilities you can consider:

  1. discretisedfield.Mesh.point2index() and discretisedfield.Mesh.index2point()

  2. You can expose field as a numpy array (field.array). After you expose it, you can index it as a numpy array.

Iterating through mesh indices can be achieved as:

for index in mesh.indices:
    ...