.. _puq-workflows: Workflows ========= These examples show how the native C++ calls combine. Each task links to the page that explains its rules, options, and interface-specific counterparts. Measure, calculate, and convert ------------------------------- Keep the unit on every intermediate value so dimensional errors are reported near the operation that caused them: .. code-block:: cpp #include #include snt::puq::Quantity length(2.5, "m"); snt::puq::Quantity width("40*cm"); snt::puq::Quantity area = length * width; snt::puq::Quantity area_cm2 = area.convert("cm2"); snt::puq::Calculator calculator; snt::puq::Quantity speed = calculator.eval("12*km / 3*h").value; Use :doc:`Concepts and model ` for arithmetic rules and :doc:`PUEL calculation ` for expression evaluation. Convert between unit systems ---------------------------- Select a system when the unit text alone is ambiguous or when a cross-system conversion needs a physical-quantity context: .. code-block:: cpp #include snt::puq::Quantity distance("US_mi"); snt::puq::Quantity distance_km = distance.convert("km"); See :doc:`Conversion and unit systems ` for the native conversion rules and the interactive converter. Inspect a unit expression ------------------------- When an application validates a unit without evaluating a complete quantity, parse the unit expression directly: .. code-block:: cpp #include snt::puq::UnitSolver solver; auto unit = solver.eval("kg*m/s2"); See :doc:`PUEL calculation ` for `Calculator` and `UnitSolver` details, and :doc:`the PUEL specification <../../puel/index>` for the language itself. Model uncertainty ----------------- Ordinary arithmetic uses first-order propagation. Distribution-aware sampling is an explicit opt-in operation for nonlinear or correlated inputs. See :doc:`Concepts and model ` for the available workflow and its scalar-input restriction.