minor updates

This commit is contained in:
seogi_macbook
2016-01-28 16:36:24 -08:00
parent 2aa2490f64
commit e3a22a713f
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -4,6 +4,7 @@ from Tests import checkDerivative
from PropMaps import PropMap, Property
from numpy.polynomial import polynomial
from scipy.interpolate import UnivariateSpline
from scipy.spatial import cKDTree
class IdentityMap(object):
"""
@@ -475,8 +476,7 @@ class Mesh2MeshTopo(IdentityMap):
# Old version using SimPEG interpolation
# self.P = self.mesh2.getInterpolationMat(self.mesh.gridCC,'CC',zerosOutside=True)
from scipy.interpolate import NearestNDInterpolator
def genActiveindfromTopo(mesh, xyztopo):
#TODO: This possibly needs to be improved use vtk(?)
if mesh.dim==3:
@@ -501,7 +501,7 @@ class Mesh2MeshTopo(IdentityMap):
"""
if self.tree==None:
self.tree = cKDTree(zip(self.mesh.gridCC[self.actind,0], self.mesh.gridCC[self.actind,1], self.mesh.gridCC[self.actind,2]))
d, inds = tree.query(zip(self.mesh2.gridCC[self.actind2,0],self.mesh2.gridCC[self.actind2,1],self.mesh2.gridCC[self.actind2,2]), k=self.nIterpPts)
d, inds = self.tree.query(zip(self.mesh2.gridCC[self.actind2,0],self.mesh2.gridCC[self.actind2,1],self.mesh2.gridCC[self.actind2,2]), k=self.nIterpPts)
w = 1./ d**2
w = Utils.sdiag(1./np.sum(w, axis=1)) * w
I = Utils.mkvc(np.arange(inds.shape[0]).reshape([-1,1]).repeat(6, axis=1))
+4 -4
View File
@@ -254,7 +254,7 @@ class GlobalProblem(BaseProblem):
Utils.setKwargs(self, **kwargs)
assert isinstance(globalMesh, Mesh.BaseMesh), "globalMesh must be a SimPEG.Mesh object."
self.globalMesh = globalMesh
self.mapping = mapping or Maps.IdentityMap(mesh)
self.mapping = mapping or Maps.IdentityMap()
@property
def groups(self):
@@ -313,13 +313,13 @@ class GlobalProblem(BaseProblem):
if self.nGroups is not len(self.meshes):
raise Exceptions.PairingException(reason='The meshes are not the the same length as the number of groups')
def getSubProblem(self, ind):
def getSubProblemandSubSurvey(self, subMap, ind):
#This is a core place that we can proceed parallelization
assert self.ispaired, 'You must be paired to a survey'
assert type(ind) in [int,long] and ind >= 0 and ind < self.nGroups, 'ind must be an index into the group list'
subMesh = self.meshes[ind]
subMap = Maps.IdentityMap(subMesh) # this is probably a mesh2mesh mapping?
# subMap = Maps.IdentityMap(subMesh) # this is probably a mesh2mesh mapping?
if self.PropMap is None:
prob = self.SubProblem(subMesh, mapping=subMap * self.mapping, **self.probKwargs)
@@ -329,7 +329,7 @@ class GlobalProblem(BaseProblem):
survey = self.survey.__class__(srcList=self.survey.srcList[self.groups[ind]], **self.surveyKwargs)
prob.pair(survey)
return prob
return prob, survey
if __name__ == '__main__':