Problem
Currently the geometry is defined by specifying an epf(x,y) function and a muf(x,y) function,
geometry = Geometry(epf, muf, ...)
This is straightforward for simple geometries but it becomes cumbersome if the geometry is made of multiple shapes.
We should introduce an additional interface for creating geometries,
geometry = Geometry(shapes, ...)
where shapes is a (nested) list of AbstractShape subtypes, eg
# accept nested list so we can use list comprehensions inside
shapes = [
Circle(r,ep=4),
[Rectangle(Lx,Ly,ep=3,origin=[n,0]) for n in -1:1]
]
and epf(x,y) and muf(x,y) are automatically generated from the flattened shapes, working in reverse order such that the last shape is on top.
Shapes
We should include some simple shapes and transforms for defining geometry, such as Ellipse or Rectangle. For example these shapes are available in meep:
https://meep.readthedocs.io/en/latest/Python_User_Interface/#geometricobject
We should also include a Background shape if the user wants to override the default values of ep=1 and mu=1, eg
shapes = [Circle(ep=4)] # assumes background is ep=1, mu=1
shapes = [Background(ep=2), Circle(ep=4)] # overrides default background
Shapes should default to ep=1, mu=1, origin=[0,0], angle=0, with dimensions (eg radius) as the positional arguments.
Transforms and piping
We can make use of Julia's function composition/piping for a nice interface:
https://docs.julialang.org/en/v1/manual/functions/#Function-composition-and-piping
Desired interface:
ellipses = [Ellipse(r1,r2,ep=11.7) |> translate(R,0) |> rotate(60n) for n in 1:6]
geometry = Geometry(ellipses, 1, a1, a2, d1, d2)

Problem
Currently the geometry is defined by specifying an
epf(x,y)function and amuf(x,y)function,This is straightforward for simple geometries but it becomes cumbersome if the geometry is made of multiple shapes.
We should introduce an additional interface for creating geometries,
where
shapesis a (nested) list ofAbstractShapesubtypes, egand
epf(x,y)andmuf(x,y)are automatically generated from the flattenedshapes, working in reverse order such that the last shape is on top.Shapes
We should include some simple shapes and transforms for defining geometry, such as
EllipseorRectangle. For example these shapes are available in meep:https://meep.readthedocs.io/en/latest/Python_User_Interface/#geometricobject
We should also include a
Backgroundshape if the user wants to override the default values ofep=1andmu=1, egShapes should default to
ep=1,mu=1,origin=[0,0],angle=0, with dimensions (eg radius) as the positional arguments.Transforms and piping
We can make use of Julia's function composition/piping for a nice interface:
https://docs.julialang.org/en/v1/manual/functions/#Function-composition-and-piping
Desired interface: