Testing of fields in time with alias.

This commit is contained in:
rowanc1
2014-05-15 12:28:46 -07:00
parent 80ace330e4
commit dd0a2e3878
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -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]
+4 -1
View File
@@ -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