Skip to content

Commit 74a26ce

Browse files
lwestfallangularsen
authored andcommitted
Add PoundForcePerFoot, PoundForcePerInch and PoundForcePerYard to ForcePerLength (#668)
* Added PoundForcePerFoot and PoundForcePerInch to ForcePerLength * Added PoundForcePerYard to ForcePerLength * Added overloads for multiplication operator to get ForcePerLength from Area * SpecificWeight (and vice-versa)
1 parent 43107d1 commit 74a26ce

File tree

10 files changed

+197
-0
lines changed

10 files changed

+197
-0
lines changed

Common/UnitDefinitions/ForcePerLength.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,42 @@
3535
"Abbreviations": [ "кгс/м" ]
3636
}
3737
]
38+
},
39+
{
40+
"SingularName": "PoundForcePerFoot",
41+
"PluralName": "PoundsForcePerFoot",
42+
"FromUnitToBaseFunc": "x*14.59390292",
43+
"FromBaseToUnitFunc": "x/14.59390292",
44+
"Localization": [
45+
{
46+
"Culture": "en-US",
47+
"Abbreviations": [ "lbf/ft" ]
48+
}
49+
]
50+
},
51+
{
52+
"SingularName": "PoundForcePerInch",
53+
"PluralName": "PoundsForcePerInch",
54+
"FromUnitToBaseFunc": "x*1.75126835e2",
55+
"FromBaseToUnitFunc": "x/1.75126835e2",
56+
"Localization": [
57+
{
58+
"Culture": "en-US",
59+
"Abbreviations": [ "lbf/in" ]
60+
}
61+
]
62+
},
63+
{
64+
"SingularName": "PoundForcePerYard",
65+
"PluralName": "PoundsForcePerYard",
66+
"FromUnitToBaseFunc": "x*4.864634307",
67+
"FromBaseToUnitFunc": "x/4.864634307",
68+
"Localization": [
69+
{
70+
"Culture": "en-US",
71+
"Abbreviations": [ "lbf/yd" ]
72+
}
73+
]
3874
}
3975
]
4076
}

UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public class ForcePerLengthTests : ForcePerLengthTestsBase
3131
protected override double MillinewtonsPerMeterInOneNewtonPerMeter => 1E3;
3232
protected override double NanonewtonsPerMeterInOneNewtonPerMeter => 1E9;
3333
protected override double NewtonsPerMeterInOneNewtonPerMeter => 1;
34+
protected override double PoundsForcePerFootInOneNewtonPerMeter => 6.8521766E-2;
35+
protected override double PoundsForcePerInchInOneNewtonPerMeter => 5.710147162769201E-3;
36+
protected override double PoundsForcePerYardInOneNewtonPerMeter => 0.205565298;
3437
protected override double MeganewtonsPerMeterInOneNewtonPerMeter => 1E-6;
3538

3639
[Fact]

UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.g.cs

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/ForcePerLengthUnit.g.cs

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Licensed under MIT No Attribution, see LICENSE file at the root.
22
// Copyright 2013 Andreas Gullberg Larsen ([email protected]). Maintained at https://github.com/angularsen/UnitsNet.
33

4+
using UnitsNet.Units;
5+
46
namespace UnitsNet
57
{
68
public partial struct SpecificWeight
@@ -11,6 +13,18 @@ public partial struct SpecificWeight
1113
return new Pressure(specificWeight.NewtonsPerCubicMeter * length.Meters, UnitsNet.Units.PressureUnit.Pascal);
1214
}
1315

16+
/// <summary>Get <see cref="ForcePerLength"/> from <see cref="SpecificWeight"/> times <see cref="Area"/>.</summary>
17+
public static ForcePerLength operator *(SpecificWeight specificWeight, Area area)
18+
{
19+
return new ForcePerLength(specificWeight.NewtonsPerCubicMeter * area.SquareMeters, ForcePerLengthUnit.NewtonPerMeter);
20+
}
21+
22+
/// <summary>Get <see cref="ForcePerLength"/> from <see cref="Area"/> times <see cref="SpecificWeight"/>.</summary>
23+
public static ForcePerLength operator *(Area area, SpecificWeight specificWeight)
24+
{
25+
return new ForcePerLength(area.SquareMeters * specificWeight.NewtonsPerCubicMeter, ForcePerLengthUnit.NewtonPerMeter);
26+
}
27+
1428
/// <summary>Get <see cref="Acceleration"/> from <see cref="SpecificWeight"/> divided by <see cref="Density"/>.</summary>
1529
public static Acceleration operator /(SpecificWeight specificWeight, Density density)
1630
{

0 commit comments

Comments
 (0)