stim/stim.h file

The public include header for consumers of the library.

Namespaces

namespace stim
The root namespace for all stim functions and types.
namespace stim::literals inline
User-defined literals for stim types.
namespace stim::lib
Library metadata.

Enums

enum class cutter_flags: uint64_t { none = 0 }
Rigid body-based cutter initialization flags.
enum class debug_draw_groups: uint64_t { none = 0, workspaces = 1 << 0, rigid_bodies = 1 << 1, soft_bodies = 1 << 2, volumetric_bodies = 1 << 3, force_feedback_emitters = 1 << 4, axes = 1 << 9, bounding_spheres = 1 << 10, bounding_boxes = 1 << 11, signed_distance_fields = 1 << 12, cutters = 1 << 13, particles = 1 << 22, position_constraints = 1 << 23, stretch_constraints = 1 << 24, bend_constraints = 1 << 25, collision_constraints = 1 << 26, constraints = position_constraints | stretch_constraints | bend_constraints | collision_constraints, all = ~uint64_t{}, defaults = all & ~(axes | bounding_spheres | signed_distance_fields) }
Debug line drawing render groups.
enum class debug_ui_groups: uint64_t { none = 0, summary = 1 << 0, memory = 1 << 1, profiler = 1 << 2, objects = 1 << 3, solver = 1 << 4, lib = 1 << 5, all = ~uint64_t{}, defaults = all }
Debug UI groups.
enum class environment_flags: uint64_t { none = 0 }
System environment initialization flags.
enum class force_feedback_emitter_flags: uint64_t { none = 0 }
Force feedback emitter initialization flags.
enum class log_categories: uint8_t { none = 0, verbose = 1 << 0, info = 1 << 1, warning = 1 << 2, error = 1 << 3 }
Log message categories.
enum class mesh_flags: uint64_t { none = 0, triangle_list = 1 << 0, triangle_strip = 1 << 1, forward_winding = 1 << 2, reverse_winding = 1 << 3 }
Mesh initialization flags.
enum class mesh_traits: uint64_t { none = 0, topology = 1 << 0, winding_order = 1 << 1, index_count = 1 << 2, vertex_count = 1 << 3, indices = 1 << 4, positions = 1 << 5, normals = 1 << 6, uvs = 1 << 7 }
Mesh traits.
enum class rigid_body_flags: uint64_t { none = 0, immobile = 1 << 0, high_resolution_sdf = 1 << 1, force_feedback = 1 << 2 }
Rigid body flags.
enum class scalar_type: uint8_t { none, float16, float32, float64, int8, int16, int32, int64, uint8, uint16, uint32, uint64 }
Scalar types.
enum class simulation_flags: uint64_t { none = 0 }
Simulation initialization flags.
enum class soft_body_flags: uint64_t { none = 0, cuttable = 1 << 0, mesh_simplification_low = 0, mesh_simplification_medium = 1 << 1, mesh_simplification_high = 1 << 2, mesh_simplification_disabled = mesh_simplification_medium | mesh_simplification_high, pin_in_place = 1 << 3, immobile_boundaries = 1 << 4 }
Soft body initialization flags.
enum class volumetric_body_flags: uint64_t { none = 0 }
Volumetric body initialization flags.

Typedefs

using mat3 = matrix<float, 3, 3>
A 3x3 matrix of floats.
using mat4 = matrix<float, 4, 4>
A 4x4 matrix of floats.
template<typename... T>
using all_scalar_types = api_detail::variadic_and<is_scalar_type<T>::value...>
Metafunction for determining if a set of types are all (or are all references to) a stim scalar types.
template<typename T>
using is_scalar_type = std::integral_constant<bool,(to_scalar_type<T>::value !=scalar_type::none)>
Metafunction for determining if a type is (or is a reference to) a stim scalar type.
template<scalar_type Type>
using to_real_type = typename api_detail::scalar_type_to_real_type<Type>::type
Metafunction for getting the real type corresponding to a scalar_type value.
template<typename T>
using to_scalar_type = api_detail::real_type_to_scalar_type<api_detail::remove_cvref<T>>
Metafunction for getting the scalar_type value corresponding to a real type.
using buffer_view = span<void>
A view of an opaque (type-erased) buffer.
using const_buffer_view = const_span<void>
A const view of an opaque (type-erased) buffer.
template<typename T, size_t Extent = -1>
using const_span = span<const T, Extent>
Alias for span<const T>.
using vec2 = vector<float, 2>
A 2D vector of floats.
using vec3 = vector<float, 3>
A 3D vector of floats.
using vec4 = vector<float, 4>
A 4D vector of floats.

Functions

auto operator""_ms(unsigned long long ms) -> duration constexpr noexcept
Creates a stim::duration representing milliseconds.
auto operator""_ms(long double ms) -> duration constexpr noexcept
Creates a stim::duration representing milliseconds.
auto operator""_ns(unsigned long long ns) -> duration constexpr noexcept
Creates a stim::duration representing nanoseconds.
auto operator""_ns(long double ns) -> duration constexpr noexcept
Creates a stim::duration representing nanoseconds.
auto operator""_s(unsigned long long s) -> duration constexpr noexcept
Creates a stim::duration representing seconds.
auto operator""_s(long double s) -> duration constexpr noexcept
Creates a stim::duration representing seconds.
auto operator""_us(unsigned long long us) -> duration constexpr noexcept
Creates a stim::duration representing microseconds.
auto operator""_us(long double us) -> duration constexpr noexcept
Creates a stim::duration representing microseconds.
auto create_environment(const environment_description& desc) -> result<environment> noexcept
Creates a stim::environment.
auto check_abi() -> result noexcept
Checks the ABI of the compiled library against the host application.
auto compiler() -> string_view noexcept
Returns the compiler used to build the library.
auto debug_build() -> bool noexcept
Returns true if this build of the library had internal debug logging and assertions enabled.
auto git_branch() -> string_view noexcept
Returns the git branch of the library when it was built.
auto git_commit_description() -> string_view noexcept
Returns the git commit description of the library when it was built.
auto git_commit_hash() -> string_view noexcept
Returns the git commit hash of the library when it was built.
auto handle() -> void* noexcept
Returns the runtime handle of the library (e.g. HMODULE on Windows).
auto header_checksum() -> string_view noexcept
Returns the SHA-256 checksum of stim.h when the library was compiled.
auto logging_categories() -> log_categories noexcept
Returns a mask of the categories of log messages that the library may emit.
auto logging_enabled() -> bool noexcept
Returns true if the library was built with logging.
auto profiler_enabled() -> bool noexcept
Returns true if the library was built with the internal profiler enabled.
auto version() -> string_view noexcept
Returns the library's full version string.
auto version_major() -> unsigned short noexcept
Returns the library's major version number.
auto version_minor() -> unsigned short noexcept
Returns the library's minor version number.
auto version_patch() -> unsigned short noexcept
Returns the library's patch number.
auto operator!(scalar_type val) -> bool constexpr noexcept
Returns true if a scalar_type is none.
auto create_simulation(const simulation_description& desc) -> result<simulation> noexcept
Creates a simulation.
auto operator""_sv(const char* str, size_t len) -> string_view constexpr noexcept
Creates a string_view.

Defines

#define STIM_INJECT_MEMBERS_BOUNDING_BOX
Define this if you wish to inject additional member functions into the body of stim::bounding_box.
#define STIM_INJECT_MEMBERS_BOUNDING_SPHERE
Define this if you wish to inject additional member functions into the body of stim::bounding_sphere.
#define STIM_INJECT_MEMBERS_DURATION
Define this if you wish to inject additional member functions into the body of stim::duration.
#define STIM_INJECT_MEMBERS_MATRIX
Define this if you wish to inject additional member functions into the body of stim::matrix.
#define STIM_INJECT_MEMBERS_MESH_DESCRIPTION
Define this if you wish to inject additional member functions into the body of stim::mesh_description.
#define STIM_INJECT_MEMBERS_MESH_READER
Define this if you wish to inject additional member functions into the body of stim::mesh_reader.
#define STIM_INJECT_MEMBERS_PLANE
Define this if you wish to inject additional member functions into the body of stim::plane.
#define STIM_ASSERT(...)
Debug assert macro used by the front-end of the library. May be overridden.
#define STIM_FLOAT16_TYPE
Set this if your codebase or environment has a 16-bit (half-precision) IEEE 754 floating point type.
#define STIM_STD_CHRONO_COMPAT
Enable this to allow the use of std::chrono duration types in stim::simulation::update().
#define STIM_STD_OSTREAM_COMPAT
Enable this to allow stim::string_viewstd::ostream printing operators.
#define STIM_STD_STRING_COMPAT
Enable this to allow stim::string_viewstd::string conversion constructors and operators.
#define STIM_STD_STRING_VIEW_COMPAT
Enable this to allow stim::string_viewstd::string_view conversion constructors and operators.
#define STIM_UE4_COMPAT
Enable this to allow some stim ↔ UE4 type conversions and other simple interop.
#define STIM_VERSION_STRING
The library's version as a dot-separated string literal.
#define STIM_INJECT_MEMBERS_SPAN
Define this if you wish to inject additional member functions into the body of stim::span.
#define STIM_INJECT_MEMBERS_STRING_VIEW
Define this if you wish to inject additional member functions into the body of stim::string_view.
#define STIM_INJECT_MEMBERS_VECTOR
Define this if you wish to inject additional member functions into the body of stim::vector.
#define STIM_VERSION_MAJOR
The library's major version number.
#define STIM_VERSION_MINOR
The library's minor version number.
#define STIM_VERSION_PATCH
The library's patch number.