当前位置: 首页>>代码示例>>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;未经允许,请勿转载。