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

preserve subdomains & boundaries in MeshQuad._splitquads #387

Merged
merged 9 commits into from
Jun 3, 2020
Merged

preserve subdomains & boundaries in MeshQuad._splitquads #387

merged 9 commits into from
Jun 3, 2020

Conversation

gdmcbain
Copy link
Contributor

@gdmcbain gdmcbain commented Jun 2, 2020

For #385

@gdmcbain gdmcbain marked this pull request as draft June 2, 2020 06:57
@gdmcbain
Copy link
Contributor Author

gdmcbain commented Jun 3, 2020

I noticed that MeshQuad._splitquads isn't covered by a test. I'll see if I can add one.

@kinnala
Copy link
Owner

kinnala commented Jun 3, 2020

This naming, _splitquads, seems to imply that it is a private method. Originally it was, as the reason for introducing it was to do plotting of solutions on quadrilateral meshes and it was used internally by MeshQuad.plot3.

Currently I can think of many other use cases so I wonder if we should add an alias, MeshQuad.split_quads, MeshQuad.split, or something. Note that we also have the variant MeshQuad._splitquads_symmetric which is supposed to split each quad into four triangles.

@gdmcbain
Copy link
Contributor Author

gdmcbain commented Jun 3, 2020

I see, yes, good point about the private-looking name.

On the two new names, the 'quads' in the first seems redundant but then there are lots of other functions and methods already called split. And maybe it could be thought to be an inverse of the new Mesh.__add__ , so maybe the former. Or what about MeshQuad.to_meshtri?

And for the symmetric variant, I hoping that they can be refactored later. As I generally have to work with unstructured meshes, I haven't looked at it myself.

@gdmcbain
Copy link
Contributor Author

gdmcbain commented Jun 3, 2020

Oh, I see that MeshQuad._splitquads_symmetric introduces new points in the centroids; that'll break the implementation above. And the tests, which are based on checking that the points supporting the subdomains and boundaries don't change. Can that be deferred?

@kinnala
Copy link
Owner

kinnala commented Jun 3, 2020

Yes, to_meshtri sounds reasonable. NumPy/SciPy uses tolist, toarray, etc. but I think tomeshtri sounds too terse. Also, we already have to_dict and to_json etc.

We can later add m.to_meshtri(symmetric=True) flag.

@gdmcbain gdmcbain marked this pull request as ready for review June 3, 2020 06:14
@gdmcbain gdmcbain changed the title WIP: preserve subdomains & boundaries in MeshQuad._splitquads preserve subdomains & boundaries in MeshQuad._splitquads Jun 3, 2020
skfem/mesh/mesh2d/mesh_quad.py Outdated Show resolved Hide resolved
tests/test_mesh.py Show resolved Hide resolved
@kinnala kinnala merged commit 219d687 into kinnala:master Jun 3, 2020
@gdmcbain gdmcbain deleted the 385-splitquads-subdomains-boundaries branch June 4, 2020 00:02
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

Successfully merging this pull request may close these issues.

2 participants