示例#1
0
    def calcdne(self):
        """Method for calculating surface Dirichlet normal energy and populating instance variables."""
        # creation of dictionary of vertex keys and face values     
        self._get_vert_tri_dict()
        
        # optional implicit smooth of mesh
        if self.dosmooth == 1:
            self.Mesh = pcopy(self.Mesh)
            self.Mesh.vertices = implicitfair.smooth(self.Mesh.vertices, self.Mesh.faces, int(self.smoothit), float(self.smoothstep), self.vert_tri_dict)
            if self.Mesh.vertices == "!":
                print "Cholesky error"
                return "!"    

        # creation of array of vertices per edge
        self._get_edge_verts()
        # list of boundary faces
        self._get_boundary_faces()
        
        # arrays of normalized face normals and vertex normals approximated from adjacent faces
        self.vnormal, self.fnormal = normcore.computenormal(self.Mesh.vertices, self.Mesh.faces, self.Mesh.triverts, self.vert_tri_dict)
        # array of e(p) and face area for polygons across mesh
        
        self._energize_surface()
        
        self._sumdne()
示例#2
0
 def calcopcr(self):
     """Method for calculating OPCR and associated variables from surface mesh. Calls internal methods."""
     self.Mesh = pcopy(self.Mesh)
     self.Mesh.vertices = self._centermesh(self.Mesh.vertices)
     self.MeshRotated = pcopy(self.Mesh)
     
     self._get_vert_tri_dict()
     
     self.opc_list[0], self.patches_list[0], self.colormap_list[0] = self._get_opc(self.Mesh.vertices, 
                                                                                   self.Mesh.faces, 
                                                                                   self.Mesh.triverts)
     
     for i in range(1,self.n_rotations):
             self._rotatemesh()
             self.opc_list[i], self.patches_list[i], self.colormap_list[i] = self._get_opc(self.MeshRotated.vertices, 
                                                                                           self.MeshRotated.faces, 
                                                                                           self.MeshRotated.triverts)
     
     self.OPCR = average(self.opc_list)
    def execute(self, stmt, arguments=None, namemapping=None, ignored=None):
        """Execute a statement.

           Arguments:
           - stmt: the statement to execute
           - arguments: a mapping with the arguments. Default: None.
           - namemapping: a mapping of names such that if stmt uses %(arg)s
             and namemapping[arg]=arg2, the value arguments[arg2] is used
             instead of arguments[arg]
           - ignored: An ignored argument only present to accept the same
             number of arguments as ConnectionWrapper.execute
        """
        if namemapping and arguments:
            arguments = pygrametl.copy(arguments, **namemapping)
        else:
            arguments = pcopy(arguments)
        self.__queue.put((stmt, arguments))
    def execute(self, stmt, arguments=None, namemapping=None, ignored=None):
        """Execute a statement.

           Arguments:
           - stmt: the statement to execute
           - arguments: a mapping with the arguments. Default: None.
           - namemapping: a mapping of names such that if stmt uses %(arg)s
             and namemapping[arg]=arg2, the value arguments[arg2] is used
             instead of arguments[arg]
           - ignored: An ignored argument only present to accept the same
             number of arguments as ConnectionWrapper.execute
        """
        if namemapping and arguments:
            arguments = pygrametl.copy(arguments, **namemapping)
        else:
            arguments = pcopy(arguments)
        self.__queue.put((stmt, arguments))