SPH
|
#include "math/MathUtils.h"
#include "objects/containers/FlatMap.h"
#include "objects/containers/StaticArray.h"
#include "objects/utility/StringUtils.h"
#include "objects/wrappers/Expected.h"
#include "physics/Constants.h"
Go to the source code of this file.
Classes | |
class | UnitDimensions |
class | UnitSystem |
class | Unit |
Single benchmark unit. More... | |
Enumerations | |
enum class | BasicDimension { LENGTH , MASS , TIME , ANGLE } |
Functions | |
Unit | operator+ (const Unit &u1, const Unit &u2) |
Unit | operator- (const Unit &u1, const Unit &u2) |
Unit | operator* (const Unit &u, const Float f) |
Unit | operator* (const Float f, const Unit &u) |
Unit | operator* (const Unit &u1, const Unit &u2) |
Unit | operator/ (const Unit &u1, const Unit &u2) |
INLINE Unit | operator""_kg (long double value) |
INLINE Unit | operator""_g (long double value) |
INLINE Unit | operator""_m (long double value) |
INLINE Unit | operator""_cm (long double value) |
INLINE Unit | operator""_mm (long double value) |
INLINE Unit | operator""_km (long double value) |
INLINE Unit | operator""_s (long double value) |
INLINE Unit | operator""_rad (long double value) |
INLINE Unit | operator""_mps (long double value) |
Expected< Unit > | parseUnit (const std::string &text) |
Variables | |
constexpr Size | DIMENSION_CNT = 4 |
UnitSystem | CODE_UNITS |
|
strong |
There are three different unit systems in the code: 1) Code units Currently selected unit system, used for actual computation in the code. Or more precisely, we don't use runtime dimensional analysis in the actual simulation for performance reasons, we convert the input quantities (values and units) into floats or doubles using the selected code units. These units determine the accuracy of the code; if a nanometer is selected as a unit of length in a simulation of protoplanetary disk, you can expect a loss of precision. Select the code units so that the typical values of quantities in your simulation correspond to the unit values of code units.
2) Reference units Unit system used as a reference for all conversions. Used for convenience as we do not want to define conversions between each pair of unit systems; for each unit system, we simply define its relation to the reference units. This is always SI, for simplicity.
3) Input/output units Selected units of input or output values.
Enumerator | |
---|---|
LENGTH | |
MASS | |
TIME | |
ANGLE |
|
extern |