def generate_from_inr( inr_filename, 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, ): fh, outfile = tempfile.mkstemp(suffix=".mesh") os.close(fh) _generate_from_inr( inr_filename, outfile, 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_from_inr( inr_filename, 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, ): fh, outfile = tempfile.mkstemp(suffix=".mesh") os.close(fh) if isinstance(cell_size, float): _generate_from_inr( inr_filename, outfile, 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, ) else: assert isinstance(cell_size, dict) if "default" in cell_size.keys(): default_cell_size = cell_size.pop("default") else: default_cell_size = 0.0 cell_sizes = list(cell_size.values()) subdomain_labels = list(cell_size.keys()) _generate_from_inr_with_subdomain_sizing( inr_filename, outfile, default_cell_size, cell_sizes, subdomain_labels, 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, verbose=verbose, seed=seed, ) mesh = meshio.read(outfile) os.remove(outfile) return mesh
def generate_from_inr( inr_filename, 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, ): fh, outfile = tempfile.mkstemp(suffix=".mesh") os.close(fh) if isinstance(max_cell_circumradius, float): _generate_from_inr( inr_filename, outfile, lloyd=lloyd, odt=odt, perturb=perturb, exude=exude, max_edge_size_at_feature_edges=max_edge_size_at_feature_edges, min_facet_angle=min_facet_angle, max_radius_surface_delaunay_ball=max_radius_surface_delaunay_ball, max_facet_distance=max_facet_distance, max_circumradius_edge_ratio=max_circumradius_edge_ratio, max_cell_circumradius=max_cell_circumradius, verbose=verbose, seed=seed, ) else: assert isinstance(max_cell_circumradius, dict) if "default" in max_cell_circumradius.keys(): default_max_cell_circumradius = max_cell_circumradius.pop( "default") else: default_max_cell_circumradius = 0.0 max_cell_circumradiuss = list(max_cell_circumradius.values()) subdomain_labels = list(max_cell_circumradius.keys()) _generate_from_inr_with_subdomain_sizing( inr_filename, outfile, default_max_cell_circumradius, max_cell_circumradiuss, subdomain_labels, lloyd=lloyd, odt=odt, perturb=perturb, exude=exude, max_edge_size_at_feature_edges=max_edge_size_at_feature_edges, min_facet_angle=min_facet_angle, max_radius_surface_delaunay_ball=max_radius_surface_delaunay_ball, max_facet_distance=max_facet_distance, max_circumradius_edge_ratio=max_circumradius_edge_ratio, verbose=verbose, seed=seed, ) mesh = meshio.read(outfile) os.remove(outfile) return mesh