simplified a module, and adjusted tests for imports

This commit is contained in:
sm
2011-06-07 21:43:03 -06:00
parent 0eb9c4102d
commit b54272bb85
6 changed files with 32 additions and 32 deletions
+22 -2
View File
@@ -8,7 +8,7 @@ import numpy as np
from scipy.spatial import KDTree
from interp.baker import run_baker
import interp.grid.simplex
from interp.baker import get_phis
import logging
log = logging.getLogger("interp")
@@ -233,7 +233,7 @@ class cell(object):
this simply calls grid.simplex.contains
"""
return interp.grid.simplex.contains(X, [G.verts[i] for i in self.verts])
return contains(X, [G.verts[i] for i in self.verts])
def __str__(self):
# neighbors = [str(i.name) for i in self.neighbors]
@@ -246,3 +246,23 @@ class cell(object):
)
__repr__ = __str__
TOL = 1e-8
def contains(X, R):
"""
tests if X (point) is in R
R is a simplex, represented by a list of n-degree coordinates
it now correctly checks for 2/3-D verts
TODO: write unit test ...
"""
phis = get_phis(X, R)
r = True
if [i for i in phis if i < 0.0 - TOL]:
r = False
return r
-20
View File
@@ -1,20 +0,0 @@
from interp.baker import get_phis
TOL = 1e-8
def contains(X, R):
"""
tests if X (point) is in R
R is a simplex, represented by a list of n-degree coordinates
it now correctly checks for 2/3-D verts
TODO: write unit test ...
"""
phis = get_phis(X, R)
r = True
if [i for i in phis if i < 0.0 - TOL]:
r = False
return r