Skip to content

Add line definitions to marching_triangles #20

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

Merged
merged 4 commits into from
Mar 3, 2025
Merged

Conversation

pjaap
Copy link
Member

@pjaap pjaap commented Jan 29, 2025

marching_triangles does now something similar to marching_tetrahedra:

It accepts lines and levels and returns now the points, adjecencies and values of a given function.

Changes in detail:

  • inconsistencies with Tc, Tp and Ti parameters fixed
  • a new method taking a lines vector added
  • old methods are deprecated (TODO: what is the best way to do that?) and return only the point list, as before
  • function values are interpolated linearly, as in marching_tetrahedra
  • small performance caveat: the loop over levels is now one level higher and recomputes the point values every time; this makes implementation of lines easier. I think to slow down is reasonable

TODOs:
[] deprecate old methods correctly
[] deal with the new return values in calling functions (e.g., makie.jl)
[] if both lines and levels are given, the result is just a mess. But this happens too in marching_tetrahedra? Maybe throw a warning if both are non-empty.

@pjaap pjaap marked this pull request as draft January 29, 2025 12:17
@pjaap pjaap force-pushed the feature/marching-lines branch from 1a0cbba to 6dc64b7 Compare January 29, 2025 12:21
@j-fu
Copy link
Member

j-fu commented Jan 29, 2025

I think we don't need a very formal deprecation process here, just a breaking version bump
and a notice how to convert in the changelog. Two packages depend on it - GridVisualize and PlutoVista,
and I created GridVisualizeTools mainly in order to avoid a PlutoVista dependency on GridVisualize.

Before merging here, it would be good if you could make a PR to GridVisualize which shows that it works.
I would care about PlutoVista then. If this works as well, we could merge here.

@pjaap
Copy link
Member Author

pjaap commented Jan 31, 2025

Ok, I pushed an update: the deprecated methods are now simply gone. In the changelog, there is a hint how to restore the old behavior, if desired.

The downstream PR is WIAS-PDELib/GridVisualize.jl#65

I'll fix the usage of marching_triangles there once this PR is merged.

The method now also returns the values of the objective function at the intersection points
and the adjacency information.

Therefore, it is possible to construct a 1D grid from the return values.
@pjaap pjaap force-pushed the feature/marching-lines branch from 597cd22 to bf8d2e9 Compare January 31, 2025 15:54
@pjaap pjaap changed the title WIP: Add line definitions to marching_triangles Add line definitions to marching_triangles Feb 28, 2025
@pjaap pjaap marked this pull request as ready for review February 28, 2025 15:22
Copy link
Member

@j-fu j-fu left a comment

Choose a reason for hiding this comment

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

I think we should avoid O(N^2) here...

@j-fu
Copy link
Member

j-fu commented Mar 1, 2025

Also, before merging, we should ensure that j-fu/PlutoVista.jl#16 works

@pjaap pjaap force-pushed the feature/marching-lines branch from 835e9b5 to 1b95b8e Compare March 3, 2025 08:55
@pjaap
Copy link
Member Author

pjaap commented Mar 3, 2025

There is some nasty type conversion problem deep in j-fu/PlutoVista.jl#16 caused by this change. I am still figuring out how to get around this one.

@j-fu
Copy link
Member

j-fu commented Mar 3, 2025

j-fu/PlutoVista.jl#16 works...

@j-fu
Copy link
Member

j-fu commented Mar 3, 2025

Sorry, didn't read your previous post... I made a cheap workaround...
I have a general idea on this we could talk about, I guess this would be another PR...

@pjaap
Copy link
Member Author

pjaap commented Mar 3, 2025

Oh, I now made a more sophisticated update here: Give the user control over the types of coordinates, values and points.
Then, in PlutoVista you can call

iso_pts = first(marching_triangles(pts, tris, f, [], collect(levels); Tc = Float32, Tv = Float32))

and

iso_pts0=first(marching_triangles(pts,tris,f,[],levels, Tv = Float32, Tc = Float32))

@pjaap
Copy link
Member Author

pjaap commented Mar 3, 2025

With the two lines changed in PlutoVista test suites are fine in now in PlutoVista, GridVisualize and GridVisualizeTools

@pjaap
Copy link
Member Author

pjaap commented Mar 3, 2025

@j-fu merge and register?

@j-fu
Copy link
Member

j-fu commented Mar 3, 2025

In GridVisualize+PlutoVista, a minor version bump would be sufficient.

@pjaap pjaap force-pushed the feature/marching-lines branch from 9cb2b46 to bd6a91f Compare March 3, 2025 13:19
@pjaap pjaap merged commit 7338a32 into main Mar 3, 2025
11 checks passed
@pjaap pjaap deleted the feature/marching-lines branch March 3, 2025 13:22
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