Skip to content

Commit

Permalink
🐛 add missing range check for punching parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lorinczandrea committed Aug 26, 2024
1 parent 5dd9516 commit a46b1e2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
16 changes: 16 additions & 0 deletions FemDesign.Core/GenericClasses/RestrictedDouble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ internal static double NonNegMax_10(double val)
{
return RestrictedDouble.ValueInClosedInterval(val, 0, 10);
}

/// <summary>
/// non_zero_max_10_1
/// </summary>
internal static double NonZeroMax_10_1(double val)
{
return RestrictedDouble.ValueInClosedInterval(val, 0.02, 10);
}

/// <summary>
/// non_zero_max_10_1
/// </summary>
internal static double NonZeroMax_10_2(double val)
{
return RestrictedDouble.ValueInClosedInterval(val, 0.03, 10);
}

/// <summary>
/// non_neg_max_10
Expand Down
27 changes: 24 additions & 3 deletions FemDesign.Core/Reinforcement/PunchingReinforcement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,34 @@ public partial class StudRails
public string Patter { get; set; }

[XmlAttribute("s0")]
public double S0 { get; set; }
public double _s0 { get; set; }

[XmlIgnore]
public double S0
{
get => _s0;
set => _s0 = RestrictedDouble.NonZeroMax_10_1(value);
}

[XmlAttribute("s1")]
public double S1 { get; set; }
public double _s1 { get; set; }

[XmlIgnore]
public double S1
{
get => _s1;
set => _s1 = RestrictedDouble.NonZeroMax_10_2(value);
}

[XmlAttribute("s2")]
public double S2 { get; set; }
public double _s2 { get; set; }

[XmlIgnore]
public double S2
{
get => _s2;
set => _s2 = RestrictedDouble.NonZeroMax_10_2(value);
}

[XmlAttribute("rails_on_circle")]
public string _railsOnCircle;
Expand Down

0 comments on commit a46b1e2

Please sign in to comment.