-
Notifications
You must be signed in to change notification settings - Fork 53
Gap automeshing #2390
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
base: daniil/min_size_autodetect
Are you sure you want to change the base?
Gap automeshing #2390
Conversation
one more point:
|
Thanks for this great feature!
Agree that we can set 1 as default if ti works quite well already. Then we can add an option like
Right now, we don't have good conformal scheme for thin strips, so probably no need right now.
Not too concerned, but I wonder that it's not hard to store them?
My understanding is that metallic structures are more of a concern. So we probably only need to distinguish between metallic (PEC, lossyMetal) and dielectric. |
3665737
to
f5a5d78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Half way through the code. Looks quite nice, although taking quite a bit efforts in understanding the logic. Some high-level description in each function will be very helpful. Some minor comments so far:
"The underlying algorithm detects gaps contained in a single cell and places a snapping plane at the gaps's centers.", | ||
) | ||
|
||
dl_min_from_gap_width: bool = pd.Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have dl_min from quite a few places: gap refinement, corner refinement, thickness refinement, and minimal feature, shall we allow controling them individually and combine them into a new class?
tidy3d/components/grid/grid_spec.py
Outdated
cells_ij = [] | ||
cells_dy = [] | ||
h_inds = np.argmax(x[:, None] > vertices[None, :, 0], axis=0) | ||
h_inds[vertices[:, 0] > x[-1]] = len(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More informative variable name for h_inds
cells_dy = [] | ||
h_inds = np.argmax(x[:, None] > vertices[None, :, 0], axis=0) | ||
h_inds[vertices[:, 0] > x[-1]] = len(x) | ||
for ind_beg, ind_end, v_beg, v_end in zip( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment that beg
and end
refers to the two vertices on the edge of the polygon
tidy3d/components/grid/grid_spec.py
Outdated
if ind_beg > ind_end: | ||
ind_beg, ind_end, v_beg, v_end = ind_end, ind_beg, v_end, v_beg | ||
|
||
if ind_end > ind_beg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearer with if ind_end == ind_beg: continue
, and undent the rest? This brings up the question on how the close-to-vertical polygon edge is handled. I guess they are handled when looking at horizontal intersection?
tidy3d/components/grid/grid_spec.py
Outdated
"""Detect intersection points of single polygon and grid lines.""" | ||
v_cells_ij, v_cells_dy = self._find_vertical_intersections(x, y, vertices) | ||
# reuse the same command but flip dimensions | ||
h_cells_ij, h_cells_dx = self._find_vertical_intersections(y, x, vertices[:, [1, 0]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use np.flip?
# reuse the same command but flip dimensions | ||
h_cells_ij, h_cells_dx = self._find_vertical_intersections(y, x, vertices[:, [1, 0]]) | ||
if len(h_cells_ij) > 0: | ||
h_cells_ij = np.roll(h_cells_ij, axis=1, shift=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more explanation here?
tidy3d/components/grid/grid_spec.py
Outdated
min_gap_width = min(min_gap_width, gap_width) | ||
|
||
if len(new_snapping_lines) == 0: | ||
log.info("Grid is no longer changing. Stopping recursive refinement.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include the information on the number of iteration where it stops.
f5a5d78
to
395f617
Compare
sprinkled around some more comments in the code, had to recall myself what I was doing 😅 |
395f617
to
ff7ac19
Compare
Integrated gap meshing in an iterative way. Now
LayerRefinementSpec
has two additional parameters:gap_meshing_iters: NonNegativeInt = 1
to set the number of iteration to perform for attempting resolving all gapsdl_min_from_gap_width: bool = True
whether or not to reducedl_min
reduce to the minimal detected gap width.A few of points to discuss:
examples of meshing thin strips and gaps:

