.. _puq-getting-started: Getting started =============== This page shows the smallest useful C++ PUQ workflow. Use :doc:`Concepts and model ` when you need the underlying quantity semantics, and :doc:`Workflows ` when you want to compose the common operations into a larger task. Construct and convert a quantity -------------------------------- Include the native quantity header, create a value with its unit, and convert it to another compatible unit: .. code-block:: cpp #include #include int main() { snt::puq::Quantity length(2.5, "m"); snt::puq::Quantity length_cm = length.convert("cm"); std::cout << length_cm.to_string() << "\n"; return 0; } The original quantity is unchanged. The converted quantity carries the target units and can be formatted, inspected, or used in further dimensional arithmetic. Build and run ------------- Install the C++ package using :doc:`../../installation` with the ``PUQ`` module enabled. Save the example above as ``main.cpp`` and create this ``CMakeLists.txt`` in the same directory: .. code-block:: cmake cmake_minimum_required(VERSION 3.22) project(snt_puq_example LANGUAGES C CXX) find_package(snt CONFIG REQUIRED) add_executable(application main.cpp) target_compile_features(application PRIVATE cxx_std_17) target_link_libraries(application PRIVATE snt-puq) Configure with the installed package prefix, build, and run: .. code-block:: console cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/snt cmake --build build ./build/application Expected output: .. code-block:: text 250*cm Replace ``/path/to/snt`` with the installation prefix; omit that option if CMake already finds SNT. C is enabled for discovery of HDF5 in packages built with DIP support. See :ref:`cmake-consumer` for package discovery details. Continue with ------------- - :doc:`Concepts and model ` explains quantities, dimensions, arithmetic, arrays, and uncertainty. - :doc:`Workflows ` shows calculation, conversion, and composition tasks. - :doc:`PUEL calculation ` and :doc:`Conversion and unit systems ` cover the detailed topic pages. - :doc:`PUQ interfaces ` lists the Python, C ABI, Rust, WebAssembly/JavaScript, and command-line counterparts.