code wiki / (root) / nx_stress.nx

nx_stress.nx

buildroot/runtime/nx_stress.nx

7088 B171 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_stress.nx -- mechanical stress primitive (σ = F/A in Pascals). THREE-WAY cross-domain composition demo per [[feedback-engineering-sciences-bits-up-3d-print-first]]: nx_force (force input, Layer 1 physics) <area-source> (polygon/mesh-derived, Layer 3 geometry) material-strength (polymer literature, Layer 2 chemistry-derived) → stress classification (Layer 3 engineering output) Unit convention: integer Pascals (N/m²). Engineering yield strengths are MPa range (10^6 Pa); ultimate tensile up to GPa (10^9 Pa). i64 Pa range = ±9.2 × 10^18 Pa = ±9.2 × 10^12 GPa, vastly exceeding any engineering analysis. Algebra: σ_Pa = F_N / A_m². Both Q14 inputs scale identically, so σ_Pa = F_q14 / A_q14 (Q14 scaling cancels in the ratio). Integer result, no rescaling. Material yield strengths (MPa) verified against polymer / FDM literature consensus: PLA: yield 50 / ultimate 65 PETG: yield 45 / ultimate 50 ABS: yield 35 / ultimate 45 ASA: yield 35 / ultimate 45 PC: yield 65 / ultimate 70 TPU: yield 30 / ultimate 40 (highly elastic; values for TPU 95A) NYLON: yield 60 / ultimate 80 PA-CF: yield 80 / ultimate 120 (carbon-fibre reinforced) PEEK: yield 95 / ultimate 100 Per cardinal feedback-nishilang-multi-line-binary-op-statement-break: every multi-line arithmetic uses named temporaries throughout. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_material_profile.nx nx_abs.nx nx_stress.nx nx_stress_test.nx

imports: nx_syscalls.nxnx_material_profile.nxnx_abs.nx

imported by: nx_stress_test.nx

structs

73struct NxStress

consts

39const NX_MAGIC_1000000: i64 = 1000000
40const NX_MAGIC_50000000: i64 = 50000000
41const NX_MAGIC_45000000: i64 = 45000000
42const NX_MAGIC_35000000: i64 = 35000000
43const NX_MAGIC_65000000: i64 = 65000000
44const NX_MAGIC_30000000: i64 = 30000000
45const NX_MAGIC_60000000: i64 = 60000000
46const NX_MAGIC_80000000: i64 = 80000000
47const NX_MAGIC_95000000: i64 = 95000000
48const NX_MAGIC_70000000: i64 = 70000000
49const NX_MAGIC_40000000: i64 = 40000000
50const NX_MAGIC_120000000: i64 = 120000000
51const NX_MAGIC_100000000: i64 = 100000000
55const NX_STRESS_SAFE: i64 = 0 // < yield / 2 -- ample margin
56const NX_STRESS_WORKING: i64 = 1 // [yield/2, yield) -- design range
57const NX_STRESS_YIELDED: i64 = 2 // [yield, ultimate) -- permanent deformation
58const NX_STRESS_FRACTURED: i64 = 3 // >= ultimate -- catastrophic failure
59const NX_STRESS_UNKNOWN_MAT: i64 = 4 // material class not in registry
60const NX_STRESS_N: i64 = 5
77const NX_STRESS_BYTES: i64 = 8

functions

62func nx_stress_verdict_name(v: i64) -> *u8
81func nx_stress_new(pa: i64) -> *NxStress
87func nx_stress_zero() -> *NxStress
calls 1: nx_stress_new
100func nx_stress_from_force_area(force_n_q14: i64, area_m2_q14: i64) -> *NxStress
called by 1: main calls 1: nx_stress_new
108func nx_stress_to_mpa(s: *NxStress) -> i64
called by 1: main
112func nx_stress_to_kpa(s: *NxStress) -> i64
121func nx_stress_yield_pa(material_class: i64) -> i64
134func nx_stress_ultimate_pa(material_class: i64) -> i64
157func nx_stress_classify(s: *NxStress, material_class: i64) -> i64