Skip to content

Commit

Permalink
simplify Point
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed Mar 31, 2019
1 parent 8900e69 commit 73d48cb
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions pygmsh/built_in/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,13 @@ def __init__(self, x, lcar=None):
self.lcar = lcar

# Points are always 3D in gmsh
if lcar is not None:
self.code = "\n".join(
[
"{} = newp;".format(self.id),
"Point({}) = {{{!r}, {!r}, {!r}, {!r}}};".format(
self.id, x[0], x[1], x[2], lcar
),
]
)
else:
self.code = "\n".join(
[
"{} = newp;".format(self.id),
"Point({}) = {{{!r}, {!r}, {!r}}};".format(
self.id, x[0], x[1], x[2]
),
]
)
args = (x[0], x[1], x[2]) if lcar is None else (x[0], x[1], x[2], lcar)
fmt = ", ".join(len(args) * ["{!r}"])

self.code = "\n".join(
[
"{} = newp;".format(self.id),
("Point({}) = {{" + fmt + "}};").format(self.id, *args),
]
)
return

0 comments on commit 73d48cb

Please sign in to comment.