(
        self,
        irad,
        orad,
        mesh_size=None,
        R=np.eye(3),
        x0=np.array([0.0, 0.0, 0.0]),
    )
Create Gmsh code for the torus under the coordinate transformation

        .. math::
            \\hat{x} = R x + x_0.

        :param irad: inner radius of the torus
        :param orad: outer radius of the torus
Create Gmsh code for the torus under the coordinate transformation
Create Gmsh code for the torus under the coordinate transformation
def _add_torus_extrude_circle(
        self,
        irad,
        orad,
        mesh_size=None,
        R=np.eye(3),
        x0=np.array([0.0, 0.0, 0.0]),
    ):
        """Create Gmsh code for the torus under the coordinate transformation

        .. math::
            \\hat{x} = R x + x_0.

        :param irad: inner radius of the torus
        :param orad: outer radius of the torus
        """
        # Add circle
        x0t = np.dot(R, np.array([0.0, orad, 0.0]))
        Rc = np.array([[0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
        c = self.add_circle(x0 + x0t, irad, mesh_size=mesh_size, R=np.dot(R, Rc))

        rot_axis = [0.0, 0.0, 1.0]
        rot_axis = np.dot(R, rot_axis)
        point_on_rot_axis = [0.0, 0.0, 0.0]
        point_on_rot_axis = np.dot(R, point_on_rot_axis) + x0

        # Form the torus by extruding the circle three times by 2/3*pi. This
        # works around the inability of Gmsh to extrude by pi or more. The
        # Extrude() macro returns an array; the first [0] entry in the array is
        # the entity that has been extruded at the far end. This can be used
        # for the following Extrude() step.  The second [1] entry of the array
        # is the surface that was created by the extrusion. The third [2-end]
        # is a list of all the planes of the lateral surface.
        previous = c.plane_surface
        all_volumes = []
        num_steps = 3
        for _ in range(num_steps):
            top, vol, _ = self.revolve(
                previous,
                rotation_axis=rot_axis,
                point_on_axis=point_on_rot_axis,
                angle=2 * np.pi / num_steps,
            )
            previous = top
            all_volumes.append(vol)

        assert int(gmsh.__version__.split(".")[0])
        self._COMPOUND_ENTITIES.append((3, [v._id for v in all_volumes]))
def _add_torus_extrude_circle ( self , irad , orad , mesh_size = None , R = np . eye ( 3 ) , x0 = np . array ( [ 0.0 , 0.0 , 0.0 ] ) , ) : # Add circle x0t = np . dot ( R , np . array ( [ 0.0 , orad , 0.0 ] ) ) Rc = np . array ( [ [ 0.0 , 0.0 , 1.0 ] , [ 1.0 , 0.0 , 0.0 ] , [ 0.0 , 1.0 , 0.0 ] ] ) c = self . add_circle ( x0 + x0t , irad , mesh_size = mesh_size , R = np . dot ( R , Rc ) ) rot_axis = [ 0.0 , 0.0 , 1.0 ] rot_axis = np . dot ( R , rot_axis ) point_on_rot_axis = [ 0.0 , 0.0 , 0.0 ] point_on_rot_axis = np . dot ( R , point_on_rot_axis ) + x0 # Form the torus by extruding the circle three times by 2/3*pi. This # works around the inability of Gmsh to extrude by pi or more. The # Extrude() macro returns an array; the first [0] entry in the array is # the entity that has been extruded at the far end. This can be used # for the following Extrude() step.  The second [1] entry of the array # is the surface that was created by the extrusion. The third [2-end] # is a list of all the planes of the lateral surface. previous = c . plane_surface all_volumes = [ ] num_steps = 3 for _ in range ( num_steps ) : top , vol , _ = self . revolve ( previous , rotation_axis = rot_axis , point_on_axis = point_on_rot_axis , angle = 2 * np . pi / num_steps , ) previous = top all_volumes . append ( vol ) assert int ( gmsh . __version__ . split ( "." ) [ 0 ] ) self . _COMPOUND_ENTITIES . append ( ( 3 , [ v . _id for v in all_volumes ] ) )