Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh2D.save puts points in yz-plane #60

Closed
gdmcbain opened this issue Sep 28, 2018 · 4 comments
Closed

Mesh2D.save puts points in yz-plane #60

gdmcbain opened this issue Sep 28, 2018 · 4 comments

Comments

@gdmcbain
Copy link
Contributor

While investigating the MeshTri returned by refinterp #59 , I was puzzled to find that save prepends rather than appends zero coordinates; i.e. it puts it into the yz-plane rather than the xy-plane.

See https://github.com/kinnala/scikit-fem/blame/master/skfem/mesh/mesh2d/mesh2d.py#L191

        # a row of zeros required in 2D
        p = np.vstack((np.zeros(self.p.shape[1]), self.p))

Is that intentional?

@gdmcbain
Copy link
Contributor Author

Actually I'm not sure that any embedding into ℝ³ is needed.

Trying

meshio.write('M2.mesh', meshio.Mesh(self.p.T, cells))

produces a valid two-dimensional MEDIT mesh file. Gmsh opens and renders this O. K.

MeshVersionFormatted 2
Dimension 2

Vertices
11520
0.0 0.0 1
0.125 0.0 1
0.0625 0.0625 1
0.0625 0.0 1
0.03125 0.03125 1
⋮

@kinnala
Copy link
Owner

kinnala commented Sep 28, 2018

I think that embedding into R^3 was done due to vtk export. But yz-plane sounds strange indeed.

@gdmcbain
Copy link
Contributor Author

Yes, something to do with VTK, but maybe not too serious.

meshio.write('M2.vtk', meshio.Mesh(M.p.T, {'triangle': M.t.T}))

WARNING:root:VTK requires 3D points, but 2D points given. Appending 0 third component.

@kinnala
Copy link
Owner

kinnala commented Sep 29, 2018

Originally scikit-fem used pyevtk so it might be a remnant. I think it can be freely removed.

@kinnala kinnala closed this as completed in 06bf72a Oct 2, 2018
kinnala added a commit that referenced this issue Oct 2, 2018
don't embed 2d points in (yz-plane of) 3d, fixes #60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants