Fulll
This commit is contained in:
@@ -1,32 +1,5 @@
|
||||
namespace QWERTYkez.Mensura.Units;
|
||||
|
||||
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)
|
||||
@@ -45,172 +18,153 @@ internal static class Coefficients
|
||||
|
||||
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Length
|
||||
|
||||
|
||||
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);
|
||||
[OperatorsGenerator] public static Area operator *(Length left, Length right) => new(left._Value * right._Value);
|
||||
|
||||
|
||||
[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);
|
||||
public static Volume operator *(Area left, Length right) => right * left;
|
||||
[OperatorsGenerator] public static Volume operator *(Length left, Area right) => new(left._Value * right._Value);
|
||||
|
||||
|
||||
[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);
|
||||
public static Pressure operator *(Length left, ForceVolumetric right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Pressure operator *(ForceVolumetric left, Length right) => new(left._Value * right._Value * Coeff1);
|
||||
public static readonly double Coeff1 = 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);
|
||||
public static Torque operator *(Force left, Length right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static Torque operator *(Length left, Force right) => new(left._Value * right._Value * Coeff2);
|
||||
public static readonly double Coeff2 = Coefficients.MultiplyCoefficient(Length.Meter, Force._Newton, Torque._Newton_Meter);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Mass // Grams
|
||||
public readonly partial record struct Mass // Grams
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Pressure // Pascals
|
||||
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);
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Length operator /(Pressure left, ForceVolumetric right) => new(left._Value * Coeff1 / right._Value);
|
||||
public 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);
|
||||
public static Force operator *(Pressure left, Area right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static Force operator *(Area left, Pressure right) => new (left._Value * right._Value * Coeff2);
|
||||
public 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);
|
||||
[OperatorsGenerator(nameof(Coeff3))] public static Length operator /(ForceLinear left, Pressure right) => new(left._Value * Coeff3 / right._Value);
|
||||
public 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);
|
||||
public static ForceLinear operator *(Pressure left, Length right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff4))] public static ForceLinear operator *(Length left, Pressure right) => new(left._Value * right._Value * Coeff4);
|
||||
public static readonly double Coeff4 = Coefficients.MultiplyCoefficient(Length._MilliMeter, Pressure.NewtonPerMilliMeterSquared, ForceLinear._NewtonPerMilliMeter);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Area // MilliMetersSquared
|
||||
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);
|
||||
public static Torque operator *(ForceLinear left, Area right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Torque operator *(Area left, ForceLinear right) => new(left._Value * right._Value * Coeff1);
|
||||
public 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);
|
||||
[OperatorsGenerator] public static Length operator /(Area left, Length right) => new(left._Value / right._Value);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Volume // MillimetersCubic
|
||||
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);
|
||||
public static Torque operator *(Pressure left, Volume right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static Torque operator *(Volume left, Pressure right) => new(left._Value * right._Value * Coeff2);
|
||||
public 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);
|
||||
[OperatorsGenerator] public static Area operator /(Volume left, Length right) => new(left._Value / right._Value);
|
||||
[OperatorsGenerator] public static Length operator /(Volume left, Area right) => new(left._Value / right._Value);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Force // Newtons
|
||||
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);
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Area operator /(Force left, Pressure right) => new(left._Value * Coeff1 / right._Value);
|
||||
public static readonly double Coeff1 = Coefficients.DivideCoefficient(Force._Newton, Pressure._Pascal, Area.MeterSquared);
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static Pressure operator /(Force left, Area right) => new(left._Value * Coeff2 / right._Value);
|
||||
public static readonly double Coeff2 = Coefficients.DivideCoefficient(Force._Newton, Area.MeterSquared, Pressure._Pascal);
|
||||
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Torque // NewtonMeters
|
||||
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);
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Length operator /(Torque left, Force right) => new(left._Value * Coeff1 / right._Value);
|
||||
public static readonly double Coeff1 = Coefficients.DivideCoefficient(Torque._Newton_Meter, Force._Newton, Length.Meter);
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static Force operator /(Torque left, Length right) => new(left._Value * Coeff2 / right._Value);
|
||||
public static readonly double Coeff2 = Coefficients.DivideCoefficient(Torque._Newton_Meter, Length.Meter, Force._Newton);
|
||||
[OperatorsGenerator(nameof(Coeff3))] public static ForceLinear operator /(Torque left, Area right) => new(left._Value * Coeff3 / right._Value);
|
||||
public static readonly double Coeff3 = Coefficients.DivideCoefficient(Torque._Newton_Meter, Area._MilliMeterSquared, ForceLinear.KiloNewtonPerMilliMeter );
|
||||
[OperatorsGenerator(nameof(Coeff4))] public static Pressure operator /(Torque left, Volume right) => new(left._Value * Coeff4 / right._Value);
|
||||
public static readonly double Coeff4 = Coefficients.DivideCoefficient(Torque._Newton_Meter, Volume.MeterCubic, Pressure._Pascal);
|
||||
[OperatorsGenerator(nameof(Coeff5))] public static Volume operator /(Torque left, Pressure right) => new(left._Value * Coeff5 / right._Value);
|
||||
public static readonly double Coeff5 = Coefficients.DivideCoefficient(Torque._Newton_Meter, Pressure._Pascal, Volume.MeterCubic);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Frequency // Hertz
|
||||
public readonly partial record struct Frequency // Hertz
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Time
|
||||
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);
|
||||
public static Speed operator *(Boost left, Time right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Speed operator *(Time left, Boost right) => new(left._Value * right._Value * Coeff1);
|
||||
public 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);
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static Speed operator /(Length left, Time right) => new(left._Value * Coeff2 / right._Value);
|
||||
public static readonly double Coeff2 = Coefficients.DivideCoefficient(Length.Meter, Time.Second, Speed.MeterPerSecond);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Speed
|
||||
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);
|
||||
public static Length operator *(Speed left, Time right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Length operator *(Time left, Speed right) => new(left._Value * right._Value * Coeff1);
|
||||
public 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);
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static Boost operator /(Speed left, Time right) => new(left._Value * Coeff2 / right._Value);
|
||||
public static readonly double Coeff2 = Coefficients.DivideCoefficient(Speed.MeterPerSecond, Time.Second, Boost._MeterPerSecondSquared);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct Boost
|
||||
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);
|
||||
public static Force operator *(Mass left, Boost right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Force operator *(Boost left, Mass right) => new(left._Value * right._Value * Coeff1);
|
||||
public 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);
|
||||
public static ForceLinear operator *(MassLinear left, Boost right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff2))] public static ForceLinear operator *(Boost left, MassLinear right) => new(left._Value * right._Value * Coeff2);
|
||||
public 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);
|
||||
public static ForceVolumetric operator *(Density left, Boost right) => right * left;
|
||||
[OperatorsGenerator(nameof(Coeff3))] public static ForceVolumetric operator *(Boost left, Density right) => new(left._Value * right._Value * Coeff3);
|
||||
public 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);
|
||||
[OperatorsGenerator(nameof(Coeff4))] public static MassLinear operator /(ForceLinear left, Boost right) => new(left._Value * Coeff4 / right._Value);
|
||||
public 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);
|
||||
[OperatorsGenerator(nameof(Coeff5))] public static Density operator /(ForceVolumetric left, Boost right) => new(left._Value * Coeff5 / right._Value);
|
||||
public 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);
|
||||
[OperatorsGenerator] public static MassPerSquare operator /(Pressure left, Boost right) => new(left._Value / right._Value);
|
||||
}
|
||||
|
||||
[CollectionsOperatorsGenerator] public readonly partial record struct MassPerSquare
|
||||
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);
|
||||
public static Pressure operator *(Boost left, MassPerSquare right) => right * left;
|
||||
[OperatorsGenerator] public static Pressure operator *(MassPerSquare left, Boost right) => new(left._Value * right._Value);
|
||||
}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct LinearForce : Pogon<LinearForce, Force>
|
||||
//{
|
||||
|
||||
public readonly partial record struct MassLinear
|
||||
{
|
||||
[OperatorsGenerator(nameof(Coeff1))] public static Boost operator /(ForceLinear left, MassLinear right) => new(left._Value * Coeff1 / right._Value);
|
||||
|
||||
//}
|
||||
|
||||
//[CollectionsOperatorsGenerator] public readonly partial record struct MassLinear : Pogon<MassLinear, Mass>
|
||||
//{
|
||||
// [CollectionsOperatorsGenerator] public static Boost operator /(LinearForce left, MassLinear right) => left.DivideProtected<LinearForce, MassLinear, 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 ForceVolumetric : Udel<ForceVolumetric, Force>
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
public static readonly double Coeff1 = Coefficients.DivideCoefficient(ForceLinear._NewtonPerMilliMeter, MassLinear.KiloGramPerMilliMeter, Boost._MeterPerSecondSquared);
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("Radians = {Radians.ToString(\"0.###\")}, Degrees = {Degrees.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Angle
|
||||
{
|
||||
public static Angle Second { get; } = new() { _Seconds = 1 };
|
||||
public static Angle _Second { get; } = new() { _Seconds = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Seconds { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("mm2 = {_MilliMetersSquared.ToString(\"0.###\")}, m2 = {MetersSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Area
|
||||
{
|
||||
public static Area MilliMeterSquared { get; } = new() { _MilliMetersSquared = 1 };
|
||||
public static Area _MilliMeterSquared { get; } = new() { _MilliMetersSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MilliMetersSquared { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("m/s2 = {_MetersPerSecondSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Boost
|
||||
{
|
||||
public static Boost MeterPerSecondSquared { get; } = new() { _MetersPerSecondSquared = 1 };
|
||||
public static Boost _MeterPerSecondSquared { get; } = new() { _MetersPerSecondSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MetersPerSecondSquared { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
namespace QWERTYkez.Mensura.Units;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Force), nameof(Length), nameof(ForceLinear))] public readonly partial record struct ForceLinear
|
||||
{
|
||||
@@ -56,23 +56,4 @@
|
||||
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);
|
||||
//}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
namespace QWERTYkez.Mensura.Units;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Force), nameof(Volume), nameof(ForceVolumetric))] public readonly partial record struct ForceVolumetric
|
||||
{
|
||||
@@ -32,25 +32,4 @@
|
||||
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);
|
||||
//}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
namespace QWERTYkez.Mensura.Units;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Mass), nameof(Length), nameof(MassLinear))] public readonly partial record struct MassLinear
|
||||
{
|
||||
@@ -56,27 +56,4 @@
|
||||
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);
|
||||
//}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace QWERTYkez.Mensura.Units.Complex;
|
||||
namespace QWERTYkez.Mensura.Units;
|
||||
|
||||
[ComplexUnitGenerator(nameof(Mass), nameof(Volume), nameof(Density))] public readonly partial record struct Density
|
||||
{
|
||||
@@ -32,28 +32,4 @@
|
||||
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);
|
||||
//}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("N = {_Newtons.ToString(\"0.###\")}, kgf = {KiloGramForces.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Force
|
||||
{
|
||||
public static Force Newton { get; } = new() { _Newtons = 1 };
|
||||
public static Force _Newton { get; } = new() { _Newtons = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Newtons { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("Hz = {_Hertz.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Frequency
|
||||
{
|
||||
public static Frequency OneHertz { get; } = new() { _Hertz = 1 };
|
||||
public static Frequency _OneHertz { get; } = new() { _Hertz = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Hertz { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("mm = {_MilliMeters.ToString(\"0.###\")}, m = {Meters.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Length
|
||||
{
|
||||
public static Length MilliMeter { get; } = new(1);
|
||||
public static Length _MilliMeter { get; } = new(1);
|
||||
[NotMapped, JsonIgnore] public double _MilliMeters { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("gr = {_Grams.ToString(\"0.###\")}, kg = {KiloGrams.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Mass
|
||||
{
|
||||
public static Mass Gram { get; } = new() { _Grams = 1 };
|
||||
public static Mass _Gram { get; } = new() { _Grams = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Grams { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("kg/m2 = {_KiloGramsPerMeterSquared.ToString(\"0.###\")}, kg/mm2 = {KiloGramsPerMilliMeterSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct MassPerSquare
|
||||
{
|
||||
public static MassPerSquare KiloGramPerMeterSquared { get; } = new() { _KiloGramsPerMeterSquared = 1 };
|
||||
public static MassPerSquare _KiloGramPerMeterSquared { get; } = new() { _KiloGramsPerMeterSquared = 1 };
|
||||
[NotMapped, JsonIgnore] public double _KiloGramsPerMeterSquared { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
//namespace MetricSystem;
|
||||
|
||||
///// <summary>
|
||||
///// Base value is PerMilliMeter
|
||||
///// </summary>
|
||||
//public abstract class Pogon<T>
|
||||
//{
|
||||
|
||||
|
||||
// internal T PerValue { get; init; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// [NotMapped, JsonIgnore] internal T PerValue
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value;
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T _PerMilliMeter
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// [NotMapped, JsonIgnore] public T PerMilliMeter
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value;
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerCentiMeter
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * LengthConv.CentiMeters.Multiplicator,
|
||||
// BaseContainerMultiplicator = LengthConv.CentiMeters.Multiplicator,
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / LengthConv.CentiMeters.Multiplicator;
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerDeciMeter
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * LengthConv.DeciMeters.Multiplicator,
|
||||
// BaseContainerMultiplicator = LengthConv.DeciMeters.Multiplicator,
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / LengthConv.DeciMeters.Multiplicator;
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerMeter
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * LengthConv.Meters.Multiplicator,
|
||||
// BaseContainerMultiplicator = LengthConv.Meters.Multiplicator,
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / LengthConv.Meters.Multiplicator;
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerKiloMeter
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * LengthConv.KiloMeters.Multiplicator,
|
||||
// BaseContainerMultiplicator = LengthConv.KiloMeters.Multiplicator,
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / LengthConv.KiloMeters.Multiplicator;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static T operator *(Pogon<U, T> left, Length right) => ((U)left).Protect()._PerMilliMeter * right.Protect()._MilliMeters;
|
||||
// public static MetricCollection<T> operator *(Pogon<U, T> left, MetricCollection<Length> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
// public static MetricArray<T> operator *(Pogon<U, T> left, MetricArray<Length> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
// public static MetricList<T> operator *(Pogon<U, T> left, MetricList<Length> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
// public static MetricObservableCollection<T> operator *(Pogon<U, T> left, MetricObservableCollection<Length> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
|
||||
|
||||
// public static T operator *(Length left, Pogon<U, T> right) => ((U)right).Protect()._PerMilliMeter * left.Protect()._MilliMeters;
|
||||
// public static MetricCollection<T> operator *(MetricCollection<Length> left, Pogon<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
// public static MetricArray<T> operator *(MetricArray<Length> left, Pogon<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
// public static MetricList<T> operator *(MetricList<Length> left, Pogon<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
// public static MetricObservableCollection<T> operator *(MetricObservableCollection<Length> left, Pogon<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
|
||||
|
||||
// public static Length operator /(T left, Pogon<U, T> right) => new() { _MilliMeters = left.Protect() / ((U)right).Protect()._PerMilliMeter };
|
||||
// public static MetricCollection<Length> operator *(MetricCollection<T> left, Pogon<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
// public static MetricArray<Length> operator *(MetricArray<T> left, Pogon<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
// public static MetricList<Length> operator *(MetricList<T> left, Pogon<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
// public static MetricObservableCollection<Length> operator *(MetricObservableCollection<T> left, Pogon<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
//}
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("Pa, N/m2 = {NewtonsPerMeterSquared.ToString(\"0.###\")}, kgf/mm2 = {KiloGramForcesPerMilliMeterSquared.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Pressure
|
||||
{
|
||||
public static Pressure Pascal { get; } = new() { _Pascals = 1 };
|
||||
public static Pressure _Pascal { get; } = new() { _Pascals = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Pascals { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("km/h = {_KiloMetersPerHour.ToString(\"0.###\")}, m/s = {MetersPerSecond.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Speed
|
||||
{
|
||||
public static Speed KiloMeterPerHour { get; } = new() { _KiloMetersPerHour = 1 };
|
||||
public static Speed _KiloMeterPerHour { get; } = new() { _KiloMetersPerHour = 1 };
|
||||
[NotMapped, JsonIgnore] public double _KiloMetersPerHour { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("ms = {_MilliSeconds.ToString(\"0.###\")}, s = {Seconds.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Time
|
||||
{
|
||||
public static Time MilliSecond { get; } = new() { _MilliSeconds = 1 };
|
||||
public static Time _MilliSecond { get; } = new() { _MilliSeconds = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MilliSeconds { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("N*m = {_Newton_Meters.ToString(\"0.###\")}, kgf*m = {KiloGramForce_Meters.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Torque
|
||||
{
|
||||
public static Torque Newton_Meter { get; } = new() { _Newton_Meters = 1 };
|
||||
public static Torque _Newton_Meter { get; } = new() { _Newton_Meters = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Newton_Meters { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
//namespace MetricSystem;
|
||||
|
||||
///// <summary>
|
||||
///// Base value is PerMilliMeterCubic
|
||||
///// </summary>
|
||||
//[Owned]
|
||||
//public abstract class Udel<U, T> : Metric<U, Udel<U, T>>
|
||||
// where U : Udel<U, T>, new()
|
||||
// where T : Metric<T, T>, new()
|
||||
//{
|
||||
// protected override void OnValueChanged()
|
||||
// {
|
||||
// OnPropertyChanged(nameof(PerMeter_PerMilliMeterSquared));
|
||||
// OnPropertyChanged(nameof(PerMilliMeterCubic));
|
||||
// OnPropertyChanged(nameof(PerCentiMeterCubic));
|
||||
// OnPropertyChanged(nameof(PerDeciMeterCubic));
|
||||
// OnPropertyChanged(nameof(PerMeterCubic));
|
||||
// OnPropertyChanged(nameof(PerKiloMeterCubic));
|
||||
// }
|
||||
|
||||
// [NotMapped, JsonIgnore] internal T PerValue
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value,
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value;
|
||||
// OnPropertyChanged(nameof(PerValue));
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T _PerMilliMeterCubic
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value,
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value;
|
||||
// OnPropertyChanged(nameof(_PerMilliMeterCubic));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// [NotMapped, JsonIgnore] public T PerMilliMeterCubic
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value,
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value;
|
||||
// OnPropertyChanged(nameof(PerMilliMeterCubic));
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerMeter_PerMilliMeterSquared
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * LengthConv.Meters.Multiplicator * Math.Pow(LengthConv.MilliMeters.Multiplicator, 2),
|
||||
// BaseContainerMultiplicator = LengthConv.Meters.Multiplicator * Math.Pow(LengthConv.MilliMeters.Multiplicator, 2),
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / (LengthConv.Meters.Multiplicator * Math.Pow(LengthConv.MilliMeters.Multiplicator, 2));
|
||||
// OnPropertyChanged(nameof(PerMeter_PerMilliMeterSquared));
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerCentiMeterCubic
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * Math.Pow(LengthConv.CentiMeters.Multiplicator, 3),
|
||||
// BaseContainerMultiplicator = Math.Pow(LengthConv.CentiMeters.Multiplicator, 3),
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / Math.Pow(LengthConv.CentiMeters.Multiplicator, 3);
|
||||
// OnPropertyChanged(nameof(PerCentiMeterCubic));
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerDeciMeterCubic
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * Math.Pow(LengthConv.DeciMeters.Multiplicator, 3),
|
||||
// BaseContainerMultiplicator = Math.Pow(LengthConv.DeciMeters.Multiplicator, 3),
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / Math.Pow(LengthConv.DeciMeters.Multiplicator, 3);
|
||||
// OnPropertyChanged(nameof(PerDeciMeterCubic));
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerMeterCubic
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * Math.Pow(LengthConv.Meters.Multiplicator, 3),
|
||||
// BaseContainerMultiplicator = Math.Pow(LengthConv.Meters.Multiplicator, 3),
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / Math.Pow(LengthConv.Meters.Multiplicator, 3);
|
||||
// OnPropertyChanged(nameof(PerMeterCubic));
|
||||
// }
|
||||
// }
|
||||
// [NotMapped, JsonIgnore] public T PerKiloMeterCubic
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return new()
|
||||
// {
|
||||
// BaseContainer = this,
|
||||
// SilentValueSetter = Value * Math.Pow(LengthConv.KiloMeters.Multiplicator, 3),
|
||||
// BaseContainerMultiplicator = Math.Pow(LengthConv.KiloMeters.Multiplicator, 3),
|
||||
// };
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Value = value.Value / Math.Pow(LengthConv.KiloMeters.Multiplicator, 3);
|
||||
// OnPropertyChanged(nameof(PerKiloMeterCubic));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// public static T operator *(Udel<U, T> left, Volume right) => ((U)left).Protect()._PerMilliMeterCubic * right.Protect()._MilliMetersCubic;
|
||||
// public static MetricCollection<T> operator *(Udel<U, T> left, MetricCollection<Volume> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
// public static MetricArray<T> operator *(Udel<U, T> left, MetricArray<Volume> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
// public static MetricList<T> operator *(Udel<U, T> left, MetricList<Volume> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
// public static MetricObservableCollection<T> operator *(Udel<U, T> left, MetricObservableCollection<Volume> right) => right.MetricSelect(r => ((U)left).Protect() * r.Protect());
|
||||
|
||||
// public static T operator *(Volume left, Udel<U, T> right) => ((U)right).Protect()._PerMilliMeterCubic * left.Protect()._MilliMetersCubic;
|
||||
// public static MetricCollection<T> operator *(MetricCollection<Volume> left, Udel<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
// public static MetricArray<T> operator *(MetricArray<Volume> left, Udel<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
// public static MetricList<T> operator *(MetricList<Volume> left, Udel<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
// public static MetricObservableCollection<T> operator *(MetricObservableCollection<Volume> left, Udel<U, T> right) => left.MetricSelect(r => ((U)right).Protect() * r.Protect());
|
||||
|
||||
// public static Volume operator /(T left, Udel<U, T> right) => new() { _MilliMetersCubic = left.Protect() / ((U)right).Protect()._PerMilliMeterCubic };
|
||||
// public static MetricCollection<Volume> operator *(MetricCollection<T> left, Udel<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
// public static MetricArray<Volume> operator *(MetricArray<T> left, Udel<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
// public static MetricList<Volume> operator *(MetricList<T> left, Udel<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
// public static MetricObservableCollection<Volume> operator *(MetricObservableCollection<T> left, Udel<U, T> right) => left.MetricSelect(l => l.Protect() / ((U)right).Protect());
|
||||
//}
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("V = {_Volts.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Voltage
|
||||
{
|
||||
public static Voltage Volt { get; } = new() { _Volts = 1 };
|
||||
public static Voltage _Volt { get; } = new() { _Volts = 1 };
|
||||
[NotMapped, JsonIgnore] public double _Volts { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[UnitGenerator, DebuggerDisplay("mm3 = {_MilliMetersCubic.ToString(\"0.###\")}, m3 = {MetersCubic.ToString(\"0.###\")}")]
|
||||
public readonly partial record struct Volume
|
||||
{
|
||||
public static Volume MilliMeterCubic { get; } = new() { _MilliMetersCubic = 1 };
|
||||
public static Volume _MilliMeterCubic { get; } = new() { _MilliMetersCubic = 1 };
|
||||
[NotMapped, JsonIgnore] public double _MilliMetersCubic { get => _Value; init => _Value = value; }
|
||||
|
||||
|
||||
|
||||
@@ -12,5 +12,4 @@ 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.Complex;
|
||||
global using QWERTYkez.Mensura.Units;
|
||||
Reference in New Issue
Block a user