Skip to content

Dilation/Erosion interface in Julia#6

Open
lxvm wants to merge 2 commits into
mainfrom
dilation
Open

Dilation/Erosion interface in Julia#6
lxvm wants to merge 2 commits into
mainfrom
dilation

Conversation

@lxvm

@lxvm lxvm commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

This PR adds a dilation_distance keyword to the ProjectionProblem API in the Julia API that provides an easy way to expand the solid region by approximately dilation_distance in all directions (or shrink/erode it if dilation_distance is negative).

Additionally, in the high-level api, the functions ssp1, ssp1_linear, and ssp2 accept an optional trailing positional argument for the dilation_distance.

Tests were added for the adjoints w.r.t. the filtered density in the presence of a non-zero dilation for both the low-level and high-level APIs.

Additionally, I added an example that demonstrates the effect of the dilation/erosion on Cassini ovals.

image

@stevengj

Copy link
Copy Markdown
Contributor

cc @smartalecH and @romanodev — it would be good to add this to the Python API too.

@smartalecH

Copy link
Copy Markdown
Collaborator

I have a draft for the python implementation locally -- I'll try to push something soon.

@stevengj

stevengj commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Note that this is the algorithm from NanoComp/meep#3087 (comment), which I assume is the same as @smartalecH's draft.

Any comments on the API? A dilation_distance keyword (defaulting to 0 or false … in Julia false == 0, negative for erosion) seems straightforward enough.

@@ -177,6 +179,7 @@ function smoothed_projection(rho_filtered, rho_filtered_derivs_normsq, R_smoothi
nonzero_norm = abs(den_helper) > zero(den_helper)

@stevengj stevengj Jun 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unrelated comment: why isn't this just !iszero(den_helper)?

@romanodev

Copy link
Copy Markdown
Collaborator

The API is straightforward. @smartalecH: if your draft is different than the intended approach, I can take a crack at this (or feel free to address only SSP1, and I will follow with SSP2)

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