Triangle/TetGen interfaceΒΆ
Some common notionsΒΆ
- class meshpy.ForeignArrayΒΆ
Note that
ForeignArray
instances are not usually created by users, andForeignArray
is not a class name available in MeshPy. It is just used to explain the interface provided.Almost all input and output data in MeshPy can be accessed using the
ForeignArray
interface. It is called βforeignβ because it provides access to an area of memory accessible by a pointer managed by an outside piece of software, such as a mesh generator.Note that
ForeignArray
has no append method. Instead, useForeignArray.resize()
and then set the consecutive entries of the array.- __len__()ΒΆ
Return the number of entries in the array. If the array is 2D (i.e. has non-1
unit
),ForeignArray.__len__()
only returns the length of the leading dimension. For example, for an array of points in n-dimensional space,__len__()
returns the number of points.
- unitΒΆ
If this
ForeignArray
represents a two-dimensional array, such as an array of point coordinates,ForeignArray.unit()
gives the size of the subordinate dimension.For example, for an array of points in 3-dimensional space,
ForeignArray.__len__()
returns the number of dimensions (3).
- allocatedΒΆ
Return a
bool
indicating whether storage has been allocated for this array. This is only meaningful if the size of this array is tied to that of another, seeForeignArray.setup()
.
- resize(new_size)ΒΆ
Change the length of the array as returned by
ForeignArray.__len__()
.
- setup()ΒΆ
Set up (i.e. allocate) storage for the array. This only works on arrays whose size is tied to that of other arrays, such as an array of point markers, which necessarily has the same size as the associated array of points, if it is allocated.
- deallocate()ΒΆ
Release any storage associated with the array.
- __getitem__(index)ΒΆ
- __setitem__(index, value)ΒΆ
Get and set entries in the array. If this foreign array is 2D (see
ForeignArray.unit
), index may be a 2-tuple of integers, as in:points[2,1] = 17
meshpy.triangle
β Triangular MeshingΒΆ
- class meshpy.triangle.ForeignArrayΒΆ
See
meshpy.ForeignArray
for shared documentation.
- class meshpy.triangle.MeshInfoΒΆ
MeshInfo
objects are picklable.- pointsΒΆ
A 2D
ForeignArray
offloat
with dimension (N,2), providing a list of points that are referred to by index from other entries of this structure.
- point_attributesΒΆ
If
MeshInfo.number_of_point_attributes
is non-zero, this is aForeignArray
offloat
s of point attributes.This elementβs size is tied to that of
MeshInfo.points
.
- point_markersΒΆ
ForeignArray
offloat
s of point attributes.This elementβs size is tied to that of
MeshInfo.points
.
- elementsΒΆ
- element_attributesΒΆ
This elementβs size is tied to that of
MeshInfo.elements
.
- element_volumesΒΆ
This elementβs size is tied to that of
MeshInfo.elements
.
- neighborsΒΆ
- facetsΒΆ
- facet_markersΒΆ
- holesΒΆ
- regionsΒΆ
- facesΒΆ
- face_markersΒΆ
- normalsΒΆ
- number_of_point_attributesΒΆ
- number_of_element_verticesΒΆ
Defautls to 4 for linear tetrahedra. Change to 10 for second-order tetrahedra.
- number_of_element_attributesΒΆ
Convenient setters:
- set_points(points, point_markers=None)ΒΆ
- set_holes(points, hole_starts)ΒΆ
- set_facets(facets, facet_markers=None)ΒΆ
Other functionality:
- copy()ΒΆ
Return a duplicate copy of this object.
- meshpy.triangle.subdivide_facets(subdivisions, points, facets, facet_markers)ΒΆ
Subdivide facets into subdivisions subfacets.
This routine is useful if you have to prohibit the insertion of Steiner points on the boundary of your triangulation to allow the mesh to conform either to itself periodically or another given mesh. In this case, you may use this routine to create the necessary resolution along the boundary in a predefined way.
subdivisions is either an
int
, indicating a uniform number of subdivisions throughout, or a list of the same length as facets, specifying a subdivision count for each individual facet.- points
a list of points referred to from the facets list.
- facets
a list of old facets, in the form [(p1, p2), (p3,p4), β¦].
- facet_markers
either None or a list of facet markers of the same length as facets.
Returns a tuple (new_points, new_facets), or (new_points, new_facets, new_facet_markers) if facet_markers is not None.
- meshpy.triangle.build(mesh_info, verbose=False, refinement_func=None, attributes=False, volume_constraints=True, max_volume=None, allow_boundary_steiner=True, allow_volume_steiner=True, quality_meshing=True, generate_edges=None, generate_faces=False, min_angle=None)ΒΆ
- meshpy.triangle.refine(input_p, verbose=False, refinement_func=None, quality_meshing=True, min_angle=None)ΒΆ
- meshpy.triangle.write_gnuplot_mesh(filename, out_p, facets=False)ΒΆ
meshpy.tet
β Tetrahedral MeshingΒΆ
- class meshpy.tet.ForeignArrayΒΆ
See
meshpy.ForeignArray
for shared documentation.
- class meshpy.tet.Options(switches='pq', **kwargs)ΒΆ
Run time switches for TetGen. See the TetGen documentation for the meaning of each switch.
Using the kwargs constructor argument, all the attributes defined below can be set. This setting will occur after
Options.parse_switches()
is called with the switches parameter.- plcΒΆ
- qualityΒΆ
- refineΒΆ
- coarseΒΆ
- metricΒΆ
- varvolumeΒΆ
- fixedvolumeΒΆ
- insertaddpointsΒΆ
- regionattribΒΆ
- conformdelΒΆ
- diagnoseΒΆ
- zeroindexΒΆ
- optlevelΒΆ
- optpassesΒΆ
- orderΒΆ
- facesoutΒΆ
- edgesoutΒΆ
- neighoutΒΆ
- vorooutΒΆ
- meditviewΒΆ
- gidviewΒΆ
- geomviewΒΆ
- noboundΒΆ
- nonodewrittenΒΆ
- noelewrittenΒΆ
- nofacewrittenΒΆ
- noiterationnumΒΆ
- nomergeΒΆ
- nobisectΒΆ
- noflipΒΆ
- nojettisonΒΆ
- steinerΒΆ
- fliprepairΒΆ
- docheckΒΆ
- quietΒΆ
- verboseΒΆ
- useshellesΒΆ
- minratioΒΆ
- goodratioΒΆ
- minangleΒΆ
- goodangleΒΆ
- maxvolumeΒΆ
- maxdihedralΒΆ
- alpha1ΒΆ
- alpha2ΒΆ
- alpha3ΒΆ
- epsilonΒΆ
- epsilon2ΒΆ
- parse_switches(switches)ΒΆ
- class meshpy.tet.MeshInfoΒΆ
- pointsΒΆ
- point_attributesΒΆ
- point_metric_tensorsΒΆ
- point_markersΒΆ
- elementsΒΆ
- element_attributesΒΆ
- element_volumesΒΆ
- neighborsΒΆ
- facetsΒΆ
- facet_markersΒΆ
- holesΒΆ
- regionsΒΆ
- facet_constraintsΒΆ
- segment_constraintsΒΆ
- pbc_groupsΒΆ
- facesΒΆ
- adjacent_elementsΒΆ
- face_markersΒΆ
- edgesΒΆ
- edge_markersΒΆ
- edge_adjacent_elementsΒΆ
Added in version 2016.1.
- number_of_point_attributesΒΆ
- number_of_element_attributesΒΆ
Convenient setters:
- set_points(points, point_markers=None)ΒΆ
- set_holes(points, hole_starts)ΒΆ
- set_facets(facets, markers=None)ΒΆ
Set a list of simple, single-polygon factes. Unlike
MeshInfo.set_facets_ex()
, this method does not allow holes and only lets you use a single polygon per facet.- facets
a list of facets, where each facet is a single polygons, represented by a list of point indices.
- markers
Either None or a list of integers of the same length as facets. Each integer is the facet marker assigned to its corresponding facet.
Note
When the above says βlistβ, any repeatable iterable also accepted instead.
- set_facets_ex(facets, facet_holestarts=None, markers=None)ΒΆ
Set a list of complicated facets. Unlike
MeshInfo.set_facets()
, this method allows holes and multiple polygons per facet.- facets
a list of facets, where each facet is a list of polygons, and each polygon is represented by a list of point indices.
- facet_holestarts
Either None or a list of hole starting points for each facet. Each facet may have several hole starting points. The mesh generator starts βeatingβ a hole into the facet at each starting point and continues until it hits a polygon specified in this facetβs record in facets.
- markers
Either None or a list of integers of the same length as facets. Each integer is the facet marker assigned to its corresponding facet.
Note
When the above says βlistβ, any repeatable iterable also accepted instead.
Other functionality:
- face_vertex_indices_to_face_markerΒΆ
- dump()ΒΆ
- write_vtk(filename)ΒΆ
TetGen-provided loading and saving:
- save_nodes(filename)ΒΆ
- save_elements(filename)ΒΆ
- save_faces(filename)ΒΆ
- save_edges(filename)ΒΆ
- save_neighbors(filename)ΒΆ
- save_poly(filename)ΒΆ
- load_node(filename)ΒΆ
- load_pbc(filename)ΒΆ
- load_var(filename)ΒΆ
- load_mtr(filename)ΒΆ
- load_poly(filename)ΒΆ
- load_ply(filename)ΒΆ
- load_stl(filename)ΒΆ
- load_medit(filename)ΒΆ
- load_plc(filename)ΒΆ
- load_tetmesh(filename)ΒΆ