|
Wildmeshing Toolkit
|
Classes | |
| class | TaggedMesh |
Functions | |
| _expr_atoms (str expr) | |
| parse_expression (str expr) | |
| normalize_selection (spec) | |
| assign_selection_ids (selections, require_ids=False) | |
| _compile_selection (sel, TaggedMesh mesh) | |
| select_boundary_faces (TaggedMesh mesh, selections) | |
| np.ndarray | select_region_nodes (TaggedMesh mesh, exprs) |
Shared mesh core: tagged-mesh loading, the wmtk expression grammar in
Python (via the wildmeshing bindings), and interface-face selection.
One loader for every consumer (constraints, boundary extraction, reduction):
reads a physical-groups .msh, merges WMTK's duplicate-tet copies (one copy
per tag in a prim's tag-set) into logical prims carrying the unioned name
set, and precomputes face adjacency.
A selection is the boundary of a region, optionally filtered:
{"region": expr, "filter": expr?, "id": int?} (bare string = region). A
face is selected iff its inside cell satisfies `region`, the outside does
not, and — when given — the outside satisfies `filter`. Expressions follow
the wmtk grammar (&, |, !, parentheses; names = physical groups).
Orientation: outward from the region. Interior faces only; the domain
boundary is never selected.
|
protected |
Compile a normalized selection dict against a mesh, validating names. `_` is rejected: on this side every cell carries a group name — write `ambient` instead.
|
protected |
Identifiers appearing in an expression (lexing only, no grammar).
| simwild.polyfem_ops.mesh_core.assign_selection_ids | ( | selections, | |
require_ids = False |
|||
| ) |
Normalize + dedupe selections and assign ids.
Identical (region, filter) specs collapse to ONE selection with one id
(conflicting explicit ids on the same selection raise; distinct
selections may share an explicit id to form one body). Auto ids are
assigned sequentially, never colliding with explicit ones.
Returns (unique, ids_per_input): unique = [{"region", "filter", "id"}]
in first-appearance order; ids_per_input = id for each input spec.
| simwild.polyfem_ops.mesh_core.normalize_selection | ( | spec | ) |
Normalize one selection spec to (region_expr, filter_expr|None, id|None).
Accepts a bare region string or {"region": str, "filter": str, "id": int}.
| simwild.polyfem_ops.mesh_core.parse_expression | ( | str | expr | ) |
Compile a wmtk-grammar tag expression through the C++ parser. Returns (predicate over a set of names, set of names referenced).
| simwild.polyfem_ops.mesh_core.select_boundary_faces | ( | TaggedMesh | mesh, |
| selections | |||
| ) |
Select oriented boundary faces for normalized selection dicts.
A face is selected iff its inside cell satisfies `region`, the outside
cell does not, and — when given — the outside satisfies `filter`.
Interior faces only; domain-boundary faces are never selected.
Returns records {"face": ordered vertex idx tuple, "a_prim": inside key,
"b_prim": outside key, "ids": sorted id list}. Orientation is the
consumer's job: outward from the region (A -> B).
| np.ndarray simwild.polyfem_ops.mesh_core.select_region_nodes | ( | TaggedMesh | mesh, |
| exprs | |||
| ) |
Sorted 0-indexed node ids of every cell whose tag-set satisfies any of the wmtk Boolean expressions in `exprs` (e.g. ["floor", "rod | anchor"]). Raises if an expression selects no cells (almost always a typo'd tag).