• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tet.MeshInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: brep2lar

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


示例17: make_ball_mesh

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


示例18: main

def main():
    import numpy
    from meshpy.tet import MeshInfo, build
    from meshpy.geometry import GeometryBuilder, Marker, make_box

    geob = GeometryBuilder()

    box_marker = Marker.FIRST_USER_MARKER
    extent_small = 0.3*numpy.ones(3, dtype=numpy.float64)
    points, facets, _, _ = \
            make_box(-extent_small, extent_small)

    geob.add_geometry(points, facets, facet_markers=box_marker)

    points, facets, _, facet_markers = \
            make_box(numpy.array([-1, -1, -1]), numpy.array([1, 1, 5]))

    geob.add_geometry(points, facets, facet_markers=facet_markers)

    mesh_info = MeshInfo()
    geob.set(mesh_info)
    #mesh_info.set_holes([(0, 0, 0)])

    # region attributes
    mesh_info.regions.resize(1)
    mesh_info.regions[0] = (
            # point in region
            [0, 0, 0] + [
                # region number
                1,
                # max volume in region
                0.001])

    mesh = build(mesh_info, max_volume=0.06,
            volume_constraints=True, attributes=True)
    print(("%d elements" % len(mesh.elements)))
    mesh.write_vtk("box-in-box.vtk")
开发者ID:OlegJakushkin,项目名称:meshpy,代码行数:37,代码来源:box-in-box.py


示例19: make_mesh_info_with_inner_tube

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


示例20: figure

#     figure()
    n, bins, patches = hist(vols, 50, facecolor='green')
    xlabel('Volume')
    ylabel('Number')
    show()
#     close()

def volTet2(vertPoints): 
        return abs(dot((vertPoints[0]-vertPoints[3]),cross((vertPoints[1]-vertPoints[3]),(vertPoints[2]-vertPoints[3])))/6.0)
 
# mainDir = '/home/hessb/Downloads/temp'
mainDir = '/fslhome/bch/trash'

os.chdir(mainDir)

mesh_info = MeshInfo()
# Cubic IBZ
# mesh_info.set_points([
#     (0,0,0), (0.5,0.5,0), (0,0.5,0), (0.5,0.5,0.5)
#     ])
# mesh_info.set_facets([
#     [0,1,2],
#     [0,1,3],
#     [1,2,3],
#     [3,2,0]
#     ])

#Cubic entire cubic voronoi cell....
a = 0.5; b = -0.5
mesh_info.set_points([
    (b,b,b), (b,b,a), (b,a,a),(b,a,b),(a,b,b), (a,b,a), (a,a,a),(a,a,b)
开发者ID:hess8,项目名称:pythonscripts,代码行数:31,代码来源:cubicIBZmesh.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mesonlib.is_windows函数代码示例发布时间:2022-05-27
下一篇:
Python tet.build函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap