How to use the pygmsh.built_in.surface.Surface 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 / geometry.py View on Github external
def add_surface(self, *args, **kwargs):
        s = Surface(*args, api_level=self._gmsh_major(), **kwargs)
        self._GMSH_CODE.append(s.code)
        return s
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(
                tpe, label, ", ".join([e.id for e in entities])
            )
        )
github nschloe / pygmsh / pygmsh / built_in / surface.py View on Github external
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