コード例 #1
0
    def get_faces(self):
        """
        This method computes the indices and coordinates of all faces.

        The composition of the i-th and the j-th reflection is a rotation
        which fixes a base face f. The stabilizing group of f is generated
        by (i, j) or [(i,), (j,)] depends on whether the two mirrors are both
        active or exactly one of them is active and the they are not perpendicular
        to each other.
        """
        for i, j in combinations(self.symmetry_gens, 2):
            f0 = []
            m = self.coxeter_matrix[i][j]
            if self.active[i] and self.active[j]:
                fgens = [(i, j)]
                for k in range(m):
                    # rotate the base edge m times to get the base f,
                    # where m = self.coxeter_matrix[i][j]
                    f0.append(self.move(0, (i, j) * k))
                    f0.append(self.move(0, (j,) + (i, j) * k))
            elif self.active[i] and m > 2:
                fgens = [(i,), (j,)]
                for k in range(m):
                    f0.append(self.move(0, (i, j) * k))
            elif self.active[j] and m > 2:
                fgens = [(i,), (j,)]
                for k in range(m):
                    f0.append(self.move(0, (i, j) * k))
            else:
                continue

            ftable = CosetTable(self.symmetry_gens, self.symmetry_rels, fgens)
            ftable.run()
            words = ftable.get_words()
            flist = []
            for word in words:
                f = tuple(self.move(v, word) for v in f0)
                if not helpers.check_duplicate_face(f, flist):
                    flist.append(f)

            self.face_indices.append(flist)
            self.face_coords.append([tuple(self.vertex_coords[x] for x in face)
                                     for face in flist])

        self.num_faces = sum([len(flist) for flist in self.face_indices])
コード例 #2
0
ファイル: models.py プロジェクト: whitefirer/pywonderland
 def get_edges(self):
     for i, active in enumerate(self.active):
         if active:
             egens = [(i, )]
             etable = CosetTable(self.symmetry_gens, self.symmetry_rels,
                                 egens)
             etable.run()
             words = etable.get_words()
             elist = []
             for word in words:
                 # two ends of this edge
                 v1 = self._move(0, word)
                 v2 = self._move(0, (i, ) + word)
                 # remove duplicates
                 if (v1, v2) not in elist and (v2, v1) not in elist:
                     elist.append((v1, v2))
             self.edge_indices.append(elist)
             self.edge_coords.append([(self.vertex_coords[x],
                                       self.vertex_coords[y])
                                      for x, y in elist])
     self.num_edges = sum([len(elist) for elist in self.edge_indices])
コード例 #3
0
ファイル: models.py プロジェクト: tuchang/pywonderland
    def get_vertices(self):
        """
        This method computes the following data that will be needed later:

        1. Coset table for the total symmetry group. (so for a vertex indexed by `i`
           and a word `w` we can get the index of the transformed vertex `i·w`)

        2. Word representaions for each element in the symmetry group. (for exporting
           the words to latex format)

        3. Coordinates of the vertices. (obviously we will need this)
        """
        # generators for the stabilizing subgroup of the initial vertex.
        vgens = [(i,) for i, active in enumerate(self.active) if not active]
        # build the coset table
        self._vtable = CosetTable(self.symmetry_gens, self.symmetry_rels, vgens)
        # run the table
        self._vtable.run()
        # get word representaions for the cosets
        self._vwords = self._vtable.get_words()
        # number the vertices
        self.num_vertices = len(self._vwords)
        # use the word representaions to transform the initial vertex to other vertices
        self.vertex_coords = tuple(self._transform(self.init_v, word) for word in self._vwords)
コード例 #4
0
ファイル: models.py プロジェクト: zzdpk2/pywonderland
 def get_vertices(self):
     self.vtable = CosetTable(self.symmetry_gens, self.symmetry_rels, coxeter=False)
     self.vtable.run()
     self.vwords = self.vtable.get_words()
     self.num_vertices = len(self.vwords)
     self.vertex_coords = tuple(self.transform(self.init_v, w) for w in self.vwords)