2024-02-26 16:16:06 +01:00
|
|
|
import tidy3d as td
|
|
|
|
import sympy as sp
|
|
|
|
import sympy.physics.units as spu
|
|
|
|
|
2024-03-11 16:35:41 +01:00
|
|
|
from ... import contracts as ct
|
2024-02-26 16:16:06 +01:00
|
|
|
from ... import sockets
|
|
|
|
from .. import base
|
|
|
|
|
2024-03-11 16:35:41 +01:00
|
|
|
class BoundCondsNode(base.MaxwellSimNode):
|
|
|
|
node_type = ct.NodeType.BoundConds
|
2024-02-26 16:16:06 +01:00
|
|
|
bl_label = "Bound Box"
|
|
|
|
#bl_icon = ...
|
|
|
|
|
|
|
|
####################
|
|
|
|
# - Sockets
|
|
|
|
####################
|
|
|
|
input_sockets = {
|
2024-03-11 16:35:41 +01:00
|
|
|
"+X": sockets.MaxwellBoundCondSocketDef(),
|
|
|
|
"-X": sockets.MaxwellBoundCondSocketDef(),
|
|
|
|
"+Y": sockets.MaxwellBoundCondSocketDef(),
|
|
|
|
"-Y": sockets.MaxwellBoundCondSocketDef(),
|
|
|
|
"+Z": sockets.MaxwellBoundCondSocketDef(),
|
|
|
|
"-Z": sockets.MaxwellBoundCondSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
}
|
|
|
|
output_sockets = {
|
2024-03-11 16:35:41 +01:00
|
|
|
"BCs": sockets.MaxwellBoundCondsSocketDef(),
|
2024-02-26 16:16:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
####################
|
|
|
|
# - Output Socket Computation
|
|
|
|
####################
|
2024-03-11 16:35:41 +01:00
|
|
|
@base.computes_output_socket(
|
|
|
|
"BCs",
|
|
|
|
input_sockets={"+X", "-X", "+Y", "-Y", "+Z", "-Z"}
|
|
|
|
)
|
|
|
|
def compute_simulation(self, input_sockets) -> td.BoundarySpec:
|
|
|
|
x_pos = input_sockets["+X"]
|
|
|
|
x_neg = input_sockets["-X"]
|
|
|
|
y_pos = input_sockets["+Y"]
|
|
|
|
y_neg = input_sockets["-Y"]
|
|
|
|
z_pos = input_sockets["+Z"]
|
|
|
|
z_neg = input_sockets["-Z"]
|
2024-02-26 16:16:06 +01:00
|
|
|
|
|
|
|
return td.BoundarySpec(
|
|
|
|
x=td.Boundary(
|
|
|
|
plus=x_pos,
|
|
|
|
minus=x_neg,
|
|
|
|
),
|
|
|
|
y=td.Boundary(
|
|
|
|
plus=y_pos,
|
|
|
|
minus=y_neg,
|
|
|
|
),
|
|
|
|
z=td.Boundary(
|
|
|
|
plus=z_pos,
|
|
|
|
minus=z_neg,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 14:28:35 +01:00
|
|
|
####################
|
|
|
|
# - Blender Registration
|
|
|
|
####################
|
2024-02-26 16:16:06 +01:00
|
|
|
BL_REGISTER = [
|
2024-03-11 16:35:41 +01:00
|
|
|
BoundCondsNode,
|
2024-02-26 16:16:06 +01:00
|
|
|
]
|
|
|
|
BL_NODES = {
|
2024-03-11 16:35:41 +01:00
|
|
|
ct.NodeType.BoundConds: (
|
|
|
|
ct.NodeCategory.MAXWELLSIM_BOUNDS
|
2024-02-26 16:16:06 +01:00
|
|
|
)
|
|
|
|
}
|