26,06,05
This commit is contained in:
@@ -1,231 +1,216 @@
|
||||
//namespace QWERTYkez.Mensura.Units;
|
||||
namespace QWERTYkez.Mensura.Units;
|
||||
|
||||
//internal static class OperationsExtension
|
||||
internal static class OperationsExtension
|
||||
{
|
||||
internal static TResult MultiplyProtected<T1, T2, TResult>(this T1 t1, T2 t2)
|
||||
where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
=> (t1.ToDouble() * t2.ToDouble()).ToUnit<TResult>();
|
||||
|
||||
internal static TResult MultiplyProtected<T1, T2, TResult>(this T1 t1, T2 t2, double multiplicator)
|
||||
where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
=> (t1.ToDouble() * t2.ToDouble() * multiplicator).ToUnit<TResult>();
|
||||
|
||||
internal static TResult DivideProtected<T1, T2, TResult>(this T1 t1, T2 t2)
|
||||
where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
=> (t1.ToDouble() / t2.ToDouble()).ToUnit<TResult>();
|
||||
|
||||
internal static TResult DivideProtected<T1, T2, TResult>(this T1 t1, T2 t2, double multiplicator)
|
||||
where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
=> (t1.ToDouble() * multiplicator / t2.ToDouble()).ToUnit<TResult>();
|
||||
}
|
||||
|
||||
internal static class Coefficients
|
||||
{
|
||||
internal static double MultiplyCoefficient<T1, T2, TResult>(T1 a, T2 b, TResult r)
|
||||
where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
=> r.ToDouble() / (a.ToDouble() * b.ToDouble());
|
||||
|
||||
internal static double DivideCoefficient<T1, T2, TResult>(T1 a, T2 b, TResult r)
|
||||
where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
=> r.ToDouble() * b.ToDouble() / a.ToDouble();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Length
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Area operator *(Length left, Length right)
|
||||
=> left.MultiplyProtected<Length, Length, Area>(right, Coeff1);
|
||||
|
||||
static readonly double Coeff1 = Coefficients.MultiplyCoefficient(MilliMeter, MilliMeter, Area.MilliMeterSquared);
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Volume operator *(Area left, Length right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Volume operator *(Length left, Area right)
|
||||
=> left.MultiplyProtected<Length, Area, Volume>(right, Coeff2);
|
||||
|
||||
static readonly double Coeff2 = Coefficients.MultiplyCoefficient(MilliMeter, Area.MilliMeterSquared, Volume.MilliMeterCubic);
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Pressure operator *(Length left, ForceVolumetric right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Pressure operator *(ForceVolumetric left, Length right) => left.MultiplyProtected<ForceVolumetric, Length, Pressure>(right, Coeff3);
|
||||
static readonly double Coeff3 = Coefficients.MultiplyCoefficient(ForceVolumetric.NewtonPerMeterCubic, Length.Meter, Pressure.NewtonPerMeterSquared);
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Torque operator *(Force left, Length right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Torque operator *(Length left, Force right) => left.MultiplyProtected<Length, Force, Torque>(right, Coeff6);
|
||||
static readonly double Coeff6 = Coefficients.MultiplyCoefficient(Length.Meter, Force.Newton, Torque.Newton_Meter);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Mass // Grams
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Pressure // Pascals
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Length operator /(Pressure left, ForceVolumetric right) => left.DivideProtected<Pressure, ForceVolumetric, Length>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.DivideCoefficient(Pressure.Pascal, ForceVolumetric.NewtonPerMeterCubic, Length.Meter);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Force operator *(Pressure left, Area right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Force operator *(Area left, Pressure right) => left.MultiplyProtected<Area, Pressure, Force>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.MultiplyCoefficient(Area.MeterSquared, Pressure.Pascal, Force.Newton);
|
||||
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Length operator /(ForceLinear left, Pressure right) => left.DivideProtected<ForceLinear, Pressure, Length>(right, Coeff3);
|
||||
static readonly double Coeff3 = Coefficients.DivideCoefficient(ForceLinear._NewtonPerMilliMeter, Pressure.NewtonPerMilliMeterSquared, Length.MilliMeter);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static ForceLinear operator *(Pressure left, Length right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static ForceLinear operator *(Length left, Pressure right) => left.MultiplyProtected<Length, Pressure, ForceLinear>(right, Coeff4);
|
||||
static readonly double Coeff4 = Coefficients.MultiplyCoefficient(Length.MilliMeter, Pressure.NewtonPerMilliMeterSquared, ForceLinear._NewtonPerMilliMeter);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Area // MilliMetersSquared
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Torque operator *(ForceLinear left, Area right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Torque operator *(Area left, ForceLinear right) => left.MultiplyProtected<Area, ForceLinear, Torque>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Area.MeterSquared, ForceLinear.NewtonPerMeter, Torque.Newton_Meter);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Length operator /(Area left, Length right) => left.DivideProtected<Area, Length, Length>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.DivideCoefficient(Area.MilliMeterSquared, Length.MilliMeter, Length.MilliMeter);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Volume // MillimetersCubic
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Torque operator *(Pressure left, Volume right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Torque operator *(Volume left, Pressure right) => left.MultiplyProtected<Volume, Pressure, Torque>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.MultiplyCoefficient(Volume.MeterCubic, Pressure.Pascal, Torque.Newton_Meter);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Area operator /(Volume left, Length right) => left.DivideProtected<Volume, Length, Area>(right);
|
||||
[CollectionsOperatorsGenerator] public static Length operator /(Volume left, Area right) => left.DivideProtected<Volume, Area, Length>(right, Coeff3);
|
||||
static readonly double Coeff3 = Coefficients.DivideCoefficient(Volume.MilliMeterCubic, Length.MilliMeter, Area.MilliMeterSquared);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Force // Newtons
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Area operator /(Force left, Pressure right) => left.DivideProtected<Force, Pressure, Area>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.DivideCoefficient(Force.Newton, Pressure.Pascal, Area.MeterSquared);
|
||||
[CollectionsOperatorsGenerator] public static Pressure operator /(Force left, Area right) => left.DivideProtected<Force, Area, Pressure>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.DivideCoefficient(Force.Newton, Area.MeterSquared, Pressure.Pascal);
|
||||
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Torque // NewtonMeters
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Length operator /(Torque left, Force right) => left.DivideProtected<Torque, Force, Length>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Force.Newton, Length.Meter);
|
||||
[CollectionsOperatorsGenerator] public static Force operator /(Torque left, Length right) => left.DivideProtected<Torque, Length, Force>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Length.Meter, Force.Newton);
|
||||
[CollectionsOperatorsGenerator] public static ForceLinear operator /(Torque left, Area right) => left.DivideProtected<Torque, Area, ForceLinear>(right, Coeff3);
|
||||
static readonly double Coeff3 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Area.MilliMeterSquared, ForceLinear.KiloNewtonPerMilliMeter );
|
||||
[CollectionsOperatorsGenerator] public static Pressure operator /(Torque left, Volume right) => left.DivideProtected<Torque, Volume, Pressure>(right, Coeff4);
|
||||
static readonly double Coeff4 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Volume.MeterCubic, Pressure.Pascal);
|
||||
[CollectionsOperatorsGenerator] public static Volume operator /(Torque left, Pressure right) => left.DivideProtected<Torque, Pressure, Volume>(right, Coeff5);
|
||||
static readonly double Coeff5 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Pressure.Pascal, Volume.MeterCubic);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Frequency // Hertz
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Time
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Speed operator *(Boost left, Time right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Speed operator *(Time left, Boost right) => left.MultiplyProtected<Time, Boost, Speed>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Time.Second, Boost.MeterPerSecondSquared, Speed.MeterPerSecond);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Speed operator /(Length left, Time right) => left.DivideProtected<Length, Time, Speed>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.DivideCoefficient(Length.Meter, Time.Second, Speed.MeterPerSecond);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Speed
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Length operator *(Speed left, Time right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Length operator *(Time left, Speed right) => left.MultiplyProtected<Time, Speed, Length>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Time.Second, Speed.MeterPerSecond, Length.Meter);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Boost operator /(Speed left, Time right) => left.DivideProtected<Speed, Time, Boost>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.DivideCoefficient(Speed.MeterPerSecond, Time.Second, Boost.MeterPerSecondSquared);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Boost
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Force operator *(Mass left, Boost right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Force operator *(Boost left, Mass right) => left.MultiplyProtected<Boost, Mass, Force>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Boost.MeterPerSecondSquared, Mass.KiloGram, Force.Newton);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static ForceLinear operator *(MassLinear left, Boost right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static ForceLinear operator *(Boost left, MassLinear right) => left.MultiplyProtected<Boost, MassLinear, ForceLinear>(right, Coeff2);
|
||||
static readonly double Coeff2 = Coefficients.MultiplyCoefficient(Boost.MeterPerSecondSquared, MassLinear.KiloGramPerMilliMeter, ForceLinear._NewtonPerMilliMeter);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static ForceVolumetric operator *(Density left, Boost right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static ForceVolumetric operator *(Boost left, Density right) => left.MultiplyProtected<Boost, Density, ForceVolumetric>(right, Coeff3);
|
||||
static readonly double Coeff3 = Coefficients.MultiplyCoefficient(Boost.MeterPerSecondSquared, Density.KiloGramPerMilliMeterCubic, ForceVolumetric._NewtonPerMilliMeterCubic);
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public static MassLinear operator /(ForceLinear left, Boost right) => left.DivideProtected<ForceLinear, Boost, MassLinear>(right, Coeff4);
|
||||
static readonly double Coeff4 = Coefficients.DivideCoefficient(ForceLinear._NewtonPerMilliMeter, Boost.MeterPerSecondSquared, MassLinear.KiloGramPerMilliMeter);
|
||||
|
||||
[CollectionsOperatorsGenerator] public static Density operator /(ForceVolumetric left, Boost right) => left.DivideProtected<ForceVolumetric, Boost, Density>(right, Coeff5);
|
||||
static readonly double Coeff5 = Coefficients.DivideCoefficient(ForceVolumetric._NewtonPerMilliMeterCubic, Boost.MeterPerSecondSquared, Density.KiloGramPerMilliMeterCubic);
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public static MassPerSquare operator /(Pressure left, Boost right) => left.DivideProtected<Pressure, Boost, MassPerSquare>(right, Coeff6);
|
||||
static readonly double Coeff6 = Coefficients.DivideCoefficient(Pressure.Pascal, Boost.MeterPerSecondSquared, MassPerSquare.KiloGramPerMeterSquared);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct MassPerSquare
|
||||
{
|
||||
[CollectionsOperatorsGenerator] public static Pressure operator *(Boost left, MassPerSquare right) => right * left;
|
||||
[CollectionsOperatorsGenerator] public static Pressure operator *(MassPerSquare left, Boost right) => left.MultiplyProtected<MassPerSquare, Boost, Pressure>(right, Coeff1);
|
||||
static readonly double Coeff1 = Coefficients.MultiplyCoefficient(MassPerSquare.KiloGramPerMeterSquared, Boost.MeterPerSecondSquared, Pressure.Pascal);
|
||||
}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct LinearForce : Pogon<LinearForce, Force>
|
||||
//{
|
||||
// internal static TResult MultiplyProtected<T1, T2, TResult>(this T1 t1, T2 t2)
|
||||
// where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
// where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
// where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
// => new() { Value = t1.Value * t2.Value };
|
||||
|
||||
// internal static TResult MultiplyProtected<T1, T2, TResult>(this T1 t1, T2 t2, double multiplicator)
|
||||
// where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
// where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
// where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
// => new() { Value = t1.Value * t2.Value * multiplicator };
|
||||
|
||||
// internal static TResult DivideProtected<T1, T2, TResult>(this T1 t1, T2 t2)
|
||||
// where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
// where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
// where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
// => new() { Value = t1.Value / t2.Value };
|
||||
|
||||
// internal static TResult DivideProtected<T1, T2, TResult>(this T1 t1, T2 t2, double multiplicator)
|
||||
// where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
// where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
// where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
// => new() { Value = t1.Value * multiplicator / t2.Value };
|
||||
//}
|
||||
|
||||
//internal static class Coefficients
|
||||
//{
|
||||
// internal static double MultiplyCoefficient<T1, T2, TResult>(T1 a, T2 b, TResult r)
|
||||
// where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
// where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
// where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
// => r.Value / (a.Value * b.Value);
|
||||
|
||||
// internal static double DivideCoefficient<T1, T2, TResult>(T1 a, T2 b, TResult r)
|
||||
// where T1 : struct, IMensuraUnit<T1>, IEquatable<T1>, IMensuraUnit
|
||||
// where T2 : struct, IMensuraUnit<T2>, IEquatable<T2>, IMensuraUnit
|
||||
// where TResult : struct, IMensuraUnit<TResult>, IEquatable<TResult>, IMensuraUnit
|
||||
// => r.Value * b.Value / a.Value;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Length
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Area operator *(Length left, Length right)
|
||||
// => left.MultiplyProtected<Length, Length, Area>(right, Coeff1);
|
||||
|
||||
// static readonly double Coeff1 = Coefficients.MultiplyCoefficient(MilliMeter, MilliMeter, Area.MilliMeterSquared);
|
||||
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Volume operator *(Area left, Length right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Volume operator *(Length left, Area right)
|
||||
// => left.MultiplyProtected<Length, Area, Volume>(right, Coeff2);
|
||||
|
||||
// static readonly double Coeff2 = Coefficients.MultiplyCoefficient(MilliMeter, Area.MilliMeterSquared, Volume.MilliMeterCubic);
|
||||
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Pressure operator *(Length left, UdelForce right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Pressure operator *(UdelForce left, Length right) => left.MultiplyProtected<UdelForce, Length, Pressure>(right, Coeff3);
|
||||
// static readonly double Coeff3 = Coefficients.MultiplyCoefficient(a => a.PerMeterCubic.Newtons = 1, Length.Meter, Pressure.NewtonPerMeterSquared);
|
||||
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Force operator *(PogonForce left, Length right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Force operator *(Length left, PogonForce right) => left.MultiplyProtected<Length, PogonForce, Force>(right, Coeff4);
|
||||
// static readonly double Coeff4 = Coefficients.MultiplyCoefficient(Length.Meter, b => b.PerMeter.Newtons = 1, Force.Newton);
|
||||
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Torque operator *(Force left, Length right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Torque operator *(Length left, Force right) => left.MultiplyProtected<Length, Force, Torque>(right, Coeff6);
|
||||
// static readonly double Coeff6 = Coefficients.MultiplyCoefficient(Length.Meter, Force.Newton, Torque.Newton_Meter);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Mass // Grams
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Pressure // Pascals
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct MassLinear : Pogon<MassLinear, Mass>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Length operator /(Pressure left, UdelForce right) => left.DivideProtected<Pressure, UdelForce, Length>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.DivideCoefficient(Pressure.Pascal, b => b.PerMeterCubic.Newtons = 1, Length.Meter);
|
||||
// [CollectionsOperatorsGenerator] public static Boost operator /(LinearForce left, MassLinear right) => left.DivideProtected<LinearForce, MassLinear, Boost>(right, Coeff1);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Force operator *(Pressure left, Area right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Force operator *(Area left, Pressure right) => left.MultiplyProtected<Area, Pressure, Force>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.MultiplyCoefficient(Area.MeterSquared, Pressure.Pascal, Force.Newton);
|
||||
|
||||
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Length operator /(PogonForce left, Pressure right) => left.DivideProtected<PogonForce, Pressure, Length>(right, Coeff3);
|
||||
// static readonly double Coeff3 = Coefficients.DivideCoefficient(a => a._PerMilliMeter.Newtons = 1, Pressure.NewtonPerMilliMeterSquared, Length.MilliMeter);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static PogonForce operator *(Pressure left, Length right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static PogonForce operator *(Length left, Pressure right) => left.MultiplyProtected<Length, Pressure, PogonForce>(right, Coeff4);
|
||||
// static readonly double Coeff4 = Coefficients.MultiplyCoefficient(Length.MilliMeter, Pressure.NewtonPerMilliMeterSquared, r => r._PerMilliMeter.Newtons = 1);
|
||||
// static readonly double Coeff1 = Coefficients.DivideCoefficient(a => a.PerMilliMeter.Newtons = 1, b => b.PerMilliMeter.KiloGrams = 1, Boost.MeterPerSecondSquared);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Area // MilliMetersSquared
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Torque operator *(PogonForce left, Area right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Torque operator *(Area left, PogonForce right) => left.MultiplyProtected<Area, PogonForce, Torque>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Area.MeterSquared, b => b.PerMeter.Newtons = 1, Torque.Newton_Meter);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Length operator /(Area left, Length right) => left.DivideProtected<Area, Length, Length>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.DivideCoefficient(Area.MilliMeterSquared, Length.MilliMeter, Length.MilliMeter);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Volume // MillimetersCubic
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Mass operator *(Density left, Volume right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Mass operator *(Volume left, Density right) => left.MultiplyProtected<Volume, Density, Mass>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Volume.MilliMeterCubic, b => b.PerMilliMeterCubic.Grams = 1, Time.Gram);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Torque operator *(Pressure left, Volume right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Torque operator *(Volume left, Pressure right) => left.MultiplyProtected<Volume, Pressure, Torque>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.MultiplyCoefficient(Volume.MeterCubic, Pressure.Pascal, Torque.Newton_Meter);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Area operator /(Volume left, Length right) => left.DivideProtected<Volume, Length, Area>(right);
|
||||
// [CollectionsOperatorsGenerator] public static Length operator /(Volume left, Area right) => left.DivideProtected<Volume, Area, Length>(right, Coeff3);
|
||||
// static readonly double Coeff3 = Coefficients.DivideCoefficient(Volume.MilliMeterCubic, Length.MilliMeter, Area.MilliMeterSquared);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Force // Newtons
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Area operator /(Force left, Pressure right) => left.DivideProtected<Force, Pressure, Area>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.DivideCoefficient(Force.Newton, Pressure.Pascal, Area.MeterSquared);
|
||||
// [CollectionsOperatorsGenerator] public static Pressure operator /(Force left, Area right) => left.DivideProtected<Force, Area, Pressure>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.DivideCoefficient(Force.Newton, Area.MeterSquared, Pressure.Pascal);
|
||||
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Torque // NewtonMeters
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Length operator /(Torque left, Force right) => left.DivideProtected<Torque, Force, Length>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Force.Newton, Length.Meter);
|
||||
// [CollectionsOperatorsGenerator] public static Force operator /(Torque left, Length right) => left.DivideProtected<Torque, Length, Force>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Length.Meter, Force.Newton);
|
||||
// [CollectionsOperatorsGenerator] public static PogonForce operator /(Torque left, Area right) => left.DivideProtected<Torque, Area, PogonForce>(right, Coeff3);
|
||||
// static readonly double Coeff3 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Area.MilliMeterSquared, r => r.PerMilliMeter.KiloNewtons = 1);
|
||||
// [CollectionsOperatorsGenerator] public static Pressure operator /(Torque left, Volume right) => left.DivideProtected<Torque, Volume, Pressure>(right, Coeff4);
|
||||
// static readonly double Coeff4 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Volume.MeterCubic, Pressure.Pascal);
|
||||
// [CollectionsOperatorsGenerator] public static Volume operator /(Torque left, Pressure right) => left.DivideProtected<Torque, Pressure, Volume>(right, Coeff5);
|
||||
// static readonly double Coeff5 = Coefficients.DivideCoefficient(Torque.Newton_Meter, Pressure.Pascal, Volume.MeterCubic);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Frequency // Hertz
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct ForceVolumetric : Udel<ForceVolumetric, Force>
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Time
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Speed operator *(Boost left, Time right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Speed operator *(Time left, Boost right) => left.MultiplyProtected<Time, Boost, Speed>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Time.Second, Boost.MeterPerSecondSquared, Speed.MeterPerSecond);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Speed operator /(Length left, Time right) => left.DivideProtected<Length, Time, Speed>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.DivideCoefficient(Length.Meter, Time.Second, Speed.MeterPerSecond);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Speed
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Length operator *(Speed left, Time right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Length operator *(Time left, Speed right) => left.MultiplyProtected<Time, Speed, Length>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Time.Second, Speed.MeterPerSecond, Length.Meter);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Boost operator /(Speed left, Time right) => left.DivideProtected<Speed, Time, Boost>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.DivideCoefficient(Speed.MeterPerSecond, Time.Second, Boost.MeterPerSecondSquared);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct Boost
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Force operator *(Mass left, Boost right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Force operator *(Boost left, Mass right) => left.MultiplyProtected<Boost, Mass, Force>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.MultiplyCoefficient(Boost.MeterPerSecondSquared, Time.KiloGram, Force.Newton);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static PogonForce operator *(PogonMass left, Boost right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static PogonForce operator *(Boost left, PogonMass right) => left.MultiplyProtected<Boost, PogonMass, PogonForce>(right, Coeff2);
|
||||
// static readonly double Coeff2 = Coefficients.MultiplyCoefficient(Boost.MeterPerSecondSquared, b => b.PerMilliMeter.KiloGrams = 1, r => r.PerMilliMeter.Newtons = 1);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static UdelForce operator *(Density left, Boost right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static UdelForce operator *(Boost left, Density right) => left.MultiplyProtected<Boost, Density, UdelForce>(right, Coeff3);
|
||||
// static readonly double Coeff3 = Coefficients.MultiplyCoefficient(Boost.MeterPerSecondSquared, b => b.PerMilliMeterCubic.KiloGrams = 1, r => r.PerMilliMeterCubic.Newtons = 1);
|
||||
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static PogonMass operator /(PogonForce left, Boost right) => left.DivideProtected<PogonForce, Boost, PogonMass>(right, Coeff4);
|
||||
// static readonly double Coeff4 = Coefficients.DivideCoefficient(a => a.PerMilliMeter.Newtons = 1, Boost.MeterPerSecondSquared, r => r.PerMilliMeter.KiloGrams = 1);
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static Density operator /(UdelForce left, Boost right) => left.DivideProtected<UdelForce, Boost, Density>(right, Coeff5);
|
||||
// static readonly double Coeff5 = Coefficients.DivideCoefficient(a => a.PerMilliMeterCubic.Newtons = 1, Boost.MeterPerSecondSquared, r => r.PerMilliMeterCubic.KiloGrams = 1);
|
||||
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static MassPerSquare operator /(Pressure left, Boost right) => left.DivideProtected<Pressure, Boost, MassPerSquare>(right, Coeff6);
|
||||
// static readonly double Coeff6 = Coefficients.DivideCoefficient(Pressure.Pascal, Boost.MeterPerSecondSquared, MassPerSquare.KiloGramPerMeterSquared);
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct MassPerSquare
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Pressure operator *(Boost left, MassPerSquare right) => right * left;
|
||||
// [CollectionsOperatorsGenerator] public static Pressure operator *(MassPerSquare left, Boost right) => left.MultiplyProtected<MassPerSquare, Boost, Pressure>(right, Coeff1);
|
||||
// static readonly double Coeff1 = Coefficients.MultiplyCoefficient(MassPerSquare.KiloGramPerMeterSquared, Boost.MeterPerSecondSquared, Pressure.Pascal);
|
||||
//}
|
||||
|
||||
////[CollectionsOperatorsGenerator] public readonly partial record struct PogonForce : Pogon<PogonForce, Force>
|
||||
////{
|
||||
|
||||
|
||||
////}
|
||||
|
||||
////[CollectionsOperatorsGenerator] public readonly partial record struct PogonMass : Pogon<PogonMass, Mass>
|
||||
////{
|
||||
//// [CollectionsOperatorsGenerator] public static Boost operator /(PogonForce left, PogonMass right) => left.DivideProtected<PogonForce, PogonMass, Boost>(right, Coeff1);
|
||||
|
||||
//// static readonly double Coeff1 = Coefficients.DivideCoefficient(a => a.PerMilliMeter.Newtons = 1, b => b.PerMilliMeter.KiloGrams = 1, Boost.MeterPerSecondSquared);
|
||||
////}
|
||||
|
||||
////[CollectionsOperatorsGenerator] public readonly partial record struct UdelForce : Udel<UdelForce, Force>
|
||||
////{
|
||||
|
||||
|
||||
////}
|
||||
|
||||
////[CollectionsOperatorsGenerator] public readonly partial record struct Density : Udel<Density, Mass>
|
||||
////{
|
||||
|
||||
|
||||
////}
|
||||
//}
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is Seconds
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("Radians = {Radians.ToString(\"0.###\")}, Degrees = {Degrees.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("Radians = {Radians.ToString(\"0.###\")}, Degrees = {Degrees.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Angle
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _Seconds { get => Seconds; init => Seconds = value; }
|
||||
public static Angle Second { get; } = new() { _Seconds = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Seconds { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Angle Second { get; } = new() { Seconds = 1 };
|
||||
[NotMapped, JsonIgnore] public double Seconds
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Angle Minute { get; } = new() { Minutes = 1 };
|
||||
[NotMapped, JsonIgnore] public double Minutes
|
||||
|
||||
@@ -3,20 +3,13 @@
|
||||
/// <summary>
|
||||
/// Base value is MilliMetersSquared
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("mm2 = {_MilliMetersSquared.ToString(\"0.###\")}, m2 = {MetersSquared.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("mm2 = {_MilliMetersSquared.ToString(\"0.###\")}, m2 = {MetersSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Area
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _MilliMetersSquared { get => MilliMetersSquared; init => MilliMetersSquared = value; }
|
||||
public static Area MilliMeterSquared { get; } = new() { _MilliMetersSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MilliMetersSquared { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
public static Area MilliMeterSquared { get; } = new() { MilliMetersSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double MilliMetersSquared
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
public static Area CentiMeterSquared { get; } = new() { CentiMetersSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double CentiMetersSquared
|
||||
{
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is MetersPerSecondSquared
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("m/s2 = {_MetersPerSecondSquared.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("m/s2 = {_MetersPerSecondSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Boost
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _MetersPerSecondSquared { get => MetersPerSecondSquared; init => MetersPerSecondSquared = value; }
|
||||
public static Boost MeterPerSecondSquared { get; } = new() { _MetersPerSecondSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MetersPerSecondSquared { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Boost MeterPerSecondSquared { get; } = new() { MetersPerSecondSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double MetersPerSecondSquared
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boost KiloMeterPerSecondSquared { get; } = new() { KiloMetersPerSecondSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloMetersPerSecondSquared
|
||||
@@ -28,7 +20,7 @@ public readonly partial record struct Boost
|
||||
}
|
||||
}
|
||||
|
||||
public static Boost G { get; } = new() { MetersPerSecondSquared = Constants.g };
|
||||
public static Boost G { get; } = new() { _MetersPerSecondSquared = Constants.g };
|
||||
|
||||
public Boost AddMetersPerSecondSquared(double value) => new(_Value + value);
|
||||
public Boost AddKiloMetersPerSecondSquared(double value) => new(_Value + BoostConv.KiloMetersPerSecondSquared.To(value));
|
||||
|
||||
78
QWERTYkez.Mensura/Units/Complex/ForceLinear.cs
Normal file
78
QWERTYkez.Mensura/Units/Complex/ForceLinear.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Force), nameof(Length), nameof(ForceLinear))] public readonly partial record struct ForceLinear
|
||||
{
|
||||
public static ForceLinear _NewtonPerMilliMeter { get; } = new() { _PerMilliMeter = new() { _Newtons = 1 } };
|
||||
public static ForceLinear KiloGramForcePerMilliMeter { get; } = new() { _PerMilliMeter = new() { KiloGramForces = 1 } };
|
||||
public static ForceLinear KiloNewtonPerMilliMeter { get; } = new() { _PerMilliMeter = new() { KiloNewtons = 1 } };
|
||||
public static ForceLinear TonForcePerMilliMeter { get; } = new() { _PerMilliMeter = new() { TonForces = 1 } };
|
||||
[NotMapped, JsonIgnore] public Force _PerMilliMeter
|
||||
{ get => (Force)_Value; init => _Value = (double)value; }
|
||||
|
||||
|
||||
public static ForceLinear NewtonPerCentiMeter { get; } = new() { PerCentiMeter = new() { _Newtons = 1 } };
|
||||
public static ForceLinear KiloGramForcePerCentiMeter { get; } = new() { PerCentiMeter = new() { KiloGramForces = 1 } };
|
||||
public static ForceLinear KiloNewtonPerCentiMeter { get; } = new() { PerCentiMeter = new() { KiloNewtons = 1 } };
|
||||
public static ForceLinear TonForcePerCentiMeter { get; } = new() { PerCentiMeter = new() { TonForces = 1 } };
|
||||
[NotMapped, JsonIgnore] public Force PerCentiMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.CentiMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.CentiMeters.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static ForceLinear NewtonPerDeciMeter { get; } = new() { PerDeciMeter = new() { _Newtons = 1 } };
|
||||
public static ForceLinear KiloGramForcePerDeciMeter { get; } = new() { PerDeciMeter = new() { KiloGramForces = 1 } };
|
||||
public static ForceLinear KiloNewtonPerDeciMeter { get; } = new() { PerDeciMeter = new() { KiloNewtons = 1 } };
|
||||
public static ForceLinear TonForcePerDeciMeter { get; } = new() { PerDeciMeter = new() { TonForces = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Force PerDeciMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.DeciMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.DeciMeters.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static ForceLinear NewtonPerMeter { get; } = new() { PerMeter = new() { _Newtons = 1 } };
|
||||
public static ForceLinear KiloGramForcePerMeter { get; } = new() { PerMeter = new() { KiloGramForces = 1 } };
|
||||
public static ForceLinear KiloNewtonPerMeter { get; } = new() { PerMeter = new() { KiloNewtons = 1 } };
|
||||
public static ForceLinear TonForcePerMeter { get; } = new() { PerMeter = new() { TonForces = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Force PerMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.Meters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.Meters.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static ForceLinear NewtonPerKiloMeter { get; } = new() { PerKiloMeter = new() { _Newtons = 1 } };
|
||||
public static ForceLinear KiloGramForcePerKiloMeter { get; } = new() { PerKiloMeter = new() { KiloGramForces = 1 } };
|
||||
public static ForceLinear KiloNewtonPerKiloMeter { get; } = new() { PerKiloMeter = new() { KiloNewtons = 1 } };
|
||||
public static ForceLinear TonForcePerKiloMeter { get; } = new() { PerKiloMeter = new() { TonForces = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Force PerKiloMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.KiloMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.KiloMeters.Multiplicator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//namespace MetricSystem;
|
||||
|
||||
//[DebuggerDisplay("N/m = {PerMeter._Newtons.ToString(\"0.###\")}, kgf/m = {PerMeter.KiloGramXXXXXXXXs.ToString(\"0.###\")}")]
|
||||
//public readonly partial record struct PogonXXXXXXXX
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//public partial class Length : Metric<Length, Length>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static PogonXXXXXXXX operator /(XXXXXXXX left, Length right) => left.DivideProtected<XXXXXXXX, Length, PogonXXXXXXXX>(right, PogonXXXXXXXXCoeff);
|
||||
// static readonly double PogonXXXXXXXXCoeff = Coefficients.DivideCoefficient<XXXXXXXX, Length, PogonXXXXXXXX>(a => a.Value = 1, b => b._MilliMeters = 1, r => r._PerMilliMeter.Value = 1);
|
||||
//}
|
||||
56
QWERTYkez.Mensura/Units/Complex/ForceVolumetric.cs
Normal file
56
QWERTYkez.Mensura/Units/Complex/ForceVolumetric.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Force), nameof(Volume), nameof(ForceVolumetric))] public readonly partial record struct ForceVolumetric
|
||||
{
|
||||
public static ForceVolumetric _NewtonPerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { _Newtons = 1 } };
|
||||
public static ForceVolumetric KiloGramForcePerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { KiloGramForces = 1 } };
|
||||
public static ForceVolumetric KiloNewtonPerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { KiloNewtons = 1 } };
|
||||
public static ForceVolumetric TonForcePerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { TonForces = 1 } };
|
||||
[NotMapped, JsonIgnore] public Force _PerMilliMeterCubic
|
||||
{ get => (Force)_Value; init => _Value = (double)value; }
|
||||
|
||||
|
||||
public static ForceVolumetric NewtonPerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { _Newtons = 1 } };
|
||||
public static ForceVolumetric KiloGramForcePerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { KiloGramForces = 1 } };
|
||||
public static ForceVolumetric KiloNewtonPerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { KiloNewtons = 1 } };
|
||||
public static ForceVolumetric TonForcePerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { TonForces = 1 } };
|
||||
[NotMapped, JsonIgnore] public Force PerCentiMeterCubic
|
||||
{
|
||||
get => new(_Value * VolumeConv.CentiMetersCubic.Multiplicator);
|
||||
init => _Value = value._Value / VolumeConv.CentiMetersCubic.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static ForceVolumetric NewtonPerMeterCubic { get; } = new() { PerMeterCubic = new() { _Newtons = 1 } };
|
||||
public static ForceVolumetric KiloGramForcePerMeterCubic { get; } = new() { PerMeterCubic = new() { KiloGramForces = 1 } };
|
||||
public static ForceVolumetric KiloNewtonPerMeterCubic { get; } = new() { PerMeterCubic = new() { KiloNewtons = 1 } };
|
||||
public static ForceVolumetric TonForcePerMeterCubic { get; } = new() { PerMeterCubic = new() { TonForces = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Force PerMeterCubic
|
||||
{
|
||||
get => new(_Value * VolumeConv.MetersCubic.Multiplicator);
|
||||
init => _Value = value._Value / VolumeConv.MetersCubic.Multiplicator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//namespace MetricSystem;
|
||||
|
||||
//[Owned, JsonConverter(typeof(MetricFormatter<ForceVolumetric>)), DebuggerDisplay("N/(m*mm2) = {PerMeter_PerMilliMeterSquared._Newtons.ToString(\"0.###\")}, kgf/(m*mm2) = {PerMeter_PerMilliMeterSquared.KiloGramForces.ToString(\"0.###\")}")]
|
||||
//public partial class ForceVolumetric : Udel<ForceVolumetric, Force>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static ForceVolumetric operator *(Area left, ForceVolumetric right) => right * left;
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static ForceVolumetric operator *(ForceVolumetric left, Area right) => left.MultiplyProtected<ForceVolumetric, Area, ForceVolumetric>(right, ForceVolumetricCoeff);
|
||||
// static readonly double ForceVolumetricCoeff = Coefficients.MultiplyCoefficient<ForceVolumetric, Area, ForceVolumetric>(a => a._PerMilliMeterCubic.Value = 1, b => b._MilliMetersSquared = 1, r => r._PerMilliMeter.Value = 1);
|
||||
//}
|
||||
|
||||
//public partial class Volume : Metric<Volume, Volume>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static ForceVolumetric operator /(Force left, Volume right) => left.DivideProtected<Force, Volume, ForceVolumetric>(right, ForceVolumetricCoeff);
|
||||
// static readonly double ForceVolumetricCoeff = Coefficients.DivideCoefficient<Force, Volume, ForceVolumetric>(a => a.Value = 1, b => b._MilliMetersCubic = 1, r => r._PerMilliMeterCubic.Value = 1);
|
||||
//}
|
||||
82
QWERTYkez.Mensura/Units/Complex/MassLinear.cs
Normal file
82
QWERTYkez.Mensura/Units/Complex/MassLinear.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Mass), nameof(Length), nameof(MassLinear))] public readonly partial record struct MassLinear
|
||||
{
|
||||
public static MassLinear _GramPerMilliMeter { get; } = new() { _PerMilliMeter = new() { _Grams = 1 } };
|
||||
public static MassLinear KiloGramPerMilliMeter { get; } = new() { _PerMilliMeter = new() { KiloGrams = 1 } };
|
||||
public static MassLinear CentnerPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Centners = 1 } };
|
||||
public static MassLinear TonPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Tons = 1 } };
|
||||
[NotMapped, JsonIgnore] public Mass _PerMilliMeter
|
||||
{ get => (Mass)_Value; init => _Value = (double)value; }
|
||||
|
||||
|
||||
public static MassLinear GramPerCentiMeter { get; } = new() { PerCentiMeter = new() { _Grams = 1 } };
|
||||
public static MassLinear KiloGramPerCentiMeter { get; } = new() { PerCentiMeter = new() { KiloGrams = 1 } };
|
||||
public static MassLinear CentnerPerCentiMeter { get; } = new() { PerCentiMeter = new() { Centners = 1 } };
|
||||
public static MassLinear TonPerCentiMeter { get; } = new() { PerCentiMeter = new() { Tons = 1 } };
|
||||
[NotMapped, JsonIgnore] public Mass PerCentiMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.CentiMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.CentiMeters.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static MassLinear GramPerDeciMeter { get; } = new() { PerDeciMeter = new() { _Grams = 1 } };
|
||||
public static MassLinear KiloGramPerDeciMeter { get; } = new() { PerDeciMeter = new() { KiloGrams = 1 } };
|
||||
public static MassLinear CentnerPerDeciMeter { get; } = new() { PerDeciMeter = new() { Centners = 1 } };
|
||||
public static MassLinear TonPerDeciMeter { get; } = new() { PerDeciMeter = new() { Tons = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Mass PerDeciMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.DeciMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.DeciMeters.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static MassLinear GramPerMeter { get; } = new() { PerMeter = new() { _Grams = 1 } };
|
||||
public static MassLinear KiloGramPerMeter { get; } = new() { PerMeter = new() { KiloGrams = 1 } };
|
||||
public static MassLinear CentnerPerMeter { get; } = new() { PerMeter = new() { Centners = 1 } };
|
||||
public static MassLinear TonPerMeter { get; } = new() { PerMeter = new() { Tons = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Mass PerMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.Meters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.Meters.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static MassLinear GramPerKiloMeter { get; } = new() { PerKiloMeter = new() { _Grams = 1 } };
|
||||
public static MassLinear KiloGramPerKiloMeter { get; } = new() { PerKiloMeter = new() { KiloGrams = 1 } };
|
||||
public static MassLinear CentnerPerKiloMeter { get; } = new() { PerKiloMeter = new() { Centners = 1 } };
|
||||
public static MassLinear TonPerKiloMeter { get; } = new() { PerKiloMeter = new() { Tons = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Mass PerKiloMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.KiloMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.KiloMeters.Multiplicator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//[Owned, JsonConverter(typeof(MetricFormatter<MassLinear>)), DebuggerDisplay("gr/m = {PerMeter._Grams.ToString(\"0.###\")}, kg/m = {PerMeter.KiloGrams.ToString(\"0.###\")}")]
|
||||
//public partial class MassLinear : Pogon<MassLinear, Mass>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Density operator /(MassLinear left, Area right) => left.DivideProtected<MassLinear, Area, Density>(right, UdelMassCoeff);
|
||||
// static readonly double UdelMassCoeff = Coefficients.DivideCoefficient<MassLinear, Area, Density>(a => a._PerMilliMeter.Value = 1, b => b._MilliMetersSquared = 1, r => r._PerMilliMeterCubic.Value = 1);
|
||||
//}
|
||||
|
||||
//public partial class Length : Metric<Length, Length>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static MassLinear operator /(Mass left, Length right) => left.DivideProtected<Mass, Length, MassLinear>(right, MassLinearCoeff);
|
||||
// static readonly double MassLinearCoeff = Coefficients.DivideCoefficient<Mass, Length, MassLinear>(a => a.Value = 1, b => b._MilliMeters = 1, r => r._PerMilliMeter.Value = 1);
|
||||
//}
|
||||
59
QWERTYkez.Mensura/Units/Complex/MassVolumetric (Density).cs
Normal file
59
QWERTYkez.Mensura/Units/Complex/MassVolumetric (Density).cs
Normal file
@@ -0,0 +1,59 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Mass), nameof(Volume), nameof(Density))] public readonly partial record struct Density
|
||||
{
|
||||
public static Density _GramPerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { _Grams = 1 } };
|
||||
public static Density KiloGramPerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { KiloGrams = 1 } };
|
||||
public static Density CentnerPerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { Centners = 1 } };
|
||||
public static Density TonPerMilliMeterCubic { get; } = new() { _PerMilliMeterCubic = new() { Tons = 1 } };
|
||||
[NotMapped, JsonIgnore] public Mass _PerMilliMeterCubic
|
||||
{ get => (Mass)_Value; init => _Value = (double)value; }
|
||||
|
||||
|
||||
public static Density GramPerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { _Grams = 1 } };
|
||||
public static Density KiloGramPerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { KiloGrams = 1 } };
|
||||
public static Density CentnerPerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { Centners = 1 } };
|
||||
public static Density TonPerCentiMeterCubic { get; } = new() { PerCentiMeterCubic = new() { Tons = 1 } };
|
||||
[NotMapped, JsonIgnore] public Mass PerCentiMeterCubic
|
||||
{
|
||||
get => new(_Value * VolumeConv.CentiMetersCubic.Multiplicator);
|
||||
init => _Value = value._Value / VolumeConv.CentiMetersCubic.Multiplicator;
|
||||
}
|
||||
|
||||
|
||||
public static Density GramPerMeterCubic { get; } = new() { PerMeterCubic = new() { _Grams = 1 } };
|
||||
public static Density KiloGramPerMeterCubic { get; } = new() { PerMeterCubic = new() { KiloGrams = 1 } };
|
||||
public static Density CentnerPerMeterCubic { get; } = new() { PerMeterCubic = new() { Centners = 1 } };
|
||||
public static Density TonPerMeterCubic { get; } = new() { PerMeterCubic = new() { Tons = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Mass PerMeterCubic
|
||||
{
|
||||
get => new(_Value * VolumeConv.MetersCubic.Multiplicator);
|
||||
init => _Value = value._Value / VolumeConv.MetersCubic.Multiplicator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//namespace MetricSystem;
|
||||
|
||||
//[Owned, JsonConverter(typeof(MetricFormatter<Density>)), DebuggerDisplay("gr/(m*mm2) = {PerMeterCubic_PerMilliMetersCubicquared._Grams.ToString(\"0.###\")}, kg/(m*mm2) = {PerMeterCubic_PerMilliMetersCubicquared.KiloGrams.ToString(\"0.###\")}")]
|
||||
//public partial class Density : Udel<Density, Mass>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static PogonMass operator *(Area left, Density right) => right * left;
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static PogonMass operator *(Density left, Area right) => left.MultiplyProtected<Density, Area, PogonMass>(right, PogonMassCoeff);
|
||||
// static readonly double PogonMassCoeff = Coefficients.MultiplyCoefficient<Density, Area, PogonMass>(a => a._PerMilliMeterCubicCubic.Value = 1, b => b._MilliMetersCubicSquared = 1, r => r._PerMilliMeterCubic.Value = 1);
|
||||
//}
|
||||
|
||||
//public partial class Volume : Metric<Volume, Volume>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Density operator /(Mass left, Volume right) => left.DivideProtected<Mass, Volume, Density>(right, DensityCoeff);
|
||||
// static readonly double DensityCoeff = Coefficients.DivideCoefficient<Mass, Volume, Density>(a => a.Value = 1, b => b._MilliMetersCubicCubic = 1, r => r._PerMilliMeterCubicCubic.Value = 1);
|
||||
//}
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is Newtons
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("N = {_Newtons.ToString(\"0.###\")}, kgf = {KiloGramForces.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("N = {_Newtons.ToString(\"0.###\")}, kgf = {KiloGramForces.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Force
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _Newtons { get => Newtons; init => Newtons = value; }
|
||||
public static Force Newton { get; } = new() { _Newtons = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Newtons { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Force Newton { get; } = new() { Newtons = 1 };
|
||||
[NotMapped, JsonIgnore] public double Newtons
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Force KiloGramForce { get; } = new() { KiloGramForces = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloGramForces
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is Hertz
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("Hz = {_Hertz.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("Hz = {_Hertz.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Frequency
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _Hertz { get => Hertz; init => Hertz = value; }
|
||||
public static Frequency OneHertz { get; } = new() { _Hertz = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Hertz { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Frequency OneHertz { get; } = new() { Hertz = 1 };
|
||||
[NotMapped, JsonIgnore] public double Hertz
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Frequency OneKiloHertz { get; } = new() { KiloHertz = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloHertz
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// Base value is MilliMeters
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("mm = {_MilliMeters.ToString(\"0.###\")}, m = {Meters.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("mm = {_MilliMeters.ToString(\"0.###\")}, m = {Meters.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Length
|
||||
{
|
||||
public static Length MilliMeter { get; } = new(1);
|
||||
@@ -15,19 +15,8 @@ public readonly partial record struct Length
|
||||
public double CentiMeters
|
||||
{
|
||||
get => LengthConv.CentiMeters.From(_Value);
|
||||
init
|
||||
{
|
||||
Length aaa = new();
|
||||
Length bbb = new();
|
||||
|
||||
if (aaa != bbb || aaa == bbb)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
_Value = LengthConv.CentiMeters.To(value);
|
||||
}
|
||||
}
|
||||
init => _Value = LengthConv.CentiMeters.To(value);
|
||||
}
|
||||
|
||||
public static Length DeciMeter { get; } = new(LengthConv.DeciMeters.To(1));
|
||||
[NotMapped, JsonIgnore]
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is Grams
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("gr = {_Grams.ToString(\"0.###\")}, kg = {KiloGrams.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("gr = {_Grams.ToString(\"0.###\")}, kg = {KiloGrams.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Mass
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _Grams { get => Grams; init => Grams = value; }
|
||||
public static Mass Gram { get; } = new() { _Grams = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Grams { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Mass Gram { get; } = new() { Grams = 1 };
|
||||
[NotMapped, JsonIgnore] public double Grams
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Mass KiloGram { get; } = new() { KiloGrams = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloGrams
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is KiloGramsPerMeterSquared
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("kg/m2 = {_KiloGramsPerMeterSquared.ToString(\"0.###\")}, kg/mm2 = {KiloGramsPerMilliMeterSquared.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("kg/m2 = {_KiloGramsPerMeterSquared.ToString(\"0.###\")}, kg/mm2 = {KiloGramsPerMilliMeterSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct MassPerSquare
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _KiloGramsPerMeterSquared { get => KiloGramsPerMeterSquared; init => KiloGramsPerMeterSquared = value; }
|
||||
public static MassPerSquare KiloGramPerMeterSquared { get; } = new() { _KiloGramsPerMeterSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double _KiloGramsPerMeterSquared { get => _Value; init => _Value = value; }
|
||||
|
||||
public static MassPerSquare KiloGramPerMeterSquared { get; } = new() { KiloGramsPerMeterSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloGramsPerMeterSquared
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static MassPerSquare KiloGramPerMilliMeterSquared { get; } = new() { KiloGramsPerMilliMeterSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloGramsPerMilliMeterSquared
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
//namespace MetricSystem;
|
||||
|
||||
//[DebuggerDisplay("N/m = {PerMeter._Newtons.ToString(\"0.###\")}, kgf/m = {PerMeter.KiloGramXXXXXXXXs.ToString(\"0.###\")}")]
|
||||
//public readonly partial record struct PogonXXXXXXXX
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//public partial class Length : Metric<Length, Length>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static PogonXXXXXXXX operator /(XXXXXXXX left, Length right) => left.DivideProtected<XXXXXXXX, Length, PogonXXXXXXXX>(right, PogonXXXXXXXXCoeff);
|
||||
// static readonly double PogonXXXXXXXXCoeff = Coefficients.DivideCoefficient<XXXXXXXX, Length, PogonXXXXXXXX>(a => a.Value = 1, b => b._MilliMeters = 1, r => r._PerMilliMeter.Value = 1);
|
||||
//}
|
||||
@@ -1,14 +0,0 @@
|
||||
//namespace MetricSystem;
|
||||
|
||||
//[Owned, JsonConverter(typeof(MetricFormatter<PogonMass>)), DebuggerDisplay("gr/m = {PerMeter._Grams.ToString(\"0.###\")}, kg/m = {PerMeter.KiloGrams.ToString(\"0.###\")}")]
|
||||
//public partial class PogonMass : Pogon<PogonMass, Mass>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Density operator /(PogonMass left, Area right) => left.DivideProtected<PogonMass, Area, Density>(right, UdelMassCoeff);
|
||||
// static readonly double UdelMassCoeff = Coefficients.DivideCoefficient<PogonMass, Area, Density>(a => a._PerMilliMeter.Value = 1, b => b._MilliMetersSquared = 1, r => r._PerMilliMeterCubic.Value = 1);
|
||||
//}
|
||||
|
||||
//public partial class Length : Metric<Length, Length>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static PogonMass operator /(Mass left, Length right) => left.DivideProtected<Mass, Length, PogonMass>(right, PogonMassCoeff);
|
||||
// static readonly double PogonMassCoeff = Coefficients.DivideCoefficient<Mass, Length, PogonMass>(a => a.Value = 1, b => b._MilliMeters = 1, r => r._PerMilliMeter.Value = 1);
|
||||
//}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,61 +1,65 @@
|
||||
#if DEBUG
|
||||
namespace QWERTYkez.Mensura.Units.Pogon;
|
||||
//#if DEBUG
|
||||
|
||||
public readonly partial record struct PogonMass
|
||||
{
|
||||
public static PogonMass GramPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Grams = 1 } };
|
||||
public static PogonMass KiloGramPerMilliMeter { get; } = new() { _PerMilliMeter = new() { KiloGrams = 1 } };
|
||||
public static PogonMass CentnerPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Centners = 1 } };
|
||||
public static PogonMass TonPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Tons = 1 } };
|
||||
[NotMapped, JsonIgnore] public Mass _PerMilliMeter
|
||||
{ get => (Mass)_Value; init => _Value = (double)value; }
|
||||
//// Reference
|
||||
|
||||
//namespace QWERTYkez.Mensura.Units.Pogon;
|
||||
|
||||
//[ComplexUnitGenerator]
|
||||
//public readonly partial record struct ZZZZZZZZZZZZZZZZ
|
||||
//{
|
||||
// public static ZZZZZZZZZZZZZZZZ GramPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Grams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ KiloGramPerMilliMeter { get; } = new() { _PerMilliMeter = new() { KiloGrams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ CentnerPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Centners = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ TonPerMilliMeter { get; } = new() { _PerMilliMeter = new() { Tons = 1 } };
|
||||
// [NotMapped, JsonIgnore] public AAAAAAAAAAAAAAAA _PerMilliMeter
|
||||
// { get => (AAAAAAAAAAAAAAAA)_Value; init => _Value = (double)value; }
|
||||
|
||||
|
||||
public static PogonMass GramPerCentiMeter { get; } = new() { PerCentiMeter = new() { Grams = 1 } };
|
||||
public static PogonMass KiloGramPerCentiMeter { get; } = new() { PerCentiMeter = new() { KiloGrams = 1 } };
|
||||
public static PogonMass CentnerPerCentiMeter { get; } = new() { PerCentiMeter = new() { Centners = 1 } };
|
||||
public static PogonMass TonPerCentiMeter { get; } = new() { PerCentiMeter = new() { Tons = 1 } };
|
||||
[NotMapped, JsonIgnore] public Mass PerCentiMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.CentiMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.CentiMeters.Multiplicator;
|
||||
}
|
||||
// public static ZZZZZZZZZZZZZZZZ GramPerCentiMeter { get; } = new() { PerCentiMeter = new() { Grams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ KiloGramPerCentiMeter { get; } = new() { PerCentiMeter = new() { KiloGrams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ CentnerPerCentiMeter { get; } = new() { PerCentiMeter = new() { Centners = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ TonPerCentiMeter { get; } = new() { PerCentiMeter = new() { Tons = 1 } };
|
||||
// [NotMapped, JsonIgnore] public AAAAAAAAAAAAAAAA PerCentiMeter
|
||||
// {
|
||||
// get => new(_Value * BBBBBBBBBBBBBBBBConv.CentiMeters.Multiplicator);
|
||||
// init => _Value = value._Value / BBBBBBBBBBBBBBBBConv.CentiMeters.Multiplicator;
|
||||
// }
|
||||
|
||||
|
||||
public static PogonMass GramPerDeciMeter { get; } = new() { PerDeciMeter = new() { Grams = 1 } };
|
||||
public static PogonMass KiloGramPerDeciMeter { get; } = new() { PerDeciMeter = new() { KiloGrams = 1 } };
|
||||
public static PogonMass CentnerPerDeciMeter { get; } = new() { PerDeciMeter = new() { Centners = 1 } };
|
||||
public static PogonMass TonPerDeciMeter { get; } = new() { PerDeciMeter = new() { Tons = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ GramPerDeciMeter { get; } = new() { PerDeciMeter = new() { Grams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ KiloGramPerDeciMeter { get; } = new() { PerDeciMeter = new() { KiloGrams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ CentnerPerDeciMeter { get; } = new() { PerDeciMeter = new() { Centners = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ TonPerDeciMeter { get; } = new() { PerDeciMeter = new() { Tons = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Mass PerDeciMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.DeciMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.DeciMeters.Multiplicator;
|
||||
}
|
||||
// [NotMapped, JsonIgnore] public AAAAAAAAAAAAAAAA PerDeciMeter
|
||||
// {
|
||||
// get => new(_Value * BBBBBBBBBBBBBBBBConv.DeciMeters.Multiplicator);
|
||||
// init => _Value = value._Value / BBBBBBBBBBBBBBBBConv.DeciMeters.Multiplicator;
|
||||
// }
|
||||
|
||||
|
||||
public static PogonMass GramPerMeter { get; } = new() { PerMeter = new() { Grams = 1 } };
|
||||
public static PogonMass KiloGramPerMeter { get; } = new() { PerMeter = new() { KiloGrams = 1 } };
|
||||
public static PogonMass CentnerPerMeter { get; } = new() { PerMeter = new() { Centners = 1 } };
|
||||
public static PogonMass TonPerMeter { get; } = new() { PerMeter = new() { Tons = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ GramPerMeter { get; } = new() { PerMeter = new() { Grams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ KiloGramPerMeter { get; } = new() { PerMeter = new() { KiloGrams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ CentnerPerMeter { get; } = new() { PerMeter = new() { Centners = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ TonPerMeter { get; } = new() { PerMeter = new() { Tons = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Mass PerMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.Meters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.Meters.Multiplicator;
|
||||
}
|
||||
// [NotMapped, JsonIgnore] public AAAAAAAAAAAAAAAA PerMeter
|
||||
// {
|
||||
// get => new(_Value * BBBBBBBBBBBBBBBBConv.Meters.Multiplicator);
|
||||
// init => _Value = value._Value / BBBBBBBBBBBBBBBBConv.Meters.Multiplicator;
|
||||
// }
|
||||
|
||||
|
||||
public static PogonMass GramPerKiloMeter { get; } = new() { PerKiloMeter = new() { Grams = 1 } };
|
||||
public static PogonMass KiloGramPerKiloMeter { get; } = new() { PerKiloMeter = new() { KiloGrams = 1 } };
|
||||
public static PogonMass CentnerPerKiloMeter { get; } = new() { PerKiloMeter = new() { Centners = 1 } };
|
||||
public static PogonMass TonPerKiloMeter { get; } = new() { PerKiloMeter = new() { Tons = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ GramPerKiloMeter { get; } = new() { PerKiloMeter = new() { Grams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ KiloGramPerKiloMeter { get; } = new() { PerKiloMeter = new() { KiloGrams = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ CentnerPerKiloMeter { get; } = new() { PerKiloMeter = new() { Centners = 1 } };
|
||||
// public static ZZZZZZZZZZZZZZZZ TonPerKiloMeter { get; } = new() { PerKiloMeter = new() { Tons = 1 } };
|
||||
|
||||
[NotMapped, JsonIgnore] public Mass PerKiloMeter
|
||||
{
|
||||
get => new(_Value * LengthConv.KiloMeters.Multiplicator);
|
||||
init => _Value = value._Value / LengthConv.KiloMeters.Multiplicator;
|
||||
}
|
||||
// [NotMapped, JsonIgnore] public AAAAAAAAAAAAAAAA PerKiloMeter
|
||||
// {
|
||||
// get => new(_Value * BBBBBBBBBBBBBBBBConv.KiloMeters.Multiplicator);
|
||||
// init => _Value = value._Value / BBBBBBBBBBBBBBBBConv.KiloMeters.Multiplicator;
|
||||
// }
|
||||
|
||||
}
|
||||
#endif
|
||||
//}
|
||||
//#endif
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is Pascals or NewtonsPerMeterSquared
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("Pa, N/m2 = {NewtonsPerMeterSquared.ToString(\"0.###\")}, kgf/mm2 = {KiloGramForcesPerMilliMeterSquared.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("Pa, N/m2 = {NewtonsPerMeterSquared.ToString(\"0.###\")}, kgf/mm2 = {KiloGramForcesPerMilliMeterSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Pressure
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _Pascals { get => Pascals; init => Pascals = value; }
|
||||
public static Pressure Pascal { get; } = new() { _Pascals = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Pascals { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Pressure Pascal { get; } = new() { Pascals = 1 };
|
||||
[NotMapped, JsonIgnore] public double Pascals
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Pressure NewtonPerMeterSquared { get; } = new() { NewtonsPerMeterSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double NewtonsPerMeterSquared
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is KiloMetersPerHour
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("km/h = {_KiloMetersPerHour.ToString(\"0.###\")}, m/s = {MetersPerSecond.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("km/h = {_KiloMetersPerHour.ToString(\"0.###\")}, m/s = {MetersPerSecond.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Speed
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _KiloMetersPerHour { get => KiloMetersPerHour; init => KiloMetersPerHour = value; }
|
||||
public static Speed KiloMeterPerHour { get; } = new() { _KiloMetersPerHour = 1 };
|
||||
[NotMapped, JsonIgnore] public double _KiloMetersPerHour { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Speed KiloMeterPerHour { get; } = new() { KiloMetersPerHour = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloMetersPerHour
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Speed MeterPerSecond { get; } = new() { MetersPerSecond = 1 };
|
||||
[NotMapped, JsonIgnore] public double MetersPerSecond
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is MilliSeconds
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("ms = {_MilliSeconds.ToString(\"0.###\")}, s = {Seconds.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("ms = {_MilliSeconds.ToString(\"0.###\")}, s = {Seconds.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Time
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _MilliSeconds { get => MilliSeconds; init => MilliSeconds = value; }
|
||||
public static Time MilliSecond { get; } = new() { _MilliSeconds = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MilliSeconds { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Time MilliSecond { get; } = new() { MilliSeconds = 1 };
|
||||
[NotMapped, JsonIgnore] public double MilliSeconds
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Time Second { get; } = new() { Seconds = 1 };
|
||||
[NotMapped, JsonIgnore] public double Seconds
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is Newton_Meters
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("N*m = {_Newton_Meters.ToString(\"0.###\")}, kgf*m = {KiloGramForce_Meters.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("N*m = {_Newton_Meters.ToString(\"0.###\")}, kgf*m = {KiloGramForce_Meters.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Torque
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _Newton_Meters { get => Newton_Meters; init => Newton_Meters = value; }
|
||||
public static Torque Newton_Meter { get; } = new() { _Newton_Meters = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Newton_Meters { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Torque Newton_Meter { get; } = new() { Newton_Meters = 1 };
|
||||
[NotMapped, JsonIgnore] public double Newton_Meters
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Torque KiloGramForce_Meter { get; } = new() { KiloGramForce_Meters = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloGramForce_Meters
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
//namespace MetricSystem;
|
||||
|
||||
//[Owned, JsonConverter(typeof(MetricFormatter<UdelForce>)), DebuggerDisplay("N/(m*mm2) = {PerMeter_PerMilliMeterSquared._Newtons.ToString(\"0.###\")}, kgf/(m*mm2) = {PerMeter_PerMilliMeterSquared.KiloGramForces.ToString(\"0.###\")}")]
|
||||
//public partial class UdelForce : Udel<UdelForce, Force>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static PogonForce operator *(Area left, UdelForce right) => right * left;
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static PogonForce operator *(UdelForce left, Area right) => left.MultiplyProtected<UdelForce, Area, PogonForce>(right, PogonForceCoeff);
|
||||
// static readonly double PogonForceCoeff = Coefficients.MultiplyCoefficient<UdelForce, Area, PogonForce>(a => a._PerMilliMeterCubic.Value = 1, b => b._MilliMetersSquared = 1, r => r._PerMilliMeter.Value = 1);
|
||||
//}
|
||||
|
||||
//public partial class Volume : Metric<Volume, Volume>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static UdelForce operator /(Force left, Volume right) => left.DivideProtected<Force, Volume, UdelForce>(right, UdelForceCoeff);
|
||||
// static readonly double UdelForceCoeff = Coefficients.DivideCoefficient<Force, Volume, UdelForce>(a => a.Value = 1, b => b._MilliMetersCubic = 1, r => r._PerMilliMeterCubic.Value = 1);
|
||||
//}
|
||||
@@ -1,16 +0,0 @@
|
||||
//namespace MetricSystem;
|
||||
|
||||
//[Owned, JsonConverter(typeof(MetricFormatter<Density>)), DebuggerDisplay("gr/(m*mm2) = {PerMeter_PerMilliMeterSquared._Grams.ToString(\"0.###\")}, kg/(m*mm2) = {PerMeter_PerMilliMeterSquared.KiloGrams.ToString(\"0.###\")}")]
|
||||
//public partial class Density : Udel<Density, Mass>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static PogonMass operator *(Area left, Density right) => right * left;
|
||||
|
||||
// [CollectionsOperatorsGenerator] public static PogonMass operator *(Density left, Area right) => left.MultiplyProtected<Density, Area, PogonMass>(right, PogonMassCoeff);
|
||||
// static readonly double PogonMassCoeff = Coefficients.MultiplyCoefficient<Density, Area, PogonMass>(a => a._PerMilliMeterCubic.Value = 1, b => b._MilliMetersSquared = 1, r => r._PerMilliMeter.Value = 1);
|
||||
//}
|
||||
|
||||
//public partial class Volume : Metric<Volume, Volume>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Density operator /(Mass left, Volume right) => left.DivideProtected<Mass, Volume, Density>(right, DensityCoeff);
|
||||
// static readonly double DensityCoeff = Coefficients.DivideCoefficient<Mass, Volume, Density>(a => a.Value = 1, b => b._MilliMetersCubic = 1, r => r._PerMilliMeterCubic.Value = 1);
|
||||
//}
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is Volts
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("V = {_Volts.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("V = {_Volts.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Voltage
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _Volts { get => Volts; init => Volts = value; }
|
||||
public static Voltage Volt { get; } = new() { _Volts = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Volts { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Voltage Volt { get; } = new() { Volts = 1 };
|
||||
[NotMapped, JsonIgnore] public double Volts
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Voltage KiloVolt { get; } = new() { KiloVolts = 1 };
|
||||
[NotMapped, JsonIgnore] public double KiloVolts
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
/// <summary>
|
||||
/// Base value is MilliMetersCubic
|
||||
/// </summary>
|
||||
[UnitOperatorsGenerator, DebuggerDisplay("mm3 = {_MilliMetersCubic.ToString(\"0.###\")}, m3 = {MetersCubic.ToString(\"0.###\")}")]
|
||||
[UnitGenerator, DebuggerDisplay("mm3 = {_MilliMetersCubic.ToString(\"0.###\")}, m3 = {MetersCubic.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Volume
|
||||
{
|
||||
[NotMapped, JsonIgnore] public double _MilliMetersCubic { get => MilliMetersCubic; init => MilliMetersCubic = value; }
|
||||
public static Volume MilliMeterCubic { get; } = new() { _MilliMetersCubic = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MilliMetersCubic { get => _Value; init => _Value = value; }
|
||||
|
||||
public static Volume MilliMeterCubic { get; } = new() { MilliMetersCubic = 1 };
|
||||
[NotMapped, JsonIgnore] public double MilliMetersCubic
|
||||
{
|
||||
get => _Value;
|
||||
init
|
||||
{
|
||||
_Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Volume CentiMeterCubic { get; } = new() { CentiMetersCubic = 1 };
|
||||
[NotMapped, JsonIgnore] public double CentiMetersCubic
|
||||
|
||||
@@ -12,4 +12,5 @@ global using System.Text.Json;
|
||||
global using System.Text.Json.Serialization;
|
||||
global using QWERTYkez.Mensura;
|
||||
global using QWERTYkez.Mensura.Extensions;
|
||||
global using QWERTYkez.Mensura.Units;
|
||||
global using QWERTYkez.Mensura.Units;
|
||||
global using QWERTYkez.Mensura.Units.Complex;
|
||||
Reference in New Issue
Block a user