def setUp(self): self.grid = EclGrid.createRectangular((10, 10, 10), (1, 1, 1)) self.kw = EclKW("FAULTBLK", self.grid.getGlobalSize(), EclDataType.ECL_INT) self.kw.assign(1) reg = EclRegion(self.grid, False) for k in range(self.grid.getNZ()): reg.clear() reg.select_kslice(k, k) self.kw.assign(k, mask=reg) self.kw[k * self.grid.getNX() * self.grid.getNY() + 7] = 177
def test_slice(self): reg = EclRegion(self.grid, False) reg.select_islice(0, 5) OK = True global_list = reg.getGlobalList() self.assertEqual(global_list.parent(), reg) for gi in global_list: (i, j, k) = self.grid.get_ijk(global_index=gi) if i > 5: OK = False self.assertTrue(OK) self.assertTrue(self.grid.getNY() * self.grid.getNZ() * 6 == len(reg.getGlobalList())) reg.select_jslice(7, 8, intersect=True) OK = True for gi in reg.getGlobalList(): (i, j, k) = self.grid.get_ijk(global_index=gi) if i > 5: OK = False if j < 7 or j > 8: OK = False self.assertTrue(OK) self.assertTrue(2 * self.grid.getNZ() * 6 == len(reg.getGlobalList())) reg2 = EclRegion(self.grid, False) reg2.select_kslice(3, 5) reg &= reg2 OK = True for gi in reg.getGlobalList(): (i, j, k) = self.grid.get_ijk(global_index=gi) if i > 5: OK = False if j < 7 or j > 8: OK = False if k < 3 or k > 5: OK = False self.assertTrue(OK) self.assertTrue(2 * 3 * 6 == len(reg.getGlobalList()))