pyflightstream.geometry.stages (provisional)¶
Generated from the docstrings at build time: every one of the 78 names in the __all__ of pyflightstream.geometry.stages has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The pure stages of the geometry pipeline, for the workspace and the command line.
Pipeline role: the one public home of the numerical building blocks that the kernel stages
(:mod:pyflightstream.workspace.geometry_pipeline) and the geometry verbs of the command
line call: the B-spline :class:Patch, the generation of the components of a resolved
configuration and their regions, the body and lifting-surface skins and the flat tip cap, the
placement of a wing in the frame of its body, the mesh spacing rules and the mesh checks, the
OBJ writer, the mathematics of reading a lifting surface back from sections, the record
boundary (schema export, pin verification, configuration writing), and junctions, the
namespace of the measured checks and limits of the S10 junction sub-steps.
The pin check of a component record is defined here; configuration writing delegates to the
file boundary, and the other names are defined in the private modules of this package and
re-exported, so a caller in another package imports this module and no private path. The functions
import no geometry
kernel and no solver; they need numpy and scipy only. The names that matter to a user are the
entry points of :mod:pyflightstream.workspace.geometry_pipeline and the configuration
boundary of :mod:pyflightstream.geometry; the rest is the contract between the two
packages and may change between releases while the module is provisional.
Examples:
>>> from pyflightstream.geometry.stages import Mesh, Patch
>>> Patch.__name__, Mesh.__name__
('Patch', 'Mesh')
Used in the guides¶
pyflightstream.geometry.stages.body
¶
body(component, junctions=()) -> list[Patch]
Return the patches of a body, with extra station breaks at the junctions fractions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved body component (plain values, metres and degrees). |
required |
junctions
|
sequence of float
|
Axial fractions at which extra station breaks are inserted; default empty. |
()
|
Returns:
| Type | Description |
|---|---|
list of Patch
|
The cap and band patches of the body, in the body frame. Each carries a |
Examples:
>>> from pyflightstream.geometry._boundary import unpack
>>> from pyflightstream.geometry.config import resolve_config
>>> raw = {"type": "body", "length_mm": 20000.0,
... "sections": [{"at": "middle", "shape": "circle", "radius_mm": 1200.0}]}
>>> patches = body(unpack(resolve_config(raw))["components"]["COMPONENT"])
>>> len(patches) > 0
True
pyflightstream.geometry.stages.controls
¶
Exact control partitions of a pinned lifting skin, with separate closure bases.
Pipeline role: pure geometry for the applied-control hand-off. Outer faces remain iso trims of the input skin. End faces and the hinge wall share its boundary curves by knot insertion and spline evaluation, without sampling or refitting.
ControlPartition
dataclass
¶
ControlPartition(
bases: dict[str, Patch],
pieces: dict[str, tuple[Trim, ...]],
warnings: tuple[str, ...] = (),
checks: tuple[dict, ...] = (),
)
Shared bases, named faces and measured checks of an applied control.
check_fowler
¶
check_fowler(model, entry, *, span)
Recompute the Fowler checks from actual applied bases and iso faces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ControlPartition
|
Applied geometry in the component's local frame. |
required |
entry
|
dict
|
Fowler control definition used for construction. |
required |
span
|
tuple
|
Inboard and outboard skin parameters and the normalized end gap. |
required |
Returns:
| Type | Description |
|---|---|
list of dict
|
Measured checks against the stated clearance and motion targets. |
partition
¶
partition(
skin: Patch,
*,
lower: float,
upper: float,
span: tuple[float, float],
) -> ControlPartition
Partition a pinned skin into closed stationary and aft control pieces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skin
|
Patch
|
One skin, lower trailing edge at u=0, leading edge at u=0.5, upper trailing edge at u=1. The span is v. Root and tip are closed here. |
required |
lower
|
float
|
Pinned hinge parameters on the lower and upper sides. |
required |
upper
|
float
|
Pinned hinge parameters on the lower and upper sides. |
required |
span
|
tuple of float
|
Control limits in the skin's normalized span, strictly inside (0, 1). |
required |
Returns:
| Type | Description |
|---|---|
ControlPartition
|
Bases shared by exact iso trims; closures have their own bases. The two pieces meet at the hinge and ends. Physical gaps and deflection are subsequent operations, not implicit offsets of these faces. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the limits are nonfinite, reversed, outside the skin, or unpinned. |
build
¶
build(
component: dict, *, strict: bool = True
) -> ControlPartition
Build closed plain and Fowler pieces from resolved control entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved lifting surface in its local frame. Span limits and gaps are fractions of the planform semispan; chord gap is a chord fraction. |
required |
strict
|
bool
|
Refuse inadequate nested clearance; false retains the failed measurement for the runner to stop at the nesting sub-step. |
True
|
Returns:
| Type | Description |
|---|---|
ControlPartition
|
Stationary main and separate rigidly moved pieces for each angle. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If controls overlap, gaps consume a span, or a hinge cannot rotate rigidly. |
placed
¶
placed(components: dict, name: str) -> ControlPartition
Build the named component's controls in the assembled coordinate frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
dict
|
Resolved component definitions including attachment parents. |
required |
name
|
str
|
Lifting surface carrying controls. |
required |
Returns:
| Type | Description |
|---|---|
ControlPartition
|
Bases transformed by the component placement and parent chain. |
face_patches
¶
face_patches(model: ControlPartition, trims) -> list[Patch]
Restrict rectangular applied faces exactly for the assembly's source hulls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ControlPartition
|
Bases and iso trims of an applied component. |
required |
trims
|
sequence of Trim
|
The faces of one stationary or moving piece. |
required |
Returns:
| Type | Description |
|---|---|
list of Patch
|
Exact restrictions by knot insertion, with normalized parameters. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If a face is not a rectangular iso trim or has an inner loop. |
imported
¶
imported(skin: Patch, entry: dict) -> dict
Prepare a plain control on an imported normalized closed-section skin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skin
|
Patch
|
Polynomial base with lower trailing edge at u=0, leading edge at u=0.5 and upper trailing edge at u=1. Span parameter is v. |
required |
entry
|
dict
|
Public control table with eta, chord_ratio, gaps and deflection_deg. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Exact partitions, UV limits and rigid motion matrices. The caller retains source trims by splitting the original native faces. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the control limits, kind or gap are unsupported or invalid. |
pyflightstream.geometry.stages.lifting_surface
¶
lifting_surface(component) -> list[Patch]
Return the skin of a lifting surface as the four-sided faces the generator writes today.
The shape is the one skin of :func:skin_model; it is sampled per layout family and bay at
the nose-clustered chord fractions the mesh spacing rules read and written as bicubic faces,
six families per bay. This is the generator's face set until the export writes the skin with
its trims; the trims and the exact layout are in :func:skin_model and :func:layout_blocks.
A bay ends only at a defining section: section lines that do not define shape (nacelle
bounds, control-surface ends, spanwise.lines) are iso lines of the skin, not face edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved lifting-surface component (plain values, metres and degrees). |
required |
Returns:
| Type | Description |
|---|---|
list of Patch
|
The skin faces, six families per spanwise bay. |
Examples:
>>> from pyflightstream.geometry import resolve_config, stages
>>> config = resolve_config({"type": "lifting_surface"})
>>> component = stages.unpack(config)["components"]["COMPONENT"]
>>> faces = stages.lifting_surface(component)
>>> len(faces) > 0
True
pyflightstream.geometry.stages.unpack
¶
unpack(value, path='', *, propeller_units=None)
Strip the {value, unit, source} wrappers, checking each unit, and return plain values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
A resolved configuration value: a wrapper, a mapping, a list or a plain value. |
required |
path
|
str
|
Dotted path of |
''
|
propeller_units
|
mapping
|
Skew and rake column units while descending a schema 1 definition; inferred automatically at the definition boundary. |
None
|
Returns:
| Type | Description |
|---|---|
object
|
A deep copy of |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If a wrapper carries a unit other than the one its path implies, or a source other than
|
Examples:
>>> from pyflightstream.geometry.stages import unpack
>>> unpack({"name": {"value": "wing", "unit": "1", "source": "given"}})
{'name': 'wing'}
Advanced¶
pyflightstream.geometry.stages.CheckFailedError
¶
CheckFailedError(check: Mapping)
Bases: InputValueError
A check measured as failed where the construction cannot go on; it carries the check.
Raised as an input error, so a direct caller is refused with the check's id and note; a run
records the carried check in the sub-step that owns it and stops there as failed.
pyflightstream.geometry.stages.GeneratedPiece
dataclass
¶
GeneratedPiece(
name: str,
version: str,
bases: dict[str, Patch],
trims: tuple[Trim, ...],
layout: dict[str, Any],
hull_patches: tuple[Patch, ...] = (),
inert_bases: tuple[str, ...] = (),
)
Placed bases and UV faces, with the version and identity actually generated.
Layout lines are metadata. They never split or resample these bases. Assembly propagates the base index of each retained face back to this source record.
pyflightstream.geometry.stages.Mesh
dataclass
¶
Mesh(
xyz: ndarray,
cells: list[tuple[int, ...]],
components: list[str],
surfaces: list[int],
node_tags: ndarray,
)
Nodes xyz (n, 3), polygon cells (node index tuples), and per-cell labels.
pyflightstream.geometry.stages.Patch
dataclass
¶
Patch(
family: str,
controls: ndarray,
knots_u: tuple[float, ...],
knots_v: tuple[float, ...],
multiplicities_u: tuple[int, ...],
multiplicities_v: tuple[int, ...],
degree_u: int,
degree_v: int,
bay: tuple[float, float] | None = None,
role: str = "",
edge_ids: tuple[str, ...] = (),
)
A tensor-product B-spline surface with clamped knot vectors.
Attributes:
| Name | Type | Description |
|---|---|---|
family |
str
|
Role of the patch in its component, for example |
controls |
ndarray
|
Control points, shape |
knots_u, knots_v |
tuple of float
|
Distinct knots of each direction. |
multiplicities_u, multiplicities_v |
tuple of int
|
Multiplicity of each distinct knot. |
degree_u, degree_v |
int
|
Polynomial degree of each direction. |
bay |
tuple of float or None
|
Normalized span interval |
role |
str
|
What the patch is for in its component ( |
edge_ids |
tuple of str
|
Names of the four boundary edges |
pyflightstream.geometry.stages.STAGE_ROWS
module-attribute
¶
STAGE_ROWS: tuple[StageRow, ...] = (
_row(
"S0",
"Definition",
False,
("input.valid", "no refused key"),
),
_row(
"S1",
"Section law",
False,
("section.residual", "acceptance.section_residual"),
("section.one_nose_radius", "acceptance"),
("section.te_thickness", "acceptance"),
("section.inflection", "acceptance"),
),
_row(
"S1.P",
"Propeller section fit",
False,
(
"propeller.section_fit",
"definition.options.fit_tol_chord",
),
),
_row(
"S2",
"Identity report",
False,
("identity.listed", "every seed listed"),
),
_row(
"S3",
"Compatibility",
False,
(
"compat.common_vector",
"identical knots and pins",
),
("compat.shape_unchanged", "1e-9 of the chord"),
),
_row(
"S4",
"Planform or body law",
False,
("law.fewest_stations", "acceptance"),
("law.monotonic", "acceptance"),
("law.ruled_twist", "acceptance"),
("law.region_boundaries", "acceptance"),
),
_row(
"S4.P",
"Propeller design measures",
False,
("propeller.solidity", "positive disk area ratio"),
(
"propeller.activity_factor",
"positive per-blade integral",
),
("propeller.beta_reference", "1e-10 deg residual"),
(
"propeller.beta_0p7R",
"absolute beta from plane at most 90 deg",
),
),
_row(
"S5",
"Placement",
False,
("place.frame", "acceptance"),
),
_row(
"S5.P",
"Propeller planar placement",
False,
("propeller.section_plane", "1e-8 mm"),
("propeller.handedness", "zero sign violations"),
),
_row(
"S6",
"Skin",
False,
("skin.section_exact", "1e-12 m"),
("skin.law_residual", "acceptance"),
(
"skin.distance",
"acceptance, when an original exists",
),
),
_row(
"S6.P",
"Propeller cubic loft",
False,
(
"propeller.loft_exact",
"1e-8 mm at defining stations",
),
("propeller.loft_c2", "zero radial knots below C2"),
),
_row(
"S7",
"Trims and layout",
False,
("trim.closed", "1e-12 in parameter units"),
("trim.in_domain", "domain of the skin"),
("trim.iso_exact", "axis-aligned"),
("trim.partition", "1e-9 relative"),
("trim.outer_only", "warning"),
),
_row(
"S8.P",
"Propeller numerical closure",
False,
(
"propeller.closure",
"zero unexpected free or triple edges at 1e-6 mm",
),
(
"spinner.periodic_net",
"1e-6 mm, sector nets turned by 360/N, with a [spinner] table",
),
(
"spinner.periodic_surface",
"1e-6 mm on a 41 by 41 grid per face",
),
(
"spinner.seam_shared",
"1e-6 mm between neighbouring seam edges",
),
(
"spinner.split_exact",
"1e-9 mm against the global surface",
),
("spinner.circle", "definition.spinner.circle_tol"),
(
"spinner.continuity",
"1 deg normal jump on band cuts, seams, pole and shoulder",
),
(
"spinner.junction_in_band",
"more than 0.01 mm clearance to band cuts and seams",
),
(
"spinner.junction_gap",
"0.01 mm between the blade and hub images of the junction",
),
),
_row(
"S8",
"Closures",
False,
("closure.rim_shared", "1e-12 m"),
(
"closure.cap_edge_gap",
"5e-6 m, 4001 boundary samples",
),
("closure.rim_jump", "acceptance"),
("closure.base_present", "acceptance"),
("closure.no_ridge", "acceptance"),
("closure.retracted_identity", "acceptance"),
),
_row(
"S8.B1",
"Blister build",
False,
(
"section.residual",
"body tolerance, 1e-4 of its length by default",
),
(
"continuity.bluff_jump",
"1 deg, geometry._blister.SEAM_LIMIT_DEG",
),
),
_row(
"S8.B2",
"Blister trim by host",
False,
(
"closure.base_present",
"every section enters the host",
),
("blister.crease_on_host", "1e-9 m"),
("trim.closed", "1e-12 in parameter units"),
("trim.in_domain", "domain of the base"),
(
"trim.area_removed",
"1e-2 relative, geometry._blister.AREA_REMOVED_LIMIT",
),
),
_row(
"S8.B3",
"Blister closure",
False,
(
"closure.free_edges",
"none: poles at the tips, symmetry plane at the keel",
),
),
_row(
"S8.F1",
"Fillet build",
False,
(
"fillet.spine",
"every section finds the hosts' intersection",
),
(
"closure.tangent_host",
"1 deg, geometry._fillet.TANGENT_LIMIT_DEG",
),
(
"closure.tangent_wing",
"1 deg, geometry._fillet.TANGENT_LIMIT_DEG",
),
(
"closure.contact_gap_host",
"body tolerance, 1e-4 of its length by default",
),
(
"closure.contact_gap_wing",
"body tolerance, 1e-4 of its length by default",
),
),
_row(
"S8.F2",
"Fillet trim by host",
False,
(
"closure.base_present",
"the base runs past both contact lines",
),
(
"fillet.host_footprint",
"2e-2 relative, geometry._fillet.FOOTPRINT_LIMIT",
),
(
"fillet.contact_on_face",
"no contact on the part of a blister its body trims away",
),
),
_row(
"S8.F3",
"Fillet closure",
False,
(
"closure.free_edges",
"none; the lower end when the lower face stops short of the TE",
),
),
_row(
"S9",
"Continuity",
False,
(
"continuity.bluff_jump",
"1 deg or a declared crease",
),
("continuity.internal", "reported"),
),
_row(
"S10",
"Junctions",
False,
(
"dominance.plan",
"no cycle; a row naming no member is warned and skipped",
),
),
_row(
"S10.D1",
"Pieces loaded",
True,
(
"assembly.face_count",
"the faces the generation built, per piece",
),
(
"placement.contact",
"the row's tolerance_m: the pieces of a row touch",
),
(
"assembly.thin_feature",
"mean width at least two SEW_M bands, 2e-5 m",
),
),
_row(
"S10.C5",
"Piece regenerated",
True,
("piece.regenerated", "REGENERATE_M, 1e-9 m"),
),
_row(
"S10.C6",
"Symmetry edges",
True,
("piece.symmetry_edges", "SYMMETRY_M, 1e-6 m"),
),
_row(
"S10.C8",
"Rims of the dominated buried",
True,
("join.rim_inside", "RIM_MARGIN_M"),
),
_row(
"S10.C9",
"Openings on their partner",
True,
("join.opening_on_partner", "OPENING_M"),
),
_row(
"S10.D2",
"Each piece alone, written, read back and sewn at 0.01 mm",
True,
(
"reimport.faces",
"faces read equal faces written",
),
("piece.triple_edges", "none"),
(
"piece.free_edges",
"none unexplained: symmetry, opening or buried",
),
),
_row(
"S10.C7",
"Each piece alone sewn at 0.001 mm",
True,
(
"junction.free_edges_classified",
"none unexplained at SEW_FINE_M",
),
),
_row(
"S10.D3",
"Body joins cut",
True,
("join.crease_gap", "CREASE_GAP_M, 1e-6 m"),
(
"join.length",
"MIN_JUNCTION_FRACTION, 0.04 of the smaller piece's extent",
),
),
_row(
"S10.D4",
"Cuts",
True,
("junction.curve_gap", "JUNCTION_GAP_M, 5e-6 m"),
(
"junction.chain_ends",
"CHAIN_END_GAP_M: no lonely end",
),
("junction.loop_closure", "LOOP_CLOSURE_M, 5e-6 m"),
("junction.single_curve", "one curve per junction"),
(
"junction.shared_vertex",
"one vertex where faces meet",
),
(
"junction.pcurve_on_face",
"JUNCTION_GAP_M, 5e-6 m",
),
(
"junction.length",
"MIN_JUNCTION_FRACTION, 0.04 of the smaller piece's extent",
),
),
_row(
"S10.E1",
"Groups of three pieces or more",
True,
(
"group.junction_length",
"MIN_JUNCTION_FRACTION of the smaller piece, per pair",
),
(
"group.single_curve",
"one curve per junction of the group",
),
),
_row(
"S10.D5",
"Projected junctions",
True,
(
"junction.projected_length",
"the dominant's contact edges, 1e-3 relative",
),
("junction.offset", "the row's tolerance_m"),
("junction.ends_on_cut", "J_END_ON_CUT_M, 5e-5 m"),
),
_row(
"S10.D6",
"Hosts split",
True,
("junction.on_host_loops", "J_ON_LOOP_M, 5e-6 m"),
(
"junction.split_closure",
"J_LOOP_CLOSURE_M, 2e-5 m",
),
),
_row(
"S10.D8",
"Inside removed",
True,
("removal.seeds_reach", "every piece keeps a seed"),
("removal.kept_on_loops", "KEPT_ON_LOOP_M, 1e-5 m"),
(
"removal.area",
"the area under the dominants, 1e-3 relative",
),
("junction.no_vertex_inside", "none"),
("junction.no_triple_edge", "none"),
),
_row(
"S10.D8b",
"Skin coverage",
True,
("coverage.skin", "acceptance.coverage_fraction"),
("coverage.area_sum", "1e-3 relative"),
),
_row(
"S10.C1",
"Shared curves of the joins",
True,
("join.shared_pairs", "at least one"),
),
_row(
"S10.C2",
"Joins written",
True,
("join.written_pairs", "WRITTEN_PAIR_M, 1e-9 m"),
),
_row(
"S10.C3",
"Edges on their surface",
True,
("join.edge_on_surface", "EDGE_ON_SURFACE_M"),
),
_row(
"S10.C4",
"Joins sewn in one import",
True,
(
"join.group_free_edges",
"none unexplained at SEW_M and SEW_FINE_M",
),
),
_row(
"S10.D9",
"Assembly written and read back",
True,
(
"write.read_back",
"faces read equal faces written, per piece",
),
("write.area", "1e-3 relative, per piece"),
),
_row(
"S10.D10",
"Assembly sewn at 0.01 and 0.05 mm",
True,
(
"sew.free_introduced",
"none beyond the pieces' own",
),
("sew.triple_edges", "none"),
(
"sew.slivers",
"none beyond the pieces' own, SLIVER_WIDTH_M (theirs listed)",
),
),
_row(
"S10.E2",
"Separate pieces clear",
True,
(
"assembly.clearance",
"SEW_M, 1e-5 m, the sewing tolerance (min)",
),
),
_row(
"S10.FW1",
"Fowler cove bays",
True,
(
"fowler.cove_bay_mismatch",
"0; split each cove face at every skin span knot",
),
),
_row(
"S10.FW2",
"Fowler nesting",
True,
(
"fowler.nested_clearance_pct",
"control.clearance_pct, minimum percent chord",
),
),
_row(
"S10.FW3",
"Fowler motion laws",
True,
(
"fowler.gap_error_pct",
"below 0.01 percent chord, 49 stations",
),
(
"fowler.overlap_error_pct",
"below 0.01 percent chord, 49 stations",
),
(
"fowler.law_threshold_hits",
"0 errors at or above 0.01 percent chord",
),
(
"fowler.inside_main",
"0 profile points at 49 stations",
),
),
_row(
"S10.FW4",
"Fowler retracted exterior",
True,
(
"closure.retracted_identity",
"1e-12 m outside the nose and lip gap bands",
),
),
_row(
"S10.F0",
"Control pieces read",
True,
(
"control.faces_read",
"faces read equal faces written",
),
),
_row(
"S10.F1",
"Main with cove sewn",
True,
(
"control.f1.free_edges",
"0 unexplained at 0.01 mm",
),
("control.f1.triple_edges", "0"),
),
_row(
"S10.F2",
"Control alone sewn",
True,
(
"control.f2.free_edges",
"0 except named open ends at 0.01 mm",
),
("control.f2.triple_edges", "0"),
),
_row(
"S10.F3",
"Control host clearance",
True,
(
"control.host_contact",
"0 pairs with native distance <= 0 m",
),
),
_row(
"S10.F4",
"Main and control together",
True,
(
"control.f4.free_delta",
"0 relative to F1 plus F2",
),
("control.f4.free_edges", "0 unnamed slot edges"),
("control.f4.triple_edges", "0"),
),
_row(
"S10.F5",
"Controlled wing body cut",
True,
("control.f5.free_delta", "0 relative to F4"),
(
"control.f5.junction_length",
"equal to the clean assembly reference",
),
("control.f5.triple_edges", "0"),
),
_row(
"S10.F6",
"Controlled wing nacelle cuts",
True,
("control.f6.free_delta", "0 relative to F5"),
(
"control.f6.junction_length",
"equal to the clean assembly reference",
),
("control.f6.triple_edges", "0"),
),
_row(
"S10.F7",
"Capped tail group",
True,
("control.f7.free_edges", "0 at 0.01 mm"),
("control.f7.triple_edges", "0"),
),
_row(
"S11",
"Export",
True,
(
"write.face_count",
"faces written equal retained faces",
),
("profile.surfaces_only", "no solid entity"),
),
_row(
"S11.V",
"Export registry",
False,
("manifest.piece_version", "version of each piece"),
),
_row(
"S11.PU",
"Propeller output units",
False,
(
"propeller.output_units",
"zero files outside schema 1 mm units",
),
),
_row(
"S11.P",
"Export profile",
False,
("profile.reader", "reader profile"),
("profile.base_shared", "1e-12"),
),
_row(
"S11.PC",
"Propeller written trim curves",
False,
(
"propeller.trim_preference",
"zero missing curves or non-PREF-1 boundaries",
),
(
"propeller.pcurve_3d",
"1e-4 mm between the pcurve image and spatial iso trim",
),
(
"propeller.pcurve_3d_junction",
"0.01 mm sewing tolerance between the pcurve image and spatial junction trim",
),
),
_row(
"S11.R",
"Export reimport",
True,
("area.read_back", "1e-3 relative"),
("area.source_excess", "acceptance.area_excess"),
("reimport.each_component", "0 lost faces"),
(
"reimport.free_edges",
"0 changed edges at 1e-5 m",
),
("reimport.triple_edges", "0 edges"),
),
_row(
"S11.S",
"Export sew",
True,
(
"sew.free_introduced",
"0 new edges at 1e-5 and 5e-5 m",
),
("sew.triple_edges", "0 edges"),
(
"sew.slivers",
"0 new faces below 5 mm mean width",
),
),
_row(
"S11.PS",
"Propeller sewn topology",
True,
(
"propeller.sewn_free_edges",
"zero beyond explicitly uncapped rims",
),
("propeller.sewn_triple_edges", "zero"),
(
"spinner.periodic_reimport",
"0.01 mm, written faces turned by 360/N, with a spinner",
),
),
_row(
"S12.C",
"Reader conversion",
True,
("gate.convert", "0 changed face counts"),
),
_row(
"S12.G",
"Reader gridding",
True,
("gate.grid", "0 mismatched or triple edges"),
),
_row(
"S12",
"Reader gate",
False,
("gate.conformal", "0 mismatched or triple edges"),
(
"gate.te_found",
"positive upper TE rim from sidecar roles",
),
),
_row(
"S13.R",
"Regenerate stored sections",
False,
("roundtrip.same_surface", "equal surface_id"),
),
_row(
"S13",
"Round trip",
True,
("roundtrip.identify", "acceptance"),
),
)
pyflightstream.geometry.stages.StageRow
dataclass
¶
StageRow(
stage: str,
name: str,
kernel: bool,
checks: tuple[tuple[str, str], ...],
)
One stage: its id, its name, whether it needs the kernel, and its checks.
checks is a tuple of (check id, limit) pairs; limit states where the limit is
taken from.
pyflightstream.geometry.stages.adopt_propeller
¶
adopt_propeller(data)
Wrap standalone schema 1 data as one geometry component, retaining its own units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
mapping
|
Standalone propeller schema 1 data, or a configuration that is returned unchanged. |
required |
Returns:
| Type | Description |
|---|---|
mapping
|
The configuration holding the data as one propeller component. |
pyflightstream.geometry.stages.adopt_surface_file
¶
adopt_surface_file(source)
Return source with a [surface] or [body] file read as one component.
A file of the published form holds no type: [surface] makes it a lifting surface and
[body] a body. The file-level tables (units, aircraft, acceptance,
reader) stay at the file level; every other table belongs to the component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Mapping
|
A parsed configuration file. |
required |
Returns:
| Type | Description |
|---|---|
Mapping
|
The file with a |
Examples:
>>> from pyflightstream.geometry.stages import adopt_surface_file
>>> adopted = adopt_surface_file({"surface": {"name": "W"}})
>>> adopted["components"]["W"]["type"]
'lifting_surface'
pyflightstream.geometry.stages.assembly_regions
¶
assembly_regions(config, patches) -> dict
Return the inside predicate of every component, in the world frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Resolved configuration of the assembly. |
required |
patches
|
dict
|
Placed patches per component name, as :func: |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Component name to a function of a world point that tells whether it is inside. |
pyflightstream.geometry.stages.azimuth_count
¶
azimuth_count(
stations,
rule: Mapping[str, Any],
*,
ring_count: int = 0,
) -> tuple[int, float]
Derive a half-body count from measured (x, half perimeter, axial step) rows.
A numeric reference must be a measured station. This boundary never invents an unmeasured perimeter or silently moves the requested reference station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
array_like
|
Measured rows of |
required |
rule
|
mapping
|
The azimuth rule: |
required |
ring_count
|
int
|
The count the result may not fall below. |
0
|
Returns:
| Type | Description |
|---|---|
tuple of int and float
|
The half-body azimuth count and the reference station |
Raises:
| Type | Description |
|---|---|
InputValueError
|
When the rows are malformed or not positive, the aspect is not positive,
|
pyflightstream.geometry.stages.azimuth_count
¶
azimuth_count(
stations,
rule: Mapping[str, Any],
*,
ring_count: int = 0,
) -> tuple[int, float]
Derive a half-body count from measured (x, half perimeter, axial step) rows.
A numeric reference must be a measured station. This boundary never invents an unmeasured perimeter or silently moves the requested reference station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
array_like
|
Measured rows of |
required |
rule
|
mapping
|
The azimuth rule: |
required |
ring_count
|
int
|
The count the result may not fall below. |
0
|
Returns:
| Type | Description |
|---|---|
tuple of int and float
|
The half-body azimuth count and the reference station |
Raises:
| Type | Description |
|---|---|
InputValueError
|
When the rows are malformed or not positive, the aspect is not positive,
|
pyflightstream.geometry.stages.azimuth_split
¶
azimuth_split(
total: int, arcs: Sequence[float], *, floor: int = 1
) -> list[int]
Split a half-body azimuth count over its sectors in proportion to their arc lengths.
Largest remainders take the leftover cells; every sector holds at least floor cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
total
|
int
|
The half-body azimuth cell count to distribute. |
required |
arcs
|
sequence of float
|
The finite positive arc length of each sector. |
required |
floor
|
int
|
The fewest cells any sector holds. |
1
|
Returns:
| Type | Description |
|---|---|
list of int
|
One cell count per sector; they sum to |
Raises:
| Type | Description |
|---|---|
InputValueError
|
When the total cannot give every sector its floor. |
pyflightstream.geometry.stages.blister_model
¶
blister_model(blister, host_body) -> BlisterModel
Return the bases, faces and records of a blister on its host body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blister
|
dict
|
Resolved blister component (plain values, metres). |
required |
host_body
|
dict
|
Resolved body component the blister hangs under. |
required |
Returns:
| Type | Description |
|---|---|
BlisterModel
|
The front and rear bases split at the station of greatest depth, their faces bounded by
the crease against the host, and the records |
Raises:
| Type | Description |
|---|---|
InputValueError
|
When a section of the blister does not enter its host, so no crease exists. |
pyflightstream.geometry.stages.block_from_walk
¶
block_from_walk(
name: str,
component: str,
walk: Sequence[int],
turns: Sequence[float],
*,
cusps: bool = True,
) -> Block | None
Choose the four corners of a face from the turns of its walk; None if it has none.
walk is the closed signed edge walk and turns[k] the turn in degrees at the vertex
where edge k starts. The four sharpest turns that are not cusps are the corners, so a
face of five or more edges becomes a block with composite sides. A face of fewer than four
edges, or with fewer than four corners, is not a block: strategy 2 reports it by name as
not full grid (delta F.2) instead of refusing. A cusp (the walk turning back) is a corner
only when the face has too few other corners, and never with cusps=False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The block name. |
required |
component
|
str
|
The component the face belongs to. |
required |
walk
|
sequence of int
|
The closed signed edge walk of the face. |
required |
turns
|
sequence of float
|
The turn in degrees at the start vertex of each edge of |
required |
cusps
|
bool
|
Whether a cusp may serve as a corner when the face has too few other corners. |
True
|
Returns:
| Type | Description |
|---|---|
Block or None
|
The block with its four sides and corner indices, or |
pyflightstream.geometry.stages.build_id
¶
build_id(
parameter: str,
package_version: str,
kernel_name: str,
kernel_version: str,
) -> str
Return the build_id: a parameter identity tied to the package and the kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter
|
str
|
Resolved parameter identity. |
required |
package_version
|
str
|
Package version used for generation. |
required |
kernel_name
|
str
|
Geometry kernel name. |
required |
kernel_version
|
str
|
Geometry kernel version. |
required |
Returns:
| Type | Description |
|---|---|
str
|
SHA-256 identity as 64 hexadecimal digits. |
pyflightstream.geometry.stages.cap_edge_gap
¶
cap_edge_gap(model: LiftingModel) -> float
Measure each cap surface along its shared boundary, including the corner sides.
Compare 4001 corresponding boundary points, including endpoints, on the exact spline edges. This includes the side edges of the corner, which a skin-rim-only check misses. No interior fit samples are used as evidence of boundary closure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
LiftingModel
|
Skin, trailing edge and caps in the same coordinate frame, in metres. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Largest sampled boundary gap in metres, or zero when no caps are present. |
pyflightstream.geometry.stages.carry_pairs_growth
¶
carry_pairs_growth(
counts: Mapping[int, int],
lengths: Mapping[int, float],
carry: Sequence[tuple[int, int]],
) -> float
Return the largest width ratio over the carry pairs (1.0 when there is none).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
counts
|
mapping of int to int
|
The cell count of each edge. |
required |
lengths
|
mapping of int to float
|
The length of each edge. |
required |
carry
|
sequence of tuple of int
|
The pairs of edges that continue one grid line across a junction. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The largest ratio of the wider to the narrower cell width over the pairs. |
pyflightstream.geometry.stages.check_body
¶
check_body(component, controls, items, polylines)
Measure the body spacing rules; items also carry axial (set on a band).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved body component; its length sets the axial step. |
required |
controls
|
dict
|
Mesh controls whose |
required |
items
|
sequence of dict
|
One entry per structured patch with its |
required |
polylines
|
dict
|
Edge tag to its |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
|
pyflightstream.geometry.stages.check_entry
¶
check_entry(
check_id,
status,
measured=None,
limit=None,
*,
unit="",
where=None,
note="",
bound="max",
)
Return one check of a stage record.
A check that ran (passed or failed) carries a finite measured value and a finite
limit, so a paper can cite both, and its status must follow from them: bound says whether
the limit is a maximum, the default, or a minimum. A skipped check carries a note that says
why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
The id of the check in the stage table, such as |
required |
status
|
str
|
|
required |
measured
|
float
|
The measured value; required when the check ran. |
None
|
limit
|
float
|
The limit it is held to; required when the check ran. |
None
|
unit
|
str
|
The unit of |
''
|
where
|
Mapping
|
Where the worst value sits, such as a component or a station. |
None
|
note
|
str
|
Why a skipped check was skipped; required for |
''
|
bound
|
str
|
|
'max'
|
Returns:
| Type | Description |
|---|---|
dict
|
The check as plain values. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the status is unknown, a number is missing or not finite, a skipped check has no note, or the status contradicts the numbers. |
Examples:
>>> from pyflightstream.geometry.stages import check_entry
>>> check_entry("input.valid", "passed", 0, 0, unit="refused keys")["status"]
'passed'
pyflightstream.geometry.stages.check_lifting
¶
check_lifting(component, controls, items, polylines)
Measure the lifting-surface spacing rules.
items lists {"family", "u", "v", "surface"} per structured patch (u and v the
edge tags); polylines maps an edge tag to its (n, 3) realized nodes. Trailing-edge
strips are skipped. Returns (rows, failures).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved lifting-surface component; its span sets the tip position. |
required |
controls
|
dict
|
Mesh controls whose chord growth, tip cells and tip ratio the edges are measured against. |
required |
items
|
sequence of dict
|
One entry per structured patch, as described above. |
required |
polylines
|
dict
|
Edge tag to its |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
|
pyflightstream.geometry.stages.check_mesh
¶
check_mesh(
mesh,
normals,
distances,
transition_surfaces=(),
symmetry_tolerance=1e-07,
*,
distance_tolerance=0.0005,
area_tolerance=1e-14,
)
Measure the acceptance checks of an oriented mesh and return them as one record.
normals holds one oriented source normal per cell and distances the distance of each
node to every incident source surface. accepted covers those checks only: not physical
spacing and not solver setup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
Mesh
|
The oriented mesh. |
required |
normals
|
array_like
|
One oriented source normal per cell, shape |
required |
distances
|
array_like
|
Distance of each node to its source surfaces, shape |
required |
transition_surfaces
|
sequence of int
|
Surfaces allowed to hold triangles; default none. |
()
|
symmetry_tolerance
|
float
|
Largest |
1e-07
|
distance_tolerance
|
float
|
Largest accepted node-to-source distance, metres; default 5e-4. |
0.0005
|
area_tolerance
|
float
|
Area below which a cell is degenerate, square metres; default 1e-14. |
1e-14
|
Returns:
| Type | Description |
|---|---|
dict
|
The record of counts, cell lists, tolerances and the |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the shapes of |
pyflightstream.geometry.stages.check_triangles
¶
check_triangles(
cells: Sequence[Sequence[int]],
components: Sequence[str],
) -> None
Refuse any triangle (E07): strategy 2 is a full quad grid everywhere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cells
|
sequence of sequence of int
|
The node indices of each cell. |
required |
components
|
sequence of str
|
The component name of each cell, in the order of |
required |
Raises:
| Type | Description |
|---|---|
InputValueError
|
E07 when any cell has three nodes, naming the count per component. |
pyflightstream.geometry.stages.chord_fraction
¶
chord_fraction(component, points)
Return the chord fraction of model-space points on a lifting surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved lifting-surface component. |
required |
points
|
ndarray
|
Model-space points, shape |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The chord fraction of each point, shape |
pyflightstream.geometry.stages.chord_nodes
¶
chord_nodes(component, controls, family, eta)
Return the chordwise nodes of a fore or aft skin patch at span fraction eta, or None.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved lifting-surface component. |
required |
controls
|
dict
|
Mesh controls for the lifting surface ( |
required |
family
|
str
|
Patch family, such as |
required |
eta
|
float
|
Span fraction at which the thickness station is taken. |
required |
Returns:
| Type | Description |
|---|---|
ndarray or None
|
Normalized nodes from 0 to 1, or None for a trailing-edge family. |
pyflightstream.geometry.stages.clean_band
¶
clean_band(stations, features, trend_tolerance=0.0001)
Classify stations by topology, then chord and thickness against interior smooth trends.
The interior polynomial trend is a classifier, never the output planform. A departure is rejected conservatively and recorded. Returns the indices of the longest clean run, the mask of every station that passed and the diagnostics of both trends.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
array_like
|
Span station of each cut. |
required |
features
|
sequence
|
Features of each cut, or None where the cut was rejected. |
required |
trend_tolerance
|
float
|
Relative departure from the interior trend that rejects a station; default 1e-4. |
0.0001
|
Returns:
| Type | Description |
|---|---|
tuple
|
|
Raises:
| Type | Description |
|---|---|
InputValueError
|
If fewer than eight interior cuts are closed, no station is clean, or the clean run has fewer than eight cuts. |
pyflightstream.geometry.stages.closed_contour
¶
closed_contour(segments, tolerance=CLOSURE_TOLERANCE_M)
Chain cut segments end to end into one closed contour or reject the station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segments
|
iterable of array_like
|
Polyline segments of one cut, each |
required |
tolerance
|
float
|
Largest endpoint or closure gap, metres; default |
CLOSURE_TOLERANCE_M
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The closed contour, shape |
pyflightstream.geometry.stages.component_topology
¶
component_topology(
name: str,
kind: str,
table: Mapping[str, Any] | None = None,
) -> dict
Return the block topology of one component: its kind, index directions and poles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The component, for the messages. |
required |
kind
|
str
|
Its type ( |
required |
table
|
mapping
|
Its |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Raises:
| Type | Description |
|---|---|
InputValueError
|
For a topology outside :data: |
pyflightstream.geometry.stages.constant
¶
constant(cells)
Return cells + 1 equally spaced normalized nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cells
|
int
|
Number of cells; a positive integer. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The nodes from 0 to 1, shape |
pyflightstream.geometry.stages.contour_features
¶
contour_features(contour, span)
Measure one closed cut: leading and trailing edge, chord, incidence, thickness ratio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contour
|
array_like
|
Closed contour of the cut, shape |
required |
span
|
array_like
|
Spanwise direction of the cut. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The |
pyflightstream.geometry.stages.cosine
¶
cosine(count)
Return count cosine-spaced values from 0 to 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
Number of samples; at least three. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The samples, shape |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If |
pyflightstream.geometry.stages.count_classes
¶
count_classes(
loops, seeds, default_cells=4, lengths=None, target=None
)
Solve the opposite-edge cell-count equalities; refuse contradictory fixed counts.
loops maps a surface to its four signed edges, seeds maps an edge to its fixed
normalized nodes. With lengths and target the free classes take the rounded mean
length over target; otherwise they take default_cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loops
|
dict
|
Surface to its four signed edge tags. |
required |
seeds
|
dict
|
Edge tag to its fixed normalized nodes. |
required |
default_cells
|
int
|
Cell count of a free class when no lengths are given; default 4. |
4
|
lengths
|
dict
|
Edge tag to its length, used with |
None
|
target
|
float
|
Target cell length for the free classes. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Edge tag to its cell count. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If two seeded edges of one opposite-edge class fix different cell counts. |
pyflightstream.geometry.stages.evaluate_patch
¶
evaluate_patch(patch: Patch, count: int = 41) -> np.ndarray
Sample a patch on a square parameter lattice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patch
|
Patch
|
B-spline surface to sample, in its control points' coordinate frame and units. |
required |
count
|
int
|
Number of samples along each parameter axis, including both ends; default 41. |
41
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Coordinates with shape |
pyflightstream.geometry.stages.evaluate_propeller_patch
¶
evaluate_propeller_patch(patch, u, v)
Evaluate matching lists of patch parameters, with no resampling or fitting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patch
|
Patch
|
The B-spline patch. |
required |
u
|
array_like
|
Matching parameter values in the two directions. |
required |
v
|
array_like
|
Matching parameter values in the two directions. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The points of the patch, one row per parameter pair. |
pyflightstream.geometry.stages.exit_code
¶
exit_code(report: Mapping) -> int
Return the exit code of a run: 0 accepted, 1 failed, 2 refused, 3 incomplete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report
|
Mapping
|
A report as :func: |
required |
Returns:
| Type | Description |
|---|---|
int
|
The process exit code of the report's status. |
Examples:
>>> from pyflightstream.geometry.stages import exit_code
>>> exit_code({"status": "failed"})
1
pyflightstream.geometry.stages.export_schema
¶
export_schema() -> dict
Return the draft 2020-12 JSON Schema of :class:ComponentRecord.
Returns:
| Type | Description |
|---|---|
dict
|
The schema, carrying its |
pyflightstream.geometry.stages.fillet_model
¶
fillet_model(
fillet, components, name="fillet"
) -> FilletModel
Return the base, faces, contacts and records of a fillet, in its body host's frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fillet
|
dict
|
Resolved fillet component (plain values, metres). |
required |
components
|
dict
|
Every resolved component by name (plain values); the hosts are read from it. |
required |
name
|
str
|
The fillet's name, for messages. |
'fillet'
|
Returns:
| Type | Description |
|---|---|
FilletModel
|
The base and its two faces, the contacts, and the records |
Raises:
| Type | Description |
|---|---|
InputValueError
|
When the hosts are not one lifting surface and one body, when they do not meet along the whole chord, or when a radius is wider than the lifting surface. |
pyflightstream.geometry.stages.fit_section
¶
fit_section(
contour,
span,
seed,
*,
degree=5,
max_degree=20,
tolerance_m=None,
)
Fit a CST section to one clean cut, raising the degree until the tolerance is met.
The seed (a NACA designation) supplies the starting shape; the correction is fitted to the
difference between the cut and the seed. tolerance_m defaults to the larger of 0.5 mm
and 0.1 percent of the chord. The residual is the maximum ordinate difference against the
cut on an independent cosine grid; accepted says whether it met the tolerance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contour
|
array_like
|
Closed contour of the cut, shape |
required |
span
|
array_like
|
Spanwise direction of the cut. |
required |
seed
|
str
|
NACA designation that supplies the starting shape. |
required |
degree
|
int
|
First CST degree tried; default 5. |
5
|
max_degree
|
int
|
Highest CST degree tried; default 20. |
20
|
tolerance_m
|
float
|
Residual tolerance, metres; default as described above. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
The fit: |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If |
pyflightstream.geometry.stages.generate_components
¶
generate_components(
config: Any, *, trimmed: Literal[False] = False
) -> dict[str, list[Patch]]
generate_components(
config: Any, *, trimmed: Literal[True]
) -> dict[str, GeneratedPiece]
generate_components(
config, *, trimmed=False
) -> dict[str, list[Patch]] | dict[str, GeneratedPiece]
Return the placed patches of every component of a resolved configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Resolved configuration; its components are unpacked to plain values. |
required |
trimmed
|
bool
|
Return source pieces with their bases and UV loops for assembly and export. False preserves the mesher's patch-list interface. |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
Component name to its list of placed patches, in the world frame. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If a component is of a type other than body, lifting_surface or wing_fuselage_fairing. |
pyflightstream.geometry.stages.generate_pieces
¶
generate_pieces(
config, *, variant="clean", selection=None
) -> dict[str, GeneratedPiece]
Build placed source pieces for trimmed assembly and export, without layout fitting.
The legacy patch generator remains the mesher's interface. Here lifting skins, fillets and blisters carry their original bases and parameter loops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Resolved geometry configuration including placement and component versions. |
required |
variant
|
str
|
Registry variant selecting active component controls. |
'clean'
|
selection
|
dict
|
Moving piece label for each active component.control, one angle per control. |
None
|
Returns:
| Type | Description |
|---|---|
dict of str to GeneratedPiece
|
Source bases in world coordinates, in metres, with their trims and layouts. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If a component type has no source-piece generator. |
pyflightstream.geometry.stages.geometry_report
¶
geometry_report(
status,
parameter_id,
*,
surface_id=None,
build_id=None,
stage=None,
check=None,
message="",
measured=None,
limit=None,
where=None,
stages=(),
outputs=None,
warnings=(),
not_run=(),
)
Return the report of a run: accepted, incomplete, failed or refused.
failed names a stage and a check. not_run lists, as "<stage> <check>", every
check of the stage table up to the last stage run that was not measured; a run with one is
incomplete, never accepted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
str
|
|
required |
parameter_id
|
str
|
The identity of the parameters of the run. |
required |
surface_id
|
str
|
The identity of the surface that was built. |
None
|
build_id
|
str
|
The identity of the build (parameters, package version and kernel). |
None
|
stage
|
str
|
The stage that failed or refused; required for |
None
|
check
|
str
|
The check that failed; required for |
None
|
message
|
str
|
The reason, in words. |
''
|
measured
|
float
|
The measured value of the failed check. |
None
|
limit
|
float
|
The limit of the failed check. |
None
|
where
|
Mapping
|
Where the failed check sits. |
None
|
stages
|
sequence of Mapping
|
The stage records of the run. |
()
|
outputs
|
Mapping
|
The files the run wrote. |
None
|
warnings
|
sequence of str
|
The warnings of the run. |
()
|
not_run
|
sequence of str
|
The checks not measured, as |
()
|
Returns:
| Type | Description |
|---|---|
dict
|
The report as plain values. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the status is unknown, a failed run names no stage or check, or an accepted run has checks not measured. |
Examples:
>>> from pyflightstream.geometry.stages import geometry_report
>>> geometry_report("accepted", "p")["status"]
'accepted'
pyflightstream.geometry.stages.insert_seed
¶
insert_seed(seeds, signed_edge, nodes)
Record the nodes of an edge walked in its own direction; refuse a different earlier seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seeds
|
dict
|
Edge tag to its recorded nodes; updated in place. |
required |
signed_edge
|
int
|
Signed edge tag; a negative sign means the nodes were walked against the edge. |
required |
nodes
|
array_like
|
Normalized nodes as walked. |
required |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the edge already has a seed that differs. |
pyflightstream.geometry.stages.irregular_nodes
¶
irregular_nodes(
xyz: ndarray,
cells: Sequence[Sequence[int]],
poles: Sequence[Sequence[float]],
*,
tolerance_m: float,
) -> tuple[int, list[tuple[int, int]]]
Return the valence 3 poles found and the other irregular interior nodes.
poles are the declared pole points (the nose and base closures whose poles are
valence3); a node within tolerance_m of one of them with valence 3 is a pole. Every
other interior node of valence other than four, and any declared pole with a different
valence, is returned as (node, valence). Open
boundary nodes (the symmetry plane) are not counted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xyz
|
ndarray
|
The node coordinates, one row per node. |
required |
cells
|
sequence of sequence of int
|
The node indices of each cell. |
required |
poles
|
sequence of sequence of float
|
The declared pole points. |
required |
tolerance_m
|
float
|
The distance within which a node is taken to be a declared pole. |
required |
Returns:
| Type | Description |
|---|---|
tuple of int and list of tuple of int
|
The count of valence 3 poles, and the other irregular interior nodes as
|
pyflightstream.geometry.stages.junctions
¶
The measured checks of the junction sub-steps, and the pure geometry they measure with.
Pipeline role: pure part of stage S10 of the geometry pipeline. The kernel module
:mod:pyflightstream.workspace._geom_assembly runs the sub-steps (load, pieces alone, the cut,
the projection, the split, the removal, the write and the sewing) and hands the numbers it
measured to the functions here, which compute distances, chains, inside tests, the flood of a
removal and the verdict of each named check. Nothing here imports a kernel.
The dominant imprints on the dominated, the dominated loses its inside, and the dominant is split along the junction too. No area constant decides a removal: the faces a piece keeps are those its seeds reach without crossing a junction.
Every limit below carries the sentence that says where it comes from. They are lengths of the geometry's own tolerances (half the sewing tolerance, the reader's resolution), not values of any aircraft.
Operation
dataclass
¶
Operation(
operation: str,
dominant: str,
dominated: str,
row: int,
tolerance_m: float = 5e-05,
contact_deg: float = 10.0,
)
One pair of a dominance row: who imprints on whom, and how.
measured
¶
measured(
check_id: str,
value: float,
limit: float,
*,
unit: str,
cause: str,
bound: str = "max",
where: Mapping[str, Any] | None = None,
note: str = "",
) -> dict[str, Any]
Return the verdict of one measured check, its class and cause named when it fails.
cause starts with the class a failure is read as, STRATEGY (the operation cannot
give the result even with correct code) or BUG (the operation is right, its inputs pass,
and its output violates its own definition), and says in one line what a failure means.
polyline_length
¶
polyline_length(points: ndarray) -> float
Return the length of the polyline through points.
distance_to_polyline
¶
distance_to_polyline(
points: ndarray, polyline: ndarray
) -> np.ndarray
Return the distance of each point to the polyline, point to segment (never to a sample).
curve_distance
¶
curve_distance(a: ndarray, b: ndarray) -> float
Return the largest distance of either sampled curve to the other one.
chain
¶
chain(
curves: Sequence[
tuple[Sequence[float], Sequence[float]]
],
gap: float,
) -> tuple[list[list[int]], list[tuple[int, int]]]
Chain curves end to end and return the chains and the ends that meet no other end.
curves holds (start, end) of each curve. Two ends within gap are joined; an end
left alone is returned as (curve, 0 or 1). A closed chain has no lonely end.
lonely_ends
¶
lonely_ends(
curves: Sequence[
tuple[Sequence[float], Sequence[float]]
],
lonely: Sequence[tuple[int, int]],
tags: Sequence[int],
) -> dict[str, Any]
Describe the lonely ends of a chain for a failure record: where each is, how far it is.
curves and lonely are the input and the second result of :func:chain; tags
names each curve. Each end carries its curve tag, its side, its point and the distance to
the nearest other end of the chain, so a record read later shows why the chain stops.
loop_closure
¶
loop_closure(
loop: Sequence[tuple[Sequence[float], Sequence[float]]],
) -> float
Return the largest gap between the end of a curve and the start of the next one.
pair_curves
¶
pair_curves(
curves: Sequence[tuple[str, ndarray]],
*,
near: float,
end_gap: float,
) -> list[tuple[int, int, float]]
Return the pairs of curves of two pieces that join the same two vertices and lie together.
curves holds (piece, samples). A pair has both ends within end_gap (in either
sense) and every sample of each within near of the other; its third item is that largest
distance, the gap before the two are made one curve.
plane_offset
¶
plane_offset(edges: Iterable[ndarray], axis: int) -> float
Return the largest distance of the edges' samples from the plane axis = 0.
mirror_match
¶
mirror_match(
left: Sequence[ndarray],
right: Sequence[ndarray],
axis: int,
) -> float
Return how far the edges of one half lie from the mirrored edges of the other half.
pole_change
¶
pole_change(
first: Sequence[Any], again: Sequence[Any]
) -> float
Return the largest pole move between two builds of a piece, patch by patch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first
|
sequence of Patch
|
Patches of the original build, with control points in meters. |
required |
again
|
sequence of Patch
|
Patches of the repeated build, in the same order and coordinate frame. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Largest control-point displacement in meters. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If |
distance_to_triangles
¶
distance_to_triangles(
points: ndarray, triangles: ndarray
) -> np.ndarray
Return the distance of each point to the nearest of the triangles.
ray_hits
¶
ray_hits(
point: ndarray, direction: ndarray, triangles: ndarray
) -> bool
Whether the line through point along direction, either sense, meets a triangle.
parity_inside
¶
parity_inside(
points: ndarray, triangles: ndarray
) -> np.ndarray
Whether each point is inside the closed hull: odd crossings, by the vote of three rays.
dominant_inside
¶
dominant_inside(
points: ndarray,
current: ndarray,
hull: ndarray,
*,
near: float,
) -> np.ndarray
Whether each point lies inside a dominant, by its current faces with the parity fallback.
A point within near of the dominant's current faces is decided by the outward normal at
its closest point there. Where the faces next to a point are gone (removed as inside another
piece), that closest point is far and its normal orients nothing, so beyond near the
point is decided by the parity of the dominant's whole hull hull.
points_outside
¶
points_outside(
points: ndarray, hull: ndarray, *, margin: float
) -> int
Return how many points are outside the hull by more than margin.
classify_free_edges
¶
classify_free_edges(
edges: Sequence[ndarray],
*,
distance: Callable[[ndarray], ndarray],
inside: Callable[[ndarray], ndarray],
plane_axis: int | None,
) -> list[str]
Return the class of each free edge: symmetry, opening, buried or unexplained.
An edge on the symmetry plane (when the model has one) is symmetry; one whose samples all
lie within :data:OPENING_M of a partner is the opening that partner closes; one whose
samples all lie inside a partner is buried; anything else is unexplained.
distance and inside measure against the partners of the edge's piece.
flood
¶
flood(
neighbours: Mapping[
Hashable, Iterable[tuple[Hashable, Hashable]]
],
*,
seeds: Iterable[Hashable],
barriers: set[Hashable],
) -> set[Hashable]
Return the faces reached from the seeds through shared edges that are not barriers.
neighbours[face] lists (edge, other face). The barriers are the junction curves, so a
piece keeps what its own exposed side reaches and loses what a junction encloses.
mean_width
¶
mean_width(area: float, perimeter: float) -> float
Return a face's mean width, twice its area over its perimeter (a strip of w by l: w).
drop_zero_width
¶
drop_zero_width(
faces: Sequence[Any], widths: Sequence[float]
) -> tuple[list[Any], list[Any]]
Return the faces kept and those dropped as narrower than :data:ZERO_WIDTH_M.
slivers
¶
slivers(widths: Sequence[float]) -> list[int]
Return the faces narrower than :data:SLIVER_WIDTH_M, by index (listed, never refused).
min_junction
¶
min_junction(*extents: float) -> float
Return the shortest junction two pieces may have, from their largest extents in metres.
It is :data:MIN_JUNCTION_FRACTION of the smaller extent, so the limit scales with the
pieces it judges.
introduced
¶
introduced(total: int, inputs: int) -> int
Return the free edges an assembly introduced: its total less those the pieces brought.
dominance_plan
¶
dominance_plan(
rows: Sequence[Mapping[str, Any]],
members: Sequence[str],
warnings: list[str],
) -> list[Operation]
Return the operations of the dominance rows on members: cuts first, then projections.
A row naming a component that is not a member of the configuration is warned about and its pairs with that name skipped. Cuts run before projections whatever the order of the rows, because a projected footprint closes on the cut's junction (hand-off S4, run 1: a projection before the cut trimmed the host off the fillet's edge).
pyflightstream.geometry.stages.leading_extension
¶
leading_extension(stations, features, band)
Return the leading-edge curve through the clean band, extended linearly beyond it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
array_like
|
Span station of each cut. |
required |
features
|
sequence
|
Features of each cut. |
required |
band
|
array_like
|
Indices of the clean stations. |
required |
Returns:
| Type | Description |
|---|---|
callable
|
A function of a span station that returns the leading-edge point. |
pyflightstream.geometry.stages.lifting_model
¶
lifting_model(component, warnings=None) -> LiftingModel
Return the whole geometry of a lifting surface: skin, trailing-edge face, caps and faces.
The records hold S4 (law.ruled_twist), S6 (skin.section_exact), S7 (trim.*), S8
(closure.rim_shared) and S9 (continuity.internal per base).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved lifting-surface component (plain values, metres and degrees). |
required |
warnings
|
list
|
Receives the warnings of the section conversion. |
None
|
Returns:
| Type | Description |
|---|---|
LiftingModel
|
The bases, the faces as trims of them, the named iso lines and the stage records. |
pyflightstream.geometry.stages.load_mesh_controls
¶
load_mesh_controls(
source: Any = None,
) -> dict[str, dict[str, float]]
Return the mesh controls: the defaults, overridden by a mapping or a TOML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
(str, Path or mapping)
|
A TOML file path or a mapping of tables to keys; None keeps the defaults. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Table name to its keys and values, a copy of the defaults with the overrides applied. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If a table or key is unknown, a table is not a mapping, or a value is not a finite positive number (a positive integer for a cell count). |
pyflightstream.geometry.stages.manifest_checks
¶
manifest_checks(
resolved, configuration, members, manifest, sources
) -> list[dict]
Check member set, declared versions and actual generated surface identities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolved
|
dict
|
Resolved configuration and registry. |
required |
configuration
|
str or None
|
Selected registry entry, or None to use the component versions. |
required |
members
|
list of str
|
Requested component names when no registry entry is selected. |
required |
manifest
|
dict
|
Written export manifest. |
required |
sources
|
dict
|
Independently retained generated versions and surface identities by component. |
required |
Returns:
| Type | Description |
|---|---|
list of dict
|
One version and source-identity check for each expected or written component. |
pyflightstream.geometry.stages.manifest_record
¶
manifest_record(
state, *, configuration, identities, dominance, coverage
) -> dict
Publish measured piece records, leaving unperformed measurements unset.
The live assembly snapshot is input only. There is one published piece list, with detailed face records alongside the specified integer count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
dict
|
Live assembly snapshot with measured components and openings. |
required |
configuration
|
str or None
|
Selected registry configuration, or all components when omitted. |
required |
identities
|
dict
|
Parameter, surface and build identities of this export. |
required |
dominance
|
list
|
Resolved dominance operations. |
required |
coverage
|
dict
|
Measured coverage ledger per component, in square metres. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Export manifest with measured face records and unset reimport areas. |
pyflightstream.geometry.stages.mesh_controls
¶
mesh_controls(
source: Any, *, members: set[str], names: set[str]
) -> dict[str, Any]
Validate a mapping or TOML using actual configuration and IGES membership.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
mapping or path
|
The controls mapping, or the TOML file holding it. |
required |
members
|
set of str
|
The component and IGES membership names the controls may refer to. |
required |
names
|
set of str
|
The component and IGES membership names the controls may refer to. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A fresh mapping with warnings and dependency order. Unknown keys warn and are skipped. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
When mesh controls are contradictory or unsafe, by error code. |
pyflightstream.geometry.stages.orient_mesh
¶
orient_mesh(
mesh,
sense="mirror_volume",
axis_origin=(0.0, 0.0, 0.0),
axis=(1.0, 0.0, 0.0),
reference=None,
)
Orient the winding: propagate over shared edges, then one outward sign per connected skin.
mirror_volume assumes every open edge lies on y=0 (reversing the reflected skin closes it).
body integrates flux away from the straight axis; reference uses a supplied vector.
Only connectivity changes. Returns (mesh, record).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
Mesh
|
The mesh to orient. |
required |
sense
|
str
|
Outward sense: |
'mirror_volume'
|
axis_origin
|
sequence of float
|
A point on the body axis; default the origin. |
(0.0, 0.0, 0.0)
|
axis
|
sequence of float
|
Direction of the body axis; default x. |
(1.0, 0.0, 0.0)
|
reference
|
sequence of float
|
Reference vector the outward flux is measured along; used by the |
None
|
Returns:
| Type | Description |
|---|---|
tuple
|
|
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the skin is nonmanifold, its winding constraints contradict, the outward sense is indeterminate or unknown, or a mirror volume has a free edge off y=0. |
pyflightstream.geometry.stages.oriented_source_normals
¶
oriented_source_normals(mesh, normals)
Choose one source-normal sign per source face, never one per cell.
A locally folded cell therefore stays inverted against the oriented source face.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
Mesh
|
The oriented mesh. |
required |
normals
|
array_like
|
Source normals, one per cell, shape |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A copy of |
pyflightstream.geometry.stages.parameter_id
¶
parameter_id(resolved: Mapping) -> str
Return the parameter_id of a resolved configuration, as 64 hex digits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolved
|
Mapping
|
A configuration as :func: |
required |
Returns:
| Type | Description |
|---|---|
str
|
The SHA-256 of the canonical form of the values, so two resolved configurations that mean the same parameters give the same string. |
Examples:
>>> from pyflightstream.geometry import resolve_config
>>> from pyflightstream.geometry.stages import parameter_id
>>> resolved = resolve_config({"type": "lifting_surface"})
>>> len(parameter_id(resolved))
64
pyflightstream.geometry.stages.placement_transform
¶
placement_transform(components, name)
Return (rotation, translation) taking the component name to the world frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
dict
|
Resolved components including placement and attachment parents. |
required |
name
|
str
|
Component whose transform is requested. |
required |
Returns:
| Type | Description |
|---|---|
tuple of numpy.ndarray
|
Rotation matrix of shape (3, 3) and translation in metres of shape (3,). |
pyflightstream.geometry.stages.propeller_measurement
¶
propeller_measurement(
name, value, limit, unit="", *, bound="max", note=""
)
Return one check entry comparing a measured value with its limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The check identifier. |
required |
value
|
float
|
The measured value and its limit. |
required |
limit
|
float
|
The measured value and its limit. |
required |
unit
|
str
|
The unit recorded with the entry. |
''
|
bound
|
str
|
|
'max'
|
note
|
str
|
Text recorded with the entry. |
''
|
Returns:
| Type | Description |
|---|---|
dict
|
The check entry, passed or failed. |
pyflightstream.geometry.stages.reference_planform
¶
reference_planform(
stations,
features,
band,
span,
*,
root_station=None,
tip_station=None,
hold_incidence=False,
boundary=None,
root_bracket=None,
mirrored=True,
)
Build the planform between a root and the outermost clean cut from the clean band only.
Leading and trailing edges are natural cubic splines of the clean stations, extended
linearly past them. The root is a station given, or the root of boundary (a function of
a leading-edge point that vanishes on the root surface) found inside root_bracket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
array_like
|
Span station of each cut. |
required |
features
|
sequence
|
Features of each cut. |
required |
band
|
array_like
|
Indices of the clean stations. |
required |
span
|
array_like
|
Spanwise direction. |
required |
root_station
|
float
|
Root station; required unless |
None
|
tip_station
|
float
|
Tip station; default the outermost clean station. |
None
|
hold_incidence
|
bool
|
Interpolate the incidence without extending it past the clean band; default False. |
False
|
boundary
|
callable
|
Function of a leading-edge point that vanishes on the root surface. |
None
|
root_bracket
|
tuple of float
|
Station bracket in which the root of |
None
|
mirrored
|
bool
|
Whether the planform is the half of a mirrored wing; default True. |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
The planform measures: semi-span, span, root and tip chord, taper, sweeps, area, aspect ratio, mean aerodynamic chord, incidence and tip twist. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If neither a root station nor a boundary is given, or the root does not precede the tip. |
pyflightstream.geometry.stages.refine_tip
¶
refine_tip(
stations, features, band, evaluate, tolerance=0.0001
)
Refine only the clean/rejected bracket, retaining a tested clean endpoint.
evaluate(station) returns the features of a fresh cut or raises
:class:StationRejectedError. Returns the stations, features and band (a clean endpoint
inserted when the bisection found one) and the final bracket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
array_like
|
Span station of each cut. |
required |
features
|
list
|
Features of each cut. |
required |
band
|
array_like
|
Indices of the clean stations. |
required |
evaluate
|
callable
|
Function of a station that returns the features of a fresh cut. |
required |
tolerance
|
float
|
Bracket width at which the bisection stops; default 1e-4. |
0.0001
|
Returns:
| Type | Description |
|---|---|
tuple
|
|
pyflightstream.geometry.stages.repair_inverted
¶
repair_inverted(
mesh, normals, inverted, area_tolerance=1e-14
)
Flip an edge of each inverted triangle when the same-face neighbour gives two sound ones.
The mesh must be consistently oriented and normals oriented with it. Cell indices are
preserved. Returns (mesh, flips).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
Mesh
|
The consistently oriented mesh. |
required |
normals
|
array_like
|
Oriented source normals, one per cell. |
required |
inverted
|
sequence of int
|
Indices of the inverted cells. |
required |
area_tolerance
|
float
|
Smallest signed area of a sound triangle, square metres; default 1e-14. |
1e-14
|
Returns:
| Type | Description |
|---|---|
tuple
|
|
pyflightstream.geometry.stages.ring_count
¶
ring_count(chord_cells: int, te_cells: int) -> int
Return the node count around a lifting root ring: both sides plus the base (2.5).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chord_cells
|
int
|
The cells along the chord on each side. |
required |
te_cells
|
int
|
The cells across the trailing edge base. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Twice |
pyflightstream.geometry.stages.sidecar_identity
¶
sidecar_identity(name, layout)
Recompute source identity from every original base and loop in a sidecar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Component name. |
required |
layout
|
dict
|
Sidecar with ordered bases in metres and original source trims. |
required |
Returns:
| Type | Description |
|---|---|
str
|
SHA-256 identity of the stored bases and loops. |
pyflightstream.geometry.stages.solve_counts
¶
solve_counts(
blocks: Sequence[Block],
lengths: Mapping[int, float],
target_m: Mapping[int, float],
*,
fixed: Mapping[int, int] | None = None,
totals: Sequence[tuple[Sequence[int], int]] = (),
carry: Sequence[tuple[int, int]] = (),
max_growth: float = 1.2,
even: Sequence[Sequence[int]] = (),
) -> dict[int, int]
Solve one cell count per edge for the whole block graph.
Opposite sides of every block hold equal counts (a composite side counts the sum of its
edges); fixed pins edges; each totals row pins the sum over a set of edges (a junction
ring, a body azimuth ring, a lifting span line); each carry pair (a, b) of edges that
continue one grid line across a junction keeps the ratio of their cell widths at most
max_growth. Among the counts that satisfy all of that, the one closest to the target
cell size target_m per edge (relative deviation summed) is returned. Each loop of
even holds an even total, so a face that is not a block closes with quads only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
sequence of Block
|
The blocks of the graph. |
required |
lengths
|
mapping of int to float
|
The length of each edge. |
required |
target_m
|
mapping of int to float
|
The target cell size of each edge. |
required |
fixed
|
mapping of int to int
|
Edges pinned to a count. |
None
|
totals
|
sequence of tuple
|
Rows of |
()
|
carry
|
sequence of tuple of int
|
Pairs of edges that continue one grid line across a junction. |
()
|
max_growth
|
float
|
The largest width ratio kept over a carry pair. |
1.2
|
even
|
sequence of sequence of int
|
Loops of edges whose total count is even. |
()
|
Returns:
| Type | Description |
|---|---|
dict of int to int
|
The cell count of each edge. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
E09 when two fixed counts contradict on opposite sides of a block, E08 when a ring total cannot be held on every side, E10 when the carry pairs cannot keep the growth limit. |
pyflightstream.geometry.stages.source_cells
¶
source_cells(
patch: Patch,
*,
spacing: float,
scale: float,
trims=None,
) -> dict
Sample source UV cells, integrating their physical areas by Gauss quadrature.
Grid counts follow the sampled arc lengths and the requested share of the piece's extent. Original trim exclusions are retained as a separate mask. The cell-area sum can therefore be checked against the kernel's source area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patch
|
Patch
|
Source base with control points in metres. |
required |
spacing
|
float
|
Positive cell spacing as a fraction of the source extent. |
required |
scale
|
float
|
Positive source extent in metres. |
required |
trims
|
sequence of Trim
|
Original included faces; omitted means the entire parameter domain. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Cell centres, normals, areas in square metres and the inclusion mask. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If spacing or scale is nonpositive, or the grid exceeds one million cells. |
pyflightstream.geometry.stages.stage_index
¶
stage_index(stage: str) -> int
Return the position of stage in the table, refusing an unknown id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
A stage id, |
required |
Returns:
| Type | Description |
|---|---|
int
|
The index of its row in |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the table holds no such stage. |
Examples:
>>> from pyflightstream.geometry.stages import stage_index
>>> stage_index("S0")
0
pyflightstream.geometry.stages.stage_record
¶
stage_record(
stage,
name,
*,
package_version,
inputs_id,
parameter_id,
checks=(),
findings=(),
warnings=(),
outputs=None,
kernel=None,
started="",
wall_s=0.0,
)
Return the record of one stage; its status follows from its checks.
failed when any check failed, skipped when none ran, else passed. The record
names package_version and inputs_id (the identity of what the stage read). A check
:func:check_entry would refuse is refused here too, whoever built it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
The stage id, such as |
required |
name
|
str
|
The name of the stage. |
required |
package_version
|
str
|
The version of this package that ran the stage. |
required |
inputs_id
|
str
|
The identity of what the stage read. |
required |
parameter_id
|
str
|
The identity of the parameters of the run. |
required |
checks
|
sequence of Mapping
|
The checks of the stage, each as :func: |
()
|
findings
|
sequence of str
|
What the stage found that is not a check. |
()
|
warnings
|
sequence of str
|
The warnings of the stage. |
()
|
outputs
|
Mapping
|
What the stage produced, such as file names and counts. |
None
|
kernel
|
str
|
The geometry kernel it used, or None. |
None
|
started
|
str
|
The start time, ISO 8601. |
''
|
wall_s
|
float
|
The wall time in seconds. |
0.0
|
Returns:
| Type | Description |
|---|---|
dict
|
The record as plain values. |
Examples:
>>> from pyflightstream.geometry.stages import check_entry, stage_record
>>> check = check_entry("input.valid", "passed", 0, 0)
>>> stage_record("S0", "Definition", package_version="0", inputs_id="a",
... parameter_id="b", checks=[check])["status"]
'passed'
pyflightstream.geometry.stages.stage_row
¶
stage_row(stage: str) -> StageRow
Return the row of stage, refusing an id the table does not hold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
Stage id from the geometry pipeline table, such as |
required |
Returns:
| Type | Description |
|---|---|
StageRow
|
The stage's name, kernel requirement and measured checks. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If |
pyflightstream.geometry.stages.stored_sections_config
¶
stored_sections_config(resolved, sections)
Store fitted lifting sections as B-splines for exact, fit-free regeneration.
The resolved parameters and derived values stay in their resolved form, so writing and reloading does not recompute their floating-point values. Optional unset mapping values are omitted because TOML has no null value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolved
|
dict
|
Resolved geometry configuration. |
required |
sections
|
dict
|
Stored B-spline section tables keyed by lifting component name. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Plain TOML-compatible configuration retaining the supplied section coefficients. |
pyflightstream.geometry.stages.surface_id
¶
surface_id(
patches: Mapping[str, Sequence[Patch]],
trims: Mapping[str, Sequence[Any]] | None = None,
) -> str
Return the surface_id of placed patches given per component name, as 64 hex digits.
trims, per component, are the faces as loops on those bases (:class:Trim); each loop
joins the identity, sorted by base, role and face, so two models on equal bases with other
faces differ. Without trims the identity is that of the bases alone, as before.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patches
|
Mapping
|
Ordered placed patches per component, with control points in metres. |
required |
trims
|
Mapping
|
Trim loops per component; omitted means only bases enter the digest. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
SHA-256 identity as 64 hexadecimal digits. |
pyflightstream.geometry.stages.tip_cap
¶
tip_cap(component) -> list[Patch]
Return the tip cap of a lifting-surface component as bicubic patches.
The list is empty for the kind none; for flat it holds one planar face bounded by
the tip section outline (:func:outline_cap).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
dict
|
Resolved lifting-surface component, whose |
required |
Returns:
| Type | Description |
|---|---|
list of Patch
|
The cap patches; empty when the kind is |
pyflightstream.geometry.stages.tip_refinement
¶
tip_refinement(cells, refined_cells=4, ratio=1.3)
Return nodes of constant interior cells, then successive division by ratio at the tip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cells
|
int
|
Total number of cells; a positive integer. |
required |
refined_cells
|
int
|
Number of cells refined at the tip, in |
4
|
ratio
|
float
|
Successive width division at the tip, finite and at least 1; default 1.3. |
1.3
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The normalized nodes from 0 to 1, shape |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If |
pyflightstream.geometry.stages.verify_pins
¶
verify_pins(
record: ComponentRecord, asset_root: str | Path
) -> list[str]
Check every referenced file against its pin; return one message per failure.
Paths resolve against asset_root. An empty list means every referenced
file exists with matching bytes. A path that escapes the root is a failure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
ComponentRecord
|
The component record whose referenced files are checked. |
required |
asset_root
|
str or Path
|
Directory against which the referenced paths resolve. |
required |
Returns:
| Type | Description |
|---|---|
list of str
|
One message per failure; empty when every pin holds. |
pyflightstream.geometry.stages.wing_in_body_frame
¶
wing_in_body_frame(components, body_name, wing_name)
Return the wing component with its leading edge expressed in the body frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
dict
|
Resolved components by name. |
required |
body_name
|
str
|
Name of the host body. |
required |
wing_name
|
str
|
Name of the lifting surface. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A copy of the wing component whose leading-edge distributions are in the body frame. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If the wing and body differ by a rigid rotation, or the wing root is off the body symmetry plane. |
pyflightstream.geometry.stages.write_config
¶
write_config(config, path)
Write a resolved configuration as TOML that :func:load_config reads back unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Resolved configuration of plain values. |
required |
path
|
str or Path
|
File to write. |
required |
pyflightstream.geometry.stages.write_obj
¶
write_obj(path, mesh)
Write the mesh as OBJ, one group per component, polygon topology preserved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
File to write. |
required |
mesh
|
Mesh
|
The mesh to write. |
required |
Raises:
| Type | Description |
|---|---|
InputValueError
|
If a component name is empty or contains whitespace. |
pyflightstream.geometry.stages.write_record
¶
write_record(path, record: Mapping) -> None
Write a record or report as sorted, indented JSON; a stage record is validated first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The file to write. |
required |
record
|
Mapping
|
A stage record or a report. |
required |
Returns:
| Type | Description |
|---|---|
None
|
The file is written. |
Examples:
>>> import tempfile, pathlib
>>> from pyflightstream.geometry.stages import geometry_report, write_record
>>> folder = pathlib.Path(tempfile.mkdtemp())
>>> write_record(folder / "report.json", geometry_report("accepted", "p"))
>>> (folder / "report.json").exists()
True