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 support for tetrahedral connectivity and use scipy to generate it #6303

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

nilsdeppe
Copy link
Member

Proposed changes

This provides an easy way to fill gaps in for domains with Gauss points. There are several optimizations possible to make it run faster if needed.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

src/Visualization/Python/GenerateXdmf.py Show resolved Hide resolved
src/Visualization/Python/GenerateXdmf.py Outdated Show resolved Hide resolved
tests/Unit/Visualization/Python/Test_GenerateXdmf.py Outdated Show resolved Hide resolved


@click.command(
name="generate-tetrahedral-connectivity",
Copy link
Member

Choose a reason for hiding this comment

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

(optional) Maybe just name triangulate?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't feel too strongly, I used this so it matches up with GenerateXdmf use-tetrahedral-connectivity but I agree it's very long

Copy link
Member

Choose a reason for hiding this comment

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

Up to you

if not subfile_name.endswith(".vol"):
subfile_name += ".vol"

for h5file, filename in h5files:
Copy link
Member

Choose a reason for hiding this comment

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

You can relatively easily show a progress bar here so the script doesn't appear "frozen" without any indication that it is doing anything. Here's how:

import rich.progress

progress = rich.progress.Progress(
        rich.progress.TextColumn("[progress.description]{task.description}"),
        rich.progress.BarColumn(),
        rich.progress.MofNCompleteColumn(),
        rich.progress.TimeRemainingColumn(),
        disable=(len(h5files) == 1),
    )
task_id = progress.add_task("Processing files", total=len(h5files))

with progress:
    for h5file, filename in progress.track(h5files, task_id=task_id):
        # ...
        progress.update(task_id, advance=1) # don't remember if this is needed

Docs are here: https://rich.readthedocs.io/en/stable/progress.html

Copy link
Member

@nilsvu nilsvu Sep 30, 2024

Choose a reason for hiding this comment

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

(optional) showing a progress bar (over timesteps rather than files as suggested before) instead of the log messages would be nicer

coordinates: str = "InertialCoordinates",
delete_tetrahedral_connectivity: bool = False,
):
"""Generate tetrahedral connectivity using scipy.spatial.Delaunay
Copy link
Member

Choose a reason for hiding this comment

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

Question: how does this handle shared grid points on LGL element boundaries? The tetrahedra connecting these points would be degenerate.

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't read the paper that describes qhull, but as far as I can tell it works fine and doesn't produce any double connectivity.

@nilsvu
Copy link
Member

nilsvu commented Sep 30, 2024

LGTM please squash.

@knelli2 knelli2 added the cli/pybindings Command line interface & Python bindings label Sep 30, 2024
@nilsvu nilsvu merged commit 3228cb9 into sxs-collaboration:develop Sep 30, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli/pybindings Command line interface & Python bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants