Writing a 1D mesh to XDMF and re-reading it makes it 2D


215
views
0
11 months ago by

I did the following in a Jupyter notebook:

from fenics import *
import matplotlib.pyplot as plt
%matplotlib inline

prefix = '/Users/lavery/KSDG/test'

mesh = UnitIntervalMesh(8)
fe.plot(mesh)
print(mesh.geometry().dim())

This plots a 1D mesh and prints 1, as expected. Now,

meshfile = prefix + '_mesh.xdmf'
meshf = XDMFFile(meshfile)
meshf.write(mesh)
meshf.close()

meshf = XDMFFile(meshfile)
rmesh = Mesh()
meshf.read(rmesh)
fe.plot(rmesh)
rmesh.geometry().dim()


Here I get an unpleasant surprise: the plot has both an X and a Y-axis, and the printed dimension is 2.

I'm using the anaconda/conda-forge distribution, version 2017.1.0, on MacOS.
File attached: test_mesh.h5 (5.78 KB)

File attached: test_mesh.xdmf (563 Bytes)

 

Community: FEniCS Project

1 Answer


2
11 months ago by
This is a bug that was already reported (see Issue #892)
Please login to add an answer/comment or follow this question.

Similar posts:
Search »