test: ISQ quantities specification tests added
This commit is contained in:
1 parent
f37ec4c62b
commit
5152db6382
6 files changed
+184
-17
No files matched your search
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <units/dimension.h>
|
||||
#include <units/quantity_spec.h>
|
||||
#include <units/reference.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
|
||||
@@ -22,13 +22,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/dimension.h>
|
||||
#include <units/isq/base_quantities.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/quantity_spec.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
// inline constexpr struct mass : base_dimension<"M"> {} mass;
|
||||
QUANTITY_SPEC(mass_density, mass / volume);
|
||||
inline constexpr auto density = mass_density;
|
||||
QUANTITY_SPEC(specific_volume, 1 / mass_density);
|
||||
@@ -38,7 +37,7 @@ QUANTITY_SPEC(surface_mass_density, mass / area);
|
||||
inline constexpr auto surface_density = surface_mass_density;
|
||||
QUANTITY_SPEC(linear_mass_density, mass / length);
|
||||
inline constexpr auto linear_density = linear_mass_density;
|
||||
QUANTITY_SPEC(momentum, mass* velocity);
|
||||
QUANTITY_SPEC(momentum, mass* velocity); // TODO vector?
|
||||
QUANTITY_SPEC(force, mass* acceleration); // vector // TODO what is a correct equation here?
|
||||
QUANTITY_SPEC(weight, force); // vector // TODO g?
|
||||
QUANTITY_SPEC(static_friction_force, force); // vector
|
||||
@@ -62,7 +61,7 @@ QUANTITY_SPEC(normal_stress, pressure, quantity_character::scalar);
|
||||
QUANTITY_SPEC(shear_stress, pressure, quantity_character::scalar);
|
||||
QUANTITY_SPEC(strain, dimensionless, quantity_character::tensor);
|
||||
QUANTITY_SPEC(relative_linear_strain, length / length);
|
||||
QUANTITY_SPEC(shear_strain, displacement / thickness);
|
||||
QUANTITY_SPEC(shear_strain, displacement / thickness); // TODO scalar or vector?
|
||||
QUANTITY_SPEC(relative_volume_strain, volume / volume);
|
||||
QUANTITY_SPEC(Poisson_number, width / length);
|
||||
QUANTITY_SPEC(modulus_of_elasticity, normal_stress / relative_linear_strain);
|
||||
@@ -83,16 +82,18 @@ inline constexpr auto coefficient_of_static_friction = static_friction_coefficie
|
||||
QUANTITY_SPEC(kinetic_friction_factor, kinetic_friction_force / force, quantity_character::scalar);
|
||||
inline constexpr auto dynamic_friction_factor = kinetic_friction_factor;
|
||||
QUANTITY_SPEC(rolling_resistance_factor, force / force, quantity_character::scalar);
|
||||
// QUANTITY_SPEC(drag_coefficient, mag<2>* drag_force / (mass_density * pow<2>(speed) * area));
|
||||
// inline constexpr auto drag_factor = drag_coefficient;
|
||||
QUANTITY_SPEC(drag_coefficient, drag_force / (mass_density * pow<2>(speed) * area)); // TODO scalar or vector?
|
||||
// QUANTITY_SPEC(drag_coefficient, mag<2>* drag_force / (mass_density * pow<2>(speed) * area)); // TODO should we
|
||||
// support that?
|
||||
inline constexpr auto drag_factor = drag_coefficient;
|
||||
QUANTITY_SPEC(dynamic_viscosity, shear_stress* length / velocity);
|
||||
QUANTITY_SPEC(kinematic_viscosity, dynamic_viscosity / mass_density);
|
||||
QUANTITY_SPEC(surface_tension, force / length, quantity_character::scalar); // TODO what is a correct equation here?
|
||||
QUANTITY_SPEC(power, force* velocity, quantity_character::scalar);
|
||||
// QUANTITY_SPEC(energy, force* length);
|
||||
QUANTITY_SPEC(potential_energy, mass* acceleration* height); // TODO what is a correct equation here?
|
||||
QUANTITY_SPEC(potential_energy, mass* pow<2>(length) / pow<2>(time)); // TODO what is a correct equation here?
|
||||
QUANTITY_SPEC(kinetic_energy, mass* pow<2>(speed));
|
||||
// QUANTITY_SPEC(kinetic_energy, mag<1, 2>* mass* pow<2>(speed));
|
||||
// QUANTITY_SPEC(kinetic_energy, mag<1, 2>* mass* pow<2>(speed)); // TODO should we support that?
|
||||
// TODO how to implement that?
|
||||
// QUANTITY_SPEC(mechanical_energy, potential_energy + kinetic_energy);
|
||||
QUANTITY_SPEC(mechanical_energy, potential_energy);
|
||||
|
||||
@@ -22,12 +22,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/dimension.h>
|
||||
#include <units/isq/base_quantities.h>
|
||||
#include <units/quantity_spec.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
// clang-format off
|
||||
QUANTITY_SPEC(width, length);
|
||||
inline constexpr auto breadth = width;
|
||||
QUANTITY_SPEC(height, length);
|
||||
@@ -35,7 +34,7 @@ inline constexpr auto depth = height;
|
||||
inline constexpr auto altitude = height;
|
||||
QUANTITY_SPEC(thickness, width);
|
||||
QUANTITY_SPEC(diameter, width);
|
||||
// QUANTITY_SPEC(radius, mag<ratio{1, 2}> * diameter);
|
||||
// QUANTITY_SPEC(radius, mag<ratio{1, 2}> * diameter); // TODO should we support that?
|
||||
QUANTITY_SPEC(radius, diameter);
|
||||
QUANTITY_SPEC(path_length, length);
|
||||
inline constexpr auto arc_length = path_length;
|
||||
@@ -51,11 +50,11 @@ QUANTITY_SPEC(angular_measure, arc_length / radius);
|
||||
QUANTITY_SPEC(rotational_displacement, path_length / radius);
|
||||
inline constexpr auto angular_displacement = rotational_displacement;
|
||||
QUANTITY_SPEC(phase_angle, angular_measure);
|
||||
QUANTITY_SPEC(solid_angular_measure, angular_measure * angular_measure);
|
||||
QUANTITY_SPEC(solid_angular_measure, angular_measure* angular_measure);
|
||||
inline constexpr auto duration = time;
|
||||
QUANTITY_SPEC(velocity, position_vector / duration); // vector
|
||||
QUANTITY_SPEC(speed, distance / duration); // TODO length, path_length?
|
||||
QUANTITY_SPEC(acceleration, velocity / duration); // vector
|
||||
QUANTITY_SPEC(speed, distance / duration); // TODO length, path_length?
|
||||
QUANTITY_SPEC(acceleration, velocity / duration); // vector
|
||||
QUANTITY_SPEC(angular_velocity, angular_displacement / duration, quantity_character::vector);
|
||||
QUANTITY_SPEC(angular_acceleration, angular_velocity / duration);
|
||||
QUANTITY_SPEC(period_duration, duration);
|
||||
@@ -76,11 +75,11 @@ inline constexpr auto phase_speed = phase_velocity;
|
||||
QUANTITY_SPEC(group_velocity, angular_frequency / angular_repetency);
|
||||
inline constexpr auto group_speed = group_velocity;
|
||||
QUANTITY_SPEC(damping_coefficient, 1 / time_constant);
|
||||
QUANTITY_SPEC(logarithmic_decrement, damping_coefficient * period_duration);
|
||||
QUANTITY_SPEC(logarithmic_decrement, damping_coefficient* period_duration);
|
||||
QUANTITY_SPEC(attenuation, 1 / distance);
|
||||
inline constexpr auto extinction = attenuation;
|
||||
QUANTITY_SPEC(phase_coefficient, phase_angle / path_length);
|
||||
QUANTITY_SPEC(propagation_coefficient, 1 / length); // γ = α + iβ where α denotes attenuation and β the phase coefficient of a plane wave
|
||||
// clang-format on
|
||||
QUANTITY_SPEC(propagation_coefficient, 1 / length); // γ = α + iβ where α denotes attenuation
|
||||
// and β the phase coefficient of a plane wave
|
||||
|
||||
} // namespace units::isq
|
||||
@@ -640,6 +640,7 @@ inline constexpr auto d = day;
|
||||
// commonly used squared and cubic units
|
||||
inline constexpr auto m2 = square<metre>;
|
||||
inline constexpr auto m3 = cubic<metre>;
|
||||
inline constexpr auto m4 = pow<4>(metre);
|
||||
inline constexpr auto s2 = square<second>;
|
||||
inline constexpr auto s3 = cubic<second>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user