def generate_mesh( domain, feature_edges=None, bounding_sphere_radius=0.0, lloyd=False, odt=False, perturb=True, exude=True, edge_size=0.0, facet_angle=0.0, facet_size=0.0, facet_distance=0.0, cell_radius_edge_ratio=0.0, cell_size=0.0, verbose=True, seed=0, ): feature_edges = [] if feature_edges is None else feature_edges fh, outfile = tempfile.mkstemp(suffix=".mesh") os.close(fh) _generate_mesh( domain, outfile, feature_edges=feature_edges, bounding_sphere_radius=bounding_sphere_radius, lloyd=lloyd, odt=odt, perturb=perturb, exude=exude, edge_size=edge_size, facet_angle=facet_angle, facet_size=facet_size, facet_distance=facet_distance, cell_radius_edge_ratio=cell_radius_edge_ratio, cell_size=cell_size, verbose=verbose, seed=seed, ) mesh = meshio.read(outfile) os.remove(outfile) return mesh
def generate_mesh( domain, extra_feature_edges=None, bounding_sphere_radius=0.0, lloyd=False, odt=False, perturb=True, exude=True, max_edge_size_at_feature_edges=0.0, min_facet_angle=0.0, max_radius_surface_delaunay_ball=0.0, max_facet_distance=0.0, max_circumradius_edge_ratio=0.0, max_cell_circumradius=0.0, verbose=True, seed=0, ): """ From <https://doc.cgal.org/latest/Mesh_3/classCGAL_1_1Mesh__criteria__3.html>: max_edge_size_at_feature_edges: a scalar field (resp. a constant) providing a space varying (resp. a uniform) upper bound for the lengths of curve edges. This parameter has to be set to a positive value when 1-dimensional features protection is used. min_facet_angle: a lower bound for the angles (in degrees) of the surface mesh facets. max_radius_surface_delaunay_ball: a scalar field (resp. a constant) describing a space varying (resp. a uniform) upper-bound or for the radii of the surface Delaunay balls. max_facet_distance: a scalar field (resp. a constant) describing a space varying (resp. a uniform) upper bound for the distance between the facet circumcenter and the center of its surface Delaunay ball. max_circumradius_edge_ratio: an upper bound for the radius-edge ratio of the mesh tetrahedra. max_cell_circumradius: a scalar field (resp. a constant) describing a space varying (resp. a uniform) upper-bound for the circumradii of the mesh tetrahedra. """ extra_feature_edges = [] if extra_feature_edges is None else extra_feature_edges fh, outfile = tempfile.mkstemp(suffix=".mesh") os.close(fh) def _select(obj): if isinstance(obj, float): return obj, None assert callable(obj) return -1.0, Wrapper(obj) ( max_edge_size_at_feature_edges_value, max_edge_size_at_feature_edges_field, ) = _select(max_edge_size_at_feature_edges) max_cell_circumradius_value, max_cell_circumradius_field = _select( max_cell_circumradius) ( max_radius_surface_delaunay_ball_value, max_radius_surface_delaunay_ball_field, ) = _select(max_radius_surface_delaunay_ball) max_facet_distance_value, max_facet_distance_field = _select( max_facet_distance) # if feature_edges: # if max_edge_size_at_feature_edges == 0.0: # raise ValueError( # "Need a positive max_edge_size_at_feature_edges bound if feature_edges are present." # ) # elif max_edge_size_at_feature_edges != 0.0: # warnings.warn( # "No feature edges. The max_edge_size_at_feature_edges argument has no effect." # ) _generate_mesh( domain, outfile, extra_feature_edges=extra_feature_edges, bounding_sphere_radius=bounding_sphere_radius, lloyd=lloyd, odt=odt, perturb=perturb, exude=exude, max_edge_size_at_feature_edges_value= max_edge_size_at_feature_edges_value, max_edge_size_at_feature_edges_field= max_edge_size_at_feature_edges_field, min_facet_angle=min_facet_angle, max_radius_surface_delaunay_ball_value= max_radius_surface_delaunay_ball_value, max_radius_surface_delaunay_ball_field= max_radius_surface_delaunay_ball_field, max_facet_distance_value=max_facet_distance_value, max_facet_distance_field=max_facet_distance_field, max_circumradius_edge_ratio=max_circumradius_edge_ratio, max_cell_circumradius_value=max_cell_circumradius_value, max_cell_circumradius_field=max_cell_circumradius_field, verbose=verbose, seed=seed, ) mesh = meshio.read(outfile) os.remove(outfile) return mesh