Skip to content

Commit

Permalink
Merge pull request #3 from MagmaWorks/feature/concrete-properties
Browse files Browse the repository at this point in the history
Concrete sectionproperties
  • Loading branch information
kpne authored Dec 16, 2024
2 parents 09bb64d + b789519 commit f134a64
Show file tree
Hide file tree
Showing 34 changed files with 1,398 additions and 187 deletions.
18 changes: 18 additions & 0 deletions ISectionProperties/IConcreteSectionProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using OasysUnits;

namespace MagmaWorks.Taxonomy.Sections.SectionProperties
{
public interface IConcreteSectionProperties : ISectionProperties
{
Area TotalReinforcementArea { get; }
Area ConcreteArea { get; }
Ratio GeometricReinforcementRatio { get; }
Area CrossSectionalShearReinforcementArea { get; }
AreaMomentOfInertia ReinforcementSecondMomentOfAreaYy { get; }
AreaMomentOfInertia ReinforcementSecondMomentOfAreaZz { get; }
Length ReinforcementRadiusOfGyrationYy { get; }
Length ReinforcementRadiusOfGyrationZz { get; }
Length EffectiveDepth(SectionFace face);
Area ReinforcementArea(SectionFace face);
}
}
19 changes: 0 additions & 19 deletions ISectionProperties/IGeometricalProperties.cs

This file was deleted.

16 changes: 14 additions & 2 deletions ISectionProperties/ISectionProperties.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
namespace MagmaWorks.Taxonomy.Sections.SectionProperties
using MagmaWorks.Geometry;
using OasysUnits;

namespace MagmaWorks.Taxonomy.Sections.SectionProperties
{
public interface ISectionProperties
{
IGeometricalProperties GeometricalProperties { get; }
ILocalDomain2d Extends { get; }
ILocalPoint2d Centroid { get; }
Length Perimeter { get; }
Area Area { get; }
SectionModulus ElasticSectionModulusYy { get; }
SectionModulus ElasticSectionModulusZz { get; }
AreaMomentOfInertia MomentOfInertiaYy { get; }
AreaMomentOfInertia MomentOfInertiaZz { get; }
Length RadiusOfGyrationYy { get; }
Length RadiusOfGyrationZz { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MagmaWorks.IGeometry" Version="0.0.7" />
<PackageReference Include="MinVer" Version="4.3.0">
<PackageReference Include="MagmaWorks.IGeometry" Version="0.0.10" />
<PackageReference Include="MagmaWorks.Taxonomy.ISections" Version="0.0.26" />
<PackageReference Include="MinVer" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
6 changes: 0 additions & 6 deletions SectionProperties.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Section
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Sections.SectionProperties", "SectionProperties\MagmaWorks.Taxonomy.Sections.SectionProperties.csproj", "{53294695-E114-4DA9-9F1A-F8E2C289DB60}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Sections.SectionProperties.Serialization", "Serialization\MagmaWorks.Taxonomy.Sections.SectionProperties.Serialization.csproj", "{1E0D2D34-40B9-48C4-9A43-D8C078B2BCE4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SectionPropertiesTests", "SectionPropertiesTests\SectionPropertiesTests.csproj", "{86D261B4-B15C-4F44-B655-CE127B7CC3C0}"
EndProject
Global
Expand All @@ -25,10 +23,6 @@ Global
{53294695-E114-4DA9-9F1A-F8E2C289DB60}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53294695-E114-4DA9-9F1A-F8E2C289DB60}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53294695-E114-4DA9-9F1A-F8E2C289DB60}.Release|Any CPU.Build.0 = Release|Any CPU
{1E0D2D34-40B9-48C4-9A43-D8C078B2BCE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E0D2D34-40B9-48C4-9A43-D8C078B2BCE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E0D2D34-40B9-48C4-9A43-D8C078B2BCE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E0D2D34-40B9-48C4-9A43-D8C078B2BCE4}.Release|Any CPU.Build.0 = Release|Any CPU
{86D261B4-B15C-4F44-B655-CE127B7CC3C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86D261B4-B15C-4F44-B655-CE127B7CC3C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86D261B4-B15C-4F44-B655-CE127B7CC3C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
41 changes: 41 additions & 0 deletions SectionProperties/ConcreteSectionProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using MagmaWorks.Taxonomy.Sections.SectionProperties.Utility;
using OasysUnits;
using OasysUnits.Units;
using Area = OasysUnits.Area;

namespace MagmaWorks.Taxonomy.Sections.SectionProperties
{
public class ConcreteSectionProperties : SectionProperties, IConcreteSectionProperties
{
public Area TotalReinforcementArea => _reinforcementArea ??= Rebar.CalculateArea(_section.Rebars);
public Area ConcreteArea => base.Area - TotalReinforcementArea;
public Ratio GeometricReinforcementRatio =>
new Ratio(TotalReinforcementArea.SquareMeters / ConcreteArea.SquareMeters, RatioUnit.DecimalFraction);
public Area CrossSectionalShearReinforcementArea => Rebar.CalculateArea(_section.Link) * 2;
public AreaMomentOfInertia ReinforcementSecondMomentOfAreaYy =>
_reinforcementSecondMomentOfAreaYy ??= Rebar.CalculateInertiaYy(_section);
public AreaMomentOfInertia ReinforcementSecondMomentOfAreaZz =>
_reinforcementSecondMomentOfAreaZz ??= Rebar.CalculateInertiaZz(_section);
public Length ReinforcementRadiusOfGyrationYy =>
_reinforcementRadiusOfGyrationYy ??= Rebar.CalculateRadiusOfGyrationYy(_section);
public Length ReinforcementRadiusOfGyrationZz =>
_reinforcementRadiusOfGyrationZz ??= Rebar.CalculateRadiusOfGyrationZz(_section);

private Area? _reinforcementArea;
private AreaMomentOfInertia? _reinforcementSecondMomentOfAreaYy;
private AreaMomentOfInertia? _reinforcementSecondMomentOfAreaZz;
private Length? _reinforcementRadiusOfGyrationYy;
private Length? _reinforcementRadiusOfGyrationZz;
private readonly IConcreteSection _section;

public ConcreteSectionProperties(IConcreteSection section) : base(section.Profile)
{
_section = section;
}

public Length EffectiveDepth(SectionFace face)
=> Rebar.CalculateEffectiveDepth(_section, face);
public Area ReinforcementArea(SectionFace face)
=> Rebar.CalculateArea(_section, face);
}
}
46 changes: 0 additions & 46 deletions SectionProperties/GeometricalProperties.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MagmaWorks.Geometry" Version="0.0.7" />
<PackageReference Include="MagmaWorks.Taxonomy.ISections" Version="0.0.19" />
<PackageReference Include="MagmaWorks.Taxonomy.Profiles.Perimeter" Version="0.0.19" />
<PackageReference Include="MagmaWorks.Geometry" Version="0.0.10" />
<PackageReference Include="MagmaWorks.Taxonomy.ISections" Version="0.0.26" />
<PackageReference Include="MagmaWorks.Taxonomy.ISerialization" Version="0.0.26" />
<PackageReference Include="MagmaWorks.Taxonomy.Profiles.Perimeter" Version="0.0.26" />
<PackageReference Include="MinVer" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down Expand Up @@ -58,4 +59,10 @@
</None>
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>SectionPropertiesTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

</Project>
36 changes: 31 additions & 5 deletions SectionProperties/SectionProperties.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
using MagmaWorks.Taxonomy.Profiles;
using MagmaWorks.Geometry;
using MagmaWorks.Taxonomy.Profiles;
using OasysUnits;

namespace MagmaWorks.Taxonomy.Sections.SectionProperties
{
public class SectionProperties : ISectionProperties
{
public IGeometricalProperties GeometricalProperties
=> _geometricalProperties ??= new GeometricalProperties(_profile);
public ILocalPoint2d Centroid
=> _centroid ??= Utility.Centroid.CalculateCentroid(_profile);
public Length Perimeter
=> _perimeter ??= Utility.PerimeterLength.CalculatePerimeter(_profile);
public ILocalDomain2d Extends => _domain ??= Utility.Extends.GetDomain(_profile);
public Area Area => _area ??= Utility.Area.CalculateArea(_profile);
public SectionModulus ElasticSectionModulusYy
=> _elasticSectionModulusYy ??= Utility.SectionModulus.CalculateSectionModulusYy(_profile);
public SectionModulus ElasticSectionModulusZz
=> _elasticSectionModulusZz ??= Utility.SectionModulus.CalculateSectionModulusZz(_profile);
public AreaMomentOfInertia MomentOfInertiaYy
=> _momentOfInertiaYy ??= Utility.Inertia.CalculateInertiaYy(_profile);
public AreaMomentOfInertia MomentOfInertiaZz
=> _momentOfInertiaZz ??= Utility.Inertia.CalculateInertiaZz(_profile);
public Length RadiusOfGyrationYy
=> _radiusOfGyrationYy ??= Utility.RadiusOfGyration.CalculateRadiusOfGyrationYy(_profile);
public Length RadiusOfGyrationZz
=> _radiusOfGyrationZz ??= Utility.RadiusOfGyration.CalculateRadiusOfGyrationZz(_profile);

private IGeometricalProperties _geometricalProperties;
private ILocalPoint2d _centroid;
private Length? _perimeter;
private ILocalDomain2d _domain;
private Area? _area;
private SectionModulus? _elasticSectionModulusYy;
private SectionModulus? _elasticSectionModulusZz;
private AreaMomentOfInertia? _momentOfInertiaYy;
private AreaMomentOfInertia? _momentOfInertiaZz;
private Length? _radiusOfGyrationYy;
private Length? _radiusOfGyrationZz;
private IProfile _profile;

private SectionProperties() { }
public SectionProperties(ISection section) : this(section.Profile) { }

public SectionProperties(IProfile profile)
Expand Down
6 changes: 5 additions & 1 deletion SectionProperties/Utility/Area.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ public static OasysUnits.Area CalculateArea(IProfile profile)
return PerimeterProfile.CalculateArea(perim);
}

List<IPart> parts = ProfileParts.GetParts(profile);
return CalculateArea(ProfileParts.GetParts(profile));
}

internal static OasysUnits.Area CalculateArea(IList<IPart> parts)
{
OasysUnits.Area area = OasysUnits.Area.Zero;
foreach (IPart part in parts)
{
Expand Down
6 changes: 5 additions & 1 deletion SectionProperties/Utility/Centroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public static ILocalPoint2d CalculateCentroid(IProfile profile)
return PerimeterProfile.CalculateCentroid(perim);
}

return CalculateCentroid(ProfileParts.GetParts(profile));
}

internal static ILocalPoint2d CalculateCentroid(IList<IPart> parts)
{
Volume qz = Volume.Zero;
Volume qy = Volume.Zero;
List<IPart> parts = ProfileParts.GetParts(profile);
OasysUnits.Area area = OasysUnits.Area.Zero;
foreach (IPart part in parts)
{
Expand Down
15 changes: 13 additions & 2 deletions SectionProperties/Utility/Extends.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using MagmaWorks.Geometry;
using MagmaWorks.Taxonomy.Profiles;
using MagmaWorks.Taxonomy.Sections.SectionProperties.Utility.Parts;
using OasysUnits;

namespace MagmaWorks.Taxonomy.Sections.SectionProperties.Utility
Expand Down Expand Up @@ -114,11 +116,20 @@ public static ILocalDomain2d GetDomain(IProfile profile)
}
}

private static LocalDomain2d CreateDomain(Length maxY, Length minY, Length maxZ, Length minZ)
internal static LocalDomain2d CreateDomain(Length maxY, Length minY, Length maxZ, Length minZ)
{
var max = new LocalPoint2d(maxY, maxZ);
var min = new LocalPoint2d(minY, minZ);
return new LocalDomain2d(max, min);
}

internal static ILocalDomain2d GetDomain(IList<IPart> parts)
{
Length maxY = parts.Select(p => p.Extends.Max.Y).Max();
Length minY = parts.Select(p => p.Extends.Min.Y).Min();
Length maxZ = parts.Select(p => p.Extends.Max.Z).Max();
Length minZ = parts.Select(p => p.Extends.Min.Z).Min();
return CreateDomain(maxY, minY, maxZ, minZ);
}
}
}
26 changes: 22 additions & 4 deletions SectionProperties/Utility/Inertia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ public static class Inertia
{
public static AreaMomentOfInertia CalculateInertiaYy(IProfile profile)
{
List<IPart> parts = ProfileParts.GetParts(profile);
ILocalPoint2d elasticCentroid = Centroid.CalculateCentroid(profile);
if (profile is IPerimeter perim)
{
return PerimeterProfile.CalculateInertiaYy(perim);
}

return CalculateInertiaYy(ProfileParts.GetParts(profile));
}

internal static AreaMomentOfInertia CalculateInertiaYy(IList<IPart> parts, ILocalPoint2d elasticCentroid = null)
{
elasticCentroid ??= Centroid.CalculateCentroid(parts);
AreaMomentOfInertia inertia = AreaMomentOfInertia.Zero;
foreach (IPart part in parts)
{
Expand All @@ -26,8 +35,17 @@ public static AreaMomentOfInertia CalculateInertiaYy(IProfile profile)

public static AreaMomentOfInertia CalculateInertiaZz(IProfile profile)
{
List<IPart> parts = ProfileParts.GetParts(profile);
ILocalPoint2d elasticCentroid = Centroid.CalculateCentroid(profile);
if (profile is IPerimeter perim)
{
return PerimeterProfile.CalculateInertiaZz(perim);
}

return CalculateInertiaZz(ProfileParts.GetParts(profile));
}

internal static AreaMomentOfInertia CalculateInertiaZz(IList<IPart> parts, ILocalPoint2d elasticCentroid = null)
{
elasticCentroid ??= Centroid.CalculateCentroid(parts);
AreaMomentOfInertia inertia = AreaMomentOfInertia.Zero;
foreach (IPart part in parts)
{
Expand Down
Loading

0 comments on commit f134a64

Please sign in to comment.