MCPcopy Create free account
hub / github.com/NanoComp/meep / get_center_and_size

Function get_center_and_size

python/simulation.py:6184–6205  ·  view source on GitHub ↗

Utility function that takes a `meep::volume` `vol` and returns the center and size of the volume as a tuple of `Vector3`.

(vol)

Source from the content-addressed store, hash-verified

6182
6183# extract center and size of a meep::volume
6184def get_center_and_size(vol):
6185 """
6186 Utility function that takes a `meep::volume` `vol` and returns the center and size of
6187 the volume as a tuple of `Vector3`.
6188 """
6189 rmin = vol.get_min_corner()
6190 rmax = vol.get_max_corner()
6191 v3rmin = mp.Vector3(rmin.x(), rmin.y(), rmin.z())
6192 v3rmax = mp.Vector3(rmax.x(), rmax.y(), rmax.z())
6193
6194 if vol.dim == mp.D2:
6195 v3rmin.z = 0
6196 v3rmax.z = 0
6197 elif vol.dim == mp.D1:
6198 v3rmin.x = 0
6199 v3rmin.y = 0
6200 v3rmin.y = 0
6201 v3rmax.y = 0
6202
6203 center = 0.5 * (v3rmin + v3rmax)
6204 size = v3rmax - v3rmin
6205 return center, size
6206
6207
6208def GDSII_layers(fname):

Callers 1

GDSII_volFunction · 0.85

Calls 5

get_min_cornerMethod · 0.80
get_max_cornerMethod · 0.80
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected