tetgenpy

tetgenpy.gentet

tetgenpy.gentet.tetgen_exe(argv)[source]

Calls tetgen executable with argv as a list. This call performs the same routine as tetgen’s main(). The first element of argv is usually the executable name and tetgen also expects that. However, this can be a dummy.

Parameters:

argv (list) –

Returns:

exit_code – Will retun 0 if everything went well. -1 with RuntimeError without any informative error message.

Return type:

int

tetgenpy.gentet.tetrahedralize(switches, tetgenio_in, additional_points=None, background_mesh=None)[source]

Calls tetrahedralize from the core with appropriate parameters. Input and output is based on TetgenIO.

Parameters:
Returns:

out

Return type:

TetgenIO

tetgenpy.plc

Class to prepare input Piecewise Linear Complexes for tetgen.

class tetgenpy.plc.PLC[source]

Bases: object

add_facet_with_holes(polygons, holes, facet_id=None, coordinates=None, facet_constraint=None)[source]

Supports full features of tetgenio::facet.

Parameters:
  • polygons (array-like) – same as add_facets

  • holes (array-like) – list of locations to poke holes in this facet. If you don’t want holes, you can set it to None.

  • facet_id (int) –

  • coordinates (bool) –

Return type:

None

add_facets(polygons, facet_id=None, facet_constraints=None, coordinates=None)[source]

Adds facets with one polygon per facet.

Parameters:
  • polygons (array-like) – list of polygons by coordinate or indices referring to points list. coordinates are expected to have [[[x1_1, y1_2, z1_3], …], …] and indices [[p1_1, p1_2, …], … ].

  • facet_id (int) – value used to set facetmarker. Default is -123454321. can be also interpreted as boundary id as all the output faces on this facet will have this id.

  • facet_constraints (float or list) – max area for given facets. If it is list, len(facet_constraints) == len(polygons) should hold.

  • coordinates (bool) – Default is None. Can specify if given polygons are coordinate or index based. If None, will check the first entry and determine.

Return type:

None

add_holes(holes)[source]

Adds locations to poke holes. This hole propagates to the nearest edges of surrounding facets.

Parameters:

holes ((n, 3) array-like) – places to poke holes

Return type:

None

add_points(points, point_attributes=None, point_metrics=None)[source]

Adds points. list, tuple, or np.ndarray.

Parameters:
  • points ((n, 3) array-like) –

  • point_attributes (float or (n, m) array-like) –

  • point_metrics (float or (n, 1) array-like) –

Return type:

None

add_regions(regions)[source]

Mark regions, their attributes, and their maximum volumes. Each region has 5 entries - x,y,z coordinate, (int) attribute, (float) maximum tetrahedron volume for this region.

Parameters:

regions ((n, 5) np.ndarray) – [[x1, y1, z1, attribute, max_volume], …]

Return type:

None

add_segment_constraints(segments, constraint)[source]

Add segment constraints.

Parameters:
  • segments (array-like) –

  • constraint (float or array-like) – If array-like, should have same len as segments

Return type:

None

show()[source]
sofarsogood()[source]

assert for sanity check

to_tetgenio(as_dict=False, debug=False)[source]

Creates tetgenio based on current properties.

Parameters:
  • as_dict (bool) – return dict instead of TetgenIO object

  • debug (bool) – prints debug messages from cpp side.

tetgenpy.tetgenpy_core

class tetgenpy.tetgenpy_core.TetgenIO

Bases: pybind11_object

edge2tets(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
edgemarkers(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
edges(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
face2edges(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
face2tets(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
load_edge(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_elem(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_face(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_medit(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str, is_tet_mesh: bool) None
load_mtr(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_node(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_off(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_ply(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_poly(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_stl(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_tet(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_var(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_vol(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
load_vtk(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
neighbors(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
points(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.float64]
save_edges(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
save_elements(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
save_faces(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
save_faces2Smesh(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
save_neighbors(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
save_nodes(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
save_poly(self: tetgenpy.tetgenpy_core.TetgenIO, fname_base: str) None
setup_plc(self: tetgenpy.tetgenpy_core.TetgenIO, points: numpy.ndarray[numpy.float64], facets: list, point_attributes: numpy.ndarray[numpy.float64] = array([], dtype=float64), point_metrics: numpy.ndarray[numpy.float64] = array([], dtype=float64), facet_markers: numpy.ndarray[numpy.int32] = array([], dtype=int32), h_facets: list = [], holes: numpy.ndarray[numpy.float64] = array([], dtype=float64), regions: numpy.ndarray[numpy.float64] = array([], dtype=float64), facet_constraints: numpy.ndarray[numpy.float64] = array([], dtype=float64), segment_constraints: numpy.ndarray[numpy.float64] = array([], dtype=float64), debug: bool = False) None
setup_points(self: tetgenpy.tetgenpy_core.TetgenIO, points: numpy.ndarray[numpy.float64], point_attributes: numpy.ndarray[numpy.float64] = array([], dtype=float64), point_metrics: numpy.ndarray[numpy.float64] = array([], dtype=float64), debug: bool = False) None
setup_tetmesh(self: tetgenpy.tetgenpy_core.TetgenIO, points: numpy.ndarray[numpy.float64], tetrahedra: numpy.ndarray[numpy.int32], point_attributes: numpy.ndarray[numpy.float64] = array([], dtype=float64), point_metrics: numpy.ndarray[numpy.float64] = array([], dtype=float64), tetrahedron_attributes: numpy.ndarray[numpy.float64] = array([], dtype=float64), tetrahedron_constraints: numpy.ndarray[numpy.float64] = array([], dtype=float64), refine_elements: numpy.ndarray[numpy.int32] = array([], dtype=int32), refine_element_constraints: numpy.ndarray[numpy.float64] = array([], dtype=float64), trifaces: numpy.ndarray[numpy.int32] = array([], dtype=int32), triface_markers: numpy.ndarray[numpy.int32] = array([], dtype=int32), edges: numpy.ndarray[numpy.int32] = array([], dtype=int32), edge_markers: numpy.ndarray[numpy.int32] = array([], dtype=int32), debug: bool = False) None
tet2edges(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
tet2faces(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
tetrahedra(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
tetrahedronattributes(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
trifacemarkers(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
trifaces(self: tetgenpy.tetgenpy_core.TetgenIO) numpy.ndarray[numpy.int32]
voronoi(self: tetgenpy.tetgenpy_core.TetgenIO) dict
tetgenpy.tetgenpy_core.main(arg0: list) int
tetgenpy.tetgenpy_core.tetrahedralize(arg0: str, arg1: tetgenpy.tetgenpy_core.TetgenIO, arg2: tetgenpy.tetgenpy_core.TetgenIO, arg3: tetgenpy.tetgenpy_core.TetgenIO, arg4: tetgenpy.tetgenpy_core.TetgenIO) None