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

Add background mesh support #62

Merged
merged 14 commits into from
Feb 26, 2024
Merged

Add background mesh support #62

merged 14 commits into from
Feb 26, 2024

Conversation

angela-ko
Copy link
Contributor

@angela-ko angela-ko commented Feb 23, 2024

Adds the support for sizing func as mentioned in issue #59

dionhaefner and others added 6 commits November 30, 2023 14:39
* Added in tetgen background mesh resizing functionality

* Pass in bgmeshfilename to enable to enable mesh resizing
* Pass in bgmesh pyvista object to enable mesh resizing
* Examples of usage and testing

* Update code review commits

- Remove deduplication of tets
- Remove resorting of vertices order of tets
- Added verbose printing of bgmin object
- Moved mtr handling out of LoadArray
- Added some temporary debugging lines in test_tetgen.py

* some cleanups

* ifixedit

* address review

---------

Co-authored-by: Dion Häfner <[email protected]>
@angela-ko
Copy link
Contributor Author

@akaszynski Hi Alex! I see you've already noticed the PR but I just linked the relevant issue it's associated with + fixed a minor pydoc linter issue. Would you mind taking a look at it again?

Also, we added support for both passing in a bgmeshfilename and the bgmesh directly through a pyvista mesh but we weren't certain whether or not the bgmeshfilename feature would be necessary. Let me know if there's any changes we should make!

@angela-ko
Copy link
Contributor Author

cc: @dionhaefner

@akaszynski
Copy link
Member

Will do. Will be reviewed by this evening.

@akaszynski akaszynski mentioned this pull request Feb 24, 2024
@akaszynski
Copy link
Member

Will do. Will be reviewed by this evening.

Apologizes for the delay. Build was failing and bumping cibuildwheel fixed that, but discovered a few other minor issues while updating the build in #63, including the need for Python 3.12 wheels for pymeshfix.

Made a handful of changes and commented out what appears to be debugging code and plotter setup, which reduced the test time.

One note, it's a bit less verbose to generate a subgrid with:

cell_center = grid.cell_centers().points
subgrid = grid.extract_cells(cell_center[:, 2] < 0)

extract_cells supports boolean masks, and using cell_centers means you don't have to access the cells attribute and manually compute cell centers.

@akaszynski
Copy link
Member

Another note:

We can use cell_connectivity, avoiding the need for a loop and a temporary list within _process_bgmesh since we guarentee that the UnstructuredGrid is composed of only tetrahedra. This greatly improves performance. Implemented in 69b064c.

@akaszynski akaszynski changed the title Merge changes for sizing func support Add background mesh support Feb 25, 2024
Copy link
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good to go. Added documentation for how to use the background mesh since this is an additional feature. Please review the docs as well. I'll merge and release Monday evening if I don't hear back.

@angela-ko
Copy link
Contributor Author

LGTM! Thanks for the speedy review / edits.

Glad to learn that cell connectivity could be used to get the tets instead as well.

@akaszynski akaszynski merged commit a15f3bf into pyvista:main Feb 26, 2024
7 checks passed
@tkoyama010
Copy link
Member

Awesome job!

@dionhaefner
Copy link

Wow, that was fast - thanks everyone!

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.

4 participants