upxo.meshing.gbconformant.d3v2p1.chart_reuse module

Reuse of meshed charts across the retry passes of remesh_interfaces_gmsh (opt-in).

A retry pass rebuilds the whole Gmsh model with the failed charts split into smaller disks. Every other chart is unchanged: the same source triangles (so the same retained boundary edges, which are source edges) and the same points. Meshing it again gives the mesh it already had. With ChartCache the charts that came out of a pass with a valid mesh are kept as arrays. In the next pass those charts are hidden from generate(2) (and not parametrized), so only the new and the failed charts are meshed, and their kept meshes are added to the assembled surface as arrays. They are not put into Gmsh: adding meshes to a model entity by entity gets slower with every call as the model grows (about 1 ms per call at 2,500 charts, quadratic in all).

A chart is identified by the sorted ids of its source triangles. Its stored mesh is the coordinates of its interior nodes and its triangles, whose corners are either retained boundary node tags (the same in every pass: they are source node tags) or interior nodes. Interior nodes are numbered after Gmsh’s, so node numbering differs from a run without reuse; the triangles of every chart do not.

A chart is kept only if Gmsh logged no warning that names it. Everything that makes a pass acceptable is checked afterwards on the assembled surface exactly as without reuse (boundary conformity, orientation, intersections, openings, volumes).

upxo.meshing.gbconformant.d3v2p1.chart_reuse.chart_key(ids)[source]

Identity of a chart: its source triangle ids, order-free.

upxo.meshing.gbconformant.d3v2p1.chart_reuse.warned_surfaces(messages)[source]

Gmsh surface tags that any warning or error message in messages names.

class upxo.meshing.gbconformant.d3v2p1.chart_reuse.ChartCache[source]

Bases: object

Meshed charts kept between the passes of one remeshing call (and its retries).

harvest(gmsh, charts, exclude=())[source]

Keep the 2D mesh of every chart (tag -> source triangle ids) not in exclude that has one. Returns the number of charts newly kept.

tags_with_meshes(charts)[source]

Tags of the charts (tag -> source triangle ids) this cache holds a mesh for.

meshes(charts, tags, first_tag)[source]

The kept meshes of the charts in tags as arrays, in the numbering of a model whose largest node tag is first_tag - 1: (tag -> (m, 3) triangle corners as node tags, tags of the interior nodes, their coordinates). Corners that are retained boundary nodes keep their tag; interior nodes get first_tag, first_tag + 1, … Nothing is put into Gmsh: adding meshes to a model entity by entity takes longer with every call as the model grows.

note_pass(depth, charts, reused, kept)[source]
summary()[source]