Build the existing example

examples/library.cpp is the source-tree example also built by the project's test configuration. From the repository root, configure with tests enabled and build its target:

cmake -S . -B build/library -DCMAKE_CXX_COMPILER=g++-13 \
  -DCMAKE_BUILD_TYPE=Release \
  -DYSPEC_BUILD_TESTS=ON
cmake --build build/library --target library_example --parallel 2
OMP_NUM_THREADS=2 build/library/bin/library_example
OMP_NUM_THREADS=2 ctest --test-dir build/library -R '^example.library$' --output-on-failure

It reads the bundled prem.200 model, computes a one-hour displacement series at two receivers, and prints the vertical displacement at 2000 seconds and 30 degrees. The run checks that this value is finite and nonzero. At the checked code and dependency revisions, it prints 4.12899e-07 m; the exact scalar can vary with revisions and compiler settings.

What the example demonstrates

The high-level YSpec::Model, YSpec::Calculation, YSpec::Source and YSpec::Receiver interfaces take SI quantities: metres, seconds and hertz. Locations are geographic latitude and longitude in degrees. The model deck is read with Model::ReadDeck, which converts its material properties for internal use.

Seismograms::Trace(source, receiver, component) returns the selected component's samples. The example takes sample 100 from the vertical trace; with a 20-second step that is 2000 seconds after the origin. Its displacement is in metres. The three seismogram components are up, north and east.

Source-build boundary

The YSpec::YSpec library target is available to projects built from this source tree, and its public headers use the C++ standard library. YSpec's install rules add yspec and yspec-snapshot; dependency projects may add their own files. YSpec does not install an exported library package or a YSpecConfig.cmake. A separate consumer therefore needs to include or add this source tree and its build dependencies explicitly. Do not use find_package(YSpec) with the current installation.

See the generated API reference for the public declarations and detailed contracts.