mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-04 18:49:36 +08:00
Testing of fields in time with alias.
This commit is contained in:
+1
-1
@@ -434,7 +434,7 @@ class TimeFields(Fields):
|
||||
pointerFields = self._fields[alias][:,txInd,timeInd]
|
||||
pointerShape = self._correctShape(alias, ind, deflate=True)
|
||||
pointerFields = pointerFields.reshape(pointerShape, order='F')
|
||||
if len(pointerShape) == 2:
|
||||
if len(pointerShape) < 3:
|
||||
out = func(self, pointerFields, txInd)
|
||||
else: #loop over the time steps
|
||||
nT = pointerShape[2]
|
||||
|
||||
@@ -288,7 +288,6 @@ class FieldsTest_Time_Aliased(unittest.TestCase):
|
||||
prob = Problem.BaseTimeProblem(mesh, timeSteps=[(10.,3), (20.,2)])
|
||||
survey.pair(prob)
|
||||
def alias(F, b, ind):
|
||||
print 'aliasB: b.shape:', b.shape
|
||||
return F.mesh.edgeCurl.T * b
|
||||
self.F = Survey.TimeFields(mesh, survey, knownFields={'b':'F'}, aliasFields={'e':['b','E',alias]})
|
||||
self.Tx0 = Tx0
|
||||
@@ -322,6 +321,10 @@ class FieldsTest_Time_Aliased(unittest.TestCase):
|
||||
e[i] = e[i][:,:,np.newaxis]
|
||||
e = np.concatenate(e, axis=2)
|
||||
self.assertTrue(np.all(F[:, 'e', :] == e ))
|
||||
self.assertTrue(np.all(F[self.Tx0, 'e', :] == e[:,0,:] ))
|
||||
self.assertTrue(np.all(F[self.Tx1, 'e', :] == e[:,1,:] ))
|
||||
for t in range(nT):
|
||||
self.assertTrue(np.all(F[self.Tx1, 'e', t] == e[:,1,t] ))
|
||||
|
||||
b = np.random.rand(F.mesh.nF,nT)
|
||||
F[self.Tx0, 'b',:] = b
|
||||
|
||||
Reference in New Issue
Block a user