Getting started
This page shows the smallest native MAT workflow. Use Concepts and model for the composition and formula rules, and Workflows for mixtures, matter calculations, and the application facade.
Standalone use
#include <iostream>
#include <snt/mat/substance.h>
int main() {
snt::mat::Substance water("H2O");
const auto formula = water.data_composite();
std::cout << formula.sum.mass.to_string() << "\n";
return 0;
}
The examples/mat/Standalone program demonstrates these calls. The
examples/mat/InstalledConsumer project validates that an installed package
links snt-mat and propagates its public PUQ dependency.
Build and run
Install the C++ package using Installation with the
MAT module enabled (ENABLE_MAT=ON).
Save the example above as main.cpp and create this CMakeLists.txt in
the same directory:
cmake_minimum_required(VERSION 3.22)
project(snt_mat_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-mat)
Configure with the installed package prefix, build, and run:
cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/snt
cmake --build build
./build/application
Expected output:
18.0153*u
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 Using SciNumTools from CMake for package discovery details.
Continue with Workflows to build mixtures, derive matter values, and use the command-oriented facade.