Mesh refinement and plotting in 1D
When I create a mesh in 1D, refine it and interpolate something on it, the plot looks very messed up, as in the plot first the original nodes are connected and then the new nodes from the refinement. An MWE is given below:
from dolfin import * print dolfin.version
mesh = refine(UnitIntervalMesh(10))
V = FunctionSpace(mesh, "CG", 1) f = interpolate(Expression("sin(10*x[0])"), V)
plot(f)
The dolfin.version I use is 1.2.0+, i.e. the nightly or development builds (Ubuntu package: 1.2.0+git20130604~ppa1~precise1).
Comments (7)
-
-
- changed milestone to 1.3
-
I just had a look at this, it seems that VTK is not respecting the connectivity information (set in VTKPlottableMesh::build_grid_cells) in 1D.
More specifically, the class vtkXYPlotActor does not seem to use the Cell information, but just assumes the points are in order.
-
I've made a branch "chris/fix-issue-59" which implements a hack to get around this feature. I'm not making any claims for it being the best solution to the problem.
-
Looks good. Bit harsh calling it a hack. Looks like a nice work-around to me.
I've merged
chris/fix-issue-59
intonext
. -
- changed status to resolved
-
- removed milestone
Removing milestone: 1.3 (automated comment)
- Log in to comment
Can confirm problem. Plotting is fine without refinement, but something is up with points near boundary once refined.