MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Optimize speed of plotting mesh

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99712] Optimize speed of plotting mesh
  • From: "Gehricht at googlemail.com" <Gehricht at googlemail.com>
  • Date: Tue, 12 May 2009 03:07:23 -0400 (EDT)

Dear MathGroup!

I have to bring coordinates with the corresponding mesh (at each
coordinate) together. The question is not, how do it but how to do it
more efficiently. The following steps are necessary

a) Generation of the coordinates from a dx in each spatial direction.
At the moment I am doing this with table

coordinates=Table[i*dx+j*dy+k*dz,{i,0,imax},{j,0,jmax},{k,0,kmax}]

which  seems to be the true bottleneck (takes 24 sec's for 2299968
Points)

b) Bring coordinates and mesh together

(Flatten[#1]) & /@ Transpose[{coordinates, mesh}]

Takes about 6 secs

c) Delete Cases, in which the mesh data is lower than a certain value

choppedData=DeleteCases[data, {_, _, _, x_ /; x <= 10^-4}]

Also takes about 6 secs. Might be unnecessary, but I thought it is a
good idea to decrease the number of mesh points for the CounterPlot.

d) Plot the mesh

ListContourPlot3D[choppedData, Mesh -> None, Contours -> 5,
  PlotRange -> All, MaxPlotPoints -> 50,
  ContourStyle -> Yellow] // Timing

I guess, this can be improved by Interpolation of the data, though I
have not tried it yet. I have to use a large value for MaxPlotPoints,
because otherwise the mesh does not look smooth.

With thanks for your help
Yours Wolfgang



  • Prev by Date: SparseArray and Compile
  • Next by Date: Re: Re: derivative of a well-behaved function
  • Previous by thread: Re: SparseArray and Compile
  • Next by thread: Re: Optimize speed of plotting mesh