How to use the pygmsh.built_in.point.Point function in pygmsh

To help you get started, we’ve selected a few pygmsh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / pygmsh / pygmsh / built_in / ellipse_arc.py View on Github external
def __init__(self, start, center, point_on_major_axis, end):
        super().__init__()

        assert isinstance(start, Point)
        assert isinstance(center, Point)
        assert isinstance(point_on_major_axis, Point)
        assert isinstance(end, Point)

        self.start = start
        self.center = center
        self.point_on_major_axis = point_on_major_axis
        self.end = end

        self.code = "\n".join(
            [
                f"{self.id} = newl;",
                "Ellipse({}) = {{{}, {}, {}, {}}};".format(
                    self.id, start.id, center.id, point_on_major_axis.id, end.id
                ),
            ]
github nschloe / pygmsh / pygmsh / built_in / geometry.py View on Github external
def add_point(self, *args, **kwargs):
        p = Point(*args, **kwargs)
        self._GMSH_CODE.append(p.code)
        return p
github nschloe / pygmsh / pygmsh / built_in / circle_arc.py View on Github external
def __init__(self, start, center, end):
        super().__init__()

        assert isinstance(start, Point)
        assert isinstance(center, Point)
        assert isinstance(end, Point)

        self.start = start
        self.center = center
        self.end = end

        self.code = "\n".join(
            [
                f"{self.id} = newl;",
                "Circle({}) = {{{}, {}, {}}};".format(
                    self.id, start.id, center.id, end.id
                ),
            ]
        )
        return
github nschloe / pygmsh / pygmsh / built_in / line.py View on Github external
def __init__(self, p0, p1):
        super().__init__()

        assert isinstance(p0, Point)
        assert isinstance(p1, Point)
        self.points = [p0, p1]

        self.code = "\n".join(
            [f"{self.id} = newl;", f"Line({self.id}) = {{{p0.id}, {p1.id}}};"]
        )
        return
github nschloe / pygmsh / pygmsh / built_in / ellipse_arc.py View on Github external
def __init__(self, start, center, point_on_major_axis, end):
        super().__init__()

        assert isinstance(start, Point)
        assert isinstance(center, Point)
        assert isinstance(point_on_major_axis, Point)
        assert isinstance(end, Point)

        self.start = start
        self.center = center
        self.point_on_major_axis = point_on_major_axis
        self.end = end

        self.code = "\n".join(
            [
                f"{self.id} = newl;",
                "Ellipse({}) = {{{}, {}, {}, {}}};".format(
                    self.id, start.id, center.id, point_on_major_axis.id, end.id
                ),
            ]
        )
        return
github nschloe / pygmsh / pygmsh / built_in / line.py View on Github external
def __init__(self, p0, p1):
        super().__init__()

        assert isinstance(p0, Point)
        assert isinstance(p1, Point)
        self.points = [p0, p1]

        self.code = "\n".join(
            [f"{self.id} = newl;", f"Line({self.id}) = {{{p0.id}, {p1.id}}};"]
        )
        return
github nschloe / pygmsh / pygmsh / built_in / bspline.py View on Github external
def __init__(self, control_points):
        super().__init__()

        for c in control_points:
            assert isinstance(c, Point)
        assert len(control_points) > 1

        self.control_points = control_points

        self.code = "\n".join(
            [
                f"{self.id} = newl;",
                "BSpline({}) = {{{}}};".format(
                    self.id, ", ".join([c.id for c in self.control_points])
                ),
            ]
        )
        return
github nschloe / pygmsh / pygmsh / built_in / spline.py View on Github external
def __init__(self, points):
        super().__init__()

        for c in points:
            assert isinstance(c, Point)
        assert len(points) > 1

        self.points = points

        self.code = "\n".join(
            [
                f"{self.id} = newl;",
                "Spline({}) = {{{}}};".format(
                    self.id, ", ".join([c.id for c in self.points])
                ),
            ]
        )
        return
github nschloe / pygmsh / pygmsh / built_in / geometry.py View on Github external
def add_physical(self, entities, label=None):
        if not isinstance(entities, list):
            entities = [entities]

        d = {0: "Point", 1: "Line", 2: "Surface", 3: "Volume"}
        tpe = d[entities[0].dimension]

        for e in entities:
            assert isinstance(
                e,
                (
                    Point,
                    PointBase,
                    LineBase,
                    Surface,
                    PlaneSurface,
                    SurfaceBase,
                    Volume,
                    VolumeBase,
                ),
            ), "Can add physical groups only for Points, Lines, Surfaces, Volumes, not {}.".format(
                type(e)
            )
            assert d[e.dimension] == tpe

        label = self._new_physical_group(label)
        self._GMSH_CODE.append(
            "Physical {}({}) = {{{}}};".format(