当前位置: 首页>>代码示例>>Python>>正文


Python tet.MeshInfo类代码示例

本文整理汇总了Python中meshpy.tet.MeshInfo的典型用法代码示例。如果您正苦于以下问题:Python MeshInfo类的具体用法?Python MeshInfo怎么用?Python MeshInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MeshInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_Preview

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,代码行数:31,代码来源:mesh_MeshPy.py

示例2: make_cylinder_mesh

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,代码行数:34,代码来源:generator.py

示例3: mesh

 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,代码行数:7,代码来源:shadow_function.py

示例4: generateCubeMesh

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,代码行数:33,代码来源:meshGenerator.py

示例5: make_inverse_mesh_info

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,代码行数:35,代码来源:rzmesh.py

示例6: test_tetgen

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,代码行数:25,代码来源:test_meshpy.py

示例7: main

def main():
    from math import pi, cos, sin
    from meshpy.tet import MeshInfo, build
    from meshpy.geometry import generate_surface_of_revolution,\
            EXT_CLOSED_IN_RZ, GeometryBuilder

    big_r = 3
    little_r = 2.9

    points = 50
    dphi = 2*pi/points

    rz = [(big_r+little_r*cos(i*dphi), little_r*sin(i*dphi))
            for i in range(points)]

    geob = GeometryBuilder()
    geob.add_geometry(*generate_surface_of_revolution(rz,
            closure=EXT_CLOSED_IN_RZ, radial_subdiv=20))

    mesh_info = MeshInfo()
    geob.set(mesh_info)

    mesh_info.save_nodes("torus")
    mesh_info.save_poly("torus")
    mesh = build(mesh_info)
    mesh.write_vtk("torus.vtk")
    mesh.save_elements("torus_mesh")
    mesh.save_nodes("torus_mesh")

    mesh.write_neu(file("torus.neu", "w"),
            {1: ("pec", 0)})
开发者ID:binho58,项目名称:meshpy,代码行数:31,代码来源:test_tet_torus.py

示例8: create_beam

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,代码行数:30,代码来源:signorini.py

示例9: main

def main():
    #Test1: mesh testing
    MeshPoints = []
    MeshFacets = []
    with open('MeshFacets', 'rb') as input:
        MeshFacets = pickle.load(input)
    with open('MeshPoints', 'rb') as input:
        MeshPoints = pickle.load(input)

    mesh_info = MeshInfo()

    mesh_info.regions.resize(1)
    mesh_info.regions[0] = [
                            MeshPoints[0][0], MeshPoints[0][1], MeshPoints[0][2], # point in volume -> first box
                            0, # region tag (user-defined number)
                            1, # max tet volume in region
                            ]
    print "Building mesh from {} facets and {} points".format(len(MeshFacets), len(MeshPoints))
    try:
        mesh = build(mesh_info, options=Options(switches="pqT", epsilon=0.01), volume_constraints=True)
    except:
        pass
    try:
        mesh = build(mesh_info, options=Options(switches="pqT", epsilon=0.0001), volume_constraints=True)
    except:
        pass
    print "Created mesh with {} points, {} faces and {} elements.".format(len(mesh.points), len(mesh.faces), len(mesh.elements))
开发者ID:sdfsdffsdfsf,项目名称:DXFMapper,代码行数:27,代码来源:Tests.py

示例10: main

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,代码行数:33,代码来源:test_tetgen.py

示例11: brep2lar

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,代码行数:11,代码来源:test1.py

示例12: test_tetgen_points

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,代码行数:13,代码来源:test_meshpy.py

示例13: make_mesh_info

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,代码行数:13,代码来源:rzmesh.py

示例14: _make_z_periodic_mesh

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,代码行数:47,代码来源:generator.py

示例15: main

def main():
    from ply import parse_ply
    import sys
    data = parse_ply(sys.argv[1])

    from meshpy.geometry import GeometryBuilder

    builder = GeometryBuilder()
    builder.add_geometry(
            points=[pt[:3] for pt in data["vertex"].data],
            facets=[fd[0] for fd in data["face"].data])
    builder.wrap_in_box(1)

    from meshpy.tet import MeshInfo, build
    mi = MeshInfo()
    builder.set(mi)
    mi.set_holes([builder.center()])
    mesh = build(mi)
    print("%d elements" % len(mesh.elements))
    mesh.write_vtk("out.vtk")
开发者ID:OlegJakushkin,项目名称:meshpy,代码行数:20,代码来源:mesh_ply.py


注:本文中的meshpy.tet.MeshInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。