back to home

llnl / units

A run-time C++ library for working with units of measurement and conversions between them and with string representations of units and measurements

165 stars
31 forks
4 issues
C++CMakePython

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing llnl/units in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/llnl/units)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Units What's new Documentation The Units library provides a means of working with units of measurement at runtime, including conversion to and from strings. It provides a small number of types for working with units and measurements and operations necessary for user input and output with units. This software was developed for use in LLNL/GridDyn, and HELICS and is currently a work in progress (though it's getting close). Namespaces, function names, and code organization are subject to change, though they are fairly stable at this point. Feedback is welcome. A set of documentation is available. A Python wrapper is also available through Pypi that wraps a limited subset of the library for most common purposes. Table of contents • Purpose • Limitations • Alternatives • C++ Types • Unit Representation • Building The Library • Try it out • Usage • Units • Measurements • String Conversions • Contributions • Users • Release Purpose A units library was needed to represent units from a wide range of disciplines and be able to separate them from the numerical values for use in calculations when needed. The main drivers are • converting units, often represented by strings, to a standardized unit set when dealing with user input and output. • Being able to use the unit as a single type that could contain any unit, and not introduce a huge number of types to represent all possible units. • Being able to associate a completely arbitrary unit given by users with a generic interface and support conversions between those user defined units and other units. • The library has its origins in power systems so support for per-unit operations was also lacking in the alternatives. • Capturing uncertainty and uncertainty calculations directly with a measurement It was desired that the unit representation be a compact type ( or < conditions then check for equality if needed. There are a few situations that are not totally consistent like and , but such is nature of floating point operations. So, from a mathematical purity sense this isn't consistent but does mostly what was needed. If the difference between the two values is a subnormal number the equality comparison also evaluates to true, even if that would otherwise be outside the numerical tolerance. Defined units There are 2 sets of defined units, many common units are defined in the namespace, many others are defined in and subnamespaces. See Defined Units for details on the available units. Physics constants A set of physical and numerical constants are defined in the namespace. More details a _...truncated for preview_