diff --git a/CodeGen/Generators/QuantityRelationsParser.cs b/CodeGen/Generators/QuantityRelationsParser.cs new file mode 100644 index 0000000000..38f7abe5e8 --- /dev/null +++ b/CodeGen/Generators/QuantityRelationsParser.cs @@ -0,0 +1,195 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CodeGen.Exceptions; +using CodeGen.JsonTypes; +using Newtonsoft.Json; + +namespace CodeGen.Generators +{ + /// + /// Parses the JSON file that defines the relationships (operators) between quantities + /// and applies them to the parsed quantity objects. + /// + internal static class QuantityRelationsParser + { + /// + /// Parse and apply relations to quantities. + /// + /// The relations are defined in UnitRelations.json + /// Each defined relation can be applied multiple times to one or two quantities depending on the operator and the operands. + /// + /// The format of a relation definition is "Quantity.Unit operator Quantity.Unit = Quantity.Unit" (See examples below). + /// "double" can be used as a unitless operand. + /// "1" can be used as the left operand to define inverse relations. + /// + /// + /// [ + /// "Power.Watt = ElectricPotential.Volt * ElectricCurrent.Ampere", + /// "Speed.MeterPerSecond = Length.Meter / Duration.Second", + /// "ReciprocalLength.InverseMeter = 1 / Length.Meter" + /// ] + /// + /// Repository root directory. + /// List of previously parsed Quantity objects. + public static void ParseAndApplyRelations(string rootDir, Quantity[] quantities) + { + var quantityDictionary = quantities.ToDictionary(q => q.Name, q => q); + + // Add double and 1 as pseudo-quantities to validate relations that use them. + var pseudoQuantity = new Quantity { Name = null!, Units = [new Unit { SingularName = null! }] }; + quantityDictionary["double"] = pseudoQuantity with { Name = "double" }; + quantityDictionary["1"] = pseudoQuantity with { Name = "1" }; + + var relations = ParseRelations(rootDir, quantityDictionary); + + // Because multiplication is commutative, we can infer the other operand order. + relations.AddRange(relations + .Where(r => r.Operator is "*" or "inverse" && r.LeftQuantity != r.RightQuantity) + .Select(r => r with + { + LeftQuantity = r.RightQuantity, + LeftUnit = r.RightUnit, + RightQuantity = r.LeftQuantity, + RightUnit = r.LeftUnit, + }) + .ToList()); + + // We can infer TimeSpan relations from Duration relations. + var timeSpanQuantity = pseudoQuantity with { Name = "TimeSpan" }; + relations.AddRange(relations + .Where(r => r.LeftQuantity.Name is "Duration") + .Select(r => r with { LeftQuantity = timeSpanQuantity }) + .ToList()); + relations.AddRange(relations + .Where(r => r.RightQuantity.Name is "Duration") + .Select(r => r with { RightQuantity = timeSpanQuantity }) + .ToList()); + + // Sort all relations to keep generated operators in a consistent order. + relations.Sort(); + + var duplicates = relations + .GroupBy(r => r.SortString) + .Where(g => g.Count() > 1) + .Select(g => g.Key) + .ToList(); + + if (duplicates.Any()) + { + var list = string.Join("\n ", duplicates); + throw new UnitsNetCodeGenException($"Duplicate inferred relations:\n {list}"); + } + + foreach (var quantity in quantities) + { + var quantityRelations = new List(); + + foreach (var relation in relations) + { + if (relation.LeftQuantity == quantity) + { + // The left operand of a relation is responsible for generating the operator. + quantityRelations.Add(relation); + } + else if (relation.RightQuantity == quantity && relation.LeftQuantity.Name is "double" or "TimeSpan") + { + // Because we cannot add generated operators to double or TimeSpan, we make the right operand responsible in this case. + quantityRelations.Add(relation); + } + } + + quantity.Relations = quantityRelations.ToArray(); + } + } + + private static List ParseRelations(string rootDir, IReadOnlyDictionary quantities) + { + var relationsFileName = Path.Combine(rootDir, "Common/UnitRelations.json"); + + try + { + var text = File.ReadAllText(relationsFileName); + var relationStrings = JsonConvert.DeserializeObject>(text) ?? []; + + var parsedRelations = relationStrings.Select(relationString => ParseRelation(relationString, quantities)).ToList(); + + // File parsed successfully, save it back to disk in the sorted state. + File.WriteAllText(relationsFileName, JsonConvert.SerializeObject(relationStrings, Formatting.Indented)); + + return parsedRelations; + } + catch (Exception e) + { + throw new UnitsNetCodeGenException($"Error parsing relations file: {relationsFileName}", e); + } + } + + private static QuantityRelation ParseRelation(string relationString, IReadOnlyDictionary quantities) + { + var segments = relationString.Split(' '); + + if (segments is not [_, "=", _, "*" or "/", _]) + { + throw new Exception($"Invalid relation string: {relationString}"); + } + + var @operator = segments[3]; + var left = segments[2].Split('.'); + var right = segments[4].Split('.'); + var result = segments[0].Split('.'); + + var leftQuantity = GetQuantity(left[0]); + var rightQuantity = GetQuantity(right[0]); + var resultQuantity = GetQuantity(result[0]); + + var leftUnit = GetUnit(leftQuantity, left.ElementAtOrDefault(1)); + var rightUnit = GetUnit(rightQuantity, right.ElementAtOrDefault(1)); + var resultUnit = GetUnit(resultQuantity, result.ElementAtOrDefault(1)); + + if (leftQuantity.Name == "1") + { + @operator = "inverse"; + leftQuantity = resultQuantity; + leftUnit = resultUnit; + } + + return new QuantityRelation + { + Operator = @operator, + LeftQuantity = leftQuantity, + LeftUnit = leftUnit, + RightQuantity = rightQuantity, + RightUnit = rightUnit, + ResultQuantity = resultQuantity, + ResultUnit = resultUnit + }; + + Quantity GetQuantity(string quantityName) + { + if (!quantities.TryGetValue(quantityName, out var quantity)) + { + throw new Exception($"Undefined quantity {quantityName} in relation string: {relationString}"); + } + + return quantity; + } + + Unit GetUnit(Quantity quantity, string? unitName) + { + try + { + return quantity.Units.First(u => u.SingularName == unitName); + } + catch (InvalidOperationException) + { + throw new Exception($"Undefined unit {unitName} in relation string: {relationString}"); + } + } + } + } +} \ No newline at end of file diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index ab5abdae8b..38504033e5 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -39,8 +39,12 @@ public string Generate() using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; -using System.Linq; -using System.Runtime.Serialization; +using System.Linq;"); + if (_quantity.Relations.Any(r => r.Operator is "*" or "/")) + Writer.WL(@"#if NET7_0_OR_GREATER +using System.Numerics; +#endif"); + Writer.WL(@"using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -67,6 +71,35 @@ namespace UnitsNet public readonly partial struct {_quantity.Name} : {(_quantity.GenerateArithmetic ? "IArithmeticQuantity" : "IQuantity")}<{_quantity.Name}, {_unitEnumName}, {_quantity.ValueType}>,"); + if (_quantity.Relations.Any(r => r.Operator is "*" or "/")) + { + Writer.WL(@$" +#if NET7_0_OR_GREATER"); + foreach (var relation in _quantity.Relations) + { + if (relation.LeftQuantity == _quantity) + { + switch (relation.Operator) + { + case "*": + Writer.W(@" + IMultiplyOperators"); + break; + case "/": + Writer.W(@" + IDivisionOperators"); + break; + default: + continue; + } + Writer.WL($"<{relation.LeftQuantity.Name}, {relation.RightQuantity.Name}, {relation.ResultQuantity.Name}>,"); + } + } + + Writer.WL(@$" +#endif"); + } + if (_quantity.ValueType == "decimal") Writer.WL(@$" IDecimalQuantity,"); @@ -100,6 +133,7 @@ namespace UnitsNet GenerateStaticFactoryMethods(); GenerateStaticParseMethods(); GenerateArithmeticOperators(); + GenerateRelationalOperators(); GenerateEqualityAndComparison(); GenerateConversionMethods(); GenerateToString(); @@ -690,6 +724,92 @@ private void GenerateLogarithmicArithmeticOperators() " ); } + /// + /// Generates operators that express relations between quantities as applied by . + /// + private void GenerateRelationalOperators() + { + if (!_quantity.Relations.Any()) return; + + Writer.WL($@" + #region Relational Operators +"); + + foreach (QuantityRelation relation in _quantity.Relations) + { + if (relation.Operator == "inverse") + { + Writer.WL($@" + /// Calculates the inverse of this quantity. + /// The corresponding inverse quantity, . + public {relation.RightQuantity.Name} Inverse() + {{ + return {relation.LeftUnit.PluralName} == 0.0 ? {relation.RightQuantity.Name}.Zero : {relation.RightQuantity.Name}.From{relation.RightUnit.PluralName}(1 / {relation.LeftUnit.PluralName}); + }} +"); + } + else + { + var leftParameter = relation.LeftQuantity.Name.ToCamelCase(); + var leftConversionProperty = relation.LeftUnit.PluralName; + var rightParameter = relation.RightQuantity.Name.ToCamelCase(); + var rightConversionProperty = relation.RightUnit.PluralName; + + if (relation.LeftQuantity.Name is nameof(TimeSpan)) + { + leftConversionProperty = "Total" + leftConversionProperty; + } + + if (relation.RightQuantity.Name is nameof(TimeSpan)) + { + rightConversionProperty = "Total" + rightConversionProperty; + } + + if (leftParameter == rightParameter) + { + leftParameter = "left"; + rightParameter = "right"; + } + + var leftPart = $"{leftParameter}.{leftConversionProperty}"; + var rightPart = $"{rightParameter}.{rightConversionProperty}"; + + if (leftParameter is "double") + { + leftParameter = leftPart = "value"; + } + + if (rightParameter is "double") + { + rightParameter = rightPart = "value"; + } + + var leftCast = relation.LeftQuantity.ValueType is "decimal" ? "(double)" : string.Empty; + var rightCast = relation.RightQuantity.ValueType is "decimal" ? "(double)" : string.Empty; + + var expression = $"{leftCast}{leftPart} {relation.Operator} {rightCast}{rightPart}"; + + if (relation.ResultQuantity.Name is not ("double" or "decimal")) + { + expression = $"{relation.ResultQuantity.Name}.From{relation.ResultUnit.PluralName}({expression})"; + } + + Writer.WL($@" + /// Get from {relation.Operator} . + public static {relation.ResultQuantity.Name} operator {relation.Operator}({relation.LeftQuantity.Name} {leftParameter}, {relation.RightQuantity.Name} {rightParameter}) + {{ + return {expression}; + }} +"); + } + } + + Writer.WL($@" + + #endregion +"); + } + private void GenerateEqualityAndComparison() { Writer.WL($@" diff --git a/CodeGen/JsonTypes/Quantity.cs b/CodeGen/JsonTypes/Quantity.cs index 4af26113fc..6956560161 100644 --- a/CodeGen/JsonTypes/Quantity.cs +++ b/CodeGen/JsonTypes/Quantity.cs @@ -5,7 +5,7 @@ namespace CodeGen.JsonTypes { - internal class Quantity + internal record Quantity { // 0649 Field is never assigned to #pragma warning disable 0649 @@ -18,6 +18,7 @@ internal class Quantity public int LogarithmicScalingFactor = 1; public string Name = null!; public Unit[] Units = Array.Empty(); + public QuantityRelation[] Relations = Array.Empty(); public string? XmlDocRemarks; public string XmlDocSummary = null!; public string? ObsoleteText; diff --git a/CodeGen/JsonTypes/QuantityRelation.cs b/CodeGen/JsonTypes/QuantityRelation.cs new file mode 100644 index 0000000000..9aec29c2a9 --- /dev/null +++ b/CodeGen/JsonTypes/QuantityRelation.cs @@ -0,0 +1,34 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +using System; + +namespace CodeGen.JsonTypes +{ + internal record QuantityRelation : IComparable + { + public string Operator = null!; + + public Quantity LeftQuantity = null!; + public Unit LeftUnit = null!; + + public Quantity RightQuantity = null!; + public Unit RightUnit = null!; + + public Quantity ResultQuantity = null!; + public Unit ResultUnit = null!; + + public string SortString => ResultQuantity.Name + PrependDot(ResultUnit.SingularName) + + " = " + + LeftQuantity.Name + PrependDot(LeftUnit.SingularName) + + " " + Operator + " " + + RightQuantity.Name + PrependDot(RightUnit.SingularName); + + public int CompareTo(QuantityRelation? other) + { + return string.Compare(SortString, other?.SortString, StringComparison.Ordinal); + } + + private static string PrependDot(string? s) => s == null ? string.Empty : "." + s; + } +} \ No newline at end of file diff --git a/CodeGen/Program.cs b/CodeGen/Program.cs index d5589d5d1d..cfeecb0a93 100644 --- a/CodeGen/Program.cs +++ b/CodeGen/Program.cs @@ -65,10 +65,12 @@ public static int Main(bool verbose = false, DirectoryInfo? repositoryRoot = nul if (verbose) Log.Debug("Verbose output enabled"); var sw = Stopwatch.StartNew(); - var quantities = QuantityJsonFilesParser.ParseQuantities(repositoryRoot.FullName); + var quantities = QuantityJsonFilesParser.ParseQuantities(rootDir); QuantityNameToUnitEnumValues quantityNameToUnitEnumValues = UnitEnumValueAllocator.AllocateNewUnitEnumValues($"{rootDir}/Common/UnitEnumValues.g.json", quantities); + QuantityRelationsParser.ParseAndApplyRelations(rootDir, quantities); + UnitsNetGenerator.Generate(rootDir, quantities, quantityNameToUnitEnumValues); if (updateNanoFrameworkDependencies) diff --git a/Common/UnitRelations.json b/Common/UnitRelations.json new file mode 100644 index 0000000000..622b3a21e8 --- /dev/null +++ b/Common/UnitRelations.json @@ -0,0 +1,164 @@ +[ + "Acceleration.MeterPerSecondSquared = Force.Newton / Mass.Kilogram", + "Acceleration.MeterPerSecondSquared = SpecificWeight.NewtonPerCubicMeter / Density.KilogramPerCubicMeter", + "Acceleration.MeterPerSecondSquared = Speed.MeterPerSecond / Duration.Second", + "AmountOfSubstance.Kilomole = MolarFlow.KilomolePerSecond * Duration.Second", + "AmountOfSubstance.Mole = Mass.Kilogram / MolarMass.KilogramPerMole", + "Angle.Radian = RotationalSpeed.RadianPerSecond * Duration.Second", + "Angle.Radian = Torque.NewtonMeter / RotationalStiffness.NewtonMeterPerRadian", + "Area.SquareMeter = KinematicViscosity.SquareMeterPerSecond * Duration.Second", + "Area.SquareMeter = Length.Meter * Length.Meter", + "Area.SquareMeter = LinearDensity.KilogramPerMeter / Density.KilogramPerCubicMeter", + "Area.SquareMeter = LuminousIntensity.Candela / Luminance.CandelaPerSquareMeter", + "Area.SquareMeter = Mass.Kilogram / AreaDensity.KilogramPerSquareMeter", + "Area.SquareMeter = MassFlow.KilogramPerSecond / MassFlux.KilogramPerSecondPerSquareMeter", + "Area.SquareMeter = Power.Watt / HeatFlux.WattPerSquareMeter", + "Area.SquareMeter = Volume.CubicMeter / Length.Meter", + "Area.SquareMeter = VolumeFlow.CubicMeterPerSecond / Speed.MeterPerSecond", + "AreaDensity.KilogramPerSquareMeter = Mass.Kilogram / Area.SquareMeter", + "BrakeSpecificFuelConsumption.KilogramPerJoule = double / SpecificEnergy.JoulePerKilogram", + "BrakeSpecificFuelConsumption.KilogramPerJoule = MassFlow.KilogramPerSecond / Power.Watt", + "Density.KilogramPerCubicMeter = double / SpecificVolume.CubicMeterPerKilogram", + "Density.KilogramPerCubicMeter = LinearDensity.KilogramPerMeter / Area.SquareMeter", + "Density.KilogramPerCubicMeter = Mass.Kilogram / Volume.CubicMeter", + "Density.KilogramPerCubicMeter = MassFlow.KilogramPerSecond / VolumeFlow.CubicMeterPerSecond", + "Density.KilogramPerCubicMeter = MassFlux.KilogramPerSecondPerSquareMeter / Speed.MeterPerSecond", + "Density.KilogramPerCubicMeter = SpecificWeight.NewtonPerCubicMeter / Acceleration.MeterPerSecondSquared", + "double = SpecificEnergy.JoulePerKilogram * BrakeSpecificFuelConsumption.KilogramPerJoule", + "double = TemperatureDelta.Kelvin * CoefficientOfThermalExpansion.PerKelvin", + "Duration.Hour = ElectricCharge.AmpereHour / ElectricCurrent.Ampere", + "Duration.Second = Energy.Joule / Power.Watt", + "Duration.Second = Force.Newton / ForceChangeRate.NewtonPerSecond", + "Duration.Second = Length.Meter / Speed.MeterPerSecond", + "Duration.Second = Speed.MeterPerSecond / Acceleration.MeterPerSecondSquared", + "DynamicViscosity.NewtonSecondPerMeterSquared = Density.KilogramPerCubicMeter * KinematicViscosity.SquareMeterPerSecond", + "ElectricCharge.AmpereHour = ElectricCurrent.Ampere * Duration.Hour", + "ElectricCharge.Coulomb = Energy.Joule / ElectricPotential.Volt", + "ElectricConductivity.SiemensPerMeter = 1 / ElectricResistivity.OhmMeter", + "ElectricCurrent.Ampere = ElectricCharge.AmpereHour / Duration.Hour", + "ElectricCurrent.Ampere = ElectricCurrentGradient.AmperePerSecond * Duration.Second", + "ElectricCurrent.Ampere = ElectricPotential.Volt / ElectricResistance.Ohm", + "ElectricCurrent.Ampere = Power.Watt / ElectricPotential.Volt", + "ElectricCurrentGradient.AmperePerSecond = ElectricCurrent.Ampere / Duration.Second", + "ElectricPotential.Volt = ElectricCurrent.Ampere * ElectricResistance.Ohm", + "ElectricPotential.Volt = Energy.Joule / ElectricCharge.Coulomb", + "ElectricPotential.Volt = Power.Watt / ElectricCurrent.Ampere", + "ElectricResistance.Ohm = ElectricPotential.Volt / ElectricCurrent.Ampere", + "Energy.Joule = ElectricPotential.Volt * ElectricCharge.Coulomb", + "Energy.Joule = EnergyDensity.JoulePerCubicMeter * Volume.CubicMeter", + "Energy.Joule = Power.Watt * Duration.Second", + "Energy.Joule = SpecificEnergy.JoulePerKilogram * Mass.Kilogram", + "Energy.Joule = TemperatureDelta.Kelvin * Entropy.JoulePerKelvin", + "Entropy.JoulePerKelvin = Energy.Joule / TemperatureDelta.Kelvin", + "Entropy.JoulePerKelvin = SpecificEntropy.JoulePerKilogramKelvin * Mass.Kilogram", + "Force.Newton = ForceChangeRate.NewtonPerSecond * Duration.Second", + "Force.Newton = ForcePerLength.NewtonPerMeter * Length.Meter", + "Force.Newton = ForcePerLength.NewtonPerMeter / ReciprocalLength.InverseMeter", + "Force.Newton = Mass.Kilogram * Acceleration.MeterPerSecondSquared", + "Force.Newton = Power.Watt / Speed.MeterPerSecond", + "Force.Newton = Pressure.Pascal * Area.SquareMeter", + "Force.Newton = Pressure.Pascal / ReciprocalArea.InverseSquareMeter", + "Force.Newton = Torque.NewtonMeter / Length.Meter", + "ForcePerLength.NewtonPerMeter = Force.Newton * ReciprocalLength.InverseMeter", + "ForcePerLength.NewtonPerMeter = Force.Newton / Length.Meter", + "ForcePerLength.NewtonPerMeter = Pressure.Pascal / ReciprocalLength.InverseMeter", + "ForcePerLength.NewtonPerMeter = SpecificWeight.NewtonPerCubicMeter * Area.SquareMeter", + "HeatFlux.WattPerSquareMeter = Power.Watt / Area.SquareMeter", + "Jerk.MeterPerSecondCubed = Acceleration.MeterPerSecondSquared / Duration.Second", + "KinematicViscosity.SquareMeterPerSecond = DynamicViscosity.NewtonSecondPerMeterSquared / Density.KilogramPerCubicMeter", + "KinematicViscosity.SquareMeterPerSecond = Length.Meter * Speed.MeterPerSecond", + "Length.Kilometer = TemperatureDelta.Kelvin / TemperatureGradient.DegreeCelsiusPerKilometer", + "Length.Meter = Area.SquareMeter / Length.Meter", + "Length.Meter = Force.Newton / ForcePerLength.NewtonPerMeter", + "Length.Meter = Mass.Kilogram / LinearDensity.KilogramPerMeter", + "Length.Meter = Pressure.Pascal / SpecificWeight.NewtonPerCubicMeter", + "Length.Meter = ReciprocalLength.InverseMeter / ReciprocalArea.InverseSquareMeter", + "Length.Meter = RotationalStiffness.NewtonMeterPerRadian / RotationalStiffnessPerLength.NewtonMeterPerRadianPerMeter", + "Length.Meter = Speed.MeterPerSecond * Duration.Second", + "Length.Meter = Torque.NewtonMeter / Force.Newton", + "Length.Meter = Volume.CubicMeter / Area.SquareMeter", + "LinearDensity.KilogramPerMeter = Area.SquareMeter * Density.KilogramPerCubicMeter", + "LinearDensity.KilogramPerMeter = Mass.Kilogram / Length.Meter", + "Luminance.CandelaPerSquareMeter = LuminousIntensity.Candela / Area.SquareMeter", + "LuminousIntensity.Candela = Luminance.CandelaPerSquareMeter * Area.SquareMeter", + "Mass.Gram = AmountOfSubstance.Mole * MolarMass.GramPerMole", + "Mass.Kilogram = AreaDensity.KilogramPerSquareMeter * Area.SquareMeter", + "Mass.Kilogram = Density.KilogramPerCubicMeter * Volume.CubicMeter", + "Mass.Kilogram = Energy.Joule / SpecificEnergy.JoulePerKilogram", + "Mass.Kilogram = Force.Newton / Acceleration.MeterPerSecondSquared", + "Mass.Kilogram = LinearDensity.KilogramPerMeter * Length.Meter", + "Mass.Kilogram = Mass.Kilogram / MassFraction.DecimalFraction", + "Mass.Kilogram = MassConcentration.KilogramPerCubicMeter * Volume.CubicMeter", + "Mass.Kilogram = MassFlow.KilogramPerSecond * Duration.Second", + "Mass.Kilogram = MassFraction.DecimalFraction * Mass.Kilogram", + "MassConcentration.GramPerCubicMeter = Molarity.MolePerCubicMeter * MolarMass.GramPerMole", + "MassConcentration.KilogramPerCubicMeter = VolumeConcentration.DecimalFraction * Density.KilogramPerCubicMeter", + "MassFlow.GramPerSecond = Area.SquareMeter * MassFlux.GramPerSecondPerSquareMeter", + "MassFlow.KilogramPerSecond = Mass.Kilogram / Duration.Second", + "MassFlow.KilogramPerSecond = MolarFlow.KilomolePerSecond * MolarMass.KilogramPerKilomole", + "MassFlow.KilogramPerSecond = Power.Watt * BrakeSpecificFuelConsumption.KilogramPerJoule", + "MassFlow.KilogramPerSecond = Power.Watt / SpecificEnergy.JoulePerKilogram", + "MassFlow.KilogramPerSecond = VolumeFlow.CubicMeterPerSecond * Density.KilogramPerCubicMeter", + "MassFlux.KilogramPerSecondPerSquareMeter = MassFlow.KilogramPerSecond / Area.SquareMeter", + "MassFlux.KilogramPerSecondPerSquareMeter = Speed.MeterPerSecond * Density.KilogramPerCubicMeter", + "Molarity.MolePerCubicMeter = AmountOfSubstance.Mole / Volume.CubicMeter", + "Molarity.MolePerCubicMeter = MassConcentration.GramPerCubicMeter / MolarMass.GramPerMole", + "Molarity.MolePerCubicMeter = Molarity.MolePerCubicMeter * VolumeConcentration.DecimalFraction", + "Power.Watt = ElectricPotential.Volt * ElectricCurrent.Ampere", + "Power.Watt = Energy.Joule * Frequency.PerSecond", + "Power.Watt = Energy.Joule / Duration.Second", + "Power.Watt = Force.Newton * Speed.MeterPerSecond", + "Power.Watt = HeatFlux.WattPerSquareMeter * Area.SquareMeter", + "Power.Watt = MassFlow.KilogramPerSecond / BrakeSpecificFuelConsumption.KilogramPerJoule", + "Power.Watt = SpecificEnergy.JoulePerKilogram * MassFlow.KilogramPerSecond", + "Pressure.NewtonPerSquareMeter = Force.Newton * ReciprocalArea.InverseSquareMeter", + "Pressure.NewtonPerSquareMeter = ForcePerLength.NewtonPerMeter * ReciprocalLength.InverseMeter", + "Pressure.NewtonPerSquareMeter = ForcePerLength.NewtonPerMeter / Length.Meter", + "Pressure.Pascal = Force.Newton / Area.SquareMeter", + "Pressure.Pascal = PressureChangeRate.PascalPerSecond * Duration.Second", + "Pressure.Pascal = SpecificWeight.NewtonPerCubicMeter * Length.Meter", + "PressureChangeRate.PascalPerSecond = Pressure.Pascal / Duration.Second", + "Ratio.DecimalFraction = Area.SquareMeter * ReciprocalArea.InverseSquareMeter", + "ReciprocalArea.InverseSquareMeter = 1 / Area.SquareMeter", + "ReciprocalArea.InverseSquareMeter = ReciprocalLength.InverseMeter * ReciprocalLength.InverseMeter", + "ReciprocalLength.InverseMeter = 1 / Length.Meter", + "ReciprocalLength.InverseMeter = ReciprocalArea.InverseSquareMeter / ReciprocalLength.InverseMeter", + "RotationalSpeed.RadianPerSecond = Angle.Radian / Duration.Second", + "RotationalSpeed.RadianPerSecond = Power.Watt / Torque.NewtonMeter", + "RotationalStiffness.NewtonMeterPerRadian = RotationalStiffnessPerLength.NewtonMeterPerRadianPerMeter * Length.Meter", + "RotationalStiffness.NewtonMeterPerRadian = Torque.NewtonMeter / Angle.Radian", + "RotationalStiffnessPerLength.NewtonMeterPerRadianPerMeter = RotationalStiffness.NewtonMeterPerRadian / Length.Meter", + "SpecificEnergy.JoulePerKilogram = double / BrakeSpecificFuelConsumption.KilogramPerJoule", + "SpecificEnergy.JoulePerKilogram = Energy.Joule / Mass.Kilogram", + "SpecificEnergy.JoulePerKilogram = Power.Watt / MassFlow.KilogramPerSecond", + "SpecificEnergy.JoulePerKilogram = SpecificEntropy.JoulePerKilogramKelvin * TemperatureDelta.Kelvin", + "SpecificEnergy.JoulePerKilogram = Speed.MeterPerSecond * Speed.MeterPerSecond", + "SpecificEntropy.JoulePerKilogramKelvin = Entropy.JoulePerKelvin / Mass.Kilogram", + "SpecificEntropy.JoulePerKilogramKelvin = SpecificEnergy.JoulePerKilogram / TemperatureDelta.Kelvin", + "SpecificWeight.NewtonPerCubicMeter = Acceleration.MeterPerSecondSquared * Density.KilogramPerCubicMeter", + "SpecificWeight.NewtonPerCubicMeter = Pressure.Pascal / Length.Meter", + "Speed.MeterPerSecond = Acceleration.MeterPerSecondSquared * Duration.Second", + "Speed.MeterPerSecond = KinematicViscosity.SquareMeterPerSecond / Length.Meter", + "Speed.MeterPerSecond = Length.Meter / Duration.Second", + "Speed.MeterPerSecond = MassFlux.KilogramPerSecondPerSquareMeter / Density.KilogramPerCubicMeter", + "Speed.MeterPerSecond = VolumeFlow.CubicMeterPerSecond / Area.SquareMeter", + "TemperatureDelta.DegreeCelsius = TemperatureChangeRate.DegreeCelsiusPerSecond * Duration.Second", + "TemperatureDelta.DegreeCelsius = TemperatureGradient.DegreeCelsiusPerKilometer * Length.Kilometer", + "TemperatureDelta.Kelvin = Energy.Joule / Entropy.JoulePerKelvin", + "TemperatureGradient.KelvinPerMeter = TemperatureDelta.Kelvin / Length.Meter", + "Torque.NewtonMeter = ForcePerLength.NewtonPerMeter * Area.SquareMeter", + "Torque.NewtonMeter = Length.Meter * Force.Newton", + "Torque.NewtonMeter = Power.Watt / RotationalSpeed.RadianPerSecond", + "Torque.NewtonMeter = RotationalStiffness.NewtonMeterPerRadian * Angle.Radian", + "Volume.CubicMeter = AmountOfSubstance.Mole / Molarity.MolePerCubicMeter", + "Volume.CubicMeter = AreaMomentOfInertia.MeterToTheFourth / Length.Meter", + "Volume.CubicMeter = Length.Meter * Area.SquareMeter", + "Volume.CubicMeter = Mass.Kilogram / Density.KilogramPerCubicMeter", + "Volume.CubicMeter = SpecificVolume.CubicMeterPerKilogram * Mass.Kilogram", + "Volume.CubicMeter = VolumeFlow.CubicMeterPerSecond * Duration.Second", + "VolumeConcentration.DecimalFraction = MassConcentration.KilogramPerCubicMeter / Density.KilogramPerCubicMeter", + "VolumeFlow.CubicMeterPerSecond = Area.SquareMeter * Speed.MeterPerSecond", + "VolumeFlow.CubicMeterPerSecond = MassFlow.KilogramPerSecond / Density.KilogramPerCubicMeter", + "VolumeFlow.CubicMeterPerSecond = MolarFlow.MolePerSecond / Molarity.MolePerCubicMeter", + "VolumeFlow.CubicMeterPerSecond = Volume.CubicMeter / Duration.Second" +] \ No newline at end of file diff --git a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs deleted file mode 100644 index 562111afd0..0000000000 --- a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct Acceleration - { - /// - /// Multiply and to get . - /// - public static SpecificWeight operator *(Acceleration acceleration, Density density) - { - return new SpecificWeight(acceleration.MetersPerSecondSquared * density.KilogramsPerCubicMeter, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); - } - - /// - /// Multiply and to get . - /// - public static Speed operator *(Acceleration acceleration, Duration duration) - { - return new Speed(acceleration.MetersPerSecondSquared * duration.Seconds, UnitsNet.Units.SpeedUnit.MeterPerSecond); - } - - /// - /// Divide by to get . - /// - public static Jerk operator /(Acceleration acceleration, Duration duration) - { - return new Jerk(acceleration.MetersPerSecondSquared / duration.Seconds, UnitsNet.Units.JerkUnit.MeterPerSecondCubed); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs b/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs index 6fb8944cfe..83b85777cf 100644 --- a/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs +++ b/UnitsNet/CustomCode/Quantities/AmountOfSubstance.extra.cs @@ -39,30 +39,5 @@ public static AmountOfSubstance FromMass(Mass mass, MolarMass molarMass) { return mass / molarMass; } - - /// Get from for a given . - public static Mass operator *(AmountOfSubstance amountOfSubstance, MolarMass molarMass) - { - return Mass.FromGrams(amountOfSubstance.Moles * molarMass.GramsPerMole); - } - - /// Get from for a given . - public static Mass operator *(MolarMass molarMass, AmountOfSubstance amountOfSubstance) - { - return Mass.FromGrams(amountOfSubstance.Moles * molarMass.GramsPerMole); - } - - /// Get from divided by . - public static Molarity operator /(AmountOfSubstance amountOfComponent, Volume mixtureVolume) - { - return Molarity.FromMolesPerCubicMeter(amountOfComponent.Moles / mixtureVolume.CubicMeters); - } - - /// Get from divided by . - public static Volume operator /(AmountOfSubstance amountOfSubstance, Molarity molarity) - { - return Volume.FromCubicMeters(amountOfSubstance.Moles / molarity.MolesPerCubicMeter); - } - } } diff --git a/UnitsNet/CustomCode/Quantities/Angle.extra.cs b/UnitsNet/CustomCode/Quantities/Angle.extra.cs deleted file mode 100644 index 59318915c4..0000000000 --- a/UnitsNet/CustomCode/Quantities/Angle.extra.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct Angle - { - /// Get from delta over time delta. - public static RotationalSpeed operator /(Angle angle, TimeSpan timeSpan) - { - return RotationalSpeed.FromRadiansPerSecond(angle.Radians / timeSpan.TotalSeconds); - } - - /// - public static RotationalSpeed operator /(Angle angle, Duration duration) - { - return RotationalSpeed.FromRadiansPerSecond(angle.Radians / duration.Seconds); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Area.extra.cs b/UnitsNet/CustomCode/Quantities/Area.extra.cs index 8df2a275d3..3a9d28e973 100644 --- a/UnitsNet/CustomCode/Quantities/Area.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Area.extra.cs @@ -23,47 +23,5 @@ public static Area FromCircleRadius(Length radius) } #endregion - - /// - /// Calculates the inverse of this quantity. - /// - /// The corresponding inverse quantity, . - public ReciprocalArea Inverse() - { - if (SquareMeters == 0.0) - return new ReciprocalArea(0.0, UnitsNet.Units.ReciprocalAreaUnit.InverseSquareMeter); - - return new ReciprocalArea(1 / SquareMeters, UnitsNet.Units.ReciprocalAreaUnit.InverseSquareMeter); - } - - /// Get from divided by . - public static Length operator /(Area area, Length length) - { - return Length.FromMeters(area.SquareMeters / length.Meters); - } - - /// Get from times . - public static MassFlow operator *(Area area, MassFlux massFlux) - { - return MassFlow.FromGramsPerSecond(area.SquareMeters * massFlux.GramsPerSecondPerSquareMeter); - } - - /// Get from times . - public static VolumeFlow operator *(Area area, Speed speed) - { - return VolumeFlow.FromCubicMetersPerSecond(area.SquareMeters * speed.MetersPerSecond); - } - - /// Get from times . - public static LinearDensity operator *(Area area, Density density) - { - return LinearDensity.FromKilogramsPerMeter(area.SquareMeters * density.KilogramsPerCubicMeter); - } - - /// Get from times . - public static Ratio operator *(Area area, ReciprocalArea reciprocalArea) - { - return Ratio.FromDecimalFractions(area.SquareMeters * reciprocalArea.InverseSquareMeters); - } } } diff --git a/UnitsNet/CustomCode/Quantities/AreaDensity.extra.cs b/UnitsNet/CustomCode/Quantities/AreaDensity.extra.cs deleted file mode 100644 index 1e92e6f211..0000000000 --- a/UnitsNet/CustomCode/Quantities/AreaDensity.extra.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct AreaDensity - { - /// Get from times . - public static Mass operator *(AreaDensity areaDensity, Area area) - { - return Mass.FromKilograms(areaDensity.KilogramsPerSquareMeter * area.SquareMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/AreaMomentOfInertia.extra.cs b/UnitsNet/CustomCode/Quantities/AreaMomentOfInertia.extra.cs deleted file mode 100644 index 2d254b9c17..0000000000 --- a/UnitsNet/CustomCode/Quantities/AreaMomentOfInertia.extra.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct AreaMomentOfInertia - { - /// Get from divided by . - public static Volume operator /(AreaMomentOfInertia areaMomentOfInertia, Length length) - { - return Volume.FromCubicMeters(areaMomentOfInertia.MetersToTheFourth / length.Meters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/BrakeSpecificFuelConsumption.extra.cs b/UnitsNet/CustomCode/Quantities/BrakeSpecificFuelConsumption.extra.cs deleted file mode 100644 index e2bfa67d7a..0000000000 --- a/UnitsNet/CustomCode/Quantities/BrakeSpecificFuelConsumption.extra.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct BrakeSpecificFuelConsumption - { - /// Get from times . - public static MassFlow operator *(BrakeSpecificFuelConsumption bsfc, Power power) - { - return MassFlow.FromKilogramsPerSecond(bsfc.KilogramsPerJoule * (double)power.Watts); - } - - /// Get from divided by . - public static SpecificEnergy operator /(double value, BrakeSpecificFuelConsumption bsfc) - { - return SpecificEnergy.FromJoulesPerKilogram(value/bsfc.KilogramsPerJoule); - } - - /// Get constant from times . - public static double operator *(BrakeSpecificFuelConsumption bsfc, SpecificEnergy specificEnergy) - { - return specificEnergy.JoulesPerKilogram*bsfc.KilogramsPerJoule; - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/CoefficientOfThermalExpansion.extra.cs b/UnitsNet/CustomCode/Quantities/CoefficientOfThermalExpansion.extra.cs deleted file mode 100644 index 0a426727fd..0000000000 --- a/UnitsNet/CustomCode/Quantities/CoefficientOfThermalExpansion.extra.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct CoefficientOfThermalExpansion - { - /// Get a scalar from a multiplied by a . - public static double operator *(CoefficientOfThermalExpansion cte, TemperatureDelta temperatureDelta) => cte.PerKelvin * temperatureDelta.Kelvins; - } -} diff --git a/UnitsNet/CustomCode/Quantities/Density.extra.cs b/UnitsNet/CustomCode/Quantities/Density.extra.cs deleted file mode 100644 index fd036dc519..0000000000 --- a/UnitsNet/CustomCode/Quantities/Density.extra.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using UnitsNet.Units; - -namespace UnitsNet -{ - public partial struct Density - { - /// Get from times . - public static Mass operator *(Density density, Volume volume) - { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); - } - - /// Get from times . - public static Mass operator *(Volume volume, Density density) - { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); - } - - /// Get from times . - public static DynamicViscosity operator *(Density density, KinematicViscosity kinematicViscosity) - { - return DynamicViscosity.FromNewtonSecondsPerMeterSquared(kinematicViscosity.SquareMetersPerSecond * density.KilogramsPerCubicMeter); - } - - /// Get times . - public static MassFlux operator *(Density density, Speed speed) - { - return MassFlux.FromKilogramsPerSecondPerSquareMeter(density.KilogramsPerCubicMeter * speed.MetersPerSecond); - } - - /// Get from times . - public static SpecificWeight operator *(Density density, Acceleration acceleration) - { - return new SpecificWeight(density.KilogramsPerCubicMeter * acceleration.MetersPerSecondSquared, SpecificWeightUnit.NewtonPerCubicMeter); - } - - /// Get from times . - public static LinearDensity operator *(Density density, Area area) - { - return LinearDensity.FromKilogramsPerMeter(density.KilogramsPerCubicMeter * area.SquareMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Duration.extra.cs b/UnitsNet/CustomCode/Quantities/Duration.extra.cs index e1e898c62d..4333d3c745 100644 --- a/UnitsNet/CustomCode/Quantities/Duration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Duration.extra.cs @@ -92,29 +92,5 @@ public static explicit operator Duration(TimeSpan duration) { return timeSpan.TotalSeconds >= duration.Seconds; } - - /// Get from multiplied by . - public static Volume operator *(Duration duration, VolumeFlow volumeFlow) - { - return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); - } - - /// Get from multiplied by . - public static ElectricCharge operator *(Duration time, ElectricCurrent current) - { - return ElectricCharge.FromAmpereHours(current.Amperes * time.Hours); - } - - /// Get from multiplied by . - public static Speed operator *(Duration duration, Acceleration acceleration) - { - return new Speed(acceleration.MetersPerSecondSquared * duration.Seconds, SpeedUnit.MeterPerSecond); - } - - /// Get from multiplied by . - public static Force operator *(Duration duration, ForceChangeRate forceChangeRate) - { - return new Force(forceChangeRate.NewtonsPerSecond * duration.Seconds, ForceUnit.Newton); - } } } diff --git a/UnitsNet/CustomCode/Quantities/DynamicViscosity.extra.cs b/UnitsNet/CustomCode/Quantities/DynamicViscosity.extra.cs deleted file mode 100644 index e99348a111..0000000000 --- a/UnitsNet/CustomCode/Quantities/DynamicViscosity.extra.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct DynamicViscosity - { - /// Get from divided by . - public static KinematicViscosity operator /(DynamicViscosity dynamicViscosity, Density density) - { - return KinematicViscosity.FromSquareMetersPerSecond(dynamicViscosity.NewtonSecondsPerMeterSquared / density.KilogramsPerCubicMeter); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ElectricCharge.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricCharge.extra.cs deleted file mode 100644 index 2ece06a503..0000000000 --- a/UnitsNet/CustomCode/Quantities/ElectricCharge.extra.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct ElectricCharge - { - /// Get from divided by . - public static ElectricCurrent operator /(ElectricCharge charge, Duration time) - { - return ElectricCurrent.FromAmperes(charge.AmpereHours / time.Hours); - } - - /// Get from divided by . - public static Duration operator /(ElectricCharge charge, ElectricCurrent current) - { - return Duration.FromHours(charge.AmpereHours / current.Amperes); - } - - /// Get from times . - public static Energy operator *(ElectricCharge charge, ElectricPotential potential) - { - return Energy.FromJoules(potential.Volts * charge.Coulombs); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ElectricConductivity.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricConductivity.extra.cs deleted file mode 100644 index 120fae5701..0000000000 --- a/UnitsNet/CustomCode/Quantities/ElectricConductivity.extra.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using UnitsNet.Units; - -namespace UnitsNet -{ - public partial struct ElectricConductivity - { - /// - /// Calculates the inverse or of this unit. - /// - /// The inverse or of this unit. - public ElectricResistivity Inverse() - { - if (SiemensPerMeter == 0.0) - return new ElectricResistivity( 0.0, ElectricResistivityUnit.OhmMeter ); - - return new ElectricResistivity( 1 / SiemensPerMeter, ElectricResistivityUnit.OhmMeter ); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ElectricCurrent.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricCurrent.extra.cs deleted file mode 100644 index 8928254f82..0000000000 --- a/UnitsNet/CustomCode/Quantities/ElectricCurrent.extra.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct ElectricCurrent - { - /// Get from multiplied by . - /// Ohm's law implementation - public static ElectricPotential operator *(ElectricCurrent current, ElectricResistance resistance) - { - return ElectricPotential.FromVolts(resistance.Ohms * current.Amperes); - } - - /// Calculate from multiplied by . - /// Electric power is defined as P = U * I. - public static Power operator *(ElectricCurrent current, ElectricPotential potential) - { - return Power.FromWatts(potential.Volts * current.Amperes); - } - - /// Calculate from multiplied by . - public static ElectricCharge operator *(ElectricCurrent current, Duration time) - { - return ElectricCharge.FromAmpereHours(current.Amperes * time.Hours); - } - - /// Get from divided by . - public static ElectricCurrentGradient operator /(ElectricCurrent current, Duration duration) - { - return ElectricCurrentGradient.FromAmperesPerSecond(current.Amperes / duration.Seconds); - } - - /// Get from divided by . - public static ElectricCurrentGradient operator /(ElectricCurrent current, TimeSpan timeSpan) - { - return ElectricCurrentGradient.FromAmperesPerSecond(current.Amperes / timeSpan.TotalSeconds); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ElectricCurrentGradient.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricCurrentGradient.extra.cs deleted file mode 100644 index 11800f51f6..0000000000 --- a/UnitsNet/CustomCode/Quantities/ElectricCurrentGradient.extra.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct ElectricCurrentGradient - { - /// Get from times . - public static ElectricCurrent operator *(ElectricCurrentGradient currentGradient, Duration duration) - { - return ElectricCurrent.FromAmperes(currentGradient.AmperesPerSecond * duration.Seconds); - } - - /// Get from times . - public static ElectricCurrent operator *(ElectricCurrentGradient currentGradient, TimeSpan timeSpan) - { - return ElectricCurrent.FromAmperes(currentGradient.AmperesPerSecond * timeSpan.TotalSeconds); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs index 5ff53c0389..5a807c63c5 100644 --- a/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs +++ b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs @@ -18,32 +18,5 @@ public AmplitudeRatio ToAmplitudeRatio() { return AmplitudeRatio.FromElectricPotential(this); } - - /// Get from divided by . - /// Ohm's law implementation - public static ElectricResistance operator /(ElectricPotential potential, ElectricCurrent current) - { - return ElectricResistance.FromOhms(potential.Volts / current.Amperes); - } - - /// Get from divided by . - /// Ohm's law implementation - public static ElectricCurrent operator /(ElectricPotential potential, ElectricResistance resistance) - { - return ElectricCurrent.FromAmperes(potential.Volts / resistance.Ohms); - } - - /// Calculate from multiplied by . - /// Electric power is defined as P = U * I. - public static Power operator *(ElectricPotential potential, ElectricCurrent current) - { - return Power.FromWatts(potential.Volts * current.Amperes); - } - - /// Get from times . - public static Energy operator *(ElectricPotential potential, ElectricCharge charge) - { - return Energy.FromJoules(potential.Volts * charge.Coulombs); - } } } diff --git a/UnitsNet/CustomCode/Quantities/ElectricResistance.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricResistance.extra.cs deleted file mode 100644 index 95d103d89e..0000000000 --- a/UnitsNet/CustomCode/Quantities/ElectricResistance.extra.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct ElectricResistance - { - /// Get from multiplied by . - /// Ohm's law implementation - public static ElectricPotential operator *(ElectricResistance resistance, ElectricCurrent current) - { - return ElectricPotential.FromVolts(resistance.Ohms * current.Amperes); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ElectricResistivity.extra.cs b/UnitsNet/CustomCode/Quantities/ElectricResistivity.extra.cs deleted file mode 100644 index f53482d9f2..0000000000 --- a/UnitsNet/CustomCode/Quantities/ElectricResistivity.extra.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using UnitsNet.Units; - -namespace UnitsNet -{ - public partial struct ElectricResistivity - { - /// - /// Calculates the inverse or of this unit. - /// - /// The inverse or of this unit. - public ElectricConductivity Inverse() - { - if (OhmMeters == 0.0) - return new ElectricConductivity( 0, ElectricConductivityUnit.SiemensPerMeter ); - - return new ElectricConductivity( 1 / OhmMeters, ElectricConductivityUnit.SiemensPerMeter ); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Energy.extra.cs b/UnitsNet/CustomCode/Quantities/Energy.extra.cs deleted file mode 100644 index 10fd0ff4ab..0000000000 --- a/UnitsNet/CustomCode/Quantities/Energy.extra.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct Energy - { - /// Get from divided by . - public static Power operator /(Energy energy, TimeSpan time) - { - return Power.FromWatts(energy.Joules / time.TotalSeconds); - } - - /// Get from divided by . - public static Power operator /(Energy energy, Duration duration) - { - return Power.FromWatts(energy.Joules / duration.Seconds); - } - - /// Get from divided by . - public static Duration operator /(Energy energy, Power power) - { - return Duration.FromSeconds(energy.Joules / (double)power.Watts); - } - - /// Get from divided by . - public static ElectricCharge operator /(Energy energy, ElectricPotential potential) - { - return ElectricCharge.FromCoulombs(energy.Joules / potential.Volts); - } - - /// Get from divided by . - public static ElectricPotential operator /(Energy energy, ElectricCharge current) - { - return ElectricPotential.FromVolts(energy.Joules / current.Coulombs); - } - - /// Get from times . - public static Power operator *(Energy energy, Frequency frequency) - { - return Power.FromWatts(energy.Joules * frequency.PerSecond); - } - - /// Get from times . - public static Power operator *(Frequency frequency, Energy energy) - { - return Power.FromWatts(energy.Joules * frequency.PerSecond); - } - - /// Get from divided by - public static Entropy operator /(Energy energy, TemperatureDelta temperatureDelta) - { - return Entropy.FromJoulesPerKelvin(energy.Joules / temperatureDelta.Kelvins); - } - - /// Get from divided by . - public static TemperatureDelta operator /(Energy energy, Entropy entropy) - { - return TemperatureDelta.FromKelvins(energy.Joules / entropy.JoulesPerKelvin); - } - - /// Get from divided by - public static SpecificEnergy operator /(Energy energy, Mass mass) - { - return SpecificEnergy.FromJoulesPerKilogram(energy.Joules / mass.Kilograms); - } - - /// Get from divided by . - public static Mass operator /(Energy energy, SpecificEnergy specificEnergy) - { - return Mass.FromKilograms(energy.Joules / specificEnergy.JoulesPerKilogram); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/EnergyDensity.extra.cs b/UnitsNet/CustomCode/Quantities/EnergyDensity.extra.cs index d2fda8070b..811267d7f9 100644 --- a/UnitsNet/CustomCode/Quantities/EnergyDensity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/EnergyDensity.extra.cs @@ -4,20 +4,6 @@ namespace UnitsNet { public partial struct EnergyDensity { - #region Operators - - /// - /// Returns the from the given and . - /// - public static Energy operator * ( EnergyDensity energyDensity, Volume volume ) - { - return Energy.FromJoules ( energyDensity.JoulesPerCubicMeter * volume.As ( VolumeUnit.CubicMeter ) ); - } - - #endregion - - #region Methods - /// /// Computes the combustion energy of a natural gas heating system. /// @@ -46,7 +32,5 @@ public static Energy CombustionEnergy ( EnergyDensity energyDensity, Volume volu { return Energy.FromJoules ( (energyDensity * volume).As ( EnergyUnit.Joule ) * conversionFactor.DecimalFractions ); } - - #endregion } } diff --git a/UnitsNet/CustomCode/Quantities/Entropy.extra.cs b/UnitsNet/CustomCode/Quantities/Entropy.extra.cs deleted file mode 100644 index 5b3d45c313..0000000000 --- a/UnitsNet/CustomCode/Quantities/Entropy.extra.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct Entropy - { - /// Get from divided by . - public static SpecificEntropy operator /(Entropy entropy, Mass mass) - { - return SpecificEntropy.FromJoulesPerKilogramKelvin(entropy.JoulesPerKelvin / mass.Kilograms); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Force.extra.cs b/UnitsNet/CustomCode/Quantities/Force.extra.cs index 7972c0f412..d729d18b18 100644 --- a/UnitsNet/CustomCode/Quantities/Force.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Force.extra.cs @@ -19,59 +19,5 @@ public static Force FromMassByAcceleration(Mass mass, Acceleration acceleration) { return new Force(mass.Kilograms * acceleration.MetersPerSecondSquared, ForceUnit.Newton); } - - /// Get from times . - public static Power operator *(Force force, Speed speed) - { - return Power.FromWatts(force.Newtons * speed.MetersPerSecond); - } - - /// Get from times . - public static Power operator *(Speed speed, Force force) - { - return Power.FromWatts(force.Newtons * speed.MetersPerSecond); - } - - /// Get from times . - public static ForcePerLength operator *(Force force, ReciprocalLength reciprocalLength) - { - return ForcePerLength.FromNewtonsPerMeter(force.Newtons * reciprocalLength.InverseMeters); - } - - /// Get from times . - public static Pressure operator *(Force force, ReciprocalArea reciprocalArea) - { - return Pressure.FromNewtonsPerSquareMeter(force.Newtons * reciprocalArea.InverseSquareMeters); - } - - /// Get from divided by . - public static Acceleration operator /(Force force, Mass mass) - { - return Acceleration.FromMetersPerSecondSquared(force.Newtons / mass.Kilograms); - } - - /// Get from divided by . - public static Mass operator /(Force force, Acceleration acceleration) - { - return Mass.FromKilograms(force.Newtons / acceleration.MetersPerSecondSquared); - } - - /// Get from divided by . - public static Pressure operator /(Force force, Area area) - { - return Pressure.FromPascals(force.Newtons / area.SquareMeters); - } - - /// Get from divided by . - public static ForcePerLength operator /(Force force, Length length) - { - return ForcePerLength.FromNewtonsPerMeter(force.Newtons / length.Meters); - } - - /// Get from divided by . - public static Duration operator /(Force force, ForceChangeRate forceChangeRate) - { - return new Duration(force.Newtons / forceChangeRate.NewtonsPerSecond, DurationUnit.Second); - } } } diff --git a/UnitsNet/CustomCode/Quantities/ForceChangeRate.extra.cs b/UnitsNet/CustomCode/Quantities/ForceChangeRate.extra.cs deleted file mode 100644 index 4880daadde..0000000000 --- a/UnitsNet/CustomCode/Quantities/ForceChangeRate.extra.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using UnitsNet.Units; - -namespace UnitsNet -{ - public partial struct ForceChangeRate - { - /// Get from multiplied by . - public static Force operator *(ForceChangeRate forceChangeRate, Duration duration) - { - return new Force(forceChangeRate.NewtonsPerSecond * duration.Seconds, ForceUnit.Newton); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ForcePerLength.extra.cs b/UnitsNet/CustomCode/Quantities/ForcePerLength.extra.cs deleted file mode 100644 index 5c37361248..0000000000 --- a/UnitsNet/CustomCode/Quantities/ForcePerLength.extra.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct ForcePerLength - { - /// Get from multiplied by . - public static Force operator *(ForcePerLength forcePerLength, Length length) - { - return Force.FromNewtons(forcePerLength.NewtonsPerMeter * length.Meters); - } - - /// Get from divided by . - public static Length operator /(Force force, ForcePerLength forcePerLength) - { - return Length.FromMeters(force.Newtons / forcePerLength.NewtonsPerMeter); - } - - /// Get from divided by . - public static Pressure operator /(ForcePerLength forcePerLength, Length length) - { - return Pressure.FromNewtonsPerSquareMeter(forcePerLength.NewtonsPerMeter / length.Meters); - } - - /// Get from multiplied by . - public static Torque operator *(ForcePerLength forcePerLength, Area area) - { - return Torque.FromNewtonMeters(forcePerLength.NewtonsPerMeter * area.SquareMeters); - } - - /// Get from multiplied by . - public static Pressure operator *(ForcePerLength forcePerLength, ReciprocalLength reciprocalLength) - { - return Pressure.FromNewtonsPerSquareMeter(forcePerLength.NewtonsPerMeter * reciprocalLength.InverseMeters); - } - - /// Get from divided by . - public static Force operator /(ForcePerLength forcePerLength, ReciprocalLength reciprocalLength) - { - return Force.FromNewtons(forcePerLength.NewtonsPerMeter / reciprocalLength.InverseMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/HeatFlux.extra.cs b/UnitsNet/CustomCode/Quantities/HeatFlux.extra.cs deleted file mode 100644 index 395661fb1f..0000000000 --- a/UnitsNet/CustomCode/Quantities/HeatFlux.extra.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct HeatFlux - { - /// Get from times . - public static Power operator *(HeatFlux heatFlux, Area area) - { - return Power.FromWatts(heatFlux.WattsPerSquareMeter * area.SquareMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs b/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs deleted file mode 100644 index f43b75534c..0000000000 --- a/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct KinematicViscosity - { - /// Get from divided by . - public static Speed operator /(KinematicViscosity kinematicViscosity, Length length) - { - return Speed.FromMetersPerSecond(kinematicViscosity.SquareMetersPerSecond / length.Meters); - } - - /// Get from times . - public static Area operator *(KinematicViscosity kinematicViscosity, TimeSpan timeSpan) - { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * timeSpan.TotalSeconds); - } - - /// Get from times . - public static Area operator *(TimeSpan timeSpan, KinematicViscosity kinematicViscosity) - { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * timeSpan.TotalSeconds); - } - - /// Get from times . - public static Area operator *(KinematicViscosity kinematicViscosity, Duration duration) - { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * duration.Seconds); - } - - /// Get from times . - public static Area operator *(Duration duration, KinematicViscosity kinematicViscosity) - { - return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * duration.Seconds); - } - - /// Get from times . - public static DynamicViscosity operator *(KinematicViscosity kinematicViscosity, Density density) - { - return DynamicViscosity.FromNewtonSecondsPerMeterSquared(kinematicViscosity.SquareMetersPerSecond * density.KilogramsPerCubicMeter); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index 7c41035344..3d251b249f 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -13,17 +13,6 @@ public partial struct Length { private const double InchesInOneFoot = 12; - /// - /// Calculates the inverse of this unit. - /// - /// The inverse of this unit as . - public ReciprocalLength Inverse() - { - return Meters == 0.0 - ? new ReciprocalLength(0.0, ReciprocalLengthUnit.InverseMeter) - : new ReciprocalLength(1 / Meters, ReciprocalLengthUnit.InverseMeter); - } - /// /// Converts the length to a customary feet/inches combination. /// @@ -122,66 +111,6 @@ public static bool TryParseFeetInches(string? str, out Length result, IFormatPro result = default; return false; } - - /// Get from divided by . - public static Speed operator /(Length length, TimeSpan timeSpan) - { - return Speed.FromMetersPerSecond(length.Meters/timeSpan.TotalSeconds); - } - - /// Get from divided by . - public static Speed operator /(Length length, Duration duration) - { - return Speed.FromMetersPerSecond(length.Meters/duration.Seconds); - } - - /// Get from divided by . - public static Duration operator /(Length length, Speed speed) - { - return Duration.FromSeconds(length.Meters/speed.MetersPerSecond); - } - - /// Get from times . - public static Area operator *(Length length1, Length length2) - { - return Area.FromSquareMeters(length1.Meters*length2.Meters); - } - - /// Get from times . - public static Volume operator *(Area area, Length length) - { - return Volume.FromCubicMeters(area.SquareMeters*length.Meters); - } - - /// Get from times . - public static Volume operator *(Length length, Area area) - { - return Volume.FromCubicMeters(area.SquareMeters*length.Meters); - } - - /// Get from times . - public static Torque operator *(Force force, Length length) - { - return Torque.FromNewtonMeters(force.Newtons*length.Meters); - } - - /// Get from times . - public static Torque operator *(Length length, Force force) - { - return Torque.FromNewtonMeters(force.Newtons*length.Meters); - } - - /// Get from times . - public static KinematicViscosity operator *(Length length, Speed speed) - { - return KinematicViscosity.FromSquareMetersPerSecond(length.Meters*speed.MetersPerSecond); - } - - /// Get from times . - public static Pressure operator *(Length length, SpecificWeight specificWeight) - { - return new Pressure(length.Meters * specificWeight.NewtonsPerCubicMeter, PressureUnit.Pascal); - } } /// diff --git a/UnitsNet/CustomCode/Quantities/LinearDensity.extra.cs b/UnitsNet/CustomCode/Quantities/LinearDensity.extra.cs deleted file mode 100644 index 1b4740e08d..0000000000 --- a/UnitsNet/CustomCode/Quantities/LinearDensity.extra.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct LinearDensity - { - - /// Get from times . - public static Density operator /(LinearDensity linearDensity, Area area) - { - return Density.FromKilogramsPerCubicMeter(linearDensity.KilogramsPerMeter / area.SquareMeters); - } - - /// Get from times . - public static Area operator /(LinearDensity linearDensity, Density density) - { - return Area.FromSquareMeters(linearDensity.KilogramsPerMeter / density.KilogramsPerCubicMeter); - } - - /// Get from times . - public static Mass operator *(LinearDensity linearDensity, Length length) - { - return Mass.FromKilograms(linearDensity.KilogramsPerMeter * length.Meters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Luminance.extra.cs b/UnitsNet/CustomCode/Quantities/Luminance.extra.cs deleted file mode 100644 index 25d59b34cc..0000000000 --- a/UnitsNet/CustomCode/Quantities/Luminance.extra.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct Luminance - { - /// Get from times . - public static LuminousIntensity operator *(Luminance luminance, Area area) - { - return LuminousIntensity.FromCandela(luminance.CandelasPerSquareMeter * area.SquareMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/LuminousIntensity.extra.cs b/UnitsNet/CustomCode/Quantities/LuminousIntensity.extra.cs deleted file mode 100644 index b2f5960f7b..0000000000 --- a/UnitsNet/CustomCode/Quantities/LuminousIntensity.extra.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct LuminousIntensity - { - /// Get from divided by . - public static Luminance operator /(LuminousIntensity luminousIntensity, Area area) - { - return Luminance.FromCandelasPerSquareMeter(luminousIntensity.Candela / area.SquareMeters); - } - - /// Get from divided by . - public static Area operator /(LuminousIntensity luminousIntensity, Luminance luminance) - { - return Area.FromSquareMeters(luminousIntensity.Candela / luminance.CandelasPerSquareMeter); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Mass.extra.cs b/UnitsNet/CustomCode/Quantities/Mass.extra.cs index e82862fc21..906feca314 100644 --- a/UnitsNet/CustomCode/Quantities/Mass.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Mass.extra.cs @@ -45,72 +45,6 @@ public static Mass FromStonePounds(double stone, double pounds) { return FromPounds(StonesInOnePound*stone + pounds); } - - /// Get from divided by . - public static MassFlow operator /(Mass mass, TimeSpan timeSpan) - { - return MassFlow.FromKilogramsPerSecond(mass.Kilograms/timeSpan.TotalSeconds); - } - - /// Get from divided by . - public static MassFlow operator /(Mass mass, Duration duration) - { - return MassFlow.FromKilogramsPerSecond(mass.Kilograms/duration.Seconds); - } - - /// Get from divided by . - public static Density operator /(Mass mass, Volume volume) - { - return Density.FromKilogramsPerCubicMeter(mass.Kilograms/volume.CubicMeters); - } - - /// Get from divided by . - public static Volume operator /(Mass mass, Density density) - { - return Volume.FromCubicMeters(mass.Kilograms / density.KilogramsPerCubicMeter); - } - - /// Get from divided by . - public static AmountOfSubstance operator /(Mass mass, MolarMass molarMass) - { - return AmountOfSubstance.FromMoles(mass.Kilograms / molarMass.KilogramsPerMole); - } - - /// Get from divided by . - public static AreaDensity operator /(Mass mass, Area area) - { - return AreaDensity.FromKilogramsPerSquareMeter(mass.Kilograms / area.SquareMeters); - } - - /// Get from divided by . - public static Area operator /(Mass mass, AreaDensity areaDensity) - { - return Area.FromSquareMeters(mass.Kilograms / areaDensity.KilogramsPerSquareMeter); - } - - /// Get from times . - public static Force operator *(Mass mass, Acceleration acceleration) - { - return Force.FromNewtons(mass.Kilograms*acceleration.MetersPerSecondSquared); - } - - /// Get from times . - public static Force operator *(Acceleration acceleration, Mass mass) - { - return Force.FromNewtons(mass.Kilograms*acceleration.MetersPerSecondSquared); - } - - /// Get from times . - public static LinearDensity operator /(Mass mass, Length length) - { - return LinearDensity.FromKilogramsPerMeter(mass.Kilograms / length.Meters); - } - - /// Get from divided by . - public static Length operator /(Mass mass, LinearDensity linearDensity) - { - return Length.FromMeters(mass.Kilograms / linearDensity.KilogramsPerMeter); - } } /// diff --git a/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs b/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs index 3e02c6e53d..569c228523 100644 --- a/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/MassConcentration.extra.cs @@ -43,34 +43,5 @@ public static MassConcentration FromVolumeConcentration(VolumeConcentration volu } #endregion - - #region Operators - - /// Get from times . - public static Mass operator *(MassConcentration density, Volume volume) - { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); - } - - /// Get from times . - public static Mass operator *(Volume volume, MassConcentration density) - { - return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); - } - - /// Get from divided by the component's . - public static Molarity operator /(MassConcentration massConcentration, MolarMass componentMass) - { - return Molarity.FromMolesPerCubicMeter(massConcentration.GramsPerCubicMeter / componentMass.GramsPerMole); - } - - /// Get from divided by the component's . - public static VolumeConcentration operator /(MassConcentration massConcentration, Density componentDensity) - { - return VolumeConcentration.FromDecimalFractions(massConcentration.KilogramsPerCubicMeter / componentDensity.KilogramsPerCubicMeter); - } - - #endregion - } } diff --git a/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs b/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs deleted file mode 100644 index 47ed64f065..0000000000 --- a/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct MassFlow - { - /// Get from times . - public static Mass operator *(MassFlow massFlow, TimeSpan time) - { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds); - } - - /// Get from times . - public static Mass operator *(TimeSpan time, MassFlow massFlow) - { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds); - } - - /// Get from times . - public static Mass operator *(MassFlow massFlow, Duration duration) - { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds); - } - - /// Get from times . - public static Mass operator *(Duration duration, MassFlow massFlow) - { - return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds); - } - - /// Get from divided by . - public static Power operator /(MassFlow massFlow, BrakeSpecificFuelConsumption bsfc) - { - return Power.FromWatts(massFlow.KilogramsPerSecond / bsfc.KilogramsPerJoule); - } - - /// Get from divided by . - public static BrakeSpecificFuelConsumption operator /(MassFlow massFlow, Power power) - { - return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(massFlow.KilogramsPerSecond / (double)power.Watts); - } - - /// Get from times . - public static Power operator *(MassFlow massFlow, SpecificEnergy specificEnergy) - { - return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram); - } - - /// Get from divided by . - public static MassFlux operator /(MassFlow massFlow, Area area) - { - return MassFlux.FromKilogramsPerSecondPerSquareMeter(massFlow.KilogramsPerSecond / area.SquareMeters); - } - - /// Get from divided by . - public static Area operator /(MassFlow massFlow, MassFlux massFlux) - { - return Area.FromSquareMeters(massFlow.KilogramsPerSecond / massFlux.KilogramsPerSecondPerSquareMeter); - } - - /// Get from divided by . - public static Density operator /(MassFlow massFlow, VolumeFlow volumeFlow) - { - return Density.FromKilogramsPerCubicMeter(massFlow.KilogramsPerSecond / volumeFlow.CubicMetersPerSecond); - } - - /// Get from divided by . - public static VolumeFlow operator /(MassFlow massFlow, Density density) - { - return VolumeFlow.FromCubicMetersPerSecond(massFlow.KilogramsPerSecond / density.KilogramsPerCubicMeter); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/MassFlux.extra.cs b/UnitsNet/CustomCode/Quantities/MassFlux.extra.cs deleted file mode 100644 index 654ce48a20..0000000000 --- a/UnitsNet/CustomCode/Quantities/MassFlux.extra.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct MassFlux - { - /// Get from divided by . - public static Density operator /(MassFlux massFlux, Speed speed) - { - return Density.FromKilogramsPerCubicMeter(massFlux.KilogramsPerSecondPerSquareMeter / speed.MetersPerSecond); - } - - /// Get from divided by . - public static Speed operator /(MassFlux massFlux, Density density) - { - return Speed.FromMetersPerSecond(massFlux.KilogramsPerSecondPerSquareMeter / density.KilogramsPerCubicMeter); - } - - /// Get from times . - public static MassFlow operator *(MassFlux massFlux, Area area) - { - return MassFlow.FromGramsPerSecond(massFlux.GramsPerSecondPerSquareMeter * area.SquareMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs b/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs index c685887214..b7c1112740 100644 --- a/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs +++ b/UnitsNet/CustomCode/Quantities/MassFraction.extra.cs @@ -35,23 +35,5 @@ public static MassFraction FromMasses(Mass componentMass, Mass mixtureMass) } #endregion - - /// Get from multiplied by a . - public static Mass operator *(MassFraction massFraction, Mass mass) - { - return Mass.FromKilograms(massFraction.DecimalFractions * mass.Kilograms); - } - - /// Get from multiplied by a . - public static Mass operator *(Mass mass, MassFraction massFraction) - { - return Mass.FromKilograms(massFraction.DecimalFractions * mass.Kilograms); - } - /// Get the total by dividing the component by a . - public static Mass operator /(Mass mass, MassFraction massFraction) - { - return Mass.FromKilograms(mass.Kilograms / massFraction.DecimalFractions); - } - } } diff --git a/UnitsNet/CustomCode/Quantities/MolarFlow.extra.cs b/UnitsNet/CustomCode/Quantities/MolarFlow.extra.cs deleted file mode 100644 index 9a69147ce3..0000000000 --- a/UnitsNet/CustomCode/Quantities/MolarFlow.extra.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace UnitsNet -{ - public partial struct MolarFlow - { - /// Get from times . - public static AmountOfSubstance operator *(MolarFlow molarFlow, TimeSpan timeSpan) - { - return AmountOfSubstance.FromKilomoles(molarFlow.KilomolesPerSecond * timeSpan.TotalSeconds); - } - - /// Get from times . - public static AmountOfSubstance operator *(MolarFlow molarFlow, Duration duration) - { - return AmountOfSubstance.FromKilomoles(molarFlow.KilomolesPerSecond * duration.Seconds); - } - - /// Get from times . - public static MassFlow operator *(MolarFlow molarFlow, MolarMass molecularWeight) - { - return MassFlow.FromKilogramsPerSecond(molarFlow.KilomolesPerSecond * molecularWeight.KilogramsPerKilomole); - } - - /// Get from divided by . - public static VolumeFlow operator /(MolarFlow molarFlow, Molarity molarity) - { - return VolumeFlow.FromCubicMetersPerSecond(molarFlow.KilomolesPerSecond / molarity.KilomolesPerCubicMeter); - } - - } -} diff --git a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs index 05bad46e43..32203f21f7 100644 --- a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs @@ -38,34 +38,5 @@ public static Molarity FromVolumeConcentration(VolumeConcentration volumeConcent } #endregion - - #region Operators - - /// Get from times the . - public static MassConcentration operator *(Molarity molarity, MolarMass componentMass) - { - return MassConcentration.FromGramsPerCubicMeter(molarity.MolesPerCubicMeter * componentMass.GramsPerMole); - } - - /// Get from times the . - public static MassConcentration operator *(MolarMass componentMass, Molarity molarity) - { - return MassConcentration.FromGramsPerCubicMeter(molarity.MolesPerCubicMeter * componentMass.GramsPerMole); - } - - /// Get from diluting the current by the given . - public static Molarity operator *(Molarity molarity, VolumeConcentration volumeConcentration) - { - return new Molarity(molarity.MolesPerCubicMeter * volumeConcentration.DecimalFractions, MolarityUnit.MolePerCubicMeter); - } - - /// Get from diluting the current by the given . - public static Molarity operator *(VolumeConcentration volumeConcentration, Molarity molarity) - { - return new Molarity(molarity.MolesPerCubicMeter * volumeConcentration.DecimalFractions, MolarityUnit.MolePerCubicMeter); - } - - #endregion - } } diff --git a/UnitsNet/CustomCode/Quantities/Power.extra.cs b/UnitsNet/CustomCode/Quantities/Power.extra.cs index 562192b2f4..b16eec0c63 100644 --- a/UnitsNet/CustomCode/Quantities/Power.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Power.extra.cs @@ -20,91 +20,5 @@ public PowerRatio ToPowerRatio() { return PowerRatio.FromPower(this); } - - /// Get from times . - public static Energy operator *(Power power, TimeSpan time) - { - return Energy.FromJoules((double)power.Watts * time.TotalSeconds); - } - - /// Get from times . - public static Energy operator *(TimeSpan time, Power power) - { - return Energy.FromJoules((double)power.Watts * time.TotalSeconds); - } - - /// Get from times . - public static Energy operator *(Power power, Duration duration) - { - return Energy.FromJoules((double)power.Watts * duration.Seconds); - } - - /// Get from times . - public static Energy operator *(Duration duration, Power power) - { - return Energy.FromJoules((double)power.Watts * duration.Seconds); - } - - /// Get from divided by . - public static Force operator /(Power power, Speed speed) - { - return Force.FromNewtons((double)power.Watts / speed.MetersPerSecond); - } - - /// Get from divided by . - public static Torque operator /(Power power, RotationalSpeed rotationalSpeed) - { - return Torque.FromNewtonMeters((double)power.Watts / rotationalSpeed.RadiansPerSecond); - } - - /// Get from divided by . - public static RotationalSpeed operator /(Power power, Torque torque) - { - return RotationalSpeed.FromRadiansPerSecond((double)power.Watts / torque.NewtonMeters); - } - - /// Get from times . - public static MassFlow operator *(Power power, BrakeSpecificFuelConsumption bsfc) - { - return MassFlow.FromKilogramsPerSecond(bsfc.KilogramsPerJoule * (double)power.Watts); - } - - /// Get from divided by . - public static SpecificEnergy operator /(Power power, MassFlow massFlow) - { - return SpecificEnergy.FromJoulesPerKilogram((double)power.Watts / massFlow.KilogramsPerSecond); - } - - /// Get from divided by . - public static MassFlow operator /(Power power, SpecificEnergy specificEnergy) - { - return MassFlow.FromKilogramsPerSecond((double)power.Watts / specificEnergy.JoulesPerKilogram); - } - - /// Get from divided by . - public static HeatFlux operator /(Power power, Area area) - { - return HeatFlux.FromWattsPerSquareMeter((double)power.Watts / area.SquareMeters); - } - - /// Get from divided by . - public static Area operator /(Power power, HeatFlux heatFlux) - { - return Area.FromSquareMeters((double)power.Watts / heatFlux.WattsPerSquareMeter ); - } - - /// Calculate from divided by . - /// Electric power is defined as P = U * I, so I = P / U. - public static ElectricCurrent operator /(Power power, ElectricPotential potential) - { - return ElectricCurrent.FromAmperes((double)power.Watts / potential.Volts); - } - - /// Calculate from divided by . - /// Electric power is defined as P = U * I, so I = P / U. - public static ElectricPotential operator /(Power power, ElectricCurrent current) - { - return ElectricPotential.FromVolts((double)power.Watts / current.Amperes); - } } } diff --git a/UnitsNet/CustomCode/Quantities/Pressure.extra.cs b/UnitsNet/CustomCode/Quantities/Pressure.extra.cs deleted file mode 100644 index 259771f8dc..0000000000 --- a/UnitsNet/CustomCode/Quantities/Pressure.extra.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct Pressure - { - /// Get from times . - public static Force operator *(Pressure pressure, Area area) - { - return Force.FromNewtons(pressure.Pascals * area.SquareMeters); - } - - /// Get from times . - public static Force operator *(Area area, Pressure pressure) - { - return Force.FromNewtons(pressure.Pascals * area.SquareMeters); - } - - /// Get from divided by . - public static Length operator /(Pressure pressure, SpecificWeight specificWeight) - { - return new Length(pressure.Pascals / specificWeight.NewtonsPerCubicMeter, UnitsNet.Units.LengthUnit.Meter); - } - - /// Get from divided by . - public static SpecificWeight operator /(Pressure pressure, Length length) - { - return new SpecificWeight(pressure.Pascals / length.Meters, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); - } - - /// Get from divided by . - public static ForcePerLength operator /(Pressure pressure, ReciprocalLength reciprocalLength) - { - return new ForcePerLength(pressure.Pascals / reciprocalLength.InverseMeters, UnitsNet.Units.ForcePerLengthUnit.NewtonPerMeter); - } - - /// Get from divided by . - public static Force operator /(Pressure pressure, ReciprocalArea reciprocalArea) - { - return new Force(pressure.Pascals / reciprocalArea.InverseSquareMeters, UnitsNet.Units.ForceUnit.Newton); - } - - /// Get from divided by - public static PressureChangeRate operator /(Pressure pressure, TimeSpan timeSpan) - { - return new PressureChangeRate(pressure.Pascals / timeSpan.TotalSeconds , UnitsNet.Units.PressureChangeRateUnit.PascalPerSecond); - } - - /// Get from divided by - public static PressureChangeRate operator /(Pressure pressure, Duration duration) - { - return new PressureChangeRate(pressure.Pascals / duration.Seconds, UnitsNet.Units.PressureChangeRateUnit.PascalPerSecond); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/PressureChangeRate.extra.cs b/UnitsNet/CustomCode/Quantities/PressureChangeRate.extra.cs deleted file mode 100644 index 1d2359459e..0000000000 --- a/UnitsNet/CustomCode/Quantities/PressureChangeRate.extra.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct PressureChangeRate - { - /// Get from times - public static Pressure operator *(PressureChangeRate pressureChangeRate, TimeSpan timeSpan) - { - return new Pressure(pressureChangeRate.PascalsPerSecond * timeSpan.TotalSeconds , UnitsNet.Units.PressureUnit.Pascal); - } - - /// Get from times - public static Pressure operator *(PressureChangeRate pressureChangeRate, Duration duration) - { - return new Pressure(pressureChangeRate.PascalsPerSecond * duration.Seconds, UnitsNet.Units.PressureUnit.Pascal); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ReciprocalArea.extra.cs b/UnitsNet/CustomCode/Quantities/ReciprocalArea.extra.cs deleted file mode 100644 index 067fd556f0..0000000000 --- a/UnitsNet/CustomCode/Quantities/ReciprocalArea.extra.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using UnitsNet.Units; - -namespace UnitsNet -{ - public partial struct ReciprocalArea - { - /// - /// Calculates the inverse of this quantity. - /// - /// The corresponding inverse quantity, . - public Area Inverse() - { - if (InverseSquareMeters == 0.0) - return new Area(0.0, AreaUnit.SquareMeter); - - return new Area(1 / InverseSquareMeters, AreaUnit.SquareMeter); - } - - /// Get from multiplied by . - public static Pressure operator *(ReciprocalArea reciprocalArea, Force force) - { - return Pressure.FromNewtonsPerSquareMeter(reciprocalArea.InverseSquareMeters * force.Newtons); - } - - /// Get from multiplied by . - public static Ratio operator *(ReciprocalArea reciprocalArea, Area area) - { - return new Ratio(reciprocalArea.InverseSquareMeters * area.SquareMeters, RatioUnit.DecimalFraction); - } - - /// Get from divided by . - public static ReciprocalLength operator /(ReciprocalArea reciprocalArea, ReciprocalLength reciprocalLength) - { - return ReciprocalLength.FromInverseMeters(reciprocalArea.InverseSquareMeters / reciprocalLength.InverseMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/ReciprocalLength.extra.cs b/UnitsNet/CustomCode/Quantities/ReciprocalLength.extra.cs deleted file mode 100644 index caf649773c..0000000000 --- a/UnitsNet/CustomCode/Quantities/ReciprocalLength.extra.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using UnitsNet.Units; - -namespace UnitsNet -{ - public partial struct ReciprocalLength - { - /// - /// Calculates the inverse of this quantity. - /// - /// The corresponding inverse quantity, . - public Length Inverse() - { - if (InverseMeters == 0.0) - return new Length(0.0, LengthUnit.Meter); - - return new Length(1 / InverseMeters, LengthUnit.Meter); - } - - /// Get from multiplied by . - public static Pressure operator *(ReciprocalLength reciprocalLength, ForcePerLength forcePerLength) - { - return Pressure.FromNewtonsPerSquareMeter(reciprocalLength.InverseMeters * forcePerLength.NewtonsPerMeter); - } - - /// Get from times . - public static ForcePerLength operator *(ReciprocalLength reciprocalLength, Force force) - { - return ForcePerLength.FromNewtonsPerMeter(reciprocalLength.InverseMeters * force.Newtons); - } - - /// Get from times . - public static ReciprocalArea operator *(ReciprocalLength reciprocalLength, ReciprocalLength other) - { - return ReciprocalArea.FromInverseSquareMeters(reciprocalLength.InverseMeters * other.InverseMeters); - } - - /// Get from times . - public static Length operator /(ReciprocalLength reciprocalLength, ReciprocalArea reciprocalArea) - { - return Length.FromMeters(reciprocalLength.InverseMeters / reciprocalArea.InverseSquareMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs deleted file mode 100644 index a1f18c79cd..0000000000 --- a/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct RotationalSpeed - { - /// Get from times . - public static Angle operator *(RotationalSpeed rotationalSpeed, TimeSpan timeSpan) - { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * timeSpan.TotalSeconds); - } - - /// Get from times . - public static Angle operator *(TimeSpan timeSpan, RotationalSpeed rotationalSpeed) - { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * timeSpan.TotalSeconds); - } - - /// Get from times . - public static Angle operator *(RotationalSpeed rotationalSpeed, Duration duration) - { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * duration.Seconds); - } - - /// Get from times . - public static Angle operator *(Duration duration, RotationalSpeed rotationalSpeed) - { - return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * duration.Seconds); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs deleted file mode 100644 index 48b9342455..0000000000 --- a/UnitsNet/CustomCode/Quantities/RotationalStiffness.extra.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct RotationalStiffness - { - /// Get from times . - public static Torque operator *(RotationalStiffness rotationalStiffness, Angle angle) - { - return Torque.FromNewtonMeters(rotationalStiffness.NewtonMetersPerRadian * angle.Radians); - } - - /// Get from divided by . - public static RotationalStiffnessPerLength operator /(RotationalStiffness rotationalStiffness, Length length) - { - return RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(rotationalStiffness.NewtonMetersPerRadian / length.Meters); - } - - /// Get from divided by . - public static Length operator /(RotationalStiffness rotationalStiffness, RotationalStiffnessPerLength rotationalStiffnessPerLength) - { - return Length.FromMeters(rotationalStiffness.NewtonMetersPerRadian / rotationalStiffnessPerLength.NewtonMetersPerRadianPerMeter); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs deleted file mode 100644 index 1aef772c05..0000000000 --- a/UnitsNet/CustomCode/Quantities/RotationalStiffnessPerLength.extra.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -// ReSharper disable once CheckNamespace -namespace UnitsNet -{ - public partial struct RotationalStiffnessPerLength - { - /// Get from times . - public static RotationalStiffness operator *(RotationalStiffnessPerLength rotationalStiffness, Length length) - { - return RotationalStiffness.FromNewtonMetersPerRadian(rotationalStiffness.NewtonMetersPerRadianPerMeter * length.Meters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/SpecificEnergy.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificEnergy.extra.cs deleted file mode 100644 index d90dcf8de5..0000000000 --- a/UnitsNet/CustomCode/Quantities/SpecificEnergy.extra.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct SpecificEnergy - { - /// Get from times . - public static Energy operator *(SpecificEnergy specificEnergy, Mass mass) - { - return Energy.FromJoules(specificEnergy.JoulesPerKilogram * mass.Kilograms); - } - - /// Get from times . - public static Energy operator *(Mass mass, SpecificEnergy specificEnergy) - { - return Energy.FromJoules(specificEnergy.JoulesPerKilogram * mass.Kilograms); - } - - /// Get from divided by . - public static BrakeSpecificFuelConsumption operator /(double value, SpecificEnergy specificEnergy) - { - return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(value / specificEnergy.JoulesPerKilogram); - } - - /// Get from times . - public static double operator *(SpecificEnergy specificEnergy, BrakeSpecificFuelConsumption bsfc) - { - return specificEnergy.JoulesPerKilogram * bsfc.KilogramsPerJoule; - } - - /// Get from times . - public static Power operator *(SpecificEnergy specificEnergy, MassFlow massFlow) - { - return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram); - } - - /// Get from divided by . - public static SpecificEntropy operator /(SpecificEnergy specificEnergy, TemperatureDelta temperatureDelta) - { - return SpecificEntropy.FromJoulesPerKilogramKelvin(specificEnergy.JoulesPerKilogram / temperatureDelta.Kelvins); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/SpecificEntropy.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificEntropy.extra.cs deleted file mode 100644 index 96b2f1e58e..0000000000 --- a/UnitsNet/CustomCode/Quantities/SpecificEntropy.extra.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct SpecificEntropy - { - /// Get from times . - public static Entropy operator *(SpecificEntropy specificEntropy, Mass mass) - { - return Entropy.FromJoulesPerKelvin(specificEntropy.JoulesPerKilogramKelvin * mass.Kilograms); - } - - /// Get from times . - public static Entropy operator *(Mass mass, SpecificEntropy specificEntropy) - { - return Entropy.FromJoulesPerKelvin(specificEntropy.JoulesPerKilogramKelvin * mass.Kilograms); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/SpecificVolume.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificVolume.extra.cs deleted file mode 100644 index f284f8bb28..0000000000 --- a/UnitsNet/CustomCode/Quantities/SpecificVolume.extra.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct SpecificVolume - { - /// Get from divided by . - public static Density operator /(double constant, SpecificVolume volume) - { - return Density.FromKilogramsPerCubicMeter(constant / volume.CubicMetersPerKilogram); - } - - /// Get from times . - public static Volume operator *(SpecificVolume volume, Mass mass) - { - return Volume.FromCubicMeters(volume.CubicMetersPerKilogram * mass.Kilograms); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs deleted file mode 100644 index 0a6bd6e6d9..0000000000 --- a/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using UnitsNet.Units; - -namespace UnitsNet -{ - public partial struct SpecificWeight - { - /// Get from times . - public static Pressure operator *(SpecificWeight specificWeight, Length length) - { - return new Pressure(specificWeight.NewtonsPerCubicMeter * length.Meters, PressureUnit.Pascal); - } - - /// Get from times . - public static ForcePerLength operator *(SpecificWeight specificWeight, Area area) - { - return new ForcePerLength(specificWeight.NewtonsPerCubicMeter * area.SquareMeters, ForcePerLengthUnit.NewtonPerMeter); - } - - /// Get from times . - public static ForcePerLength operator *(Area area, SpecificWeight specificWeight) - { - return new ForcePerLength(area.SquareMeters * specificWeight.NewtonsPerCubicMeter, ForcePerLengthUnit.NewtonPerMeter); - } - - /// Get from divided by . - public static Acceleration operator /(SpecificWeight specificWeight, Density density) - { - return new Acceleration(specificWeight.NewtonsPerCubicMeter / density.KilogramsPerCubicMeter, AccelerationUnit.MeterPerSecondSquared); - } - - /// Get from divided by . - public static Density operator /(SpecificWeight specific, Acceleration acceleration) - { - return new Density(specific.NewtonsPerCubicMeter / acceleration.MetersPerSecondSquared, DensityUnit.KilogramPerCubicMeter); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Speed.extra.cs b/UnitsNet/CustomCode/Quantities/Speed.extra.cs deleted file mode 100644 index b46031ab8d..0000000000 --- a/UnitsNet/CustomCode/Quantities/Speed.extra.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct Speed - { - /// Get from divided by . - public static Acceleration operator /(Speed speed, TimeSpan timeSpan) - { - return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / timeSpan.TotalSeconds); - } - - /// Get from times . - public static Length operator *(Speed speed, TimeSpan timeSpan) - { - return Length.FromMeters(speed.MetersPerSecond * timeSpan.TotalSeconds); - } - - /// Get from times . - public static Length operator *(TimeSpan timeSpan, Speed speed) - { - return Length.FromMeters(speed.MetersPerSecond * timeSpan.TotalSeconds); - } - - /// Get from divided by . - public static Acceleration operator /(Speed speed, Duration duration) - { - return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / duration.Seconds); - } - - /// Get from divided by . - public static Duration operator /(Speed speed, Acceleration acceleration) - { - return Duration.FromSeconds(speed.MetersPerSecond / acceleration.MetersPerSecondSquared); - } - - /// Get from times . - public static Length operator *(Speed speed, Duration duration) - { - return Length.FromMeters(speed.MetersPerSecond * duration.Seconds); - } - - /// Get from times . - public static Length operator *(Duration duration, Speed speed) - { - return Length.FromMeters(speed.MetersPerSecond * duration.Seconds); - } - - /// Get from times . - public static KinematicViscosity operator *(Speed speed, Length length) - { - return KinematicViscosity.FromSquareMetersPerSecond(length.Meters * speed.MetersPerSecond); - } - - /// Get from times . - public static SpecificEnergy operator *(Speed left, Speed right) - { - return SpecificEnergy.FromJoulesPerKilogram(left.MetersPerSecond * right.MetersPerSecond); - } - - /// Get from times . - public static MassFlux operator *(Speed speed, Density density) - { - return MassFlux.FromKilogramsPerSecondPerSquareMeter(speed.MetersPerSecond * density.KilogramsPerCubicMeter); - } - - /// Get from times . - public static VolumeFlow operator *(Speed speed, Area area) - { - return VolumeFlow.FromCubicMetersPerSecond(speed.MetersPerSecond * area.SquareMeters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/TemperatureChangeRate.extra.cs b/UnitsNet/CustomCode/Quantities/TemperatureChangeRate.extra.cs deleted file mode 100644 index 04f36df7bf..0000000000 --- a/UnitsNet/CustomCode/Quantities/TemperatureChangeRate.extra.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct TemperatureChangeRate - { - /// Get from times . - public static TemperatureDelta operator *(Duration left, TemperatureChangeRate right) => right * left; - - /// Get from times . - public static TemperatureDelta operator *(TemperatureChangeRate left, Duration right) - { - return TemperatureDelta.FromDegreesCelsius(left.DegreesCelsiusPerSecond * right.Seconds); - } - - - /// Get from times . - public static TemperatureDelta operator *(TimeSpan left, TemperatureChangeRate right) => right * left; - - /// Get from times . - public static TemperatureDelta operator *(TemperatureChangeRate left, TimeSpan right) - { - return TemperatureDelta.FromDegreesCelsius(left.DegreesCelsiusPerSecond * right.TotalSeconds); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs b/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs deleted file mode 100644 index e126f14d29..0000000000 --- a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct TemperatureDelta - { - /// Get from divided by . - public static TemperatureGradient operator /(TemperatureDelta left, Length right) - { - return TemperatureGradient.FromKelvinsPerMeter(left.Kelvins / right.Meters); - } - - /// Get from times . - public static SpecificEnergy operator *(SpecificEntropy specificEntropy, TemperatureDelta temperatureDelta) - { - return SpecificEnergy.FromJoulesPerKilogram(specificEntropy.JoulesPerKilogramKelvin * temperatureDelta.Kelvins); - } - - /// Get from times . - public static SpecificEnergy operator *(TemperatureDelta temperatureDelta, SpecificEntropy specificEntropy) - { - return specificEntropy * temperatureDelta; - } - - /// Get from times . - public static Energy operator *(Entropy entropy, TemperatureDelta temperatureDelta) - { - return Energy.FromJoules(entropy.JoulesPerKelvin * temperatureDelta.Kelvins); - } - - /// Get from times . - public static Energy operator *(TemperatureDelta temperatureDelta, Entropy entropy) - { - return Energy.FromJoules(entropy.JoulesPerKelvin * temperatureDelta.Kelvins); - } - - /// Get a scalar from a multiplied by a . - public static double operator *(TemperatureDelta temperatureDelta, CoefficientOfThermalExpansion cte) - { - return temperatureDelta.Kelvins * cte.PerKelvin; - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/TemperatureGradient.extra.cs b/UnitsNet/CustomCode/Quantities/TemperatureGradient.extra.cs deleted file mode 100644 index 468c9f2902..0000000000 --- a/UnitsNet/CustomCode/Quantities/TemperatureGradient.extra.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct TemperatureGradient - { - /// Get from divided by . - public static Length operator /(TemperatureDelta left, TemperatureGradient right) - { - return Length.FromKilometers(left.Kelvins / right.DegreesCelsiusPerKilometer); - } - - /// Get from times . - public static TemperatureDelta operator *(Length left, TemperatureGradient right) => right * left; - - /// Get from times . - public static TemperatureDelta operator *(TemperatureGradient left, Length right) - { - return TemperatureDelta.FromDegreesCelsius(left.DegreesCelsiusPerKilometer * right.Kilometers); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Torque.extra.cs b/UnitsNet/CustomCode/Quantities/Torque.extra.cs deleted file mode 100644 index 26bd4f551b..0000000000 --- a/UnitsNet/CustomCode/Quantities/Torque.extra.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -namespace UnitsNet -{ - public partial struct Torque - { - /// Get from times . - public static Force operator /(Torque torque, Length length) - { - return Force.FromNewtons(torque.NewtonMeters / length.Meters); - } - - /// Get from times . - public static Length operator /(Torque torque, Force force) - { - return Length.FromMeters(torque.NewtonMeters / force.Newtons); - } - - /// Get from times . - public static RotationalStiffness operator /(Torque torque, Angle angle) - { - return RotationalStiffness.FromNewtonMetersPerRadian(torque.NewtonMeters / angle.Radians); - } - - /// Get from times . - public static Angle operator /(Torque torque, RotationalStiffness rotationalStiffness) - { - return Angle.FromRadians(torque.NewtonMeters / rotationalStiffness.NewtonMetersPerRadian); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Volume.extra.cs b/UnitsNet/CustomCode/Quantities/Volume.extra.cs index aab43915a4..88d6bf2a51 100644 --- a/UnitsNet/CustomCode/Quantities/Volume.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Volume.extra.cs @@ -7,30 +7,6 @@ namespace UnitsNet { public partial struct Volume { - /// Get from divided by . - public static Area operator /(Volume volume, Length length) - { - return Area.FromSquareMeters(volume.CubicMeters / length.Meters); - } - - /// Get from divided by . - public static Length operator /(Volume volume, Area area) - { - return Length.FromMeters(volume.CubicMeters / area.SquareMeters); - } - - /// Get from divided by . - public static VolumeFlow operator /(Volume volume, Duration duration) - { - return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / duration.Seconds); - } - - /// Get from divided by . - public static VolumeFlow operator /(Volume volume, TimeSpan timeSpan) - { - return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / timeSpan.TotalSeconds); - } - /// Get from divided by . public static TimeSpan operator /(Volume volume, VolumeFlow volumeFlow) { diff --git a/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs b/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs index fed1b0ca30..205acf77e3 100644 --- a/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/VolumeConcentration.extra.cs @@ -47,22 +47,5 @@ public static VolumeConcentration FromMolarity(Molarity molarity, Density compon } #endregion - - #region Operators - - /// Get from times the component . - public static MassConcentration operator *(VolumeConcentration volumeConcentration, Density componentDensity) - { - return MassConcentration.FromKilogramsPerCubicMeter(volumeConcentration.DecimalFractions * componentDensity.KilogramsPerCubicMeter); - } - - /// Get from times the component . - public static MassConcentration operator *(Density componentDensity, VolumeConcentration volumeConcentration) - { - return MassConcentration.FromKilogramsPerCubicMeter(volumeConcentration.DecimalFractions * componentDensity.KilogramsPerCubicMeter); - } - - #endregion - } } diff --git a/UnitsNet/CustomCode/Quantities/VolumeFlow.extra.cs b/UnitsNet/CustomCode/Quantities/VolumeFlow.extra.cs deleted file mode 100644 index 51e71e8180..0000000000 --- a/UnitsNet/CustomCode/Quantities/VolumeFlow.extra.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed under MIT No Attribution, see LICENSE file at the root. -// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. - -using System; - -namespace UnitsNet -{ - public partial struct VolumeFlow - { - /// Get from times . - public static Volume operator *(VolumeFlow volumeFlow, TimeSpan timeSpan) - { - return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * timeSpan.TotalSeconds); - } - - /// Get from times . - public static Volume operator *(VolumeFlow volumeFlow, Duration duration) - { - return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); - } - - /// Get from divided by . - public static Speed operator /(VolumeFlow volumeFlow, Area area) - { - return Speed.FromMetersPerSecond(volumeFlow.CubicMetersPerSecond / area.SquareMeters); - } - - /// Get from divided by . - public static Area operator /(VolumeFlow volumeFlow, Speed speed) - { - return Area.FromSquareMeters(volumeFlow.CubicMetersPerSecond / speed.MetersPerSecond); - } - - /// Get from times . - public static MassFlow operator *(VolumeFlow volumeFlow, Density density) - { - return MassFlow.FromKilogramsPerSecond(volumeFlow.CubicMetersPerSecond * density.KilogramsPerCubicMeter); - } - - /// Get from times . - public static MassFlow operator *(Density density, VolumeFlow volumeFlow) - { - return MassFlow.FromKilogramsPerSecond(volumeFlow.CubicMetersPerSecond * density.KilogramsPerCubicMeter); - } - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index f0cabde7d0..82cd08f957 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,14 @@ namespace UnitsNet [DataContract] public readonly partial struct Acceleration : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -664,6 +675,52 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Accel #endregion + #region Relational Operators + + /// Get from * . + public static Force operator *(Acceleration acceleration, Mass mass) + { + return Force.FromNewtons(acceleration.MetersPerSecondSquared * mass.Kilograms); + } + + /// Get from / . + public static Jerk operator /(Acceleration acceleration, Duration duration) + { + return Jerk.FromMetersPerSecondCubed(acceleration.MetersPerSecondSquared / duration.Seconds); + } + + /// Get from / . + public static Jerk operator /(Acceleration acceleration, TimeSpan timeSpan) + { + return Jerk.FromMetersPerSecondCubed(acceleration.MetersPerSecondSquared / timeSpan.TotalSeconds); + } + + /// Get from * . + public static SpecificWeight operator *(Acceleration acceleration, Density density) + { + return SpecificWeight.FromNewtonsPerCubicMeter(acceleration.MetersPerSecondSquared * density.KilogramsPerCubicMeter); + } + + /// Get from * . + public static Speed operator *(Acceleration acceleration, Duration duration) + { + return Speed.FromMetersPerSecond(acceleration.MetersPerSecondSquared * duration.Seconds); + } + + /// Get from * . + public static Speed operator *(Acceleration acceleration, TimeSpan timeSpan) + { + return Speed.FromMetersPerSecond(acceleration.MetersPerSecondSquared * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Speed operator *(TimeSpan timeSpan, Acceleration acceleration) + { + return Speed.FromMetersPerSecond(timeSpan.TotalSeconds * acceleration.MetersPerSecondSquared); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index ae7e21055f..4a0f4a288e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,11 @@ namespace UnitsNet [DataContract] public readonly partial struct AmountOfSubstance : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -718,6 +726,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Amoun #endregion + #region Relational Operators + + /// Get from * . + public static Mass operator *(AmountOfSubstance amountOfSubstance, MolarMass molarMass) + { + return Mass.FromGrams(amountOfSubstance.Moles * molarMass.GramsPerMole); + } + + /// Get from / . + public static Molarity operator /(AmountOfSubstance amountOfSubstance, Volume volume) + { + return Molarity.FromMolesPerCubicMeter(amountOfSubstance.Moles / volume.CubicMeters); + } + + /// Get from / . + public static Volume operator /(AmountOfSubstance amountOfSubstance, Molarity molarity) + { + return Volume.FromCubicMeters(amountOfSubstance.Moles / molarity.MolesPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 9621cc606b..5bfb70c16a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,11 @@ namespace UnitsNet [DataContract] public readonly partial struct Angle : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -700,6 +708,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Angle #endregion + #region Relational Operators + + /// Get from / . + public static RotationalSpeed operator /(Angle angle, Duration duration) + { + return RotationalSpeed.FromRadiansPerSecond(angle.Radians / duration.Seconds); + } + + /// Get from / . + public static RotationalSpeed operator /(Angle angle, TimeSpan timeSpan) + { + return RotationalSpeed.FromRadiansPerSecond(angle.Radians / timeSpan.TotalSeconds); + } + + /// Get from * . + public static Torque operator *(Angle angle, RotationalStiffness rotationalStiffness) + { + return Torque.FromNewtonMeters(angle.Radians * rotationalStiffness.NewtonMetersPerRadian); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index b8736078a1..2e1bd2d4db 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,20 @@ namespace UnitsNet [DataContract] public readonly partial struct Area : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -664,6 +681,89 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaU #endregion + #region Relational Operators + + /// Get from * . + public static Force operator *(Area area, Pressure pressure) + { + return Force.FromNewtons(area.SquareMeters * pressure.Pascals); + } + + /// Get from * . + public static ForcePerLength operator *(Area area, SpecificWeight specificWeight) + { + return ForcePerLength.FromNewtonsPerMeter(area.SquareMeters * specificWeight.NewtonsPerCubicMeter); + } + + /// Get from / . + public static Length operator /(Area area, Length length) + { + return Length.FromMeters(area.SquareMeters / length.Meters); + } + + /// Get from * . + public static LinearDensity operator *(Area area, Density density) + { + return LinearDensity.FromKilogramsPerMeter(area.SquareMeters * density.KilogramsPerCubicMeter); + } + + /// Get from * . + public static LuminousIntensity operator *(Area area, Luminance luminance) + { + return LuminousIntensity.FromCandela(area.SquareMeters * luminance.CandelasPerSquareMeter); + } + + /// Get from * . + public static Mass operator *(Area area, AreaDensity areaDensity) + { + return Mass.FromKilograms(area.SquareMeters * areaDensity.KilogramsPerSquareMeter); + } + + /// Get from * . + public static MassFlow operator *(Area area, MassFlux massFlux) + { + return MassFlow.FromGramsPerSecond(area.SquareMeters * massFlux.GramsPerSecondPerSquareMeter); + } + + /// Get from * . + public static Power operator *(Area area, HeatFlux heatFlux) + { + return Power.FromWatts(area.SquareMeters * heatFlux.WattsPerSquareMeter); + } + + /// Get from * . + public static Ratio operator *(Area area, ReciprocalArea reciprocalArea) + { + return Ratio.FromDecimalFractions(area.SquareMeters * reciprocalArea.InverseSquareMeters); + } + + /// Calculates the inverse of this quantity. + /// The corresponding inverse quantity, . + public ReciprocalArea Inverse() + { + return SquareMeters == 0.0 ? ReciprocalArea.Zero : ReciprocalArea.FromInverseSquareMeters(1 / SquareMeters); + } + + /// Get from * . + public static Torque operator *(Area area, ForcePerLength forcePerLength) + { + return Torque.FromNewtonMeters(area.SquareMeters * forcePerLength.NewtonsPerMeter); + } + + /// Get from * . + public static Volume operator *(Area area, Length length) + { + return Volume.FromCubicMeters(area.SquareMeters * length.Meters); + } + + /// Get from * . + public static VolumeFlow operator *(Area area, Speed speed) + { + return VolumeFlow.FromCubicMetersPerSecond(area.SquareMeters * speed.MetersPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index b14ae6d232..e055232358 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct AreaDensity : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -466,6 +472,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaD #endregion + #region Relational Operators + + /// Get from * . + public static Mass operator *(AreaDensity areaDensity, Area area) + { + return Mass.FromKilograms(areaDensity.KilogramsPerSquareMeter * area.SquareMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 37d5b60326..3946253a3d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct AreaMomentOfInertia : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -520,6 +526,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaM #endregion + #region Relational Operators + + /// Get from / . + public static Volume operator /(AreaMomentOfInertia areaMomentOfInertia, Length length) + { + return Volume.FromCubicMeters(areaMomentOfInertia.MetersToTheFourth / length.Meters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 86e4fc0b8d..d2a38fc8de 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct BrakeSpecificFuelConsumption : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -466,6 +473,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Brake #endregion + #region Relational Operators + + /// Get from * . + public static MassFlow operator *(BrakeSpecificFuelConsumption brakeSpecificFuelConsumption, Power power) + { + return MassFlow.FromKilogramsPerSecond(brakeSpecificFuelConsumption.KilogramsPerJoule * (double)power.Watts); + } + + /// Get from / . + public static SpecificEnergy operator /(double value, BrakeSpecificFuelConsumption brakeSpecificFuelConsumption) + { + return SpecificEnergy.FromJoulesPerKilogram(value / brakeSpecificFuelConsumption.KilogramsPerJoule); + } + + /// Get from * . + public static double operator *(BrakeSpecificFuelConsumption brakeSpecificFuelConsumption, SpecificEnergy specificEnergy) + { + return brakeSpecificFuelConsumption.KilogramsPerJoule * specificEnergy.JoulesPerKilogram; + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index e99ed813d4..9624136a81 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct CoefficientOfThermalExpansion : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -580,6 +586,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Coeff #endregion + #region Relational Operators + + /// Get from * . + public static double operator *(CoefficientOfThermalExpansion coefficientOfThermalExpansion, TemperatureDelta temperatureDelta) + { + return coefficientOfThermalExpansion.PerKelvin * temperatureDelta.Kelvins; + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 99d758e9ea..091e1606f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,15 @@ namespace UnitsNet [DataContract] public readonly partial struct Density : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -1423,6 +1435,52 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Densi #endregion + #region Relational Operators + + /// Get from * . + public static DynamicViscosity operator *(Density density, KinematicViscosity kinematicViscosity) + { + return DynamicViscosity.FromNewtonSecondsPerMeterSquared(density.KilogramsPerCubicMeter * kinematicViscosity.SquareMetersPerSecond); + } + + /// Get from * . + public static LinearDensity operator *(Density density, Area area) + { + return LinearDensity.FromKilogramsPerMeter(density.KilogramsPerCubicMeter * area.SquareMeters); + } + + /// Get from * . + public static Mass operator *(Density density, Volume volume) + { + return Mass.FromKilograms(density.KilogramsPerCubicMeter * volume.CubicMeters); + } + + /// Get from * . + public static MassConcentration operator *(Density density, VolumeConcentration volumeConcentration) + { + return MassConcentration.FromKilogramsPerCubicMeter(density.KilogramsPerCubicMeter * volumeConcentration.DecimalFractions); + } + + /// Get from * . + public static MassFlow operator *(Density density, VolumeFlow volumeFlow) + { + return MassFlow.FromKilogramsPerSecond(density.KilogramsPerCubicMeter * volumeFlow.CubicMetersPerSecond); + } + + /// Get from * . + public static MassFlux operator *(Density density, Speed speed) + { + return MassFlux.FromKilogramsPerSecondPerSquareMeter(density.KilogramsPerCubicMeter * speed.MetersPerSecond); + } + + /// Get from * . + public static SpecificWeight operator *(Density density, Acceleration acceleration) + { + return SpecificWeight.FromNewtonsPerCubicMeter(density.KilogramsPerCubicMeter * acceleration.MetersPerSecondSquared); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 69319efff5..23f5ca369f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,21 @@ namespace UnitsNet [DataContract] public readonly partial struct Duration : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -610,6 +628,88 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Durat #endregion + #region Relational Operators + + /// Get from * . + public static AmountOfSubstance operator *(Duration duration, MolarFlow molarFlow) + { + return AmountOfSubstance.FromKilomoles(duration.Seconds * molarFlow.KilomolesPerSecond); + } + + /// Get from * . + public static Angle operator *(Duration duration, RotationalSpeed rotationalSpeed) + { + return Angle.FromRadians(duration.Seconds * rotationalSpeed.RadiansPerSecond); + } + + /// Get from * . + public static Area operator *(Duration duration, KinematicViscosity kinematicViscosity) + { + return Area.FromSquareMeters(duration.Seconds * kinematicViscosity.SquareMetersPerSecond); + } + + /// Get from * . + public static ElectricCharge operator *(Duration duration, ElectricCurrent electricCurrent) + { + return ElectricCharge.FromAmpereHours(duration.Hours * electricCurrent.Amperes); + } + + /// Get from * . + public static ElectricCurrent operator *(Duration duration, ElectricCurrentGradient electricCurrentGradient) + { + return ElectricCurrent.FromAmperes(duration.Seconds * electricCurrentGradient.AmperesPerSecond); + } + + /// Get from * . + public static Energy operator *(Duration duration, Power power) + { + return Energy.FromJoules(duration.Seconds * (double)power.Watts); + } + + /// Get from * . + public static Force operator *(Duration duration, ForceChangeRate forceChangeRate) + { + return Force.FromNewtons(duration.Seconds * forceChangeRate.NewtonsPerSecond); + } + + /// Get from * . + public static Length operator *(Duration duration, Speed speed) + { + return Length.FromMeters(duration.Seconds * speed.MetersPerSecond); + } + + /// Get from * . + public static Mass operator *(Duration duration, MassFlow massFlow) + { + return Mass.FromKilograms(duration.Seconds * massFlow.KilogramsPerSecond); + } + + /// Get from * . + public static Pressure operator *(Duration duration, PressureChangeRate pressureChangeRate) + { + return Pressure.FromPascals(duration.Seconds * pressureChangeRate.PascalsPerSecond); + } + + /// Get from * . + public static Speed operator *(Duration duration, Acceleration acceleration) + { + return Speed.FromMetersPerSecond(duration.Seconds * acceleration.MetersPerSecondSquared); + } + + /// Get from * . + public static TemperatureDelta operator *(Duration duration, TemperatureChangeRate temperatureChangeRate) + { + return TemperatureDelta.FromDegreesCelsius(duration.Seconds * temperatureChangeRate.DegreesCelsiusPerSecond); + } + + /// Get from * . + public static Volume operator *(Duration duration, VolumeFlow volumeFlow) + { + return Volume.FromCubicMeters(duration.Seconds * volumeFlow.CubicMetersPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 38e4aeba1f..817c95d006 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,9 @@ namespace UnitsNet [DataContract] public readonly partial struct DynamicViscosity : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -595,6 +601,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Dynam #endregion + #region Relational Operators + + /// Get from / . + public static KinematicViscosity operator /(DynamicViscosity dynamicViscosity, Density density) + { + return KinematicViscosity.FromSquareMetersPerSecond(dynamicViscosity.NewtonSecondsPerMeterSquared / density.KilogramsPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 182ff4d5b3..01d6a795d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,12 @@ namespace UnitsNet [DataContract] public readonly partial struct ElectricCharge : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -613,6 +622,34 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect #endregion + #region Relational Operators + + /// Get from / . + public static Duration operator /(ElectricCharge electricCharge, ElectricCurrent electricCurrent) + { + return Duration.FromHours(electricCharge.AmpereHours / electricCurrent.Amperes); + } + + /// Get from / . + public static ElectricCurrent operator /(ElectricCharge electricCharge, Duration duration) + { + return ElectricCurrent.FromAmperes(electricCharge.AmpereHours / duration.Hours); + } + + /// Get from / . + public static ElectricCurrent operator /(ElectricCharge electricCharge, TimeSpan timeSpan) + { + return ElectricCurrent.FromAmperes(electricCharge.AmpereHours / timeSpan.TotalHours); + } + + /// Get from * . + public static Energy operator *(ElectricCharge electricCharge, ElectricPotential electricPotential) + { + return Energy.FromJoules(electricCharge.Coulombs * electricPotential.Volts); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index 4a511c980d..171e7fe67c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -523,6 +523,17 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect #endregion + #region Relational Operators + + /// Calculates the inverse of this quantity. + /// The corresponding inverse quantity, . + public ElectricResistivity Inverse() + { + return SiemensPerMeter == 0.0 ? ElectricResistivity.Zero : ElectricResistivity.FromOhmMeters(1 / SiemensPerMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 1c0345e7f3..bcf22620a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,14 @@ namespace UnitsNet [DataContract] public readonly partial struct ElectricCurrent : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -574,6 +585,52 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect #endregion + #region Relational Operators + + /// Get from * . + public static ElectricCharge operator *(ElectricCurrent electricCurrent, Duration duration) + { + return ElectricCharge.FromAmpereHours(electricCurrent.Amperes * duration.Hours); + } + + /// Get from * . + public static ElectricCharge operator *(ElectricCurrent electricCurrent, TimeSpan timeSpan) + { + return ElectricCharge.FromAmpereHours(electricCurrent.Amperes * timeSpan.TotalHours); + } + + /// Get from * . + public static ElectricCharge operator *(TimeSpan timeSpan, ElectricCurrent electricCurrent) + { + return ElectricCharge.FromAmpereHours(timeSpan.TotalHours * electricCurrent.Amperes); + } + + /// Get from / . + public static ElectricCurrentGradient operator /(ElectricCurrent electricCurrent, Duration duration) + { + return ElectricCurrentGradient.FromAmperesPerSecond(electricCurrent.Amperes / duration.Seconds); + } + + /// Get from / . + public static ElectricCurrentGradient operator /(ElectricCurrent electricCurrent, TimeSpan timeSpan) + { + return ElectricCurrentGradient.FromAmperesPerSecond(electricCurrent.Amperes / timeSpan.TotalSeconds); + } + + /// Get from * . + public static ElectricPotential operator *(ElectricCurrent electricCurrent, ElectricResistance electricResistance) + { + return ElectricPotential.FromVolts(electricCurrent.Amperes * electricResistance.Ohms); + } + + /// Get from * . + public static Power operator *(ElectricCurrent electricCurrent, ElectricPotential electricPotential) + { + return Power.FromWatts(electricCurrent.Amperes * electricPotential.Volts); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 87e82436ea..8298166188 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct ElectricCurrentGradient : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -538,6 +545,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect #endregion + #region Relational Operators + + /// Get from * . + public static ElectricCurrent operator *(ElectricCurrentGradient electricCurrentGradient, Duration duration) + { + return ElectricCurrent.FromAmperes(electricCurrentGradient.AmperesPerSecond * duration.Seconds); + } + + /// Get from * . + public static ElectricCurrent operator *(ElectricCurrentGradient electricCurrentGradient, TimeSpan timeSpan) + { + return ElectricCurrent.FromAmperes(electricCurrentGradient.AmperesPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static ElectricCurrent operator *(TimeSpan timeSpan, ElectricCurrentGradient electricCurrentGradient) + { + return ElectricCurrent.FromAmperes(timeSpan.TotalSeconds * electricCurrentGradient.AmperesPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 0ca85795d4..dd3983378f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,12 @@ namespace UnitsNet [DataContract] public readonly partial struct ElectricPotential : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -520,6 +529,34 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect #endregion + #region Relational Operators + + /// Get from / . + public static ElectricCurrent operator /(ElectricPotential electricPotential, ElectricResistance electricResistance) + { + return ElectricCurrent.FromAmperes(electricPotential.Volts / electricResistance.Ohms); + } + + /// Get from / . + public static ElectricResistance operator /(ElectricPotential electricPotential, ElectricCurrent electricCurrent) + { + return ElectricResistance.FromOhms(electricPotential.Volts / electricCurrent.Amperes); + } + + /// Get from * . + public static Energy operator *(ElectricPotential electricPotential, ElectricCharge electricCharge) + { + return Energy.FromJoules(electricPotential.Volts * electricCharge.Coulombs); + } + + /// Get from * . + public static Power operator *(ElectricPotential electricPotential, ElectricCurrent electricCurrent) + { + return Power.FromWatts(electricPotential.Volts * electricCurrent.Amperes); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 069df82a5e..dfdbb436cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct ElectricResistance : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -538,6 +544,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect #endregion + #region Relational Operators + + /// Get from * . + public static ElectricPotential operator *(ElectricResistance electricResistance, ElectricCurrent electricCurrent) + { + return ElectricPotential.FromVolts(electricResistance.Ohms * electricCurrent.Amperes); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 6a3d689c08..a768739661 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -667,6 +667,17 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect #endregion + #region Relational Operators + + /// Calculates the inverse of this quantity. + /// The corresponding inverse quantity, . + public ElectricConductivity Inverse() + { + return OhmMeters == 0.0 ? ElectricConductivity.Zero : ElectricConductivity.FromSiemensPerMeter(1 / OhmMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 69b240fe68..5ecdc6dee6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,18 @@ namespace UnitsNet [DataContract] public readonly partial struct Energy : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -1132,6 +1147,70 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Energ #endregion + #region Relational Operators + + /// Get from / . + public static Duration operator /(Energy energy, Power power) + { + return Duration.FromSeconds(energy.Joules / (double)power.Watts); + } + + /// Get from / . + public static ElectricCharge operator /(Energy energy, ElectricPotential electricPotential) + { + return ElectricCharge.FromCoulombs(energy.Joules / electricPotential.Volts); + } + + /// Get from / . + public static ElectricPotential operator /(Energy energy, ElectricCharge electricCharge) + { + return ElectricPotential.FromVolts(energy.Joules / electricCharge.Coulombs); + } + + /// Get from / . + public static Entropy operator /(Energy energy, TemperatureDelta temperatureDelta) + { + return Entropy.FromJoulesPerKelvin(energy.Joules / temperatureDelta.Kelvins); + } + + /// Get from / . + public static Mass operator /(Energy energy, SpecificEnergy specificEnergy) + { + return Mass.FromKilograms(energy.Joules / specificEnergy.JoulesPerKilogram); + } + + /// Get from * . + public static Power operator *(Energy energy, Frequency frequency) + { + return Power.FromWatts(energy.Joules * frequency.PerSecond); + } + + /// Get from / . + public static Power operator /(Energy energy, Duration duration) + { + return Power.FromWatts(energy.Joules / duration.Seconds); + } + + /// Get from / . + public static Power operator /(Energy energy, TimeSpan timeSpan) + { + return Power.FromWatts(energy.Joules / timeSpan.TotalSeconds); + } + + /// Get from / . + public static SpecificEnergy operator /(Energy energy, Mass mass) + { + return SpecificEnergy.FromJoulesPerKilogram(energy.Joules / mass.Kilograms); + } + + /// Get from / . + public static TemperatureDelta operator /(Energy energy, Entropy entropy) + { + return TemperatureDelta.FromKelvins(energy.Joules / entropy.JoulesPerKelvin); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs index 6e464bed84..7200c3d2e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct EnergyDensity : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -628,6 +634,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Energ #endregion + #region Relational Operators + + /// Get from * . + public static Energy operator *(EnergyDensity energyDensity, Volume volume) + { + return Energy.FromJoules(energyDensity.JoulesPerCubicMeter * volume.CubicMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 1badb61a6e..3fdd8dc5c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct Entropy : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -538,6 +545,22 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Entro #endregion + #region Relational Operators + + /// Get from * . + public static Energy operator *(Entropy entropy, TemperatureDelta temperatureDelta) + { + return Energy.FromJoules(entropy.JoulesPerKelvin * temperatureDelta.Kelvins); + } + + /// Get from / . + public static SpecificEntropy operator /(Entropy entropy, Mass mass) + { + return SpecificEntropy.FromJoulesPerKilogramKelvin(entropy.JoulesPerKelvin / mass.Kilograms); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index b6194be0a9..b051006985 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,18 @@ namespace UnitsNet [DataContract] public readonly partial struct Force : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -682,6 +697,70 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force #endregion + #region Relational Operators + + /// Get from / . + public static Acceleration operator /(Force force, Mass mass) + { + return Acceleration.FromMetersPerSecondSquared(force.Newtons / mass.Kilograms); + } + + /// Get from / . + public static Duration operator /(Force force, ForceChangeRate forceChangeRate) + { + return Duration.FromSeconds(force.Newtons / forceChangeRate.NewtonsPerSecond); + } + + /// Get from * . + public static ForcePerLength operator *(Force force, ReciprocalLength reciprocalLength) + { + return ForcePerLength.FromNewtonsPerMeter(force.Newtons * reciprocalLength.InverseMeters); + } + + /// Get from / . + public static ForcePerLength operator /(Force force, Length length) + { + return ForcePerLength.FromNewtonsPerMeter(force.Newtons / length.Meters); + } + + /// Get from / . + public static Length operator /(Force force, ForcePerLength forcePerLength) + { + return Length.FromMeters(force.Newtons / forcePerLength.NewtonsPerMeter); + } + + /// Get from / . + public static Mass operator /(Force force, Acceleration acceleration) + { + return Mass.FromKilograms(force.Newtons / acceleration.MetersPerSecondSquared); + } + + /// Get from * . + public static Power operator *(Force force, Speed speed) + { + return Power.FromWatts(force.Newtons * speed.MetersPerSecond); + } + + /// Get from * . + public static Pressure operator *(Force force, ReciprocalArea reciprocalArea) + { + return Pressure.FromNewtonsPerSquareMeter(force.Newtons * reciprocalArea.InverseSquareMeters); + } + + /// Get from / . + public static Pressure operator /(Force force, Area area) + { + return Pressure.FromPascals(force.Newtons / area.SquareMeters); + } + + /// Get from * . + public static Torque operator *(Force force, Length length) + { + return Torque.FromNewtonMeters(force.Newtons * length.Meters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 4895eefd75..4519c95dec 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct ForceChangeRate : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -682,6 +689,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force #endregion + #region Relational Operators + + /// Get from * . + public static Force operator *(ForceChangeRate forceChangeRate, Duration duration) + { + return Force.FromNewtons(forceChangeRate.NewtonsPerSecond * duration.Seconds); + } + + /// Get from * . + public static Force operator *(ForceChangeRate forceChangeRate, TimeSpan timeSpan) + { + return Force.FromNewtons(forceChangeRate.NewtonsPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Force operator *(TimeSpan timeSpan, ForceChangeRate forceChangeRate) + { + return Force.FromNewtons(timeSpan.TotalSeconds * forceChangeRate.NewtonsPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index e5aa697de2..271abd4ff4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,13 @@ namespace UnitsNet [DataContract] public readonly partial struct ForcePerLength : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -1096,6 +1106,40 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force #endregion + #region Relational Operators + + /// Get from * . + public static Force operator *(ForcePerLength forcePerLength, Length length) + { + return Force.FromNewtons(forcePerLength.NewtonsPerMeter * length.Meters); + } + + /// Get from / . + public static Force operator /(ForcePerLength forcePerLength, ReciprocalLength reciprocalLength) + { + return Force.FromNewtons(forcePerLength.NewtonsPerMeter / reciprocalLength.InverseMeters); + } + + /// Get from * . + public static Pressure operator *(ForcePerLength forcePerLength, ReciprocalLength reciprocalLength) + { + return Pressure.FromNewtonsPerSquareMeter(forcePerLength.NewtonsPerMeter * reciprocalLength.InverseMeters); + } + + /// Get from / . + public static Pressure operator /(ForcePerLength forcePerLength, Length length) + { + return Pressure.FromNewtonsPerSquareMeter(forcePerLength.NewtonsPerMeter / length.Meters); + } + + /// Get from * . + public static Torque operator *(ForcePerLength forcePerLength, Area area) + { + return Torque.FromNewtonMeters(forcePerLength.NewtonsPerMeter * area.SquareMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 749f1cfbf6..ac5fb15c23 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct Frequency : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -646,6 +652,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Frequ #endregion + #region Relational Operators + + /// Get from * . + public static Power operator *(Frequency frequency, Energy energy) + { + return Power.FromWatts(frequency.PerSecond * energy.Joules); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 9c567936fa..041f94fbbd 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct HeatFlux : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -736,6 +742,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out HeatF #endregion + #region Relational Operators + + /// Get from * . + public static Power operator *(HeatFlux heatFlux, Area area) + { + return Power.FromWatts(heatFlux.WattsPerSquareMeter * area.SquareMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index 0b7d2db502..9c57ad8ecc 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,12 @@ namespace UnitsNet [DataContract] public readonly partial struct KinematicViscosity : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -577,6 +586,40 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Kinem #endregion + #region Relational Operators + + /// Get from * . + public static Area operator *(KinematicViscosity kinematicViscosity, Duration duration) + { + return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * duration.Seconds); + } + + /// Get from * . + public static Area operator *(KinematicViscosity kinematicViscosity, TimeSpan timeSpan) + { + return Area.FromSquareMeters(kinematicViscosity.SquareMetersPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Area operator *(TimeSpan timeSpan, KinematicViscosity kinematicViscosity) + { + return Area.FromSquareMeters(timeSpan.TotalSeconds * kinematicViscosity.SquareMetersPerSecond); + } + + /// Get from * . + public static DynamicViscosity operator *(KinematicViscosity kinematicViscosity, Density density) + { + return DynamicViscosity.FromNewtonSecondsPerMeterSquared(kinematicViscosity.SquareMetersPerSecond * density.KilogramsPerCubicMeter); + } + + /// Get from / . + public static Speed operator /(KinematicViscosity kinematicViscosity, Length length) + { + return Speed.FromMetersPerSecond(kinematicViscosity.SquareMetersPerSecond / length.Meters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 3053cb1b02..cb76d25dfa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,20 @@ namespace UnitsNet [DataContract] public readonly partial struct Length : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -1168,6 +1185,89 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lengt #endregion + #region Relational Operators + + /// Get from * . + public static Area operator *(Length left, Length right) + { + return Area.FromSquareMeters(left.Meters * right.Meters); + } + + /// Get from / . + public static Duration operator /(Length length, Speed speed) + { + return Duration.FromSeconds(length.Meters / speed.MetersPerSecond); + } + + /// Get from * . + public static Force operator *(Length length, ForcePerLength forcePerLength) + { + return Force.FromNewtons(length.Meters * forcePerLength.NewtonsPerMeter); + } + + /// Get from * . + public static KinematicViscosity operator *(Length length, Speed speed) + { + return KinematicViscosity.FromSquareMetersPerSecond(length.Meters * speed.MetersPerSecond); + } + + /// Get from * . + public static Mass operator *(Length length, LinearDensity linearDensity) + { + return Mass.FromKilograms(length.Meters * linearDensity.KilogramsPerMeter); + } + + /// Get from * . + public static Pressure operator *(Length length, SpecificWeight specificWeight) + { + return Pressure.FromPascals(length.Meters * specificWeight.NewtonsPerCubicMeter); + } + + /// Calculates the inverse of this quantity. + /// The corresponding inverse quantity, . + public ReciprocalLength Inverse() + { + return Meters == 0.0 ? ReciprocalLength.Zero : ReciprocalLength.FromInverseMeters(1 / Meters); + } + + /// Get from * . + public static RotationalStiffness operator *(Length length, RotationalStiffnessPerLength rotationalStiffnessPerLength) + { + return RotationalStiffness.FromNewtonMetersPerRadian(length.Meters * rotationalStiffnessPerLength.NewtonMetersPerRadianPerMeter); + } + + /// Get from / . + public static Speed operator /(Length length, Duration duration) + { + return Speed.FromMetersPerSecond(length.Meters / duration.Seconds); + } + + /// Get from / . + public static Speed operator /(Length length, TimeSpan timeSpan) + { + return Speed.FromMetersPerSecond(length.Meters / timeSpan.TotalSeconds); + } + + /// Get from * . + public static TemperatureDelta operator *(Length length, TemperatureGradient temperatureGradient) + { + return TemperatureDelta.FromDegreesCelsius(length.Kilometers * temperatureGradient.DegreesCelsiusPerKilometer); + } + + /// Get from * . + public static Torque operator *(Length length, Force force) + { + return Torque.FromNewtonMeters(length.Meters * force.Newtons); + } + + /// Get from * . + public static Volume operator *(Length length, Area area) + { + return Volume.FromCubicMeters(length.Meters * area.SquareMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 2ed6835479..6b92af85a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,11 @@ namespace UnitsNet [DataContract] public readonly partial struct LinearDensity : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -667,6 +675,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Linea #endregion + #region Relational Operators + + /// Get from / . + public static Area operator /(LinearDensity linearDensity, Density density) + { + return Area.FromSquareMeters(linearDensity.KilogramsPerMeter / density.KilogramsPerCubicMeter); + } + + /// Get from / . + public static Density operator /(LinearDensity linearDensity, Area area) + { + return Density.FromKilogramsPerCubicMeter(linearDensity.KilogramsPerMeter / area.SquareMeters); + } + + /// Get from * . + public static Mass operator *(LinearDensity linearDensity, Length length) + { + return Mass.FromKilograms(linearDensity.KilogramsPerMeter * length.Meters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs index 24b9b6ac62..1df5b7a1a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,9 @@ namespace UnitsNet [DataContract] public readonly partial struct Luminance : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -595,6 +601,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin #endregion + #region Relational Operators + + /// Get from * . + public static LuminousIntensity operator *(Luminance luminance, Area area) + { + return LuminousIntensity.FromCandela(luminance.CandelasPerSquareMeter * area.SquareMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index e019392462..96ee4951cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,10 @@ namespace UnitsNet [DataContract] public readonly partial struct LuminousIntensity : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -433,6 +440,22 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin #endregion + #region Relational Operators + + /// Get from / . + public static Area operator /(LuminousIntensity luminousIntensity, Luminance luminance) + { + return Area.FromSquareMeters(luminousIntensity.Candela / luminance.CandelasPerSquareMeter); + } + + /// Get from / . + public static Luminance operator /(LuminousIntensity luminousIntensity, Area area) + { + return Luminance.FromCandelasPerSquareMeter(luminousIntensity.Candela / area.SquareMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 4545ceefca..af04728649 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,23 @@ namespace UnitsNet [DataContract] public readonly partial struct Mass : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -898,6 +918,100 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassU #endregion + #region Relational Operators + + /// Get from / . + public static AmountOfSubstance operator /(Mass mass, MolarMass molarMass) + { + return AmountOfSubstance.FromMoles(mass.Kilograms / molarMass.KilogramsPerMole); + } + + /// Get from / . + public static Area operator /(Mass mass, AreaDensity areaDensity) + { + return Area.FromSquareMeters(mass.Kilograms / areaDensity.KilogramsPerSquareMeter); + } + + /// Get from / . + public static AreaDensity operator /(Mass mass, Area area) + { + return AreaDensity.FromKilogramsPerSquareMeter(mass.Kilograms / area.SquareMeters); + } + + /// Get from / . + public static Density operator /(Mass mass, Volume volume) + { + return Density.FromKilogramsPerCubicMeter(mass.Kilograms / volume.CubicMeters); + } + + /// Get from * . + public static Energy operator *(Mass mass, SpecificEnergy specificEnergy) + { + return Energy.FromJoules(mass.Kilograms * specificEnergy.JoulesPerKilogram); + } + + /// Get from * . + public static Entropy operator *(Mass mass, SpecificEntropy specificEntropy) + { + return Entropy.FromJoulesPerKelvin(mass.Kilograms * specificEntropy.JoulesPerKilogramKelvin); + } + + /// Get from * . + public static Force operator *(Mass mass, Acceleration acceleration) + { + return Force.FromNewtons(mass.Kilograms * acceleration.MetersPerSecondSquared); + } + + /// Get from / . + public static Length operator /(Mass mass, LinearDensity linearDensity) + { + return Length.FromMeters(mass.Kilograms / linearDensity.KilogramsPerMeter); + } + + /// Get from / . + public static LinearDensity operator /(Mass mass, Length length) + { + return LinearDensity.FromKilogramsPerMeter(mass.Kilograms / length.Meters); + } + + /// Get from * . + public static Mass operator *(Mass mass, MassFraction massFraction) + { + return Mass.FromKilograms(mass.Kilograms * massFraction.DecimalFractions); + } + + /// Get from / . + public static Mass operator /(Mass mass, MassFraction massFraction) + { + return Mass.FromKilograms(mass.Kilograms / massFraction.DecimalFractions); + } + + /// Get from / . + public static MassFlow operator /(Mass mass, Duration duration) + { + return MassFlow.FromKilogramsPerSecond(mass.Kilograms / duration.Seconds); + } + + /// Get from / . + public static MassFlow operator /(Mass mass, TimeSpan timeSpan) + { + return MassFlow.FromKilogramsPerSecond(mass.Kilograms / timeSpan.TotalSeconds); + } + + /// Get from * . + public static Volume operator *(Mass mass, SpecificVolume specificVolume) + { + return Volume.FromCubicMeters(mass.Kilograms * specificVolume.CubicMetersPerKilogram); + } + + /// Get from / . + public static Volume operator /(Mass mass, Density density) + { + return Volume.FromCubicMeters(mass.Kilograms / density.KilogramsPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 56e5d32fda..f8ee175af2 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,11 @@ namespace UnitsNet [DataContract] public readonly partial struct MassConcentration : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -1297,6 +1305,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassC #endregion + #region Relational Operators + + /// Get from * . + public static Mass operator *(MassConcentration massConcentration, Volume volume) + { + return Mass.FromKilograms(massConcentration.KilogramsPerCubicMeter * volume.CubicMeters); + } + + /// Get from / . + public static Molarity operator /(MassConcentration massConcentration, MolarMass molarMass) + { + return Molarity.FromMolesPerCubicMeter(massConcentration.GramsPerCubicMeter / molarMass.GramsPerMole); + } + + /// Get from / . + public static VolumeConcentration operator /(MassConcentration massConcentration, Density density) + { + return VolumeConcentration.FromDecimalFractions(massConcentration.KilogramsPerCubicMeter / density.KilogramsPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index ba52ccc8bc..4231859097 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,17 @@ namespace UnitsNet [DataContract] public readonly partial struct MassFlow : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -1006,6 +1020,70 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF #endregion + #region Relational Operators + + /// Get from / . + public static Area operator /(MassFlow massFlow, MassFlux massFlux) + { + return Area.FromSquareMeters(massFlow.KilogramsPerSecond / massFlux.KilogramsPerSecondPerSquareMeter); + } + + /// Get from / . + public static BrakeSpecificFuelConsumption operator /(MassFlow massFlow, Power power) + { + return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(massFlow.KilogramsPerSecond / (double)power.Watts); + } + + /// Get from / . + public static Density operator /(MassFlow massFlow, VolumeFlow volumeFlow) + { + return Density.FromKilogramsPerCubicMeter(massFlow.KilogramsPerSecond / volumeFlow.CubicMetersPerSecond); + } + + /// Get from * . + public static Mass operator *(MassFlow massFlow, Duration duration) + { + return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds); + } + + /// Get from * . + public static Mass operator *(MassFlow massFlow, TimeSpan timeSpan) + { + return Mass.FromKilograms(massFlow.KilogramsPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Mass operator *(TimeSpan timeSpan, MassFlow massFlow) + { + return Mass.FromKilograms(timeSpan.TotalSeconds * massFlow.KilogramsPerSecond); + } + + /// Get from / . + public static MassFlux operator /(MassFlow massFlow, Area area) + { + return MassFlux.FromKilogramsPerSecondPerSquareMeter(massFlow.KilogramsPerSecond / area.SquareMeters); + } + + /// Get from * . + public static Power operator *(MassFlow massFlow, SpecificEnergy specificEnergy) + { + return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram); + } + + /// Get from / . + public static Power operator /(MassFlow massFlow, BrakeSpecificFuelConsumption brakeSpecificFuelConsumption) + { + return Power.FromWatts(massFlow.KilogramsPerSecond / brakeSpecificFuelConsumption.KilogramsPerJoule); + } + + /// Get from / . + public static VolumeFlow operator /(MassFlow massFlow, Density density) + { + return VolumeFlow.FromCubicMetersPerSecond(massFlow.KilogramsPerSecond / density.KilogramsPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index d816110871..7f29655414 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,11 @@ namespace UnitsNet [DataContract] public readonly partial struct MassFlux : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -628,6 +636,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF #endregion + #region Relational Operators + + /// Get from / . + public static Density operator /(MassFlux massFlux, Speed speed) + { + return Density.FromKilogramsPerCubicMeter(massFlux.KilogramsPerSecondPerSquareMeter / speed.MetersPerSecond); + } + + /// Get from * . + public static MassFlow operator *(MassFlux massFlux, Area area) + { + return MassFlow.FromGramsPerSecond(massFlux.GramsPerSecondPerSquareMeter * area.SquareMeters); + } + + /// Get from / . + public static Speed operator /(MassFlux massFlux, Density density) + { + return Speed.FromMetersPerSecond(massFlux.KilogramsPerSecondPerSquareMeter / density.KilogramsPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 591357a833..3d11a8d6ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,9 @@ namespace UnitsNet [DataContract] public readonly partial struct MassFraction : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -847,6 +853,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF #endregion + #region Relational Operators + + /// Get from * . + public static Mass operator *(MassFraction massFraction, Mass mass) + { + return Mass.FromKilograms(massFraction.DecimalFractions * mass.Kilograms); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs index 998ada124c..41af47b11d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,12 @@ namespace UnitsNet [DataContract] public readonly partial struct MolarFlow : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -574,6 +583,40 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar #endregion + #region Relational Operators + + /// Get from * . + public static AmountOfSubstance operator *(MolarFlow molarFlow, Duration duration) + { + return AmountOfSubstance.FromKilomoles(molarFlow.KilomolesPerSecond * duration.Seconds); + } + + /// Get from * . + public static AmountOfSubstance operator *(MolarFlow molarFlow, TimeSpan timeSpan) + { + return AmountOfSubstance.FromKilomoles(molarFlow.KilomolesPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static AmountOfSubstance operator *(TimeSpan timeSpan, MolarFlow molarFlow) + { + return AmountOfSubstance.FromKilomoles(timeSpan.TotalSeconds * molarFlow.KilomolesPerSecond); + } + + /// Get from * . + public static MassFlow operator *(MolarFlow molarFlow, MolarMass molarMass) + { + return MassFlow.FromKilogramsPerSecond(molarFlow.KilomolesPerSecond * molarMass.KilogramsPerKilomole); + } + + /// Get from / . + public static VolumeFlow operator /(MolarFlow molarFlow, Molarity molarity) + { + return VolumeFlow.FromCubicMetersPerSecond(molarFlow.MolesPerSecond / molarity.MolesPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 1264b2e43b..285f387898 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,11 @@ namespace UnitsNet [DataContract] public readonly partial struct MolarMass : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -646,6 +654,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar #endregion + #region Relational Operators + + /// Get from * . + public static Mass operator *(MolarMass molarMass, AmountOfSubstance amountOfSubstance) + { + return Mass.FromGrams(molarMass.GramsPerMole * amountOfSubstance.Moles); + } + + /// Get from * . + public static MassConcentration operator *(MolarMass molarMass, Molarity molarity) + { + return MassConcentration.FromGramsPerCubicMeter(molarMass.GramsPerMole * molarity.MolesPerCubicMeter); + } + + /// Get from * . + public static MassFlow operator *(MolarMass molarMass, MolarFlow molarFlow) + { + return MassFlow.FromKilogramsPerSecond(molarMass.KilogramsPerKilomole * molarFlow.KilomolesPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index afc1c50f01..85997751a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,10 @@ namespace UnitsNet [DataContract] public readonly partial struct Molarity : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -613,6 +620,22 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar #endregion + #region Relational Operators + + /// Get from * . + public static MassConcentration operator *(Molarity molarity, MolarMass molarMass) + { + return MassConcentration.FromGramsPerCubicMeter(molarity.MolesPerCubicMeter * molarMass.GramsPerMole); + } + + /// Get from * . + public static Molarity operator *(Molarity molarity, VolumeConcentration volumeConcentration) + { + return Molarity.FromMolesPerCubicMeter(molarity.MolesPerCubicMeter * volumeConcentration.DecimalFractions); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 199ef43506..475bbbe81e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,20 @@ namespace UnitsNet [DataContract] public readonly partial struct Power : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, +#endif IDecimalQuantity, IComparable, IComparable, @@ -881,6 +898,88 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Power #endregion + #region Relational Operators + + /// Get from / . + public static Area operator /(Power power, HeatFlux heatFlux) + { + return Area.FromSquareMeters((double)power.Watts / heatFlux.WattsPerSquareMeter); + } + + /// Get from / . + public static ElectricCurrent operator /(Power power, ElectricPotential electricPotential) + { + return ElectricCurrent.FromAmperes((double)power.Watts / electricPotential.Volts); + } + + /// Get from / . + public static ElectricPotential operator /(Power power, ElectricCurrent electricCurrent) + { + return ElectricPotential.FromVolts((double)power.Watts / electricCurrent.Amperes); + } + + /// Get from * . + public static Energy operator *(Power power, Duration duration) + { + return Energy.FromJoules((double)power.Watts * duration.Seconds); + } + + /// Get from * . + public static Energy operator *(Power power, TimeSpan timeSpan) + { + return Energy.FromJoules((double)power.Watts * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Energy operator *(TimeSpan timeSpan, Power power) + { + return Energy.FromJoules(timeSpan.TotalSeconds * (double)power.Watts); + } + + /// Get from / . + public static Force operator /(Power power, Speed speed) + { + return Force.FromNewtons((double)power.Watts / speed.MetersPerSecond); + } + + /// Get from / . + public static HeatFlux operator /(Power power, Area area) + { + return HeatFlux.FromWattsPerSquareMeter((double)power.Watts / area.SquareMeters); + } + + /// Get from * . + public static MassFlow operator *(Power power, BrakeSpecificFuelConsumption brakeSpecificFuelConsumption) + { + return MassFlow.FromKilogramsPerSecond((double)power.Watts * brakeSpecificFuelConsumption.KilogramsPerJoule); + } + + /// Get from / . + public static MassFlow operator /(Power power, SpecificEnergy specificEnergy) + { + return MassFlow.FromKilogramsPerSecond((double)power.Watts / specificEnergy.JoulesPerKilogram); + } + + /// Get from / . + public static RotationalSpeed operator /(Power power, Torque torque) + { + return RotationalSpeed.FromRadiansPerSecond((double)power.Watts / torque.NewtonMeters); + } + + /// Get from / . + public static SpecificEnergy operator /(Power power, MassFlow massFlow) + { + return SpecificEnergy.FromJoulesPerKilogram((double)power.Watts / massFlow.KilogramsPerSecond); + } + + /// Get from / . + public static Torque operator /(Power power, RotationalSpeed rotationalSpeed) + { + return Torque.FromNewtonMeters((double)power.Watts / rotationalSpeed.RadiansPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index ea201d6617..c03ed75484 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,15 @@ namespace UnitsNet [DataContract] public readonly partial struct Pressure : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -1294,6 +1306,52 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Press #endregion + #region Relational Operators + + /// Get from * . + public static Force operator *(Pressure pressure, Area area) + { + return Force.FromNewtons(pressure.Pascals * area.SquareMeters); + } + + /// Get from / . + public static Force operator /(Pressure pressure, ReciprocalArea reciprocalArea) + { + return Force.FromNewtons(pressure.Pascals / reciprocalArea.InverseSquareMeters); + } + + /// Get from / . + public static ForcePerLength operator /(Pressure pressure, ReciprocalLength reciprocalLength) + { + return ForcePerLength.FromNewtonsPerMeter(pressure.Pascals / reciprocalLength.InverseMeters); + } + + /// Get from / . + public static Length operator /(Pressure pressure, SpecificWeight specificWeight) + { + return Length.FromMeters(pressure.Pascals / specificWeight.NewtonsPerCubicMeter); + } + + /// Get from / . + public static PressureChangeRate operator /(Pressure pressure, Duration duration) + { + return PressureChangeRate.FromPascalsPerSecond(pressure.Pascals / duration.Seconds); + } + + /// Get from / . + public static PressureChangeRate operator /(Pressure pressure, TimeSpan timeSpan) + { + return PressureChangeRate.FromPascalsPerSecond(pressure.Pascals / timeSpan.TotalSeconds); + } + + /// Get from / . + public static SpecificWeight operator /(Pressure pressure, Length length) + { + return SpecificWeight.FromNewtonsPerCubicMeter(pressure.Pascals / length.Meters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 926bbfcb38..13c093d8ea 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct PressureChangeRate : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -736,6 +743,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Press #endregion + #region Relational Operators + + /// Get from * . + public static Pressure operator *(PressureChangeRate pressureChangeRate, Duration duration) + { + return Pressure.FromPascals(pressureChangeRate.PascalsPerSecond * duration.Seconds); + } + + /// Get from * . + public static Pressure operator *(PressureChangeRate pressureChangeRate, TimeSpan timeSpan) + { + return Pressure.FromPascals(pressureChangeRate.PascalsPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Pressure operator *(TimeSpan timeSpan, PressureChangeRate pressureChangeRate) + { + return Pressure.FromPascals(timeSpan.TotalSeconds * pressureChangeRate.PascalsPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index f7e08dc4ea..d738a440ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,11 @@ namespace UnitsNet [DataContract] public readonly partial struct ReciprocalArea : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -613,6 +621,35 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Recip #endregion + #region Relational Operators + + /// Get from * . + public static Pressure operator *(ReciprocalArea reciprocalArea, Force force) + { + return Pressure.FromNewtonsPerSquareMeter(reciprocalArea.InverseSquareMeters * force.Newtons); + } + + /// Get from * . + public static Ratio operator *(ReciprocalArea reciprocalArea, Area area) + { + return Ratio.FromDecimalFractions(reciprocalArea.InverseSquareMeters * area.SquareMeters); + } + + /// Calculates the inverse of this quantity. + /// The corresponding inverse quantity, . + public Area Inverse() + { + return InverseSquareMeters == 0.0 ? Area.Zero : Area.FromSquareMeters(1 / InverseSquareMeters); + } + + /// Get from / . + public static ReciprocalLength operator /(ReciprocalArea reciprocalArea, ReciprocalLength reciprocalLength) + { + return ReciprocalLength.FromInverseMeters(reciprocalArea.InverseSquareMeters / reciprocalLength.InverseMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index c200897823..338ba936b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,12 @@ namespace UnitsNet [DataContract] public readonly partial struct ReciprocalLength : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -595,6 +604,41 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Recip #endregion + #region Relational Operators + + /// Get from * . + public static ForcePerLength operator *(ReciprocalLength reciprocalLength, Force force) + { + return ForcePerLength.FromNewtonsPerMeter(reciprocalLength.InverseMeters * force.Newtons); + } + + /// Get from / . + public static Length operator /(ReciprocalLength reciprocalLength, ReciprocalArea reciprocalArea) + { + return Length.FromMeters(reciprocalLength.InverseMeters / reciprocalArea.InverseSquareMeters); + } + + /// Get from * . + public static Pressure operator *(ReciprocalLength reciprocalLength, ForcePerLength forcePerLength) + { + return Pressure.FromNewtonsPerSquareMeter(reciprocalLength.InverseMeters * forcePerLength.NewtonsPerMeter); + } + + /// Get from * . + public static ReciprocalArea operator *(ReciprocalLength left, ReciprocalLength right) + { + return ReciprocalArea.FromInverseSquareMeters(left.InverseMeters * right.InverseMeters); + } + + /// Calculates the inverse of this quantity. + /// The corresponding inverse quantity, . + public Length Inverse() + { + return InverseMeters == 0.0 ? Length.Zero : Length.FromMeters(1 / InverseMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index 96c7cebc8d..764cfd2154 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct RotationalSpeed : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -646,6 +653,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat #endregion + #region Relational Operators + + /// Get from * . + public static Angle operator *(RotationalSpeed rotationalSpeed, Duration duration) + { + return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * duration.Seconds); + } + + /// Get from * . + public static Angle operator *(RotationalSpeed rotationalSpeed, TimeSpan timeSpan) + { + return Angle.FromRadians(rotationalSpeed.RadiansPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Angle operator *(TimeSpan timeSpan, RotationalSpeed rotationalSpeed) + { + return Angle.FromRadians(timeSpan.TotalSeconds * rotationalSpeed.RadiansPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 48ad38d3f3..f695eb00af 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,11 @@ namespace UnitsNet [DataContract] public readonly partial struct RotationalStiffness : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -1006,6 +1014,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat #endregion + #region Relational Operators + + /// Get from / . + public static Length operator /(RotationalStiffness rotationalStiffness, RotationalStiffnessPerLength rotationalStiffnessPerLength) + { + return Length.FromMeters(rotationalStiffness.NewtonMetersPerRadian / rotationalStiffnessPerLength.NewtonMetersPerRadianPerMeter); + } + + /// Get from / . + public static RotationalStiffnessPerLength operator /(RotationalStiffness rotationalStiffness, Length length) + { + return RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(rotationalStiffness.NewtonMetersPerRadian / length.Meters); + } + + /// Get from * . + public static Torque operator *(RotationalStiffness rotationalStiffness, Angle angle) + { + return Torque.FromNewtonMeters(rotationalStiffness.NewtonMetersPerRadian * angle.Radians); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 4076454003..7994f6fea6 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct RotationalStiffnessPerLength : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -502,6 +508,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat #endregion + #region Relational Operators + + /// Get from * . + public static RotationalStiffness operator *(RotationalStiffnessPerLength rotationalStiffnessPerLength, Length length) + { + return RotationalStiffness.FromNewtonMetersPerRadian(rotationalStiffnessPerLength.NewtonMetersPerRadianPerMeter * length.Meters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 923f5374af..ae041cfd4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,12 @@ namespace UnitsNet [DataContract] public readonly partial struct SpecificEnergy : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -955,6 +964,40 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci #endregion + #region Relational Operators + + /// Get from / . + public static BrakeSpecificFuelConsumption operator /(double value, SpecificEnergy specificEnergy) + { + return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(value / specificEnergy.JoulesPerKilogram); + } + + /// Get from * . + public static Energy operator *(SpecificEnergy specificEnergy, Mass mass) + { + return Energy.FromJoules(specificEnergy.JoulesPerKilogram * mass.Kilograms); + } + + /// Get from * . + public static Power operator *(SpecificEnergy specificEnergy, MassFlow massFlow) + { + return Power.FromWatts(specificEnergy.JoulesPerKilogram * massFlow.KilogramsPerSecond); + } + + /// Get from / . + public static SpecificEntropy operator /(SpecificEnergy specificEnergy, TemperatureDelta temperatureDelta) + { + return SpecificEntropy.FromJoulesPerKilogramKelvin(specificEnergy.JoulesPerKilogram / temperatureDelta.Kelvins); + } + + /// Get from * . + public static double operator *(SpecificEnergy specificEnergy, BrakeSpecificFuelConsumption brakeSpecificFuelConsumption) + { + return specificEnergy.JoulesPerKilogram * brakeSpecificFuelConsumption.KilogramsPerJoule; + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 3432edb992..947b7d5784 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct SpecificEntropy : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -574,6 +581,22 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci #endregion + #region Relational Operators + + /// Get from * . + public static Entropy operator *(SpecificEntropy specificEntropy, Mass mass) + { + return Entropy.FromJoulesPerKelvin(specificEntropy.JoulesPerKilogramKelvin * mass.Kilograms); + } + + /// Get from * . + public static SpecificEnergy operator *(SpecificEntropy specificEntropy, TemperatureDelta temperatureDelta) + { + return SpecificEnergy.FromJoulesPerKilogram(specificEntropy.JoulesPerKilogramKelvin * temperatureDelta.Kelvins); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 74876ceb95..fe1120be0d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct SpecificVolume : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -466,6 +472,22 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci #endregion + #region Relational Operators + + /// Get from / . + public static Density operator /(double value, SpecificVolume specificVolume) + { + return Density.FromKilogramsPerCubicMeter(value / specificVolume.CubicMetersPerKilogram); + } + + /// Get from * . + public static Volume operator *(SpecificVolume specificVolume, Mass mass) + { + return Volume.FromCubicMeters(specificVolume.CubicMetersPerKilogram * mass.Kilograms); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index 569e137d55..dd50467cf8 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,12 @@ namespace UnitsNet [DataContract] public readonly partial struct SpecificWeight : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -721,6 +730,34 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci #endregion + #region Relational Operators + + /// Get from / . + public static Acceleration operator /(SpecificWeight specificWeight, Density density) + { + return Acceleration.FromMetersPerSecondSquared(specificWeight.NewtonsPerCubicMeter / density.KilogramsPerCubicMeter); + } + + /// Get from / . + public static Density operator /(SpecificWeight specificWeight, Acceleration acceleration) + { + return Density.FromKilogramsPerCubicMeter(specificWeight.NewtonsPerCubicMeter / acceleration.MetersPerSecondSquared); + } + + /// Get from * . + public static ForcePerLength operator *(SpecificWeight specificWeight, Area area) + { + return ForcePerLength.FromNewtonsPerMeter(specificWeight.NewtonsPerCubicMeter * area.SquareMeters); + } + + /// Get from * . + public static Pressure operator *(SpecificWeight specificWeight, Length length) + { + return Pressure.FromPascals(specificWeight.NewtonsPerCubicMeter * length.Meters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 2d5a5bd3e6..f1672b27ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,18 @@ namespace UnitsNet [DataContract] public readonly partial struct Speed : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -1006,6 +1021,76 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speed #endregion + #region Relational Operators + + /// Get from / . + public static Acceleration operator /(Speed speed, Duration duration) + { + return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / duration.Seconds); + } + + /// Get from / . + public static Acceleration operator /(Speed speed, TimeSpan timeSpan) + { + return Acceleration.FromMetersPerSecondSquared(speed.MetersPerSecond / timeSpan.TotalSeconds); + } + + /// Get from / . + public static Duration operator /(Speed speed, Acceleration acceleration) + { + return Duration.FromSeconds(speed.MetersPerSecond / acceleration.MetersPerSecondSquared); + } + + /// Get from * . + public static KinematicViscosity operator *(Speed speed, Length length) + { + return KinematicViscosity.FromSquareMetersPerSecond(speed.MetersPerSecond * length.Meters); + } + + /// Get from * . + public static Length operator *(Speed speed, Duration duration) + { + return Length.FromMeters(speed.MetersPerSecond * duration.Seconds); + } + + /// Get from * . + public static Length operator *(Speed speed, TimeSpan timeSpan) + { + return Length.FromMeters(speed.MetersPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static Length operator *(TimeSpan timeSpan, Speed speed) + { + return Length.FromMeters(timeSpan.TotalSeconds * speed.MetersPerSecond); + } + + /// Get from * . + public static MassFlux operator *(Speed speed, Density density) + { + return MassFlux.FromKilogramsPerSecondPerSquareMeter(speed.MetersPerSecond * density.KilogramsPerCubicMeter); + } + + /// Get from * . + public static Power operator *(Speed speed, Force force) + { + return Power.FromWatts(speed.MetersPerSecond * force.Newtons); + } + + /// Get from * . + public static SpecificEnergy operator *(Speed left, Speed right) + { + return SpecificEnergy.FromJoulesPerKilogram(left.MetersPerSecond * right.MetersPerSecond); + } + + /// Get from * . + public static VolumeFlow operator *(Speed speed, Area area) + { + return VolumeFlow.FromCubicMetersPerSecond(speed.MetersPerSecond * area.SquareMeters); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index eec5946820..05799ba7c5 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,10 @@ namespace UnitsNet [DataContract] public readonly partial struct TemperatureChangeRate : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -592,6 +599,28 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe #endregion + #region Relational Operators + + /// Get from * . + public static TemperatureDelta operator *(TemperatureChangeRate temperatureChangeRate, Duration duration) + { + return TemperatureDelta.FromDegreesCelsius(temperatureChangeRate.DegreesCelsiusPerSecond * duration.Seconds); + } + + /// Get from * . + public static TemperatureDelta operator *(TemperatureChangeRate temperatureChangeRate, TimeSpan timeSpan) + { + return TemperatureDelta.FromDegreesCelsius(temperatureChangeRate.DegreesCelsiusPerSecond * timeSpan.TotalSeconds); + } + + /// Get from * . + public static TemperatureDelta operator *(TimeSpan timeSpan, TemperatureChangeRate temperatureChangeRate) + { + return TemperatureDelta.FromDegreesCelsius(timeSpan.TotalSeconds * temperatureChangeRate.DegreesCelsiusPerSecond); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index dd5e3ae53f..3a0bec33d8 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,13 @@ namespace UnitsNet [DataContract] public readonly partial struct TemperatureDelta : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -574,6 +584,40 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe #endregion + #region Relational Operators + + /// Get from * . + public static Energy operator *(TemperatureDelta temperatureDelta, Entropy entropy) + { + return Energy.FromJoules(temperatureDelta.Kelvins * entropy.JoulesPerKelvin); + } + + /// Get from / . + public static Length operator /(TemperatureDelta temperatureDelta, TemperatureGradient temperatureGradient) + { + return Length.FromKilometers(temperatureDelta.Kelvins / temperatureGradient.DegreesCelsiusPerKilometer); + } + + /// Get from * . + public static SpecificEnergy operator *(TemperatureDelta temperatureDelta, SpecificEntropy specificEntropy) + { + return SpecificEnergy.FromJoulesPerKilogram(temperatureDelta.Kelvins * specificEntropy.JoulesPerKilogramKelvin); + } + + /// Get from / . + public static TemperatureGradient operator /(TemperatureDelta temperatureDelta, Length length) + { + return TemperatureGradient.FromKelvinsPerMeter(temperatureDelta.Kelvins / length.Meters); + } + + /// Get from * . + public static double operator *(TemperatureDelta temperatureDelta, CoefficientOfThermalExpansion coefficientOfThermalExpansion) + { + return temperatureDelta.Kelvins * coefficientOfThermalExpansion.PerKelvin; + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index 9ce18cec11..93d6ee18a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,9 @@ namespace UnitsNet [DataContract] public readonly partial struct TemperatureGradient : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -484,6 +490,16 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe #endregion + #region Relational Operators + + /// Get from * . + public static TemperatureDelta operator *(TemperatureGradient temperatureGradient, Length length) + { + return TemperatureDelta.FromDegreesCelsius(temperatureGradient.DegreesCelsiusPerKilometer * length.Kilometers); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index d0eeea5075..87eaaf99b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,12 @@ namespace UnitsNet [DataContract] public readonly partial struct Torque : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -862,6 +871,34 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Torqu #endregion + #region Relational Operators + + /// Get from / . + public static Angle operator /(Torque torque, RotationalStiffness rotationalStiffness) + { + return Angle.FromRadians(torque.NewtonMeters / rotationalStiffness.NewtonMetersPerRadian); + } + + /// Get from / . + public static Force operator /(Torque torque, Length length) + { + return Force.FromNewtons(torque.NewtonMeters / length.Meters); + } + + /// Get from / . + public static Length operator /(Torque torque, Force force) + { + return Length.FromMeters(torque.NewtonMeters / force.Newtons); + } + + /// Get from / . + public static RotationalStiffness operator /(Torque torque, Angle angle) + { + return RotationalStiffness.FromNewtonMetersPerRadian(torque.NewtonMeters / angle.Radians); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index edae796b3c..b7517fca06 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,15 @@ namespace UnitsNet [DataContract] public readonly partial struct Volume : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, + IDivisionOperators, + IDivisionOperators, +#endif IComparable, IComparable, IConvertible, @@ -1384,6 +1396,52 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum #endregion + #region Relational Operators + + /// Get from / . + public static Area operator /(Volume volume, Length length) + { + return Area.FromSquareMeters(volume.CubicMeters / length.Meters); + } + + /// Get from * . + public static Energy operator *(Volume volume, EnergyDensity energyDensity) + { + return Energy.FromJoules(volume.CubicMeters * energyDensity.JoulesPerCubicMeter); + } + + /// Get from / . + public static Length operator /(Volume volume, Area area) + { + return Length.FromMeters(volume.CubicMeters / area.SquareMeters); + } + + /// Get from * . + public static Mass operator *(Volume volume, Density density) + { + return Mass.FromKilograms(volume.CubicMeters * density.KilogramsPerCubicMeter); + } + + /// Get from * . + public static Mass operator *(Volume volume, MassConcentration massConcentration) + { + return Mass.FromKilograms(volume.CubicMeters * massConcentration.KilogramsPerCubicMeter); + } + + /// Get from / . + public static VolumeFlow operator /(Volume volume, Duration duration) + { + return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / duration.Seconds); + } + + /// Get from / . + public static VolumeFlow operator /(Volume volume, TimeSpan timeSpan) + { + return VolumeFlow.FromCubicMetersPerSecond(volume.CubicMeters / timeSpan.TotalSeconds); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index 6e17a83f5f..3b813902a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -41,6 +44,10 @@ namespace UnitsNet [DataContract] public readonly partial struct VolumeConcentration : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -775,6 +782,22 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum #endregion + #region Relational Operators + + /// Get from * . + public static MassConcentration operator *(VolumeConcentration volumeConcentration, Density density) + { + return MassConcentration.FromKilogramsPerCubicMeter(volumeConcentration.DecimalFractions * density.KilogramsPerCubicMeter); + } + + /// Get from * . + public static Molarity operator *(VolumeConcentration volumeConcentration, Molarity molarity) + { + return Molarity.FromMolesPerCubicMeter(volumeConcentration.DecimalFractions * molarity.MolesPerCubicMeter); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to. diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 7f74b243cc..bce0ff4739 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -21,6 +21,9 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using System.Runtime.Serialization; using UnitsNet.InternalHelpers; using UnitsNet.Units; @@ -38,6 +41,13 @@ namespace UnitsNet [DataContract] public readonly partial struct VolumeFlow : IArithmeticQuantity, +#if NET7_0_OR_GREATER + IDivisionOperators, + IMultiplyOperators, + IDivisionOperators, + IMultiplyOperators, + IMultiplyOperators, +#endif IComparable, IComparable, IConvertible, @@ -1618,6 +1628,46 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum #endregion + #region Relational Operators + + /// Get from / . + public static Area operator /(VolumeFlow volumeFlow, Speed speed) + { + return Area.FromSquareMeters(volumeFlow.CubicMetersPerSecond / speed.MetersPerSecond); + } + + /// Get from * . + public static MassFlow operator *(VolumeFlow volumeFlow, Density density) + { + return MassFlow.FromKilogramsPerSecond(volumeFlow.CubicMetersPerSecond * density.KilogramsPerCubicMeter); + } + + /// Get from / . + public static Speed operator /(VolumeFlow volumeFlow, Area area) + { + return Speed.FromMetersPerSecond(volumeFlow.CubicMetersPerSecond / area.SquareMeters); + } + + /// Get from * . + public static Volume operator *(TimeSpan timeSpan, VolumeFlow volumeFlow) + { + return Volume.FromCubicMeters(timeSpan.TotalSeconds * volumeFlow.CubicMetersPerSecond); + } + + /// Get from * . + public static Volume operator *(VolumeFlow volumeFlow, Duration duration) + { + return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); + } + + /// Get from * . + public static Volume operator *(VolumeFlow volumeFlow, TimeSpan timeSpan) + { + return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * timeSpan.TotalSeconds); + } + + #endregion + #region Equality / IComparable /// Returns true if less or equal to.