moved some functionality from interp.grid.simplex to interp.grid
This commit is contained in:
parent
86145803d4
commit
2796eaeed8
@ -18,46 +18,3 @@ def contains(X, R):
|
|||||||
if [i for i in phis if i < 0.0 - TOL]:
|
if [i for i in phis if i < 0.0 - TOL]:
|
||||||
r = False
|
r = False
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
class cell(object):
|
|
||||||
def __init__(self, name):
|
|
||||||
self.name = name
|
|
||||||
self.verts = []
|
|
||||||
self.neighbors = []
|
|
||||||
|
|
||||||
def add_vert(self, v):
|
|
||||||
"""
|
|
||||||
v should be an index into grid.verts
|
|
||||||
"""
|
|
||||||
self.verts.append(v)
|
|
||||||
|
|
||||||
def add_neighbor(self, n):
|
|
||||||
"""
|
|
||||||
reference to another cell object
|
|
||||||
"""
|
|
||||||
self.neighbors.append(n)
|
|
||||||
|
|
||||||
def contains(self, X, G):
|
|
||||||
"""
|
|
||||||
X = point of interest
|
|
||||||
G = corrensponding grid object (G.verts)
|
|
||||||
because of the way i'm storing things,
|
|
||||||
a cell simply stores indicies, and so one
|
|
||||||
must pass in a reference to the grid object
|
|
||||||
containing real verts.
|
|
||||||
|
|
||||||
this simply calls grid.simplex.contains
|
|
||||||
"""
|
|
||||||
return contains(X, [G.verts[i] for i in self.verts])
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
neighbors = [str(i.name) for i in self.neighbors]
|
|
||||||
return '<cell %s: verts: %s neighbors: [%s]>' %\
|
|
||||||
(
|
|
||||||
self.name,
|
|
||||||
self.verts,
|
|
||||||
", ".join(neighbors)
|
|
||||||
)
|
|
||||||
|
|
||||||
__repr__ = __str__
|
|
||||||
|
Loading…
Reference in New Issue
Block a user