flaport / meow

https://flaport.github.io/meow
Apache License 2.0
29 stars 6 forks source link

Decouple Cell and CrossSection #29

Closed flaport closed 1 year ago

flaport commented 1 year ago

This PR decouples the CrossSection from the Cell. This has the advantage that a CrossSection will no longer have a z_min and z_max (present in Cell) which should improve caching of previously calculated modes.

This required some breaking changes:

  1. Cell is no longer an attribute of CrossSection. Wherever you used cs.cell or similar you'll have to find an alternative way of accessing the needed information. Note: mesh is now a native attribute of CrossSection.
  2. Use CrossSection.from_cell(cell=cell, env=env) wherever you used to use CrossSection(cell=cell, env=env)
  3. A Mode depends on a CrossSection not on a Cell and hence its .cell attribute is now also gone. This will obviously improve caching but unfortunately this also means you'll have to provide cells as a second argument to compute_s_matrix from now on. Since compute_s_matrix only depends on the cell length you can also skip supplying cells and specify cell_lengths as a keyword argument for that function.
  4. The ez_interfaces attribute (previously in Cell) is now moded to Mesh.

There are a bunch of other minor changes under the hood (such as Geometry->Geometry2D,Geometry3D and Structure->Structure2D,Structure3D) but these should not touch the user API.

@Jan-David-Black , feel free to comment or request changes. I'm planning to merge this branch on Thursday.

jan-david-fischbach commented 1 year ago

@flaport sounds good to me. I'll have to get my hands dirty with it though to say more :) Hopefully I'll find time before Thursday!

jan-david-fischbach commented 1 year ago

👍 Do we delete the branch?