Wildmeshing Toolkit
Loading...
Searching...
No Matches
Classes | Functions
simwild.polyfem_ops.mesh_core Namespace Reference

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)
 

Detailed Description

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.

Function Documentation

◆ _compile_selection()

simwild.polyfem_ops.mesh_core._compile_selection (   sel,
TaggedMesh  mesh 
)
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.

◆ _expr_atoms()

simwild.polyfem_ops.mesh_core._expr_atoms ( str  expr)
protected
Identifiers appearing in an expression (lexing only, no grammar).

◆ assign_selection_ids()

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.

◆ normalize_selection()

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}.

◆ parse_expression()

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).

◆ select_boundary_faces()

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).

◆ select_region_nodes()

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).