How to use the meshplex.base.compute_triangle_circumcenters function in meshplex

To help you get started, we’ve selected a few meshplex 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 / meshplex / meshplex / mesh_tetra.py View on Github external
from matplotlib import pyplot as plt

        fig = plt.figure()
        ax = fig.gca(projection=Axes3D.name)
        # "It is not currently possible to manually set the aspect on 3D axes"
        # plt.axis("equal")

        if self._circumcenters is None:
            self._compute_cell_circumcenters()

        X = self.node_coords
        for cell_id in range(len(self.cells["nodes"])):
            cc = self._circumcenters[cell_id]
            #
            x = X[self.node_face_cells[..., [cell_id]]]
            face_ccs = compute_triangle_circumcenters(x, self.ei_dot_ei, self.ei_dot_ej)
            # draw the face circumcenters
            ax.plot(
                face_ccs[..., 0].flatten(),
                face_ccs[..., 1].flatten(),
                face_ccs[..., 2].flatten(),
                "go",
            )
            # draw the connections
            #   tet circumcenter---face circumcenter
            for face_cc in face_ccs:
                ax.plot(
                    [cc[..., 0], face_cc[..., 0]],
                    [cc[..., 1], face_cc[..., 1]],
                    [cc[..., 2], face_cc[..., 2]],
                    "b-",
                )
github nschloe / meshplex / meshplex / mesh_tetra.py View on Github external
renderer.AddActor(
                get_sphere_actor(
                    self.cell_incenters[cell_id],
                    self.cell_inradius[cell_id],
                    insphere_rgba,
                )
            )

        if barycenter_rgba is not None:
            renderer.AddActor(
                get_sphere_actor(self.cell_barycenters[cell_id], r, barycenter_rgba)
            )

        if face_circumcenter_rgba is not None:
            x = self.node_coords[self.node_face_cells[..., [cell_id]]]
            face_ccs = compute_triangle_circumcenters(
                x, self.ei_dot_ei, self.ei_dot_ej
            )[:, 0, :]
            for f in face_ccs:
                renderer.AddActor(get_sphere_actor(f, r, face_circumcenter_rgba))

        if control_volume_boundaries_rgba:
            cell_cc = self.cell_circumcenters[cell_id]
            x = self.node_coords[self.node_face_cells[..., [cell_id]]]
            face_ccs = compute_triangle_circumcenters(
                x, self.ei_dot_ei, self.ei_dot_ej
            )[:, 0, :]
            for face, face_cc in zip(range(4), face_ccs):
                for edge in range(3):
                    k0, k1 = self.idx_hierarchy[:, edge, face, cell_id]
                    edge_midpoint = 0.5 * (self.node_coords[k0] + self.node_coords[k1])
github nschloe / meshplex / meshplex / mesh_tri.py View on Github external
def cell_circumcenters(self):
        """
        """
        if self._cell_circumcenters is None:
            node_cells = self.cells["nodes"].T
            self._cell_circumcenters = compute_triangle_circumcenters(
                self.node_coords[node_cells], self.ei_dot_ei, self.ei_dot_ej
            )
        return self._cell_circumcenters
github nschloe / meshplex / meshplex / mesh_tetra.py View on Github external
for adj_edge_id in adj_edge_ids:
            x = self.node_coords[self.edges["nodes"][adj_edge_id]]
            ax.plot(x[:, 0], x[:, 1], x[:, 2], col)

        # make clear which is edge_id
        x = self.node_coords[self.edges["nodes"][edge_id]]
        ax.plot(x[:, 0], x[:, 1], x[:, 2], color=col, linewidth=3.0)

        # connect the face circumcenters with the corresponding cell
        # circumcenters
        X = self.node_coords
        for cell_id in adj_cell_ids:
            cc = self._circumcenters[cell_id]
            #
            x = X[self.node_face_cells[..., [cell_id]]]
            face_ccs = compute_triangle_circumcenters(x, self.ei_dot_ei, self.ei_dot_ej)
            # draw the face circumcenters
            ax.plot(
                face_ccs[..., 0].flatten(),
                face_ccs[..., 1].flatten(),
                face_ccs[..., 2].flatten(),
                "go",
            )
            # draw the connections
            #   tet circumcenter---face circumcenter
            for face_cc in face_ccs:
                ax.plot(
                    [cc[..., 0], face_cc[..., 0]],
                    [cc[..., 1], face_cc[..., 1]],
                    [cc[..., 2], face_cc[..., 2]],
                    "b-",
                )