-
Notifications
You must be signed in to change notification settings - Fork 50
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
Scene/AbstractSimualtion/Simulation/HeatSimulation cleaning #1211
Conversation
Regarding
I think so, but probably not until 3.0. Maybe in the meantime, we can have it call
Kind of like the other two responses, I think it would be best to try to unify these concepts for all types of solvers for 3.0 but just support them like you have here for now (just for backwards compatibility). When we release 3.0 we can rename or remove these properties but yea I think it would be nice to unify them eventually. These are my thoughts before digging into the code, so probably will have more later. |
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.
@dbochkov-flexcompute It's of course hard to follow all of the individual changes, but this looks really good as I look through the diff and if the tests pass and it works in the notebooks, I think it's probably done correctly.
My only questions are about the file structure and whether we should try to reorganize the files now while we're doing this restructuring.
So now it seems that tidy3d/components
contains
base_sim/
heat/
geometry/
grid/
and then pretty much everything else is a file. I'm wondering if we should try re-organizing this like we discussed into some major directories, such as
# anything generic that the components depend on.
base/
constants.py
types.py
base.py
data/
data_array.py
dataset.py
scene/
scene.py
geometry/
structures.py
medium.py
simulation/
grid/
base_sim/
optical/
heat/
viz.py (?)
sim_data/ (or this data could be combined in the individual sims above)
sim_data.py
monitor_data.py
we could also consider renaming components
to base
or src
. Just wondering if you think there's any restructuring structure in the filesystem that makes sense to just take care of now that we are doing this major refactor.
just want to say, if we want to do this more general refactoring after this PR (to split up the work) I'm fine with that too. |
I think it would be better to do file restructuring in a separate PR, because chances there could be other PRs that would need to be rebased after this PR is merged. It could be more confusing if it involves both modifications to classes and major file reshuffling |
9511a2d
to
9063757
Compare
|
This PR switches optical classes (
Simulation
,Monitor
,Source
,MonitorData
,SimulationData
) to use introduced with the heat solverScene
,AbstractSimulation
,AbstractMonitor
,AbstractSource
,AbstractMonitorData
,AbstractSimulationData
. The main changes are related to plotting functionalities. That is most of actual plotting functions and their helpers are now only inScene
. The overall distribution of plotting functions is the followingScene
:AbstractSimulation
:Simulation
:Scene.plot_eps
but include monitors, sources, etc)HeatSimulation
:Scene.plot_heat_conductivity
but include monitors, sources, etc)As I mentioned previously, in
Scene.plot_structures_eps()
I had to modify how custom materials are plotted because there is no fdtd grid. I added an optional argumentgrid: Grid
so that inSimulation.plot_eps
fdtd gridSimulation.grid
is passed and custom materials are plotted as before.Regarding wrappers
Simulation.plot_structures_eps()
andSimulation.plot_structures()
: I added them to preserve backward compatibility and the difference between them and theirScene
counterparts is in the default plot limits: in scene those are detected automatically based on structures, while in simulation the size of simulation domain is used. Plus inSimulation.plot_structures_eps()
we also pass fdtd grid as described above. I think we should do either of two things:Scene.plot_structures_eps()
andScene.plot_structures()
.plot_structures_heat_conductivity()
inAbstractSimulation
Some other small things:
.bounds_pml
to represent actual simulation domain, but to have something uniformity between solvers I added propertyAbstractSimulation.simulation_bounds
which by default are computed from.center
and.size
. And inSimulation
its overridden using.bounds_pml
. Do we want to depreciate.bounds_pml
eventually?Simulation
toScene
andAbstractSimulation
.mediums
,medium_map
,background_structure
,intersecting_mediums
,intersecting_structures
are inScene
now, but to preserve backward compatibility there are repeated using dummy wrappers inSimulation
. Similar questions, do we want to depreciate them inSimulation
or extend to other solvers?