> On Apr 8, 2019, at 6:38 PM, Dario Panada <dario.pan...@gmail.com> wrote:
> DP: I guess what confuses me here is the [..., i] syntax on the CellVariable > object thought. FiPy is built on NumPy. `...` or Ellipsis means "all the indices except for the one specified". FiPy stores cells in the last index of the internal NumPy array. A CellVariable can potentially be a field of vectors or tensors, so there could be more leading dimensions. Writing `[..., i]` ensures you're inserting data where you want. https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html?highlight=ellipsis%20expand > Between this approach and .value, which one would you recommend? >>> i = np.ravel_multi_index([coordinate[0], coordinate[1], coordinate[2]], >>> (20, 20, 20)) >>> sourceGrid[..., i] = sourceRate _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]