-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAtmosphericPressure.g.cs
More file actions
58 lines (53 loc) · 3.46 KB
/
AtmosphericPressure.g.cs
File metadata and controls
58 lines (53 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.
// <auto-generated />
namespace ktsu.Semantics.Quantities;
using System.Numerics;
/// <summary>
/// Pressure exerted by the atmosphere.
/// Semantic overload of <see cref="Pressure{T}"/>.
/// </summary>
/// <typeparam name="T">The numeric storage type.</typeparam>
public record AtmosphericPressure<T> : PhysicalQuantity<AtmosphericPressure<T>, T>, IVector0<AtmosphericPressure<T>, T>
where T : struct, INumber<T>
{
/// <summary>Gets a quantity with value zero.</summary>
public static AtmosphericPressure<T> Zero => Create(T.Zero);
/// <summary>
/// Creates a new AtmosphericPressure from a value in Pascal.
/// </summary>
/// <param name="value">The value in Pascal.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromPascals(T value) => Create(Vector0Guards.EnsureNonNegative(value, nameof(value)));
/// <summary>
/// Creates a new AtmosphericPressure from a value in Bar.
/// </summary>
/// <param name="value">The value in Bar.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromBars(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.BarToPascals)), nameof(value)));
/// <summary>
/// Creates a new AtmosphericPressure from a value in Atmosphere.
/// </summary>
/// <param name="value">The value in Atmosphere.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromAtmospheres(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.AtmosphereToPascals)), nameof(value)));
/// <summary>
/// Creates a new AtmosphericPressure from a value in Psi.
/// </summary>
/// <param name="value">The value in Psi.</param>
/// <returns>A new AtmosphericPressure instance.</returns>
/// <exception cref="System.ArgumentException">Thrown when the resulting magnitude would be negative.</exception>
public static AtmosphericPressure<T> FromPsi(T value) => Create(Vector0Guards.EnsureNonNegative((value * T.CreateChecked(Units.ConversionConstants.PsiToPascals)), nameof(value)));
/// <summary>Implicit conversion to Pressure.</summary>
public static implicit operator Pressure<T>(AtmosphericPressure<T> value) => Pressure<T>.Create(value.Value);
/// <summary>Explicit conversion from Pressure.</summary>
public static explicit operator AtmosphericPressure<T>(Pressure<T> value) => Create(value.Value);
/// <summary>Creates a AtmosphericPressure from a Pressure value.</summary>
public static AtmosphericPressure<T> From(Pressure<T> value) => Create(value.Value);
/// <summary>Subtracts two AtmosphericPressure values, returning the absolute difference as a non-negative AtmosphericPressure.</summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2225:Operator overloads have named alternates", Justification = "Physics quantity operator")] public static AtmosphericPressure<T> operator -(AtmosphericPressure<T> left, AtmosphericPressure<T> right) => Create(T.Abs(left.Quantity - right.Quantity));
};