|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Functions | |
| str | canonical_family (Iterable[str] fragments) |
| Join the literal fragments of a constructed name into one stable pattern. | |
| "dict[str, Set[str]]" | extract_families (str text) |
| Map each name variable built by PetscSNPrintf to every family it carries. | |
| "tuple[Set[str], list[str]]" | scan_option_families (Iterable[pathlib.Path] paths) |
| Collect declared option families and any constructed name that lacks one. | |
| Set[str] | scan_petsc_options (Iterable[pathlib.Path] paths) |
| Perform scan petsc options. | |
| dict | load_manifest (pathlib.Path path) |
| Read and validate the option names, families, and sources in the manifest. | |
| int | main () |
| Entry point for this script. | |
Variables | |
| str | _ACCESSOR = r'PetscOptions(?:Get(?:Int|Real|Bool|String|IntArray|RealArray)|HasName)' |
| OPTION_RE = re.compile(_ACCESSOR + r'\s*\(\s*NULL\s*,\s*NULL\s*,\s*"(-[^"]+)"') | |
| CONSTRUCTED_RE | |
| SNPRINTF_RE = re.compile(r'PetscSNPrintf\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*,') | |
| LITERAL_RE = re.compile(r'"((?:[^"\\]|\\.)*)"') | |
Static ingress audit for PETSc option parsing in setup/io. This script scans the source files named by the manifest for PetscOptionsGet*/HasName calls, extracts option flags, and compares them against a maintained manifest. Two kinds of option name reach C. Most are string literals. A variable-arity configuration, such as the field-statistics window list, must construct its names instead, and a constructed name is invisible to a literal scan. Rather than let that become a hole, this audit also collects the format strings those names are built from, requires each to be declared as a family, and fails on any constructed name it cannot trace back to one. The invariant is that every option name reaching C is either a declared literal or a declared family. Reads that pass a private PetscOptions object rather than NULL are deliberately out of scope: they read checkpoint state, not user configuration.
| str audit_ingress.canonical_family | ( | Iterable[str] | fragments | ) |
Join the literal fragments of a constructed name into one stable pattern.
Each substituted value collapses to a bare %, so a name spliced around PetscInt_FMT and one written with d produce the same family.
| [in] | fragments | Literal chunks of the format expression, in source order. |
canonical_family(). Definition at line 46 of file audit_ingress.py.
| "dict[str, Set[str]]" audit_ingress.extract_families | ( | str | text | ) |
Map each name variable built by PetscSNPrintf to every family it carries.
One buffer is normally reused for many names, so a variable maps to a set rather than a single pattern; collapsing it to the last assignment would hide every family but one.
| [in] | text | Source text of one translation unit. |
extract_families(). Definition at line 58 of file audit_ingress.py.
| "tuple[Set[str], list[str]]" audit_ingress.scan_option_families | ( | Iterable[pathlib.Path] | paths | ) |
Collect declared option families and any constructed name that lacks one.
| [in] | paths | Source files to scan. |
scan_option_families(). Definition at line 85 of file audit_ingress.py.
| Set[str] audit_ingress.scan_petsc_options | ( | Iterable[pathlib.Path] | paths | ) |
Perform scan petsc options.
| [in] | paths | Argument passed to scan_petsc_options(). |
scan_petsc_options(). Definition at line 105 of file audit_ingress.py.
| dict audit_ingress.load_manifest | ( | pathlib.Path | path | ) |
Read and validate the option names, families, and sources in the manifest.
| [in] | path | Filesystem path argument passed to load_manifest(). |
load_manifest(). Definition at line 119 of file audit_ingress.py.
| int audit_ingress.main | ( | ) |
Entry point for this script.
main(). Definition at line 142 of file audit_ingress.py.
|
protected |
Definition at line 30 of file audit_ingress.py.
| audit_ingress.OPTION_RE = re.compile(_ACCESSOR + r'\s*\(\s*NULL\s*,\s*NULL\s*,\s*"(-[^"]+)"') |
Definition at line 32 of file audit_ingress.py.
| audit_ingress.CONSTRUCTED_RE |
Definition at line 35 of file audit_ingress.py.
| audit_ingress.SNPRINTF_RE = re.compile(r'PetscSNPrintf\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*,') |
Definition at line 41 of file audit_ingress.py.
| audit_ingress.LITERAL_RE = re.compile(r'"((?:[^"\\]|\\.)*)"') |
Definition at line 43 of file audit_ingress.py.