Skip to content

Conversation

@mahlau-flex
Copy link
Contributor

@mahlau-flex mahlau-flex commented Dec 19, 2025

Added the priority attribute to TopologyDesignRegion to enable manual control of structures in overlapping regions. Previously a static structure of priority=1 would always override the TopologyDesignRegion.

Greptile Summary

This PR adds a priority attribute to TopologyDesignRegion to enable manual control of structure overlapping behavior, matching the functionality already available in the Structure class. The implementation correctly passes the priority value through to the created structure.

  • Added priority field to TopologyDesignRegion class with the same definition as Structure.priority
  • Updated to_structure() method to pass priority when creating the structure
  • Added test to verify priority propagation
  • Updated CHANGELOG with clear user-facing description

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is straightforward and follows the existing pattern from the Structure class. The field definition is identical to the existing priority field, and the change only adds passthrough functionality without modifying existing behavior.
  • No files require special attention

Important Files Changed

Filename Overview
tidy3d/plugins/invdes/region.py Added priority field to TopologyDesignRegion class, matching the Structure class definition, and passed it through to the created structure
tests/test_plugins/test_invdes.py Added basic test to verify priority is propagated to structure, but missing test for default None behavior
CHANGELOG.md Added clear and user-focused changelog entry describing the new feature

Sequence Diagram

sequenceDiagram
    participant User
    participant TopologyDesignRegion
    participant Structure
    participant Simulation
    
    User->>TopologyDesignRegion: Create with priority=1
    Note over TopologyDesignRegion: Store priority field
    
    User->>TopologyDesignRegion: Call to_structure(params)
    TopologyDesignRegion->>TopologyDesignRegion: Compute eps_values(params)
    TopologyDesignRegion->>TopologyDesignRegion: Create CustomMedium with permittivity
    TopologyDesignRegion->>Structure: Create Structure(geometry, medium, priority)
    Structure-->>TopologyDesignRegion: Return Structure with priority=1
    TopologyDesignRegion-->>User: Return Structure
    
    User->>Simulation: Add Structure to simulation
    Note over Simulation: Apply priority rules in overlapping regions
    Note over Simulation: Higher priority structure takes precedence
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@mahlau-flex mahlau-flex force-pushed the FXC-4605-Structure-with-priority-1-overrides-TopologyDesignRegion-object branch from bf2ef42 to 56abb73 Compare December 19, 2025 09:06
@github-actions
Copy link
Contributor

Diff Coverage

Diff: origin/develop...HEAD, staged and unstaged changes

  • tidy3d/plugins/invdes/region.py (100%)

Summary

  • Total: 2 lines
  • Missing: 0 lines
  • Coverage: 100%

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