-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 24/09/15 20:53, Justin Chang wrote:
Lawrence,
Thanks for the clarification. One more follow-up question.
Yes I only want scalars (for now), and I am guessing that the data that will be loaded into numpy array has to correspond to the connectivity from mesh.cell_orientations?
Let's recall the class in question: import numpy as np class MyInit(Expression): def __init__(self): self.data = ... # load data from file into numpy array def eval(self, val, x): # x[0..d-1] are the d coordinate values (x, y, z) val[0] = ... # compute correct value from self.data based on x. No, so the idea is that when eval is called, x contains the coordinates values at the basis function node that you're currently interpolating onto. You then need to find the appropriate value (given this position) in the data array and set the node accordingly. BTW, mesh.cell_orientations is a red herring here. That's only necessary if you're solving problems on immersed manifolds. I think what you're asking is, "does the ordering of my input array have to match function space ordering". The answer is no, but you'll need to do some lookups as described above.
Also, what happens if I run this program in parallel? Will "function.interpolate(init)" first load the numpy array in serial, then distribute across all processes, or will it be interpolated after mesh distribution?
So the numpy data will be loaded redundantly on every process. But the interpolation will happen in parallel (i.e. each process will only interpolate its local section). Cheers, Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWCQMHAAoJECOc1kQ8PEYvsQIH/0J6rmOkbpswK5TT+OA2DPOk 20dYZsVMYKkQQ5CvsLmGPvMK0/Ba0s8L4SlH+UPauLk+trk8fvcALJu0xceVU/Dy 95GwNbnRgpQpC+14K0BY9HU2hMTKyMXbMP1/ObzfBkM3zE1KlsuBUxy7KvcBC+n6 zYxoA4TswyiLselnQTKeqR5GBS4DxfncusUk6TtQ5+udwjRFsHxxGWu6J3TvIH6+ W7uml6G69bAaPJUZtQTduv6RSBhoXWTOaRgeWBmlBhZsucZc/A2KWQKw3Bfvkhvq 3m1+26lTlom5glG/hr/GTXloocPtUPXSOkIBMo5G6xRxYdHXLGGB7NuazSIthkk= =N7UL -----END PGP SIGNATURE-----