當前位置: 首頁>>代碼示例>>Python>>正文


Python EclGridGenerator.create_single_cell_grid方法代碼示例

本文整理匯總了Python中ecl.grid.EclGridGenerator.create_single_cell_grid方法的典型用法代碼示例。如果您正苦於以下問題:Python EclGridGenerator.create_single_cell_grid方法的具體用法?Python EclGridGenerator.create_single_cell_grid怎麽用?Python EclGridGenerator.create_single_cell_grid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ecl.grid.EclGridGenerator的用法示例。


在下文中一共展示了EclGridGenerator.create_single_cell_grid方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_concvex_cell_containment

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import create_single_cell_grid [as 別名]
    def test_concvex_cell_containment(self):
        points = [
            (10, 10, 10),
            (25, 5, 5),
            (5, 25, 5),
            (20, 20, 10),
            (5, 5, 25),
            (20, 10, 20),
            (10, 20, 20),
            (25, 25, 25)
            ]

        grid = GridGen.create_single_cell_grid(points)

        assertPoint = lambda p : self.assertTrue(
                grid.cell_contains(p[0], p[1], p[2], 0)
                )

        assertNotPoint = lambda p : self.assertFalse(
                grid.cell_contains(p[0], p[1], p[2], 0)
                )

        # Cell center
        assertPoint(average(points));

        # "Side" center
        assertPoint(average(points[0:4:]))
        assertPoint(average(points[4:8:]))
        assertPoint(average(points[1:8:2]))
        assertPoint(average(points[0:8:2]))
        assertPoint(average(points[0:8:4] + points[1:8:4]))
        assertPoint(average(points[2:8:4] + points[3:8:4]))

        # Corners
        for p in points:
            assertPoint(p)

        # Edges
        edges = ([(i, i+1) for i in range(0, 8, 2)] +
                 [(i, i+2) for i in [0, 1, 4, 5]] +
                 [(i, i+4) for i in range(4)] +
                 [(1,2), (2,7), (1,7), (4,7), (2,4), (4,1)])
        for a,b in edges:
            assertPoint(average([points[a], points[b]]))

        # Epsilon inside from corners
        middle_point = average(points)
        for p in points:
            assertPoint(average(20*[p] + [middle_point]))

        # Espilon outside
        middle_point[2] = 0
        for p in points[0:4:]:
            assertNotPoint(average(20*[p] + [middle_point]))

        middle_point[2] = 30
        for p in points[4:8:]:
            assertNotPoint(average(20*[p] + [middle_point]))
開發者ID:,項目名稱:,代碼行數:60,代碼來源:

示例2: createWrapperGrid

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import create_single_cell_grid [as 別名]
def createWrapperGrid(grid):
    """
    Creates a grid that occupies the same space as the given grid,
    but that consists of a single cell.
    """

    x, y, z = grid.getNX()-1, grid.getNY()-1, grid.getNZ()-1
    corner_pos = [
                    (0, 0, 0), (x, 0, 0), (0, y, 0), (x, y, 0),
                    (0, 0, z), (x, 0, z), (0, y, z), (x, y, z)
                ]

    corners = [
                grid.getCellCorner(i, ijk=pos)
                for i, pos in enumerate(corner_pos)
              ]

    return GridGen.create_single_cell_grid(corners)
開發者ID:,項目名稱:,代碼行數:20,代碼來源:


注:本文中的ecl.grid.EclGridGenerator.create_single_cell_grid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。