Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, line_loop, api_level=2):
assert isinstance(line_loop, LineLoop)
self.line_loop = line_loop
self.id = f"rs{Surface._ID}"
Surface._ID += 1
# `Ruled Surface` was deprecated in Gmsh 3 in favor of `Surface`.
name = "Surface" if api_level > 2 else "Ruled Surface"
self.code = "\n".join(
[f"{self.id} = news;", f"{name}({self.id}) = {{{self.line_loop.id}}};"]
)
self.num_edges = len(line_loop)
return
def __init__(self, lines):
self.lines = lines
self.id = f"ll{LineLoop._ID}"
LineLoop._ID += 1
self.code = "\n".join(
[
f"{self.id} = newll;",
"Line Loop({}) = {{{}}};".format(
self.id, ", ".join([l.id for l in lines])
),
]
)
return
def add_line_loop(self, *args, **kwargs):
p = LineLoop(*args, **kwargs)
self._GMSH_CODE.append(p.code)
return p
def __init__(self, line_loop, holes=None):
super().__init__()
assert isinstance(line_loop, LineLoop)
self.line_loop = line_loop
if holes is None:
holes = []
# The input holes are either line loops or entities that contain line
# loops (like polygons).
self.holes = [h if isinstance(h, LineLoop) else h.line_loop for h in holes]
line_loops = [self.line_loop] + self.holes
self.code = "\n".join(
[
f"{self.id} = news;",
"Plane Surface({}) = {{{}}};".format(
self.id, ",".join([ll.id for ll in line_loops])
),
]
)
self.num_edges = len(self.line_loop) + sum(len(h) for h in self.holes)
return
def __init__(self, line_loop, holes=None):
super().__init__()
assert isinstance(line_loop, LineLoop)
self.line_loop = line_loop
if holes is None:
holes = []
# The input holes are either line loops or entities that contain line
# loops (like polygons).
self.holes = [h if isinstance(h, LineLoop) else h.line_loop for h in holes]
line_loops = [self.line_loop] + self.holes
self.code = "\n".join(
[
f"{self.id} = news;",
"Plane Surface({}) = {{{}}};".format(
self.id, ",".join([ll.id for ll in line_loops])
),