From: Alan W. Irwin <airwin@us...>  20031202 22:07:42

On 20031202 20:59+0100 Christophe TROESTLER wrote: > Hi all, > > I am experimenting with PLplot to display functions obtained by the > finite elements method on nonsquare domains. I use plgriddata() to > transform the data to a suitable format for plmesh*() but I get > problems with the fact that plgriddata() generates NaNs on the > complement of the domain in the surrounding square. Fortunately my > interest at the moment is in Dirichlet boundary conditions so I just > convert any NaN to 0.0 and everything is fine. However, IMHO, a much > better solution would be that PLplot does not draw any line for NaN > data. Is there a way to do that? How am I supposed to plot solutions > of PDEs with e.g. Neumann boundary conditions? > > Thanks for any help, > ChriS If you changed plgriddata to specify the resulting nonrectangular boundaries, then getting plcont, plshade, and plshades to plot the results is entirely straightforward because the z(x,y) grid for those routines is specified as x(ix,iy), and y(ix,iy). So ix, and iy must be defined on a rectangular grid, but x and y don't have to be for those routines so you can just keep repeating the boundary values of z(x,y) and either x(y) or y(x) whenever you reach it, and all is well. (I have tried this for the nonrectangular region where my own data are defined, and this method works fine for plcont, plshade, and plshades.) plmeshc and friends constitute a more difficult case since drawing occurs only along constant x vectors(DRAW_LINEY), constant y vectors (DRAW_LINEX), or both (DRAW_LINEXY). Thus their arguments are z(x,y), and the x(ix) and y(iy) vectors. But there is no intrinsic reason why the defined grid of ix and iy has to be rectangular in this case. Thus, in principle, it should be possible to modify plgriddata to produce and plmeshc to accept monotonically changing boundaries for x(ix) and y(iy), that are specified either by ix ranging from ixmin(iy) to ixmax(iy) with iy in the range from 0 to ny1 or the equivalent form (for montonic bondaries) where the iy range is a function of ix. (You would need both forms of specifying the boundaries or else internally transform from one to the other because plmeshc has options to draw just in x, just in y, or in both coordinates.) I say "in principle", since I need this enhanced functionality myself, but I am having trouble understanding the plmeshc code well enough to change it. Chris, I assume your PDE solution has monotonic boundaries (otherwise, plmeshc would produce a mess for the default DRAW_LINEXY) so if you think my idea of specifying the ix and iy limits would work for your needs and you are game to make the required coding changes, that would also be a big help to me (and probably many other users). Alan __________________________ Alan W. Irwin email: irwin@... phone: 2507272902 Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the PLplot scientific plotting software package (plplot.org), the Yorick frontend to PLplot (yplot.sf.net), the Loads of Linux Links project (loll.sf.net), and the Linux Brochure Project (lbproject.sf.net). __________________________ Linuxpowered Science __________________________ 