On Wed, Oct 21, 2009 at 1:29 PM, Kun-Dar Li <[email protected]> wrote: > > Hi Daniel, > > Thank you so much for your help. I'm trying to figure out what do these > mean. > >> To put data from 3D mesh into a 2D mesh: >> >> var2D.setValue(var3D((x, y, cutPlaneZValue * numpy.ones(len(x))), >> order=1)) >> > > 1. Is "cutPlaneZValue" a speical function? Or, I need to define it by my > self.
No, just a parameter you define. > 2. Why is len(x)? not len(z) or..? x and y have the same length, it is just the number of points in the 2D mesh. Could be var2D.getMesh().getNumberOfCells() instead of len(x) if that makes it clearer. Each coordinate has to be the same length. > 3. What does it put into var2D? The summation of Z-axial positions? I got > confusion with this. Should have explained a bit better. The __call__ method of a CellVariable enables interpolation to a set of coordinates passed in via the __call__ method (the __call__ method is just accessed using parentheses like in a function call). It returns a set of values for corresponding to each of the coordinates that were passed in. The order argument just determines the order of the interpolation. We really should be using "scipy.ndimage.map_coordinates" to do this now and you may want to look into using that instead if you want higher order interpolation. It should give the same results for order=1. If your points are coincidental then obviously that won't be an issue. >> To put data from 2D mesh into 3D mesh: >> >> var3D.setValue(var2D(var3D.getMesh().getCellCenters()[:2], order=1)) > > 4. It seems this just expand var2D into 3D, like the same value along > Z-axial. Is my understanding right? Yes, is that what you want to do? I wasn't clear on what you actually needed. -- Daniel Wheeler
