def test_kw_iadd(self): P = self.rst_file["PRESSURE"][5] fipnum = self.init_file["FIPNUM"][0] fipnum_copy = fipnum.deep_copy() reg = EclRegion(self.grid, False) reg.select_more(P, 260) fipnum.add(1, mask=reg) self.assertFalse(fipnum.equal(fipnum_copy)) reg.invert() fipnum.add(1, mask=reg) fipnum.sub(1) self.assertTrue(fipnum.equal(fipnum_copy))
def test_kw_iadd(self): P = self.rst_file["PRESSURE"][5] fipnum = self.init_file["FIPNUM"][0] fipnum_copy = fipnum.deep_copy() reg = EclRegion(self.grid, False) reg.select_more(P, 260) fipnum.add(1, mask=reg) self.assertFalse(fipnum.equal(fipnum_copy)) reg.invert() fipnum.add(1, mask=reg) fipnum.sub(1) self.assertTrue(fipnum.equal(fipnum_copy))
class FluxnumBox(Fluxnum): def __init__(self, grid, i_start, i_end, j_start, j_end, k_start=0, k_end=0): """ Define FLUXNUM region based on box dimensions """ Fluxnum.__init__(self, grid) i_start -= 1 i_end -= 1 j_start -= 1 j_end -= 1 if k_end == 0: k_start = 0 k_end = self.grid.nz - 1 else: k_start -= 1 k_end -= 1 self.set_inner_region(i_start, i_end, j_start, j_end, k_start, k_end) self.set_outer_region(i_start, i_end, j_start, j_end, k_start, k_end) def set_inner_region(self, i_start, i_end, j_start, j_end, k_start, k_end): self.inner_region = EclRegion(self.grid, False) self.inner_region.select_box((i_start, j_start, k_start), (i_end, j_end, k_end)) def set_outer_region(self, i_start, i_end, j_start, j_end, k_start, k_end): self.outer_region = EclRegion(self.grid, False) self.outer_region.select_box((i_start, j_start, k_start), (i_end, j_end, k_end)) self.outer_region.invert()