def get_mesh(self, resolution, target_order):
        from meshmode.mesh.io import generate_gmsh, FileSource
        base_mesh = generate_gmsh(
                FileSource("ellipsoid.step"), 2, order=2,
                other_options=[
                    "-string",
                    "Mesh.CharacteristicLengthMax = %g;" % resolution])

        from meshmode.mesh.processing import perform_flips
        # Flip elements--gmsh generates inside-out geometry.
        base_mesh = perform_flips(base_mesh, np.ones(base_mesh.nelements))

        from meshmode.mesh.processing import affine_map, merge_disjoint_meshes
        from meshmode.mesh.tools import rand_rotation_matrix
        pitch = 10
        meshes = [
                affine_map(
                    base_mesh,
                    A=rand_rotation_matrix(3),
                    b=pitch*np.array([
                        (ix-self.nx//2),
                        (iy-self.ny//2),
                        (iz-self.ny//2)]))
                for ix in range(self.nx)
                for iy in range(self.ny)
                for iz in range(self.nz)
                ]

        mesh = merge_disjoint_meshes(meshes, single_group=True)
        return mesh
    def get_mesh(self, resolution, target_order):
        from meshmode.mesh.io import generate_gmsh, FileSource
        base_mesh = generate_gmsh(FileSource("ellipsoid.step"),
                                  2,
                                  order=2,
                                  other_options=[
                                      "-string",
                                      "Mesh.CharacteristicLengthMax = %g;" %
                                      resolution
                                  ])

        from meshmode.mesh.processing import perform_flips
        # Flip elements--gmsh generates inside-out geometry.
        base_mesh = perform_flips(base_mesh, np.ones(base_mesh.nelements))

        from meshmode.mesh.processing import affine_map, merge_disjoint_meshes
        from meshmode.mesh.tools import rand_rotation_matrix
        pitch = 10
        meshes = [
            affine_map(base_mesh,
                       A=rand_rotation_matrix(3),
                       b=pitch * np.array([(ix - self.nx // 2),
                                           (iy - self.ny // 2),
                                           (iz - self.ny // 2)]))
            for ix in range(self.nx) for iy in range(self.ny)
            for iz in range(self.nz)
        ]

        mesh = merge_disjoint_meshes(meshes, single_group=True)
        return mesh