From e3a22a713f1b1406787e8bcca515ad4e7dd199d3 Mon Sep 17 00:00:00 2001 From: seogi_macbook Date: Thu, 28 Jan 2016 16:36:24 -0800 Subject: [PATCH] minor updates --- SimPEG/Maps.py | 6 +++--- SimPEG/Problem.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/SimPEG/Maps.py b/SimPEG/Maps.py index d14400f8..9a133e0d 100644 --- a/SimPEG/Maps.py +++ b/SimPEG/Maps.py @@ -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)) diff --git a/SimPEG/Problem.py b/SimPEG/Problem.py index 96e6a9dc..7a738cf2 100644 --- a/SimPEG/Problem.py +++ b/SimPEG/Problem.py @@ -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__':