created a test for tesing the cubic interpolation
This commit is contained in:
@@ -88,9 +88,9 @@ class grid(object):
|
||||
(dist, indicies) = self.tree.query(X, 2)
|
||||
|
||||
simplex = None
|
||||
for i in self.facets_for_point[indicies[0]]:
|
||||
if i.contains(X, self):
|
||||
simplex = i
|
||||
for facet in self.facets_for_point[indicies[0]]:
|
||||
if facet.contains(X, self):
|
||||
simplex = facet
|
||||
break
|
||||
|
||||
if not simplex:
|
||||
|
||||
+22
-8
@@ -1,13 +1,17 @@
|
||||
from baker import get_phis
|
||||
|
||||
TOL = 1e-3
|
||||
TOL = 1e-8
|
||||
|
||||
def contains(X, R):
|
||||
phis = get_phis(X, R)
|
||||
r = True
|
||||
if [i for i in phis if i < 0.0 - TOL]:
|
||||
r = False
|
||||
return r
|
||||
"""
|
||||
tests if X (point) is in R (a simplex,
|
||||
represented by a list of n-degree coordinates)
|
||||
"""
|
||||
phis = get_phis(X, R)
|
||||
r = True
|
||||
if [i for i in phis if i < 0.0 - TOL]:
|
||||
r = False
|
||||
return r
|
||||
|
||||
|
||||
class face(object):
|
||||
@@ -28,8 +32,18 @@ class face(object):
|
||||
"""
|
||||
self.neighbors.append(n)
|
||||
|
||||
def contains(self, X, grid):
|
||||
return contains(X, grid.points)
|
||||
def contains(self, X, G):
|
||||
"""
|
||||
X = point of interest
|
||||
G = corrensponding grid object (G.points)
|
||||
because of the way i'm storing things,
|
||||
a face simply stores indicies, and so one
|
||||
must pass in a reference to the grid object
|
||||
containing real points.
|
||||
|
||||
this simply calls grid.simplex.contains
|
||||
"""
|
||||
return contains(X, [G.points[i] for i in self.verts])
|
||||
|
||||
def __str__(self):
|
||||
neighbors = [i.name for i in self.neighbors]
|
||||
|
||||
Reference in New Issue
Block a user