예제 #1
0
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)
예제 #2
0
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 22 15:02:51 2015

@author: Hagen Meredig
"""

from meshpy import geometry
from meshpy.tet import MeshInfo, build



  
dat = (geometry.make_cylinder(2, 1, radial_subdivisions=10, height_subdivisions=1))

builder = geometry.GeometryBuilder()
builder.add_geometry(*dat)

info = MeshInfo()
builder.set(info)