Wildmeshing Toolkit
Loading...
Searching...
No Matches
Functions | Variables
simwild.polyfem_ops.polyfem_utils Namespace Reference

Functions

str polyfem_bin ()
 
tuple[int, list] run_streaming (list cmd, Path|None cwd=None, Path|None log_path=None)
 
None check_polyfem_success (int returncode, list[str] stdout_lines, bool allow_out_of_iterations=False)
 
 tag_centroid (msh_path, tag_name)
 
dict _minsep_spec_defaults ()
 

Variables

 _ANSI_RE = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
 
dict _SPEC = _minsep_spec_defaults()
 

Detailed Description

Shared polyfem machinery for the polyfem ops: process streaming and
convergence checking, mesh queries, the optimization-JSON builder, the
2-body polyfem mesh reduction, the interface-constraint step, single solves,
deformed-mesh write-back, and small helpers (deep merge, tag centroids).

Function Documentation

◆ _minsep_spec_defaults()

dict simwild.polyfem_ops.polyfem_utils._minsep_spec_defaults ( )
protected
Root-level defaults from minimum_separation/spec.json — the single
source of truth for op-level defaults. The op validator fills spec
defaults into every cfg, so an engine-side copy that disagreed would be
silently shadowed on the op path anyway (the max_iterations 5-vs-10
trap); deriving keeps direct-engine callers consistent.

◆ check_polyfem_success()

None simwild.polyfem_ops.polyfem_utils.check_polyfem_success ( int  returncode,
list[str]  stdout_lines,
bool   allow_out_of_iterations = False 
)
Raise RuntimeError (with a banner) unless polyfem converged;
allow_out_of_iterations=True also accepts "Iteration limit reached".

◆ polyfem_bin()

str simwild.polyfem_ops.polyfem_utils.polyfem_bin ( )
The PolyFEM binary from $POLYFEM_BIN — the single supported way to
point the polyfem ops at a build. Raises if unset or missing.

◆ run_streaming()

tuple[int, list] simwild.polyfem_ops.polyfem_utils.run_streaming ( list  cmd,
Path | None   cwd = None,
Path | None   log_path = None 
)
Run `cmd`, streaming output live (through a pty so polyfem keeps its
colors) and tee-ing it, ANSI-stripped, to optional `log_path`.
Returns (returncode, output lines).

◆ tag_centroid()

simwild.polyfem_ops.polyfem_utils.tag_centroid (   msh_path,
  tag_name 
)
Volume-weighted centroid (length-3 array) of all tets in the named
3D physical group; ValueError if the group is not found.