- better model for testing Parametric casing map

- allow vector containing values in the inactive set to be passed (not just nC in length)
This commit is contained in:
Lindsey Heagy
2016-06-26 15:24:33 -07:00
parent c75e3d0246
commit c40d11ef53
2 changed files with 11 additions and 3 deletions
+10 -2
View File
@@ -543,11 +543,19 @@ class InjectActiveCells(IdentityMap):
self.indInactive = np.logical_not(indActive)
if Utils.isScalar(valInactive):
self.valInactive = np.ones(self.nC)*float(valInactive)
self.valInactive[self.indActive] = 0.
else:
self.valInactive = valInactive.copy()
self.valInactive[self.indActive] = 0
if len(valInactive) == sum(self.indInactive):
self.valInactive = np.zeros(nC)
self.valInactive[self.indInactive] = valInactive.copy()
else:
assert len(self.valInactive) == self.nC, 'valInactive must be the size of nC or nInactive'
self.valInactive = valInactive.copy()
if any(self.valInactive[self.indActive] != 0.):
warnings.warn('the inactive has non-zero values in the active set.')
inds = np.nonzero(self.indActive)[0]
# inds[self.indActive]
self.P = sp.csr_matrix((np.ones(inds.size),(inds, range(inds.size))), shape=(self.nC, self.nP))
@property
+1 -1
View File
@@ -39,7 +39,7 @@ class MapTests(unittest.TestCase):
def test_ParametricCasingAndLayer(self):
mapping = Maps.ParametrizedCasingAndLayer(self.meshCyl)
m = np.r_[-2., 1., 6., 2., -0.1, 0.2, 0.5, 0.2, -0.3, 0.1]
m = np.r_[-2., 1., 6., 2., -0.1, 0.2, 0.5, 0.2, -0.2, 0.2]
self.assertTrue(mapping.test(m))
def test_transforms_logMap_reciprocalMap(self):