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


Python MeshInfo.set_points方法代碼示例

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


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

示例1: generateCubeMesh

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def generateCubeMesh():
    mesh_info = MeshInfo()
    mesh_info.set_points([
        (0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0),
        (0, 0, 1), (1, 0, 1), (1, 1, 1), (0, 1, 1),
    ])
    mesh_info.set_facets([
        [0, 1, 2, 3],
        [4, 5, 6, 7],
        [0, 4, 5, 1],
        [1, 5, 6, 2],
        [2, 6, 7, 3],
        [3, 7, 4, 0],
    ])
    mesh = build(mesh_info)

    cellList = []
    vertexList = []
    mupifMesh = Mesh.UnstructuredMesh()

    print("Mesh Points:")
    for i, p in enumerate(mesh.points):
        print(i, p)
        vertexList.extend([Vertex.Vertex(i, i, p)])

    print("Point numbers in tetrahedra:")
    for i, t in enumerate(mesh.elements):
        print(i, t)
        cellList.extend([Cell.Tetrahedron_3d_lin(mupifMesh, i, i, t)])

    mupifMesh.setup(vertexList, cellList)

    return(mupifMesh)
開發者ID:ollitapa,項目名稱:MMP-TracerApi,代碼行數:35,代碼來源:meshGenerator.py

示例2: make_cylinder_mesh

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def make_cylinder_mesh(radius=0.5, height=1, radial_subdivisions=10,
        height_subdivisions=1, max_volume=None, periodic=False,
        boundary_tagger=(lambda fvi, el, fn, all_v: [])):
    from meshpy.tet import MeshInfo, build
    from meshpy.geometry import make_cylinder

    points, facets, facet_holestarts, facet_markers = \
            make_cylinder(radius, height, radial_subdivisions,
                    height_subdivisions)

    assert len(facets) == len(facet_markers)

    if periodic:
        return _make_z_periodic_mesh(
                points, facets, facet_holestarts, facet_markers,
                height=height,
                max_volume=max_volume,
                boundary_tagger=boundary_tagger)
    else:
        mesh_info = MeshInfo()
        mesh_info.set_points(points)
        mesh_info.set_facets_ex(facets, facet_holestarts, facet_markers)

        generated_mesh = build(mesh_info, max_volume=max_volume)

        from hedge.mesh import make_conformal_mesh_ext
        from hedge.mesh.element import Tetrahedron

        vertices = numpy.asarray(generated_mesh.points, dtype=float, order="C")
        return make_conformal_mesh_ext(
                vertices,
                [Tetrahedron(i, el_idx, vertices)
                    for i, el_idx in enumerate(generated_mesh.elements)],
                boundary_tagger)
開發者ID:allansnielsen,項目名稱:hedge,代碼行數:36,代碼來源:generator.py

示例3: mesh

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
 def mesh(self):
     mesh_info = MeshInfo()
     mesh_info.set_points(transpose([self.flat_x,self.flat_y,self.flat_z]))
     mesh = build(mesh_info)
     print 'yo'
     for i, t in enumerate(mesh.elements):
         print i, t
開發者ID:emileokada,項目名稱:image3d,代碼行數:9,代碼來源:shadow_function.py

示例4: create_beam

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def create_beam(vol):
    # build using MeshPy
    from meshpy.tet import MeshInfo,build

    mesh_info = MeshInfo()

    mesh_info.set_points([
        (0,0,0),
        (0,1,0),
        (0,1,1),
        (0,0,1),
        (5,0,0),
        (5,1,0),
        (5,1,1),
        (5,0,1),
        ])

    mesh_info.set_facets([
        [0,1,2,3],
        [4,5,6,7],
        [0,1,5,4],
        [1,2,6,5],
        [0,3,7,4],
        [3,2,6,7],
        ])


    mesh = build(mesh_info,max_volume=vol)

    return fmsh.MeshPyTet(mesh)
開發者ID:kinnala,項目名稱:sp.fem,代碼行數:32,代碼來源:signorini.py

示例5: test_tetgen

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def test_tetgen():
    from meshpy.tet import MeshInfo, build
    mesh_info = MeshInfo()

    mesh_info.set_points([
        (0, 0, 0),
        (2, 0, 0),
        (2, 2, 0),
        (0, 2, 0),
        (0, 0, 12),
        (2, 0, 12),
        (2, 2, 12),
        (0, 2, 12),
        ])

    mesh_info.set_facets([
        [0, 1, 2, 3],
        [4, 5, 6, 7],
        [0, 4, 5, 1],
        [1, 5, 6, 2],
        [2, 6, 7, 3],
        [3, 7, 4, 0],
        ])

    build(mesh_info)
開發者ID:OlegJakushkin,項目名稱:meshpy,代碼行數:27,代碼來源:test_meshpy.py

示例6: make_inverse_mesh_info

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def make_inverse_mesh_info(rz, radial_subdiv):
    # chop off points with zero radius
    while rz[0][0] == 0:
        rz.pop(0)
    while rz[-1][0] == 0:
        rz.pop(-1)

    # construct outer cylinder
    ((min_r, max_r), (min_z, max_z)) = bounding_box(rz)

    if rz[0][1] < rz[-1][1]:
        # built in positive z direction
        rz.extend([
                (max_r+2, max_z),
                (max_r+2, min_z),
                ])
    else:
        rz.extend([
                (max_r+2, min_z),
                (max_r+2, max_z),
                ])

    from meshpy.tet import MeshInfo
    from meshpy.geometry import EXT_CLOSED_IN_RZ, \
            generate_surface_of_revolution

    points, facets, facet_holestarts, facet_markers = \
            generate_surface_of_revolution(rz, closure=EXT_CLOSED_IN_RZ,
                    radial_subdiv=radial_subdiv)

    mesh_info = MeshInfo()
    mesh_info.set_points(points)
    mesh_info.set_facets_ex(facets, facet_holestarts, facet_markers)

    return mesh_info
開發者ID:gimac,項目名稱:pyrticle,代碼行數:37,代碼來源:rzmesh.py

示例7: main

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def main():
    mesh_info = MeshInfo()

    mesh_info.set_points([
        (0, 0, 0),
        (2, 0, 0),
        (2, 2, 0),
        (0, 2, 0),
        (0, 0, 12),
        (2, 0, 12),
        (2, 2, 12),
        (0, 2, 12),
        ])

    mesh_info.set_facets([
        [0, 1, 2, 3],
        [4, 5, 6, 7],
        [0, 4, 5, 1],
        [1, 5, 6, 2],
        [2, 6, 7, 3],
        [3, 7, 4, 0],
        ])

    mesh_info.save_nodes("bar")
    mesh_info.save_poly("bar")

    mesh = build(mesh_info)

    mesh.save_nodes("barout")
    mesh.save_elements("barout")
    mesh.save_faces("barout")

    mesh.write_vtk("test.vtk")
開發者ID:OlegJakushkin,項目名稱:meshpy,代碼行數:35,代碼來源:test_tetgen.py

示例8: generate_Preview

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def generate_Preview():
        
    bpy.ops.object.mode_set(mode = 'OBJECT', toggle = False)  
    
    config = bpy.context.scene.CONFIG_MeshPy
    
    vertList = []
    faceList = []
    meshPoints = []
    meshFacets = []
    split_faceList = []
    split_vertList = []
    ob = bpy.context.active_object
    obname = ob.name
    
    #compute mesh
    compute_vertices(ob, meshPoints)
    compute_polygones(ob, meshFacets)
    
    if config.make_subdivision == False:
        arg = "Y"
    else:
        arg = ""
        
    mesh_info = MeshInfo()
    mesh_info.set_points(meshPoints)
    mesh_info.set_facets(meshFacets)
    print(meshPoints)
    print(meshFacets)
    #args = ("pq" + str(config.ratio_quality) + "a" + str(config.ratio_maxsize) + str(arg))
    '''
開發者ID:kromar,項目名稱:Blender_Addons,代碼行數:33,代碼來源:mesh_MeshPy.py

示例9: make_mesh_info_with_inner_tube

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def make_mesh_info_with_inner_tube(rz, tube_r, radial_subdiv,
        max_inner_volume=1e-4):
    # chop off points with zero radius
    while rz[0][0] == 0:
        rz.pop(0)
    while rz[-1][0] == 0:
        rz.pop(-1)

    # construct outer cylinder
    first_z = rz[0][1]
    last_z = rz[-1][1]

    rz.insert(0, (tube_r, first_z))
    rz.append((tube_r, last_z))

    from meshpy.tet import MeshInfo
    from meshpy.geometry import EXT_OPEN, generate_surface_of_revolution

    outer_points, outer_facets, outer_facet_holestarts, outer_facet_markers = \
            generate_surface_of_revolution(rz,
                    closure=EXT_OPEN, radial_subdiv=radial_subdiv)

    outer_point_indices = tuple(range(len(outer_points)))

    inner_points, inner_facets, inner_facet_holestarts, inner_facet_markers = \
            generate_surface_of_revolution(
                    [(0,first_z),
                        (tube_r, first_z),
                        (tube_r, last_z),
                        (0, last_z)],
                    point_idx_offset=len(outer_points),
                    radial_subdiv=radial_subdiv,
                    ring_point_indices=[
                        None,
                        outer_point_indices[:radial_subdiv],
                        outer_point_indices[-radial_subdiv:],
                        None,
                        ]
                    )

    points = outer_points + inner_points
    facets = outer_facets + inner_facets
    facet_holestarts = outer_facet_holestarts + inner_facet_holestarts
    facet_markers = outer_facet_markers + inner_facet_markers

    mesh_info = MeshInfo()
    mesh_info.set_points(points)
    mesh_info.set_facets_ex(facets, facet_holestarts, facet_markers)

    # set regional max. volume
    mesh_info.regions.resize(1)
    mesh_info.regions[0] = [0, 0,(first_z+last_z)/2, 0,
            max_inner_volume]

    return mesh_info
開發者ID:gimac,項目名稱:pyrticle,代碼行數:57,代碼來源:rzmesh.py

示例10: brep2lar

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def brep2lar(larBrep):
    V,FV = larBrep    
    mesh_info = MeshInfo()
    mesh_info.set_points(V)
    mesh_info.set_facets(FV)
    mesh = build(mesh_info)
    W = [v for h,v in enumerate(mesh.points)]
    CW = [tet for k,tet in enumerate(mesh.elements)]
    FW = sorted(set(AA(tuple)(CAT(AA(faces)(CW)))))
    EW = sorted(set(AA(tuple)(CAT(AA(edges)(FW)))))
    return W,CW,FW,EW
開發者ID:cvdlab,項目名稱:lar-cc,代碼行數:13,代碼來源:test1.py

示例11: make_mesh_info

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def make_mesh_info(rz, radial_subdiv):
    from meshpy.tet import MeshInfo
    from meshpy.geometry import EXT_OPEN, generate_surface_of_revolution

    points, facets, facet_holestarts, facet_markers = \
            generate_surface_of_revolution(rz, closure=EXT_OPEN,
                    radial_subdiv=radial_subdiv)

    mesh_info = MeshInfo()
    mesh_info.set_points(points)
    mesh_info.set_facets_ex(facets, facet_holestarts, facet_markers)

    return mesh_info
開發者ID:gimac,項目名稱:pyrticle,代碼行數:15,代碼來源:rzmesh.py

示例12: test_tetgen_points

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def test_tetgen_points():
    from meshpy.tet import MeshInfo, build, Options

    import numpy as np
    points = np.random.randn(10000, 3)

    mesh_info = MeshInfo()
    mesh_info.set_points(points)
    options = Options("")
    mesh = build(mesh_info, options=options)

    print(len(mesh.points))
    print(len(mesh.elements))
開發者ID:OlegJakushkin,項目名稱:meshpy,代碼行數:15,代碼來源:test_meshpy.py

示例13: _make_z_periodic_mesh

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def _make_z_periodic_mesh(points, facets, facet_holestarts, facet_markers, height,
        max_volume, boundary_tagger):
    from meshpy.tet import MeshInfo, build
    from meshpy.geometry import Marker

    mesh_info = MeshInfo()
    mesh_info.set_points(points)
    mesh_info.set_facets_ex(facets, facet_holestarts, facet_markers)

    mesh_info.pbc_groups.resize(1)
    pbcg = mesh_info.pbc_groups[0]

    pbcg.facet_marker_1 = Marker.MINUS_Z
    pbcg.facet_marker_2 = Marker.PLUS_Z

    pbcg.set_transform(translation=[0, 0, height])

    def zper_boundary_tagger(fvi, el, fn, all_v):
        # we only ask about *boundaries*
        # we should not try to have the user tag
        # the (periodicity-induced) interior faces

        face_marker = fvi2fm[frozenset(fvi)]

        if face_marker == Marker.MINUS_Z:
            return ["minus_z"]
        if face_marker == Marker.PLUS_Z:
            return ["plus_z"]

        result = boundary_tagger(fvi, el, fn, all_v)
        if face_marker == Marker.SHELL:
            result.append("shell")
        return result

    generated_mesh = build(mesh_info, max_volume=max_volume)
    fvi2fm = generated_mesh.face_vertex_indices_to_face_marker

    from hedge.mesh import make_conformal_mesh_ext
    from hedge.mesh.element import Tetrahedron

    vertices = numpy.asarray(generated_mesh.points, dtype=float, order="C")
    return make_conformal_mesh_ext(
            vertices,
            [Tetrahedron(i, el_idx, vertices)
                for i, el_idx in enumerate(generated_mesh.elements)],
            zper_boundary_tagger,
            periodicity=[None, None, ("minus_z", "plus_z")])
開發者ID:allansnielsen,項目名稱:hedge,代碼行數:49,代碼來源:generator.py

示例14: brep2lar

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def brep2lar(model,cycles,holes):
    V,FV,EV = model    
    FE = crossRelation(V,FV,EV)
    mesh_info = MeshInfo()
    mesh_info.set_points(V)
    mesh_info.set_facets_ex(cycles)
    #mesh_info.set_holes(holes)
    mesh = build(mesh_info,options=Options("pqYY"))
    W = [v for h,v in enumerate(mesh.points)]
    CW = [tet for k,tet in enumerate(mesh.elements)]
    
    def simplify(fun):
        def simplify0(simplices):
	    cellDict = defaultdict(tuple)
	    for cell in CAT(AA(fun)(simplices)):
	        cellDict[tuple(sorted(cell))] = tuple(cell)
	    return cellDict.values()
	return simplify0
    
    FW = sorted(simplify(faces)(CW))
    EW = sorted(simplify(edges)(FW))
    return W,CW,FW,EW
開發者ID:cvdlab,項目名稱:lar-cc,代碼行數:24,代碼來源:test2.py

示例15: make_ball_mesh

# 需要導入模塊: from meshpy.tet import MeshInfo [as 別名]
# 或者: from meshpy.tet.MeshInfo import set_points [as 別名]
def make_ball_mesh(r=0.5, subdivisions=10, max_volume=None,
        boundary_tagger=(lambda fvi, el, fn, all_v: [])):
    from meshpy.tet import MeshInfo, build
    from meshpy.geometry import make_ball

    points, facets, facet_holestarts, facet_markers = \
            make_ball(r, subdivisions)

    mesh_info = MeshInfo()

    mesh_info.set_points(points)
    mesh_info.set_facets_ex(facets, facet_holestarts, facet_markers)
    generated_mesh = build(mesh_info, max_volume=max_volume)

    vertices = numpy.asarray(generated_mesh.points, dtype=float, order="C")
    from hedge.mesh.element import Tetrahedron

    from hedge.mesh import make_conformal_mesh_ext
    return make_conformal_mesh_ext(
            vertices,
            [Tetrahedron(i, el_idx, vertices)
                for i, el_idx in enumerate(generated_mesh.elements)],
            boundary_tagger)
開發者ID:allansnielsen,項目名稱:hedge,代碼行數:25,代碼來源:generator.py


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