Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_plane_surface(self, *args, **kwargs):
p = PlaneSurface(*args, **kwargs)
self._GMSH_CODE.append(p.code)
return p
def set_transfinite_surface(self, surface, size=None, orientation=None):
assert surface.num_edges == 4, "a transfinite surface can only have 4 sides"
# size is not mandatory because in general a user can create it's own
# transfinite lines and then just tell gmsh that the surface is
# transfinite too
if size is not None:
assert isinstance(
surface, (PlaneSurface, Surface, self.Polygon)
), "we can create transfinite lines only if we have a line loop"
self.set_transfinite_lines(
[surface.line_loop.lines[0], surface.line_loop.lines[2]], size[0]
)
self.set_transfinite_lines(
[surface.line_loop.lines[1], surface.line_loop.lines[3]], size[1]
)
code = f"Transfinite Surface {{{surface.id}}}"
if orientation is not None:
code += " " + orientation
self._GMSH_CODE.append(code + ";")
return