Пример #1
0
    def update_edge_quality(self,edges=None):
        # First part is calculating the values
        if edges is None:
            edges=slice(None)
        g=self.grid
        vc=g.cells_center()
        ec=g.edges_center()
        g.edge_to_cells()

        c2c=mag( vc[g.edges['cells'][edges,0]] - vc[g.edges['cells'][edges,1]] )
        A=g.cells_area()
        Acc= A[g.edges['cells'][edges,:]].sum(axis=1)
        c2c=c2c / np.sqrt(Acc) # normalized
        c2c[ np.any(g.edges['cells'][edges,:]<0,axis=1) ] = np.inf
        g.edges['edge_quality'][edges]=c2c
Пример #2
0
 def distance_to_cell(self,pnt,c):
     if not self.grid:
         return 1e6
     return mag( self.grid.cells_center()[c] - np.asarray(pnt) )
Пример #3
0
 def distance_to_node(self,pnt,i):
     """ compute distance from the given point to the given node, returned in
     physical distance units [meters]"""
     if not self.grid:
         return 1e6
     return mag( self.grid.nodes['x'][i] - np.asarray(pnt) )