Crack Calculator was added
This commit is contained in:
@@ -53,5 +53,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
OnPropertyChanged(nameof(PrimitiveLeft));
|
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||||
OnPropertyChanged(nameof(PrimitiveTop));
|
OnPropertyChanged(nameof(PrimitiveTop));
|
||||||
}
|
}
|
||||||
|
public override void Refresh()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(Diameter));
|
||||||
|
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||||
|
OnPropertyChanged(nameof(PrimitiveTop));
|
||||||
|
base.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
public override void Refresh()
|
||||||
|
{
|
||||||
|
RefreshPlacement();
|
||||||
|
base.Refresh();
|
||||||
|
}
|
||||||
private void RefreshPlacement()
|
private void RefreshPlacement()
|
||||||
{
|
{
|
||||||
OnPropertyChanged(nameof(Area));
|
OnPropertyChanged(nameof(Area));
|
||||||
|
|||||||
@@ -39,19 +39,19 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
}
|
}
|
||||||
public double CenterX
|
public double CenterX
|
||||||
{
|
{
|
||||||
get => primitive.CenterX;
|
get => primitive.Center.X;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
primitive.CenterX = value;
|
primitive.Center.X = value;
|
||||||
OnPropertyChanged(nameof(CenterX));
|
OnPropertyChanged(nameof(CenterX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double CenterY
|
public double CenterY
|
||||||
{
|
{
|
||||||
get => primitive.CenterY;
|
get => primitive.Center.Y;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
primitive.CenterY = value;
|
primitive.Center.Y = value;
|
||||||
OnPropertyChanged(nameof(CenterY));
|
OnPropertyChanged(nameof(CenterY));
|
||||||
OnPropertyChanged(nameof(InvertedCenterY));
|
OnPropertyChanged(nameof(InvertedCenterY));
|
||||||
}
|
}
|
||||||
@@ -261,5 +261,16 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
OnPropertyChanged(nameof(Color));
|
OnPropertyChanged(nameof(Color));
|
||||||
}
|
}
|
||||||
|
public virtual void Refresh()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
OnPropertyChanged(nameof(Color));
|
||||||
|
OnPropertyChanged(nameof(CenterX));
|
||||||
|
OnPropertyChanged(nameof(CenterY));
|
||||||
|
OnPropertyChanged(nameof(SetMaterialColor));
|
||||||
|
OnPropertyChanged(nameof(Triangulate));
|
||||||
|
OnPropertyChanged(nameof(PrimitiveWidth));
|
||||||
|
OnPropertyChanged(nameof(PrimitiveHeight));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
var circle = primitive as ICirclePrimitive;
|
var circle = primitive as ICirclePrimitive;
|
||||||
viewItem = new CircleViewPrimitive(circle);
|
viewItem = new CircleViewPrimitive(circle);
|
||||||
}
|
}
|
||||||
else if (primitive is IPointPrimitive & primitive is not ReinforcementPrimitive)
|
else if (primitive is IPointPrimitive & primitive is not RebarPrimitive)
|
||||||
{
|
{
|
||||||
var point = primitive as IPointPrimitive;
|
var point = primitive as IPointPrimitive;
|
||||||
viewItem = new PointViewPrimitive(point);
|
viewItem = new PointViewPrimitive(point);
|
||||||
}
|
}
|
||||||
else if (primitive is ReinforcementPrimitive)
|
else if (primitive is RebarPrimitive)
|
||||||
{
|
{
|
||||||
var point = primitive as ReinforcementPrimitive;
|
var point = primitive as RebarPrimitive;
|
||||||
viewItem = new ReinforcementViewPrimitive(point);
|
viewItem = new ReinforcementViewPrimitive(point);
|
||||||
}
|
}
|
||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
|
||||||
|
|||||||
@@ -42,7 +42,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
primitive = _primitive;
|
primitive = _primitive;
|
||||||
DivisionViewModel = new HasDivisionViewModel(primitive);
|
DivisionViewModel = new HasDivisionViewModel(primitive);
|
||||||
}
|
}
|
||||||
|
public override void Refresh()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||||
|
OnPropertyChanged(nameof(PrimitiveTop));
|
||||||
|
base.Refresh();
|
||||||
|
}
|
||||||
public override INdmPrimitive GetNdmPrimitive()
|
public override INdmPrimitive GetNdmPrimitive()
|
||||||
{
|
{
|
||||||
return primitive;
|
return primitive;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
public class ReinforcementViewPrimitive : PointViewPrimitive, IHasHostPrimitive
|
public class ReinforcementViewPrimitive : PointViewPrimitive, IHasHostPrimitive
|
||||||
{
|
{
|
||||||
ReinforcementPrimitive primitive;
|
RebarPrimitive primitive;
|
||||||
|
|
||||||
public INdmPrimitive HostPrimitive
|
public INdmPrimitive HostPrimitive
|
||||||
{
|
{
|
||||||
@@ -21,9 +21,14 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReinforcementViewPrimitive(ReinforcementPrimitive _primitive) : base(_primitive)
|
public ReinforcementViewPrimitive(RebarPrimitive _primitive) : base(_primitive)
|
||||||
{
|
{
|
||||||
primitive = _primitive;
|
primitive = _primitive;
|
||||||
}
|
}
|
||||||
|
public override void Refresh()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(HostPrimitive));
|
||||||
|
base.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -1,81 +0,0 @@
|
|||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
using StructureHelper.Models.Materials;
|
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using StructureHelperLogics.Models.Templates.RCs;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelper.Models.Primitives.Factories
|
|
||||||
{
|
|
||||||
internal static class PrimitiveFactory
|
|
||||||
{
|
|
||||||
public static IEnumerable<PrimitiveBase> GetRectangleRCElement(RectangleBeamTemplate template, IHeadMaterial concrete, IHeadMaterial reinforcement)
|
|
||||||
{
|
|
||||||
List<PrimitiveBase> primitives = new List<PrimitiveBase>();
|
|
||||||
var rect = template.Shape as StructureHelperCommon.Models.Shapes.RectangleShape;
|
|
||||||
var width = rect.Width;
|
|
||||||
var height = rect.Height;
|
|
||||||
var area1 = Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
|
|
||||||
var area2 = Math.PI * template.TopDiameter * template.TopDiameter / 4d;
|
|
||||||
var gap = template.CoverGap;
|
|
||||||
|
|
||||||
double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
|
|
||||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
|
||||||
|
|
||||||
var rectangle = new RectanglePrimitive() { Width = width, Height = height, Name = "Concrete block" };
|
|
||||||
primitives.Add(new RectangleViewPrimitive(rectangle) { HeadMaterial = concrete});
|
|
||||||
var point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1};
|
|
||||||
var viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left bottom point" };
|
|
||||||
viewPoint.RegisterDeltas(xs[0], ys[0]);
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
point = new PointPrimitive() {CenterX = xs[1], CenterY = ys[0], Area = area1 };
|
|
||||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right bottom point" };
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2 };
|
|
||||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left top point" };
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2 };
|
|
||||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right top point" };
|
|
||||||
viewPoint.RegisterDeltas(xs[1], ys[1]);
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
|
|
||||||
if (template.WidthCount > 2)
|
|
||||||
{
|
|
||||||
int count = template.WidthCount - 1;
|
|
||||||
double dist = (xs[1] - xs[0]) / count;
|
|
||||||
for (int i = 1; i < count; i++)
|
|
||||||
{
|
|
||||||
point = new PointPrimitive() {CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1 };
|
|
||||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Bottom point {i}" };
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
|
|
||||||
point = new PointPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2 };
|
|
||||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Top point {i}" };
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (template.HeightCount > 2)
|
|
||||||
{
|
|
||||||
int count = template.HeightCount - 1;
|
|
||||||
double dist = (ys[1] - ys[0]) / count;
|
|
||||||
for (int i = 1; i < count; i++)
|
|
||||||
{
|
|
||||||
point = new PointPrimitive() {CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1 };
|
|
||||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Left point {i}" };
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
|
|
||||||
point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1 };
|
|
||||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Right point {i}" };
|
|
||||||
primitives.Add(viewPoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return primitives;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -50,9 +50,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is ReinforcementPrimitive)
|
if (item is RebarPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as ReinforcementPrimitive;
|
var primitive = item as RebarPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||||
if (fullStrength == true)
|
if (fullStrength == true)
|
||||||
{
|
{
|
||||||
@@ -73,9 +73,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is ReinforcementPrimitive)
|
if (item is RebarPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as ReinforcementPrimitive;
|
var primitive = item as RebarPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||||
var calculator = new AnchorageCalculator(inputData);
|
var calculator = new AnchorageCalculator(inputData);
|
||||||
var val = calculator.GetBaseDevLength() * UnitConstants.Length;
|
var val = calculator.GetBaseDevLength() * UnitConstants.Length;
|
||||||
@@ -92,9 +92,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is ReinforcementPrimitive)
|
if (item is RebarPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as ReinforcementPrimitive;
|
var primitive = item as RebarPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||||
if (fullStrength == true)
|
if (fullStrength == true)
|
||||||
{
|
{
|
||||||
@@ -116,9 +116,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is ReinforcementPrimitive)
|
if (item is RebarPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as ReinforcementPrimitive;
|
var primitive = item as RebarPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
|
||||||
if (fullStrength == true)
|
if (fullStrength == true)
|
||||||
{
|
{
|
||||||
@@ -138,8 +138,8 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
{
|
{
|
||||||
var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
|
var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
|
||||||
{
|
{
|
||||||
CenterX = primitive.CenterX,
|
CenterX = primitive.Center.X,
|
||||||
CenterY = primitive.CenterY,
|
CenterY = primitive.Center.Y,
|
||||||
Diameter = Math.Sqrt(primitive.Area / Math.PI) * 2,
|
Diameter = Math.Sqrt(primitive.Area / Math.PI) * 2,
|
||||||
Value = val
|
Value = val
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Documentation\Manuals\" />
|
<Folder Include="Documentation\Manuals\" />
|
||||||
|
<Folder Include="Infrastructure\UI\DataContexts\Logics\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="20"/>
|
<RowDefinition Height="35"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem Header="General">
|
<TabItem Header="General">
|
||||||
@@ -92,5 +92,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
public ForceCalculatorView(ForceCalculatorViewModel _forceCalculatorViewModel)
|
public ForceCalculatorView(ForceCalculatorViewModel _forceCalculatorViewModel)
|
||||||
{
|
{
|
||||||
viewModel = _forceCalculatorViewModel;
|
viewModel = _forceCalculatorViewModel;
|
||||||
|
viewModel.ParentWindow = this;
|
||||||
DataContext = viewModel;
|
DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
|
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
|
||||||
<Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
|
<Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
|
||||||
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
|
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
|
||||||
|
<Button Margin="3" Content="Fcrc" ToolTip="Show crack force" Command="{Binding ShowCrackResultCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
<MenuItem Header="Add">
|
<MenuItem Header="Add">
|
||||||
<Button Content="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
<Button Content="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||||
<Button Content="Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
<Button Content="Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||||
<Button Content="Reinforcement" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
<Button Content="Rebar" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
||||||
<Button Content="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
<Button Content="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
<MenuItem Header="Add">
|
<MenuItem Header="Add">
|
||||||
<Button Content="Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
<Button Content="Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||||
<Button Content="Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
<Button Content="Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||||
<Button Content="Reinforcement" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
<Button Content="Rebar" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
||||||
<Button Content="Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
<Button Content="Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Templates">
|
<MenuItem Header="Templates">
|
||||||
|
|||||||
@@ -111,6 +111,11 @@
|
|||||||
</Expander>
|
</Expander>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem Header="Main">
|
<TabItem Header="Main">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
@@ -224,9 +229,11 @@
|
|||||||
<TextBox Text="{Binding Opacity, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}" Margin="5"/>
|
<TextBox Text="{Binding Opacity, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}" Margin="5"/>
|
||||||
<Slider Grid.Column="1" Value="{Binding Opacity}" Maximum="100" TickPlacement="BottomRight" TickFrequency="10" IsSnapToTickEnabled="True" Margin="2"/>
|
<Slider Grid.Column="1" Value="{Binding Opacity}" Maximum="100" TickPlacement="BottomRight" TickFrequency="10" IsSnapToTickEnabled="True" Margin="2"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,23 +1,12 @@
|
|||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.Models.Materials;
|
|
||||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using PointViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
using PointViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||||
using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||||
|
|
||||||
@@ -34,6 +23,7 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
|||||||
{
|
{
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
viewModel = new PrimitivePropertiesViewModel(this.primitive, sectionRepository);
|
viewModel = new PrimitivePropertiesViewModel(this.primitive, sectionRepository);
|
||||||
|
viewModel.ParentWindow = this;
|
||||||
this.DataContext = viewModel;
|
this.DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
<RowDefinition Height="35"/>
|
<RowDefinition Height="35"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Items}"/>
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Items}"/>
|
||||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
<Button Style="{StaticResource CancelButton}"/>
|
|
||||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -20,16 +20,13 @@ namespace StructureHelper.Windows.PrimitivePropertiesWindow
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SelectPrimitivesView : Window
|
public partial class SelectPrimitivesView : Window
|
||||||
{
|
{
|
||||||
|
SelectPrimitivesViewModel viewModel;
|
||||||
public SelectPrimitivesView(SelectPrimitivesViewModel vm)
|
public SelectPrimitivesView(SelectPrimitivesViewModel vm)
|
||||||
{
|
{
|
||||||
|
viewModel = vm;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataContext = vm;
|
DataContext = viewModel;
|
||||||
}
|
viewModel.ParentWindow = this;
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
this.DialogResult = true;
|
|
||||||
this.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||||
{
|
{
|
||||||
public class ForceCalculatorViewModel : ViewModelBase
|
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
IEnumerable<INdmPrimitive> allowedPrimitives;
|
IEnumerable<INdmPrimitive> allowedPrimitives;
|
||||||
IEnumerable<IForceAction> allowedForceCombinations;
|
IEnumerable<IForceAction> allowedForceCombinations;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using StructureHelperCommon.Services.Units;
|
|||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.Services.NdmCalculations;
|
using StructureHelperLogics.Services.NdmCalculations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
@@ -34,6 +35,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||||
{
|
{
|
||||||
@@ -57,12 +59,13 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
private RelayCommand setPrestrainCommand;
|
private RelayCommand setPrestrainCommand;
|
||||||
private ICommand showAnchorageCommand;
|
private ICommand showAnchorageCommand;
|
||||||
private ICommand showGeometryResultCommand;
|
private ICommand showGeometryResultCommand;
|
||||||
|
private ICommand showGraphsCommand;
|
||||||
|
private ICommand showCrackResult;
|
||||||
|
|
||||||
public IForcesResults ForcesResults
|
public IForcesResults ForcesResults
|
||||||
{
|
{
|
||||||
get => forcesResults;
|
get => forcesResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelayCommand ShowIsoFieldCommand
|
public RelayCommand ShowIsoFieldCommand
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -77,7 +80,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand ExportToCSVCommand
|
public ICommand ExportToCSVCommand
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -100,13 +102,59 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
var exportService = new ExportToFileService(inputData, logic);
|
var exportService = new ExportToFileService(inputData, logic);
|
||||||
exportService.Export();
|
exportService.Export();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICommand showGraphsCommand;
|
|
||||||
|
|
||||||
public ICommand ShowGraphsCommand
|
public ICommand ShowGraphsCommand
|
||||||
{
|
{
|
||||||
get => showGraphsCommand ??= new RelayCommand(o => showGraphs());
|
get => showGraphsCommand ??= new RelayCommand(o => showGraphs());
|
||||||
}
|
}
|
||||||
|
public ICommand ShowCrackResultCommand
|
||||||
|
{
|
||||||
|
get => showCrackResult ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
SafetyProcessor.RunSafeProcess(ShowCrackResult);
|
||||||
|
}, o => (SelectedResult != null) && SelectedResult.IsValid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowCrackResult()
|
||||||
|
{
|
||||||
|
var limitState = SelectedResult.DesignForceTuple.LimitState;
|
||||||
|
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
||||||
|
var calculator = new CrackForceCalculator();
|
||||||
|
calculator.EndTuple = SelectedResult.DesignForceTuple.ForceTuple;
|
||||||
|
calculator.NdmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, limitState, calcTerm);
|
||||||
|
//Act
|
||||||
|
calculator.Run();
|
||||||
|
var result = (CrackForceResult)calculator.Result;
|
||||||
|
if (result.IsValid)
|
||||||
|
{
|
||||||
|
var softLogic = new ExponentialSofteningLogic() { ForceRatio = result.ActualFactor };
|
||||||
|
string message = string.Empty;
|
||||||
|
if (result.IsSectionCracked)
|
||||||
|
{
|
||||||
|
message += $"Actual crack factor {result.ActualFactor}\n";
|
||||||
|
message += $"Softening crack factor PsiS={softLogic.SofteningFactor()}\n";
|
||||||
|
message += $"M{firstAxisName}={result.ActualTuple.Mx}, M{secondAxisName}={result.ActualTuple.My}, N{thirdAxisName}={result.ActualTuple.Nz}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message += "Cracks are not apeared";
|
||||||
|
}
|
||||||
|
MessageBox.Show(
|
||||||
|
message,
|
||||||
|
"Crack results",
|
||||||
|
MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var errorVM = new ErrorProcessor()
|
||||||
|
{
|
||||||
|
ShortText = "Error apeared while crack calculate",
|
||||||
|
DetailText = result.Description
|
||||||
|
};
|
||||||
|
var wnd = new ErrorMessage(errorVM);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void showGraphs()
|
private void showGraphs()
|
||||||
{
|
{
|
||||||
|
|||||||
30
StructureHelper/Windows/ViewModels/Errors/SafetyProcessor.cs
Normal file
30
StructureHelper/Windows/ViewModels/Errors/SafetyProcessor.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using StructureHelper.Windows.Errors;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Errors
|
||||||
|
{
|
||||||
|
internal static class SafetyProcessor
|
||||||
|
{
|
||||||
|
public static void RunSafeProcess(Action action, string shortText = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
action.Invoke();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var vm = new ErrorProcessor()
|
||||||
|
{
|
||||||
|
ShortText = shortText,
|
||||||
|
DetailText = $"{ex}"
|
||||||
|
};
|
||||||
|
new ErrorMessage(vm).ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||||
|
using StructureHelper.Windows.ViewModels.Errors;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.Logics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -15,10 +19,11 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
{
|
{
|
||||||
public class AnalysisVewModelLogic : SelectedItemViewModel<INdmCalculator>
|
public class AnalysisVewModelLogic : SelectedItemViewModel<ICalculator>
|
||||||
{
|
{
|
||||||
private ICrossSectionRepository repository;
|
private ICrossSectionRepository repository;
|
||||||
private RelayCommand runCommand;
|
private RelayCommand runCommand;
|
||||||
|
static readonly CalculatorUpdateStrategy calculatorUpdateStrategy = new();
|
||||||
|
|
||||||
public override void AddMethod(object parameter)
|
public override void AddMethod(object parameter)
|
||||||
{
|
{
|
||||||
@@ -30,10 +35,19 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
if (SelectedItem is ForceCalculator)
|
if (SelectedItem is ForceCalculator)
|
||||||
{
|
{
|
||||||
var calculator = SelectedItem as ForceCalculator;
|
var calculator = SelectedItem as ForceCalculator;
|
||||||
|
var calculatorCopy = (ICalculator)calculator.Clone();
|
||||||
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceActions, calculator);
|
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceActions, calculator);
|
||||||
|
|
||||||
var wnd = new ForceCalculatorView(vm);
|
var wnd = new ForceCalculatorView(vm);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
|
if (wnd.DialogResult == true)
|
||||||
|
{
|
||||||
|
// to do: update in repository
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
calculatorUpdateStrategy.Update(calculator, calculatorCopy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
base.EditMethod(parameter);
|
base.EditMethod(parameter);
|
||||||
}
|
}
|
||||||
@@ -53,7 +67,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
(
|
(
|
||||||
runCommand = new RelayCommand(o =>
|
runCommand = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
try
|
SafetyProcessor.RunSafeProcess(RunCalculator);
|
||||||
|
}, o => SelectedItem != null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RunCalculator()
|
||||||
{
|
{
|
||||||
SelectedItem.Run();
|
SelectedItem.Run();
|
||||||
var result = SelectedItem.Result;
|
var result = SelectedItem.Result;
|
||||||
@@ -69,14 +88,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show($"{ex}", "There are some errors during solution", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, o => SelectedItem != null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||||
{
|
{
|
||||||
repository = sectionRepository;
|
repository = sectionRepository;
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||||
{
|
{
|
||||||
public interface ICalculatorsViewModelLogic : ICRUDViewModel<INdmCalculator>
|
public interface ICalculatorsViewModelLogic : ICRUDViewModel<ICalculator>
|
||||||
{
|
{
|
||||||
RelayCommand Run { get; }
|
RelayCommand Run { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
else if (primitiveType == PrimitiveType.Reinforcement)
|
else if (primitiveType == PrimitiveType.Reinforcement)
|
||||||
{
|
{
|
||||||
var primitive = new ReinforcementPrimitive
|
var primitive = new RebarPrimitive
|
||||||
{
|
{
|
||||||
Area = 0.0005d
|
Area = 0.0005d
|
||||||
};
|
};
|
||||||
@@ -162,8 +162,21 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
private void EditSelectedItem()
|
private void EditSelectedItem()
|
||||||
{
|
{
|
||||||
|
var ndmPrimitive = SelectedItem.GetNdmPrimitive();
|
||||||
|
var primitiveCopy = ndmPrimitive.Clone() as INdmPrimitive;
|
||||||
var wnd = new PrimitivePropertiesView(SelectedItem, repository);
|
var wnd = new PrimitivePropertiesView(SelectedItem, repository);
|
||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
|
if (wnd.DialogResult == true)
|
||||||
|
{
|
||||||
|
// to do save into repository
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var updateStrategy = new NdmPrimitiveUpdateStrategy();
|
||||||
|
updateStrategy.Update(ndmPrimitive, primitiveCopy);
|
||||||
|
SelectedItem.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand Copy
|
public ICommand Copy
|
||||||
@@ -183,15 +196,16 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
var oldPrimitive = SelectedItem.GetNdmPrimitive();
|
var oldPrimitive = SelectedItem.GetNdmPrimitive();
|
||||||
var newPrimitive = oldPrimitive.Clone() as INdmPrimitive;
|
var newPrimitive = oldPrimitive.Clone() as INdmPrimitive;
|
||||||
|
newPrimitive.Name += " copy";
|
||||||
repository.Primitives.Add(newPrimitive);
|
repository.Primitives.Add(newPrimitive);
|
||||||
PrimitiveBase primitiveBase;
|
PrimitiveBase primitiveBase;
|
||||||
if (newPrimitive is IRectanglePrimitive) { primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive); }
|
if (newPrimitive is IRectanglePrimitive) { primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive); }
|
||||||
else if (newPrimitive is ICirclePrimitive) { primitiveBase = new CircleViewPrimitive(newPrimitive as ICirclePrimitive); }
|
else if (newPrimitive is ICirclePrimitive) { primitiveBase = new CircleViewPrimitive(newPrimitive as ICirclePrimitive); }
|
||||||
else if (newPrimitive is IPointPrimitive)
|
else if (newPrimitive is IPointPrimitive)
|
||||||
{
|
{
|
||||||
if (newPrimitive is ReinforcementPrimitive)
|
if (newPrimitive is RebarPrimitive)
|
||||||
{
|
{
|
||||||
primitiveBase = new ReinforcementViewPrimitive(newPrimitive as ReinforcementPrimitive);
|
primitiveBase = new ReinforcementViewPrimitive(newPrimitive as RebarPrimitive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.Re
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||||
{
|
{
|
||||||
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
|
public class PrimitivePropertiesViewModel : OkCancelViewModelBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
private PrimitiveBase primitive;
|
private PrimitiveBase primitive;
|
||||||
private ICrossSectionRepository sectionRepository;
|
private ICrossSectionRepository sectionRepository;
|
||||||
@@ -316,11 +316,11 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
private void CheckHost(PrimitiveBase primitive, INdmPrimitive item)
|
private void CheckHost(PrimitiveBase primitive, INdmPrimitive item)
|
||||||
{
|
{
|
||||||
var ndm = primitive.GetNdmPrimitive();
|
var ndm = primitive.GetNdmPrimitive();
|
||||||
if (ndm is ReinforcementPrimitive)
|
if (ndm is RebarPrimitive)
|
||||||
{
|
{
|
||||||
var host = item as IHasDivisionSize;
|
var host = item as IHasDivisionSize;
|
||||||
var reinforcement = ndm as ReinforcementPrimitive;
|
var reinforcement = ndm as RebarPrimitive;
|
||||||
if (host.IsPointInside(new Point2D() { X = reinforcement.CenterX, Y = reinforcement.CenterY })
|
if (host.IsPointInside(new Point2D() { X = reinforcement.Center.X, Y = reinforcement.Center.Y })
|
||||||
&& reinforcement.HostPrimitive is null)
|
&& reinforcement.HostPrimitive is null)
|
||||||
{
|
{
|
||||||
var dialogResult = MessageBox.Show($"Primitive {reinforcement.Name} is inside primitive {item.Name}",
|
var dialogResult = MessageBox.Show($"Primitive {reinforcement.Name} is inside primitive {item.Name}",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Windows;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||||
{
|
{
|
||||||
public class SelectPrimitivesViewModel
|
public class SelectPrimitivesViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
public SelectItemsViewModel<PrimitiveBase> Items { get; }
|
public SelectItemsViewModel<PrimitiveBase> Items { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -18,5 +18,6 @@
|
|||||||
public static string LongitudinalForceMustBeLessThanCriticalForce => "#0013: Absolute value of longitudinal force must be greater than critical force";
|
public static string LongitudinalForceMustBeLessThanCriticalForce => "#0013: Absolute value of longitudinal force must be greater than critical force";
|
||||||
public static string SizeMustBeGreaterThanZero => "#0014: Size must be greater than zero";
|
public static string SizeMustBeGreaterThanZero => "#0014: Size must be greater than zero";
|
||||||
public static string ParameterIsNull => "#0015: Parameter is null";
|
public static string ParameterIsNull => "#0015: Parameter is null";
|
||||||
|
public static string ResultIsNotValid => "#0016: Result is not valid";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
|
{
|
||||||
|
public class FindParameterCalculator : ICalculator
|
||||||
|
{
|
||||||
|
FindParameterResult result;
|
||||||
|
public string Name { get; set; }
|
||||||
|
public double StartValue { get; set; }
|
||||||
|
public double EndValue { get; set; }
|
||||||
|
public Predicate<double> Predicate { get; set; }
|
||||||
|
public IAccuracy Accuracy {get;set;}
|
||||||
|
public IResult Result => result;
|
||||||
|
|
||||||
|
public FindParameterCalculator()
|
||||||
|
{
|
||||||
|
StartValue = 0d;
|
||||||
|
EndValue = 1d;
|
||||||
|
Accuracy = new Accuracy() { IterationAccuracy = 0.001, MaxIterationCount = 1000 };
|
||||||
|
}
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
result = new() { IsValid = true};
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result.Parameter = FindMinimumValue(StartValue, EndValue, Predicate);
|
||||||
|
result.Description = "Parameter was found succefully";
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
result.IsValid = false;
|
||||||
|
result.Description += ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private double FindMinimumValue(double start, double end, Predicate<double> predicate)
|
||||||
|
{
|
||||||
|
if (predicate(end) == false)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": pridicate for end value must be true");
|
||||||
|
|
||||||
|
}
|
||||||
|
double precision = Accuracy.IterationAccuracy;
|
||||||
|
int maxIterationCount = Accuracy.MaxIterationCount;
|
||||||
|
double current = start;
|
||||||
|
double step = (end - start) / 2;
|
||||||
|
int iterationNum = 0;
|
||||||
|
while (step > precision)
|
||||||
|
{
|
||||||
|
if (predicate(current))
|
||||||
|
{
|
||||||
|
end = current;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
start = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
current = (start + end) / 2;
|
||||||
|
step = (end - start) / 2;
|
||||||
|
iterationNum++;
|
||||||
|
if (iterationNum > maxIterationCount)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
|
{
|
||||||
|
public class FindParameterResult : IResult
|
||||||
|
{
|
||||||
|
public bool IsValid { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public double Parameter { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -7,9 +6,9 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TaskManager;
|
using TaskManager;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
public interface INdmCalculator : ICloneable
|
public interface ICalculator : ICloneable
|
||||||
{
|
{
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -19,6 +18,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Result of Calculations
|
/// Result of Calculations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
INdmResult Result { get; }
|
IResult Result { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,9 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
public interface INdmResult
|
public interface IResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if result of calculation is valid
|
/// True if result of calculation is valid
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
|
{
|
||||||
|
public class AccuracyUpdateStrategy : IUpdateStrategy<IAccuracy>
|
||||||
|
{
|
||||||
|
public void Update(IAccuracy targetObject, IAccuracy sourceObject)
|
||||||
|
{
|
||||||
|
targetObject.IterationAccuracy = sourceObject.IterationAccuracy;
|
||||||
|
targetObject.MaxIterationCount = sourceObject.MaxIterationCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||||
{
|
{
|
||||||
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new PointUpdateStrategy();
|
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new PointShapeUpdateStrategy();
|
||||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy = new ForcePairUpdateStrategy();
|
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy = new ForcePairUpdateStrategy();
|
||||||
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy = new FactorCombinationUpdateStrategy();
|
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy = new FactorCombinationUpdateStrategy();
|
||||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy = new ForceCombinationListUpdateStrategy();
|
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy = new ForceCombinationListUpdateStrategy();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
internal class ForceTupleUpdateStrategy : IUpdateStrategy<IForceTuple>
|
public class ForceTupleUpdateStrategy : IUpdateStrategy<IForceTuple>
|
||||||
{
|
{
|
||||||
public void Update(IForceTuple targetObject, IForceTuple sourceObject)
|
public void Update(IForceTuple targetObject, IForceTuple sourceObject)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using StructureHelperCommon.Services.Sections;
|
namespace StructureHelperCommon.Models.Sections
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Sections
|
|
||||||
{
|
{
|
||||||
public class CompressedMember : ICompressedMember
|
public class CompressedMember : ICompressedMember
|
||||||
{
|
{
|
||||||
|
static readonly CompressedMemberUpdateStrategy updateStrategy = new();
|
||||||
public bool Buckling { get; set; }
|
public bool Buckling { get; set; }
|
||||||
public double GeometryLength { get; set; }
|
public double GeometryLength { get; set; }
|
||||||
public double LengthFactorX { get; set; }
|
public double LengthFactorX { get; set; }
|
||||||
@@ -24,9 +23,9 @@ namespace StructureHelperCommon.Models.Sections
|
|||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var target = new CompressedMember();
|
var newItem = new CompressedMember();
|
||||||
CompressedMemberServices.CopyProperties(this, target);
|
updateStrategy.Update(newItem, this);
|
||||||
return target;
|
return newItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Sections
|
||||||
|
{
|
||||||
|
public class CompressedMemberUpdateStrategy : IUpdateStrategy<ICompressedMember>
|
||||||
|
{
|
||||||
|
public void Update(ICompressedMember targetObject, ICompressedMember sourceObject)
|
||||||
|
{
|
||||||
|
targetObject.Buckling = sourceObject.Buckling;
|
||||||
|
targetObject.GeometryLength = sourceObject.GeometryLength;
|
||||||
|
targetObject.LengthFactorX = sourceObject.LengthFactorX;
|
||||||
|
targetObject.DiagramFactorX = sourceObject.DiagramFactorX;
|
||||||
|
targetObject.LengthFactorY = sourceObject.LengthFactorY;
|
||||||
|
targetObject.DiagramFactorY = sourceObject.DiagramFactorY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
|
{
|
||||||
|
public class CircleShapeUpdateStrategy : IUpdateStrategy<ICircleShape>
|
||||||
|
{
|
||||||
|
public void Update(ICircleShape targetObject, ICircleShape sourceObject)
|
||||||
|
{
|
||||||
|
targetObject.Diameter = sourceObject.Diameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes.Logics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
|
{
|
||||||
|
public class LineShapeUpdateStrategy : IUpdateStrategy<ILineShape>
|
||||||
|
{
|
||||||
|
readonly PointShapeUpdateStrategy pointUpdateStrategy = new();
|
||||||
|
public void Update(ILineShape targetObject, ILineShape sourceObject)
|
||||||
|
{
|
||||||
|
pointUpdateStrategy.Update(targetObject.StartPoint, sourceObject.StartPoint);
|
||||||
|
pointUpdateStrategy.Update(targetObject.EndPoint, sourceObject.EndPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
namespace StructureHelperCommon.Models.Shapes.Logics
|
namespace StructureHelperCommon.Models.Shapes.Logics
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public class PointUpdateStrategy : IUpdateStrategy<IPoint2D>
|
public class PointShapeUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
|
{
|
||||||
|
public class RectangleShapeUpdateStrategy : IUpdateStrategy<IRectangleShape>
|
||||||
|
{
|
||||||
|
public void Update(IRectangleShape targetObject, IRectangleShape sourceObject)
|
||||||
|
{
|
||||||
|
targetObject.Width = sourceObject.Width;
|
||||||
|
targetObject.Height = sourceObject.Height;
|
||||||
|
targetObject.Angle = sourceObject.Angle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public class Point2D : IPoint2D
|
public class Point2D : IPoint2D
|
||||||
{
|
{
|
||||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointUpdateStrategy();
|
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointShapeUpdateStrategy();
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
|
||||||
|
|
||||||
namespace StructureHelperCommon.Services.Calculations
|
|
||||||
{
|
|
||||||
public static class AccuracyService
|
|
||||||
{
|
|
||||||
public static void CopyProperties(IAccuracy source, IAccuracy target)
|
|
||||||
{
|
|
||||||
target.IterationAccuracy = source.IterationAccuracy;
|
|
||||||
target.MaxIterationCount = source.MaxIterationCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
using StructureHelperCommon.Models.Sections;
|
|
||||||
|
|
||||||
namespace StructureHelperCommon.Services.Sections
|
|
||||||
{
|
|
||||||
public static class CompressedMemberServices
|
|
||||||
{
|
|
||||||
public static void CopyProperties(ICompressedMember source, ICompressedMember target)
|
|
||||||
{
|
|
||||||
target.Buckling = source.Buckling;
|
|
||||||
target.GeometryLength = source.GeometryLength;
|
|
||||||
target.LengthFactorX = source.LengthFactorX;
|
|
||||||
target.DiagramFactorX = source.DiagramFactorX;
|
|
||||||
target.LengthFactorY = source.LengthFactorY;
|
|
||||||
target.DiagramFactorY = source.DiagramFactorY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
using StructureHelperCommon.Models.Shapes;
|
|
||||||
|
|
||||||
namespace StructureHelperCommon.Services.ShapeServices
|
|
||||||
{
|
|
||||||
public static class ShapeService
|
|
||||||
{
|
|
||||||
public static void CopyLineProperties(ILineShape source, ILineShape target)
|
|
||||||
{
|
|
||||||
target.StartPoint.X = source.StartPoint.X;
|
|
||||||
target.StartPoint.Y = source.StartPoint.Y;
|
|
||||||
target.EndPoint.X = source.EndPoint.X;
|
|
||||||
target.EndPoint.Y = source.EndPoint.Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CopyRectangleProperties(IRectangleShape source, IRectangleShape target)
|
|
||||||
{
|
|
||||||
target.Width = source.Width;
|
|
||||||
target.Height = source.Height;
|
|
||||||
target.Angle = source.Angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CopyCircleProperties(ICircleShape source, ICircleShape target)
|
|
||||||
{
|
|
||||||
target.Diameter = source.Diameter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.MaterialBuilders
|
||||||
|
{
|
||||||
|
internal interface IDecoratorOption : IMaterialOption
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.MaterialBuilders.Decorators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.MaterialBuilders
|
||||||
|
{
|
||||||
|
internal class RestrictStrainDecorator : IMaterialBuilder
|
||||||
|
{
|
||||||
|
IMaterialBuilder builder;
|
||||||
|
public IMaterialOption MaterialOption { get; set; }
|
||||||
|
|
||||||
|
public RestrictStrainDecorator(IMaterialBuilder builder)
|
||||||
|
{
|
||||||
|
this.builder = builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMaterial GetMaterial()
|
||||||
|
{
|
||||||
|
CheckOptions();
|
||||||
|
var option = (RestrictStrainOption)MaterialOption;
|
||||||
|
var material = new Material();
|
||||||
|
material.InitModulus = builder.GetMaterial().InitModulus;
|
||||||
|
material.DiagramParameters = new List<double>()
|
||||||
|
{
|
||||||
|
option.MaxTensileStrain,
|
||||||
|
option.MaxCompessionStrain
|
||||||
|
};
|
||||||
|
material.Diagram = GetStressDiagram;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckOptions()
|
||||||
|
{
|
||||||
|
CheckObject.CompareTypes(typeof(RestrictStrainOption), MaterialOption.GetType());
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetStressDiagram(IEnumerable<double> parameters, double strain)
|
||||||
|
{
|
||||||
|
var maxTensileStrain = parameters.ToList()[0];
|
||||||
|
var maxCompressionStrain = parameters.ToList()[1];
|
||||||
|
if (strain > maxTensileStrain || strain < maxCompressionStrain)
|
||||||
|
{
|
||||||
|
return 0d;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var material = builder.GetMaterial();
|
||||||
|
return material.Diagram.Invoke(parameters, strain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.MaterialBuilders.Decorators
|
||||||
|
{
|
||||||
|
internal class RestrictStrainOption : IDecoratorOption
|
||||||
|
{
|
||||||
|
private double maxTensileStrain;
|
||||||
|
private double maxCompessionStrain;
|
||||||
|
|
||||||
|
public double MaxTensileStrain
|
||||||
|
{
|
||||||
|
get => maxTensileStrain;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 0d)
|
||||||
|
{
|
||||||
|
//to do exception
|
||||||
|
}
|
||||||
|
maxTensileStrain = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double MaxCompessionStrain { get => maxCompessionStrain; set => maxCompessionStrain = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
19
StructureHelperLogics/MaterialBuilders/IBearingOption.cs
Normal file
19
StructureHelperLogics/MaterialBuilders/IBearingOption.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.MaterialBuilders
|
||||||
|
{
|
||||||
|
internal interface IBearingOption : IMaterialOption
|
||||||
|
{
|
||||||
|
double InitModulus { get; set; }
|
||||||
|
double Strength { get; set; }
|
||||||
|
LimitStates LimitState { get; set; }
|
||||||
|
bool IsShortTerm { get; set; }
|
||||||
|
CodesType CodesType { get; set; }
|
||||||
|
IPartialFactor ExternalFactor { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
15
StructureHelperLogics/MaterialBuilders/IMaterialBuilder.cs
Normal file
15
StructureHelperLogics/MaterialBuilders/IMaterialBuilder.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.MaterialBuilders
|
||||||
|
{
|
||||||
|
internal interface IMaterialBuilder
|
||||||
|
{
|
||||||
|
IMaterialOption MaterialOption { get; set; }
|
||||||
|
IMaterial GetMaterial();
|
||||||
|
}
|
||||||
|
}
|
||||||
12
StructureHelperLogics/MaterialBuilders/IMaterialOption.cs
Normal file
12
StructureHelperLogics/MaterialBuilders/IMaterialOption.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.MaterialBuilders
|
||||||
|
{
|
||||||
|
internal interface IMaterialOption
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
15
StructureHelperLogics/MaterialBuilders/IPartialFactor.cs
Normal file
15
StructureHelperLogics/MaterialBuilders/IPartialFactor.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.MaterialBuilders
|
||||||
|
{
|
||||||
|
internal interface IPartialFactor
|
||||||
|
{
|
||||||
|
double YoungsModulus { get; set; }
|
||||||
|
double Compressive { get; set; }
|
||||||
|
double Tensile { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
@@ -16,14 +17,14 @@ namespace StructureHelperLogics.Models.CrossSections
|
|||||||
public List<IForceAction> ForceActions { get; private set; }
|
public List<IForceAction> ForceActions { get; private set; }
|
||||||
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
public List<INdmPrimitive> Primitives { get; }
|
public List<INdmPrimitive> Primitives { get; }
|
||||||
public List<INdmCalculator> CalculatorsList { get; private set; }
|
public List<ICalculator> CalculatorsList { get; private set; }
|
||||||
|
|
||||||
public CrossSectionRepository()
|
public CrossSectionRepository()
|
||||||
{
|
{
|
||||||
ForceActions = new List<IForceAction>();
|
ForceActions = new List<IForceAction>();
|
||||||
HeadMaterials = new List<IHeadMaterial>();
|
HeadMaterials = new List<IHeadMaterial>();
|
||||||
Primitives = new List<INdmPrimitive>();
|
Primitives = new List<INdmPrimitive>();
|
||||||
CalculatorsList = new List<INdmCalculator>();
|
CalculatorsList = new List<ICalculator>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
@@ -15,6 +16,6 @@ namespace StructureHelperLogics.Models.CrossSections
|
|||||||
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
|
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
|
||||||
{
|
{
|
||||||
List<IForceAction> ForceActions { get; }
|
List<IForceAction> ForceActions { get; }
|
||||||
List<INdmCalculator> CalculatorsList { get; }
|
List<ICalculator> CalculatorsList { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -10,9 +11,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
|
|||||||
{
|
{
|
||||||
internal class CalculatorLogic : ICalculatorLogic
|
internal class CalculatorLogic : ICalculatorLogic
|
||||||
{
|
{
|
||||||
public IEnumerable<INdmCalculator> GetNdmCalculators()
|
public IEnumerable<ICalculator> GetNdmCalculators()
|
||||||
{
|
{
|
||||||
var calculators = new List<INdmCalculator>();
|
var calculators = new List<ICalculator>();
|
||||||
calculators.Add(new ForceCalculator() { Name = "New Force Calculator"});
|
calculators.Add(new ForceCalculator() { Name = "New Force Calculator"});
|
||||||
return calculators;
|
return calculators;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||||
{
|
{
|
||||||
internal interface ICalculatorLogic
|
internal interface ICalculatorLogic
|
||||||
{
|
{
|
||||||
IEnumerable<INdmCalculator> GetNdmCalculators();
|
IEnumerable<ICalculator> GetNdmCalculators();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,13 +52,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
var angle = i * dAngle;
|
var angle = i * dAngle;
|
||||||
var x = radius * Math.Sin(angle);
|
var x = radius * Math.Sin(angle);
|
||||||
var y = radius * Math.Cos(angle);
|
var y = radius * Math.Cos(angle);
|
||||||
var point = new ReinforcementPrimitive()
|
var point = new RebarPrimitive()
|
||||||
{ CenterX = x,
|
{
|
||||||
CenterY = y,
|
|
||||||
Area = barArea,
|
Area = barArea,
|
||||||
Name = "Left bottom point",
|
Name = "Left bottom point",
|
||||||
HeadMaterial = reinforcementMaterial,
|
HeadMaterial = reinforcementMaterial,
|
||||||
HostPrimitive=concreteBlock };
|
HostPrimitive=concreteBlock };
|
||||||
|
point.Center.X = x;
|
||||||
|
point.Center.Y = y;
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
}
|
}
|
||||||
return primitives;
|
return primitives;
|
||||||
|
|||||||
@@ -59,13 +59,45 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||||
|
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
var point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point", HeadMaterial = reinforcement, HostPrimitive=concreteBlock };
|
var point = new RebarPrimitive()
|
||||||
|
{
|
||||||
|
Area = area1,
|
||||||
|
Name = "Left bottom point",
|
||||||
|
HeadMaterial = reinforcement,
|
||||||
|
HostPrimitive=concreteBlock
|
||||||
|
};
|
||||||
|
point.Center.X = xs[0];
|
||||||
|
point.Center.Y = ys[0];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
point = new RebarPrimitive()
|
||||||
|
{
|
||||||
|
Area = area1,
|
||||||
|
Name = "Right bottom point",
|
||||||
|
HeadMaterial = reinforcement,
|
||||||
|
HostPrimitive = concreteBlock
|
||||||
|
};
|
||||||
|
point.Center.X = xs[1];
|
||||||
|
point.Center.Y = ys[0];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
point = new RebarPrimitive()
|
||||||
|
{
|
||||||
|
Area = area2,
|
||||||
|
Name = "Left top point",
|
||||||
|
HeadMaterial = reinforcement,
|
||||||
|
HostPrimitive = concreteBlock
|
||||||
|
};
|
||||||
|
point.Center.X = xs[0];
|
||||||
|
point.Center.Y = ys[1];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
point = new RebarPrimitive()
|
||||||
|
{
|
||||||
|
Area = area2,
|
||||||
|
Name = "Right top point",
|
||||||
|
HeadMaterial = reinforcement,
|
||||||
|
HostPrimitive = concreteBlock
|
||||||
|
};
|
||||||
|
point.Center.X = xs[1];
|
||||||
|
point.Center.Y = ys[1];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
return primitives;
|
return primitives;
|
||||||
}
|
}
|
||||||
@@ -83,9 +115,13 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double dist = (xs[1] - xs[0]) / count;
|
double dist = (xs[1] - xs[0]) / count;
|
||||||
for (int i = 1; i < count; i++)
|
for (int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
point = new RebarPrimitive() { Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||||
|
point.Center.X = xs[0] + dist * i;
|
||||||
|
point.Center.Y = ys[0];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
point = new RebarPrimitive() {Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||||
|
point.Center.X = xs[0] + dist * i;
|
||||||
|
point.Center.Y = ys[1];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,9 +131,25 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double dist = (ys[1] - ys[0]) / count;
|
double dist = (ys[1] - ys[0]) / count;
|
||||||
for (int i = 1; i < count; i++)
|
for (int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
point = new RebarPrimitive()
|
||||||
|
{
|
||||||
|
Area = area1,
|
||||||
|
Name = $"Left point {i}",
|
||||||
|
HeadMaterial = reinforcement,
|
||||||
|
HostPrimitive = concreteBlock
|
||||||
|
};
|
||||||
|
point.Center.X = xs[0];
|
||||||
|
point.Center.Y = ys[0] + dist * i;
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
point = new RebarPrimitive()
|
||||||
|
{
|
||||||
|
Area = area1,
|
||||||
|
Name = $"Right point {i}",
|
||||||
|
HeadMaterial = reinforcement,
|
||||||
|
HostPrimitive = concreteBlock
|
||||||
|
};
|
||||||
|
point.Center.X = xs[1];
|
||||||
|
point.Center.Y = ys[0] + dist * i;
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Templates.RCs;
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
@@ -20,7 +21,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
ICalculatorLogic calculatorLogic;
|
ICalculatorLogic calculatorLogic;
|
||||||
IEnumerable<INdmPrimitive> primitives;
|
IEnumerable<INdmPrimitive> primitives;
|
||||||
IEnumerable<IForceAction> combinations;
|
IEnumerable<IForceAction> combinations;
|
||||||
IEnumerable<INdmCalculator> calculators;
|
IEnumerable<ICalculator> calculators;
|
||||||
|
|
||||||
public SectionTemplate(IRCGeometryLogic geometryLogic)
|
public SectionTemplate(IRCGeometryLogic geometryLogic)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,33 +1,26 @@
|
|||||||
using LoaderCalculator;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Matrix;
|
|
||||||
using LoaderCalculator.Data.Ndms;
|
|
||||||
using LoaderCalculator.Data.SourceData;
|
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Sections;
|
using StructureHelperCommon.Models.Sections;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.Calculations;
|
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
using StructureHelperCommon.Services.Sections;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
using StructureHelperLogics.NdmCalculations.Buckling;
|
using StructureHelperLogics.NdmCalculations.Buckling;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public class ForceCalculator : IForceCalculator
|
public class ForceCalculator : IForceCalculator
|
||||||
{
|
{
|
||||||
|
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<LimitStates> LimitStatesList { get; }
|
public List<LimitStates> LimitStatesList { get; }
|
||||||
public List<CalcTerms> CalcTermsList { get; }
|
public List<CalcTerms> CalcTermsList { get; }
|
||||||
public List<IForceAction> ForceActions { get; }
|
public List<IForceAction> ForceActions { get; }
|
||||||
public List<INdmPrimitive> Primitives { get; }
|
public List<INdmPrimitive> Primitives { get; }
|
||||||
public INdmResult Result { get; private set; }
|
public IResult Result { get; private set; }
|
||||||
public ICompressedMember CompressedMember { get; }
|
public ICompressedMember CompressedMember { get; }
|
||||||
public IAccuracy Accuracy { get; set; }
|
public IAccuracy Accuracy { get; set; }
|
||||||
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
||||||
@@ -184,16 +177,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
IForceCalculator target = new ForceCalculator { Name = Name + " copy"};
|
var newCalculator = new ForceCalculator();
|
||||||
target.LimitStatesList.Clear();
|
updateStrategy.Update(newCalculator, this);
|
||||||
target.LimitStatesList.AddRange(LimitStatesList);
|
return newCalculator;
|
||||||
target.CalcTermsList.Clear();
|
|
||||||
target.CalcTermsList.AddRange(CalcTermsList);
|
|
||||||
AccuracyService.CopyProperties(Accuracy, target.Accuracy);
|
|
||||||
CompressedMemberServices.CopyProperties(CompressedMember, target.CompressedMember);
|
|
||||||
target.Primitives.AddRange(Primitives);
|
|
||||||
target.ForceActions.AddRange(ForceActions);
|
|
||||||
return target;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
public class ForceTupleCalculator : IForceTupleCalculator
|
public class ForceTupleCalculator : IForceTupleCalculator
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public INdmResult Result { get; private set; }
|
public IResult Result { get; private set; }
|
||||||
|
|
||||||
private IForceTupleInputData inputData;
|
private IForceTupleInputData inputData;
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,10 @@ using StructureHelperCommon.Models.Calculators;
|
|||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Sections;
|
using StructureHelperCommon.Models.Sections;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations
|
public interface IForceCalculator : ICalculator, IHasPrimitives, IHasForceCombinations
|
||||||
{
|
{
|
||||||
List<CalcTerms> CalcTermsList { get; }
|
List<CalcTerms> CalcTermsList { get; }
|
||||||
List<LimitStates> LimitStatesList { get; }
|
List<LimitStates> LimitStatesList { get; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForceTupleCalculator : INdmCalculator
|
public interface IForceTupleCalculator : ICalculator
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForcesResults : INdmResult
|
public interface IForcesResults : IResult
|
||||||
{
|
{
|
||||||
string Description { get; set; }
|
string Description { get; set; }
|
||||||
List<IForcesTupleResult> ForcesResultList { get; }
|
List<IForcesTupleResult> ForcesResultList { get; }
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using LoaderCalculator.Data.ResultData;
|
using LoaderCalculator.Data.ResultData;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForcesTupleResult : INdmResult
|
public interface IForcesTupleResult : IResult
|
||||||
{
|
{
|
||||||
IDesignForceTuple DesignForceTuple { get; set; }
|
IDesignForceTuple DesignForceTuple { get; set; }
|
||||||
ILoaderResults LoaderResults { get; set; }
|
ILoaderResults LoaderResults { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||||
|
{
|
||||||
|
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<IForceCalculator>
|
||||||
|
{
|
||||||
|
static readonly AccuracyUpdateStrategy accuracyUpdateStrategy = new();
|
||||||
|
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
|
||||||
|
public void Update(IForceCalculator targetObject, IForceCalculator sourceObject)
|
||||||
|
{
|
||||||
|
targetObject.Name = sourceObject.Name;
|
||||||
|
targetObject.LimitStatesList.Clear();
|
||||||
|
targetObject.LimitStatesList.AddRange(sourceObject.LimitStatesList);
|
||||||
|
targetObject.CalcTermsList.Clear();
|
||||||
|
targetObject.CalcTermsList.AddRange(sourceObject.CalcTermsList);
|
||||||
|
accuracyUpdateStrategy.Update(targetObject.Accuracy, sourceObject.Accuracy);
|
||||||
|
compressedMemberUpdateStrategy.Update(targetObject.CompressedMember, sourceObject.CompressedMember);
|
||||||
|
targetObject.Primitives.Clear();
|
||||||
|
targetObject.Primitives.AddRange(sourceObject.Primitives);
|
||||||
|
targetObject.ForceActions.Clear();
|
||||||
|
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -15,7 +16,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
|||||||
IGeometryResult geometryResult;
|
IGeometryResult geometryResult;
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public INdmResult Result => geometryResult;
|
public IResult Result => geometryResult;
|
||||||
|
|
||||||
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
using System;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||||
{
|
{
|
||||||
public interface IGeometryCalculator : INdmCalculator
|
public interface IGeometryCalculator : ICalculator
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Models.Parameters;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Parameters;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||||
{
|
{
|
||||||
public interface IGeometryResult : INdmResult
|
public interface IGeometryResult : IResult
|
||||||
{
|
{
|
||||||
List<IValueParameter<string>> TextParameters { get; set; }
|
List<IValueParameter<string>> TextParameters { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.Logics
|
||||||
|
{
|
||||||
|
public class CalculatorUpdateStrategy : IUpdateStrategy<ICalculator>
|
||||||
|
{
|
||||||
|
public void Update(ICalculator targetObject, ICalculator sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||||
|
if (targetObject is IForceCalculator force)
|
||||||
|
{
|
||||||
|
new ForceCalculatorUpdateStrategy().Update(force, (IForceCalculator)sourceObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(INdmPrimitive), sourceObject.GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
|||||||
public static class InputDataFactory
|
public static class InputDataFactory
|
||||||
{
|
{
|
||||||
private static IStressLogic stressLogic => new StressLogic();
|
private static IStressLogic stressLogic => new StressLogic();
|
||||||
public static IAnchorageInputData GetInputData(ReinforcementPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
public static IAnchorageInputData GetInputData(RebarPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
||||||
{
|
{
|
||||||
var inputData = new AnchorageInputData();
|
var inputData = new AnchorageInputData();
|
||||||
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
|
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
|
||||||
@@ -43,7 +43,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
|||||||
return inputData;
|
return inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
|
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
||||||
{
|
{
|
||||||
if (primitive.HostPrimitive is not null)
|
if (primitive.HostPrimitive is not null)
|
||||||
{
|
{
|
||||||
@@ -59,7 +59,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
|||||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host material is incorrect or null");
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host material is incorrect or null");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
|
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
||||||
{
|
{
|
||||||
if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
|
if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public INdmResult Result { get; private set; }
|
public IResult Result { get; private set; }
|
||||||
|
|
||||||
public IAccuracy Accuracy { get; set; }
|
public IAccuracy Accuracy { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Buckling
|
namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||||
{
|
{
|
||||||
internal interface IConcreteBucklingCalculator : INdmCalculator
|
internal interface IConcreteBucklingCalculator : ICalculator
|
||||||
{
|
{
|
||||||
IAccuracy Accuracy { get; set; }
|
IAccuracy Accuracy { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -10,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Results of calculation of buckling of reinforced concrete section
|
/// Results of calculation of buckling of reinforced concrete section
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IConcreteBucklingResult : INdmResult
|
public interface IConcreteBucklingResult : IResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Factor of increasing of bending moment (p-delta effect) in the plain XOZ
|
/// Factor of increasing of bending moment (p-delta effect) in the plain XOZ
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class CrackForceCalculator : ICalculator
|
||||||
|
{
|
||||||
|
static readonly CrackedLogic crackedLogic = new();
|
||||||
|
private CrackForceResult result;
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public IForceTuple StartTuple { get; set; }
|
||||||
|
public IForceTuple EndTuple { get; set; }
|
||||||
|
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
public Accuracy Accuracy {get;set; }
|
||||||
|
public IResult Result => result;
|
||||||
|
public CrackForceCalculator()
|
||||||
|
{
|
||||||
|
StartTuple ??= new ForceTuple();
|
||||||
|
Accuracy ??= new Accuracy() { IterationAccuracy = 0.0001d, MaxIterationCount = 10000 };
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
result = new CrackForceResult();
|
||||||
|
crackedLogic.StartTuple = StartTuple;
|
||||||
|
crackedLogic.EndTuple = EndTuple;
|
||||||
|
crackedLogic.NdmCollection = NdmCollection;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
result.IsValid = false;
|
||||||
|
result.Description += ex;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (crackedLogic.IsSectionCracked(0d) == true)
|
||||||
|
{
|
||||||
|
result.IsValid = true;
|
||||||
|
result.ActualFactor = 0d;
|
||||||
|
result.ActualTuple = (IForceTuple)StartTuple.Clone();
|
||||||
|
result.IsSectionCracked = true;
|
||||||
|
result.Description += "Section cracked in start tuple";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (crackedLogic.IsSectionCracked(1d) == false)
|
||||||
|
{
|
||||||
|
result.IsValid = true;
|
||||||
|
result.IsSectionCracked = false;
|
||||||
|
result.Description = "Section is not cracked";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var parameterCalculator = new FindParameterCalculator()
|
||||||
|
{
|
||||||
|
Accuracy = Accuracy,
|
||||||
|
Predicate = crackedLogic.IsSectionCracked
|
||||||
|
};
|
||||||
|
parameterCalculator.Run();
|
||||||
|
var paramResult = parameterCalculator.Result as FindParameterResult;
|
||||||
|
if (paramResult.IsValid == true)
|
||||||
|
{
|
||||||
|
result.IsValid = true;
|
||||||
|
result.IsSectionCracked = true;
|
||||||
|
result.Description += paramResult.Description;
|
||||||
|
result.ActualFactor = paramResult.Parameter;
|
||||||
|
result.ActualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, paramResult.Parameter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.IsValid = false;
|
||||||
|
result.Description += paramResult.Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(EndTuple);
|
||||||
|
if (StartTuple == EndTuple)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Section is not cracked");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class CrackForceResult : IResult
|
||||||
|
{
|
||||||
|
public bool IsValid { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public bool IsSectionCracked { get; set; }
|
||||||
|
public double ActualFactor { get; set; }
|
||||||
|
public IForceTuple ActualTuple { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
internal class CrackedLogic : ICrackedLogic
|
||||||
|
{
|
||||||
|
ISectionCrackedLogic sectionCrackedLogic;
|
||||||
|
public IForceTuple StartTuple { get; set; }
|
||||||
|
public IForceTuple EndTuple { get; set; }
|
||||||
|
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
public CrackedLogic(ISectionCrackedLogic sectionLogic)
|
||||||
|
{
|
||||||
|
sectionCrackedLogic = sectionLogic;
|
||||||
|
}
|
||||||
|
public CrackedLogic() : this (new HoleSectionCrackedLogic())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public bool IsSectionCracked(double factor)
|
||||||
|
{
|
||||||
|
var actualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, factor);
|
||||||
|
sectionCrackedLogic.Tuple = actualTuple;
|
||||||
|
sectionCrackedLogic.NdmCollection = NdmCollection;
|
||||||
|
return sectionCrackedLogic.IsSectionCracked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class ExponentialSofteningLogic : ICrackSofteningLogic
|
||||||
|
{
|
||||||
|
private double forceRatio;
|
||||||
|
private double powerFactor;
|
||||||
|
|
||||||
|
public double PowerFactor
|
||||||
|
{
|
||||||
|
get => powerFactor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Power Factor must not be less than zero");
|
||||||
|
}
|
||||||
|
powerFactor = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double BettaFactor { get; set; }
|
||||||
|
public double ForceRatio
|
||||||
|
{
|
||||||
|
get => forceRatio;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be less than zero");
|
||||||
|
}
|
||||||
|
else if (value > 1)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be greater than 1.0");
|
||||||
|
}
|
||||||
|
forceRatio = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double FiMin {get;set;}
|
||||||
|
public ExponentialSofteningLogic()
|
||||||
|
{
|
||||||
|
FiMin = 0.2d;
|
||||||
|
PowerFactor = 2d;
|
||||||
|
BettaFactor = 0.8;
|
||||||
|
}
|
||||||
|
public double SofteningFactor()
|
||||||
|
{
|
||||||
|
double fi;
|
||||||
|
fi = 1 - BettaFactor * Math.Pow(ForceRatio, PowerFactor);
|
||||||
|
fi = Math.Max(fi, FiMin);
|
||||||
|
return fi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using LoaderCalculator.Logics;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
internal class HoleSectionCrackedLogic : ISectionCrackedLogic
|
||||||
|
{
|
||||||
|
static readonly IStressLogic stressLogic = new StressLogic();
|
||||||
|
public IForceTuple Tuple { get; set; }
|
||||||
|
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
public Accuracy Accuracy { get; set; }
|
||||||
|
public HoleSectionCrackedLogic()
|
||||||
|
{
|
||||||
|
if (Accuracy is null)
|
||||||
|
{
|
||||||
|
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 10000 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool IsSectionCracked()
|
||||||
|
{
|
||||||
|
var inputData = new ForceTupleInputData()
|
||||||
|
{
|
||||||
|
Accuracy = Accuracy,
|
||||||
|
Tuple = Tuple,
|
||||||
|
NdmCollection = NdmCollection
|
||||||
|
};
|
||||||
|
var calculator = new ForceTupleCalculator(inputData);
|
||||||
|
calculator.Run();
|
||||||
|
var calcResult = calculator.Result as ForcesTupleResult;
|
||||||
|
if (calcResult.IsValid == false)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ResultIsNotValid + ": Result of Section Calculation is not valid");
|
||||||
|
}
|
||||||
|
var strainMatrix = calcResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
|
return stressLogic.IsSectionCracked(strainMatrix, NdmCollection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public interface ICrackSofteningLogic
|
||||||
|
{
|
||||||
|
double SofteningFactor();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
internal interface ICrackedLogic
|
||||||
|
{
|
||||||
|
IForceTuple StartTuple { get; set; }
|
||||||
|
IForceTuple EndTuple { get; set; }
|
||||||
|
IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
bool IsSectionCracked(double factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
internal interface ISectionCrackedLogic
|
||||||
|
{
|
||||||
|
IForceTuple Tuple { get; set; }
|
||||||
|
IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
bool IsSectionCracked();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,24 +3,20 @@ using LoaderCalculator.Data.Ndms;
|
|||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.ShapeServices;
|
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public class CirclePrimitive : ICirclePrimitive
|
public class CirclePrimitive : ICirclePrimitive
|
||||||
{
|
{
|
||||||
|
static readonly CircleUpdateStrategy updateStrategy = new();
|
||||||
|
/// <inheritdoc/>
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public double CenterX { get; set; }
|
/// <inheritdoc/>
|
||||||
public double CenterY { get; set; }
|
public IPoint2D Center { get; private set; }
|
||||||
public IHeadMaterial? HeadMaterial { get; set; }
|
public IHeadMaterial? HeadMaterial { get; set; }
|
||||||
public StrainTuple UsersPrestrain { get; }
|
public StrainTuple UsersPrestrain { get; }
|
||||||
public StrainTuple AutoPrestrain { get; }
|
public StrainTuple AutoPrestrain { get; }
|
||||||
@@ -32,12 +28,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public bool Triangulate { get; set; }
|
public bool Triangulate { get; set; }
|
||||||
public ICrossSection? CrossSection { get; set; }
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public CirclePrimitive(Guid id)
|
public CirclePrimitive(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = "New Circle";
|
Name = "New Circle";
|
||||||
NdmMaxSize = 0.01d;
|
NdmMaxSize = 0.01d;
|
||||||
NdmMinDivision = 10;
|
NdmMinDivision = 10;
|
||||||
|
Center = new Point2D();
|
||||||
VisualProperty = new VisualProperty { Opacity = 0.8d };
|
VisualProperty = new VisualProperty { Opacity = 0.8d };
|
||||||
UsersPrestrain = new StrainTuple();
|
UsersPrestrain = new StrainTuple();
|
||||||
AutoPrestrain = new StrainTuple();
|
AutoPrestrain = new StrainTuple();
|
||||||
@@ -46,16 +44,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
}
|
}
|
||||||
public CirclePrimitive() : this (Guid.NewGuid())
|
public CirclePrimitive() : this (Guid.NewGuid())
|
||||||
{}
|
{}
|
||||||
|
/// <inheritdoc/>
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var primitive = new CirclePrimitive();
|
var primitive = new CirclePrimitive();
|
||||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
updateStrategy.Update(primitive, this);
|
||||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
|
||||||
ShapeService.CopyCircleProperties(this, primitive);
|
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
/// <inheritdoc/>
|
||||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||||
{
|
{
|
||||||
var ndms = new List<INdm>();
|
var ndms = new List<INdm>();
|
||||||
@@ -64,24 +60,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
ndms.AddRange(logic.GetNdmCollection(material));
|
ndms.AddRange(logic.GetNdmCollection(material));
|
||||||
return ndms;
|
return ndms;
|
||||||
}
|
}
|
||||||
|
/// <inheritdoc/>
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsPointInside(IPoint2D point)
|
public bool IsPointInside(IPoint2D point)
|
||||||
{
|
{
|
||||||
var dX = CenterX - point.X;
|
var dX = Center.X - point.X;
|
||||||
var dY = CenterY - point.Y;
|
var dY = Center.Y - point.Y;
|
||||||
var distance = Math.Sqrt(dX * dX + dY * dY);
|
var distance = Math.Sqrt(dX * dX + dY * dY);
|
||||||
if (distance > Diameter / 2) { return false; }
|
if (distance > Diameter / 2) { return false; }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public interface INdmPrimitive : ISaveable, ICloneable
|
public interface INdmPrimitive : ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
string? Name { get; set; }
|
string? Name { get; set; }
|
||||||
double CenterX { get; set; }
|
IPoint2D Center { get; }
|
||||||
double CenterY { get; set; }
|
|
||||||
ICrossSection? CrossSection { get; set; }
|
ICrossSection? CrossSection { get; set; }
|
||||||
IHeadMaterial? HeadMaterial { get; set; }
|
IHeadMaterial? HeadMaterial { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,17 +1,9 @@
|
|||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.ShapeServices;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
@@ -54,8 +46,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var primitive = new LinePrimitive();
|
var primitive = new LinePrimitive();
|
||||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
throw new NotImplementedException();
|
||||||
ShapeService.CopyLineProperties(this, primitive);
|
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Shapes.Logics;
|
||||||
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
internal class BaseUpdateStrategy : IUpdateStrategy<INdmPrimitive>
|
||||||
|
{
|
||||||
|
static readonly PointShapeUpdateStrategy pointShapeUpdateStrategy = new();
|
||||||
|
readonly ForceTupleUpdateStrategy tupleUpdateStrategy = new();
|
||||||
|
readonly VisualPropsUpdateStrategy visualPropsUpdateStrategy = new();
|
||||||
|
|
||||||
|
public void Update(INdmPrimitive target, INdmPrimitive source)
|
||||||
|
{
|
||||||
|
target.Name = source.Name;
|
||||||
|
if (source.HeadMaterial != null) target.HeadMaterial = source.HeadMaterial;
|
||||||
|
target.Triangulate = source.Triangulate;
|
||||||
|
pointShapeUpdateStrategy.Update(target.Center, source.Center);
|
||||||
|
visualPropsUpdateStrategy.Update(target.VisualProperty, source.VisualProperty);
|
||||||
|
tupleUpdateStrategy.Update(target.UsersPrestrain, source.UsersPrestrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
internal class CircleUpdateStrategy : IUpdateStrategy<CirclePrimitive>
|
||||||
|
{
|
||||||
|
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||||
|
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
|
||||||
|
static readonly CircleShapeUpdateStrategy shapeUpdateStrategy = new();
|
||||||
|
|
||||||
|
public void Update(CirclePrimitive targetObject, CirclePrimitive sourceObject)
|
||||||
|
{
|
||||||
|
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
shapeUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
internal class DivisionPropsUpdateStrategy : IUpdateStrategy<IHasDivisionSize>
|
||||||
|
{
|
||||||
|
public void Update(IHasDivisionSize targetObject, IHasDivisionSize sourceObject)
|
||||||
|
{
|
||||||
|
targetObject.NdmMaxSize = sourceObject.NdmMaxSize;
|
||||||
|
targetObject.NdmMinDivision = sourceObject.NdmMinDivision;
|
||||||
|
targetObject.ClearUnderlying = sourceObject.ClearUnderlying;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public class NdmPrimitiveUpdateStrategy : IUpdateStrategy<INdmPrimitive>
|
||||||
|
{
|
||||||
|
public void Update(INdmPrimitive targetObject, INdmPrimitive sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||||
|
if (targetObject is PointPrimitive point)
|
||||||
|
{
|
||||||
|
new PointUpdateStrategy().Update(point, (PointPrimitive)sourceObject);
|
||||||
|
}
|
||||||
|
else if (targetObject is RebarPrimitive rebar)
|
||||||
|
{
|
||||||
|
new RebarUpdateStrategy().Update(rebar, (RebarPrimitive)sourceObject);
|
||||||
|
}
|
||||||
|
else if (targetObject is RectanglePrimitive rectangle)
|
||||||
|
{
|
||||||
|
new RectangleUpdateStrategy().Update(rectangle, (RectanglePrimitive)sourceObject);
|
||||||
|
}
|
||||||
|
else if (targetObject is CirclePrimitive circle)
|
||||||
|
{
|
||||||
|
new CircleUpdateStrategy().Update(circle, (CirclePrimitive)sourceObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(INdmPrimitive), sourceObject.GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
internal class PointUpdateStrategy : IUpdateStrategy<PointPrimitive>
|
||||||
|
{
|
||||||
|
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||||
|
public void Update(PointPrimitive targetObject, PointPrimitive sourceObject)
|
||||||
|
{
|
||||||
|
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
targetObject.Area = sourceObject.Area;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
internal class RebarUpdateStrategy : IUpdateStrategy<RebarPrimitive>
|
||||||
|
{
|
||||||
|
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||||
|
public void Update(RebarPrimitive targetObject, RebarPrimitive sourceObject)
|
||||||
|
{
|
||||||
|
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
targetObject.Area = sourceObject.Area;
|
||||||
|
targetObject.HostPrimitive = sourceObject.HostPrimitive;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
internal class RectangleUpdateStrategy : IUpdateStrategy<RectanglePrimitive>
|
||||||
|
{
|
||||||
|
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||||
|
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
|
||||||
|
static readonly RectangleShapeUpdateStrategy shapeUpdateStrategy = new();
|
||||||
|
public void Update(RectanglePrimitive targetObject, RectanglePrimitive sourceObject)
|
||||||
|
{
|
||||||
|
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
shapeUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public class VisualPropsUpdateStrategy : IUpdateStrategy<IVisualProperty>
|
||||||
|
{
|
||||||
|
public void Update(IVisualProperty targetObject, IVisualProperty sourceObject)
|
||||||
|
{
|
||||||
|
targetObject.IsVisible = sourceObject.IsVisible;
|
||||||
|
targetObject.Color = sourceObject.Color;
|
||||||
|
targetObject.SetMaterialColor = sourceObject.SetMaterialColor;
|
||||||
|
targetObject.Opacity = sourceObject.Opacity;
|
||||||
|
targetObject.ZIndex = sourceObject.ZIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,10 +16,10 @@ namespace StructureHelperLogics.Models.Primitives
|
|||||||
{
|
{
|
||||||
public class PointPrimitive : IPointPrimitive
|
public class PointPrimitive : IPointPrimitive
|
||||||
{
|
{
|
||||||
|
static readonly PointUpdateStrategy updateStrategy = new();
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public double CenterX { get; set; }
|
public IPoint2D Center { get; private set; }
|
||||||
public double CenterY { get; set; }
|
|
||||||
public IHeadMaterial HeadMaterial { get; set; }
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
//public double NdmMaxSize { get; set; }
|
//public double NdmMaxSize { get; set; }
|
||||||
//public int NdmMinDivision { get; set; }
|
//public int NdmMinDivision { get; set; }
|
||||||
@@ -31,11 +31,13 @@ namespace StructureHelperLogics.Models.Primitives
|
|||||||
public bool Triangulate { get; set; }
|
public bool Triangulate { get; set; }
|
||||||
public ICrossSection? CrossSection { get; set; }
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public PointPrimitive(Guid id)
|
public PointPrimitive(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = "New Point";
|
Name = "New Point";
|
||||||
Area = 0.0005d;
|
Area = 0.0005d;
|
||||||
|
Center = new Point2D();
|
||||||
VisualProperty = new VisualProperty();
|
VisualProperty = new VisualProperty();
|
||||||
UsersPrestrain = new StrainTuple();
|
UsersPrestrain = new StrainTuple();
|
||||||
AutoPrestrain = new StrainTuple();
|
AutoPrestrain = new StrainTuple();
|
||||||
@@ -52,16 +54,10 @@ namespace StructureHelperLogics.Models.Primitives
|
|||||||
return logic.GetNdmCollection(material);
|
return logic.GetNdmCollection(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var primitive = new PointPrimitive();
|
var primitive = new PointPrimitive();
|
||||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
updateStrategy.Update(primitive, this);
|
||||||
primitive.Area = Area;
|
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ using LoaderCalculator.Data.Ndms;
|
|||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
@@ -17,15 +19,14 @@ using System.Windows.Media.Media3D;
|
|||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public class ReinforcementPrimitive : IPointPrimitive, IHasHostPrimitive
|
public class RebarPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||||
{
|
{
|
||||||
IDataRepository<ReinforcementPrimitive> repository;
|
static readonly RebarUpdateStrategy updateStrategy = new();
|
||||||
|
IDataRepository<RebarPrimitive> repository;
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double CenterX { get; set; }
|
public IPoint2D Center { get; private set; }
|
||||||
/// <inheritdoc/>
|
|
||||||
public double CenterY { get; set; }
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IHeadMaterial? HeadMaterial { get; set; }
|
public IHeadMaterial? HeadMaterial { get; set; }
|
||||||
public bool Triangulate { get; set; }
|
public bool Triangulate { get; set; }
|
||||||
@@ -41,27 +42,27 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public INdmPrimitive HostPrimitive { get; set; }
|
public INdmPrimitive HostPrimitive { get; set; }
|
||||||
public ICrossSection? CrossSection { get; set; }
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
public ReinforcementPrimitive(Guid id)
|
|
||||||
|
public RebarPrimitive(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = "New Reinforcement";
|
Name = "New Reinforcement";
|
||||||
Area = 0.0005d;
|
Area = 0.0005d;
|
||||||
|
Center = new Point2D();
|
||||||
VisualProperty = new VisualProperty();
|
VisualProperty = new VisualProperty();
|
||||||
UsersPrestrain = new StrainTuple();
|
UsersPrestrain = new StrainTuple();
|
||||||
AutoPrestrain = new StrainTuple();
|
AutoPrestrain = new StrainTuple();
|
||||||
Triangulate = true;
|
Triangulate = true;
|
||||||
}
|
}
|
||||||
public ReinforcementPrimitive() : this(Guid.NewGuid())
|
public RebarPrimitive() : this(Guid.NewGuid())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var primitive = new ReinforcementPrimitive();
|
var primitive = new RebarPrimitive();
|
||||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
updateStrategy.Update(primitive, this);
|
||||||
primitive.Area = Area;
|
|
||||||
primitive.HostPrimitive = HostPrimitive;
|
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,28 +1,18 @@
|
|||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.ShapeServices;
|
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public class RectanglePrimitive : IRectanglePrimitive
|
public class RectanglePrimitive : IRectanglePrimitive
|
||||||
{
|
{
|
||||||
|
readonly RectangleUpdateStrategy updateStrategy = new();
|
||||||
public Guid Id { get;}
|
public Guid Id { get;}
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public double CenterX { get; set; }
|
|
||||||
public double CenterY { get; set; }
|
|
||||||
public IHeadMaterial? HeadMaterial { get; set; }
|
public IHeadMaterial? HeadMaterial { get; set; }
|
||||||
public StrainTuple UsersPrestrain { get; private set; }
|
public StrainTuple UsersPrestrain { get; private set; }
|
||||||
public StrainTuple AutoPrestrain { get; private set; }
|
public StrainTuple AutoPrestrain { get; private set; }
|
||||||
@@ -36,12 +26,15 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public IVisualProperty VisualProperty { get; }
|
public IVisualProperty VisualProperty { get; }
|
||||||
public ICrossSection? CrossSection { get; set; }
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
|
public IPoint2D Center { get; private set; }
|
||||||
|
|
||||||
public RectanglePrimitive(Guid id)
|
public RectanglePrimitive(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = "New Rectangle";
|
Name = "New Rectangle";
|
||||||
NdmMaxSize = 0.01d;
|
NdmMaxSize = 0.01d;
|
||||||
NdmMinDivision = 10;
|
NdmMinDivision = 10;
|
||||||
|
Center = new Point2D();
|
||||||
VisualProperty = new VisualProperty { Opacity = 0.8d};
|
VisualProperty = new VisualProperty { Opacity = 0.8d};
|
||||||
UsersPrestrain = new StrainTuple();
|
UsersPrestrain = new StrainTuple();
|
||||||
AutoPrestrain = new StrainTuple();
|
AutoPrestrain = new StrainTuple();
|
||||||
@@ -58,9 +51,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var primitive = new RectanglePrimitive();
|
var primitive = new RectanglePrimitive();
|
||||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
updateStrategy.Update(primitive, this);
|
||||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
|
||||||
ShapeService.CopyRectangleProperties(this, primitive);
|
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,17 +64,12 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
return ndms;
|
return ndms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsPointInside(IPoint2D point)
|
public bool IsPointInside(IPoint2D point)
|
||||||
{
|
{
|
||||||
var xMax = CenterX + Width / 2;
|
var xMax = Center.X + Width / 2;
|
||||||
var xMin = CenterX - Width / 2;
|
var xMin = Center.X - Width / 2;
|
||||||
var yMax = CenterY + Height / 2;
|
var yMax = Center.Y + Height / 2;
|
||||||
var yMin = CenterY - Height / 2;
|
var yMin = Center.Y - Height / 2;
|
||||||
if (point.X > xMax ||
|
if (point.X > xMax ||
|
||||||
point.X < xMin ||
|
point.X < xMin ||
|
||||||
point.Y > yMax ||
|
point.Y > yMax ||
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
|
|
||||||
public CircleTriangulationLogicOptions(ICirclePrimitive primitive)
|
public CircleTriangulationLogicOptions(ICirclePrimitive primitive)
|
||||||
{
|
{
|
||||||
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
|
Center = new Point2D() { X = primitive.Center.X, Y = primitive.Center.Y };
|
||||||
Circle = primitive;
|
Circle = primitive;
|
||||||
NdmMaxSize = primitive.NdmMaxSize;
|
NdmMaxSize = primitive.NdmMaxSize;
|
||||||
NdmMinDivision = primitive.NdmMinDivision;
|
NdmMinDivision = primitive.NdmMinDivision;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
|
|
||||||
public PointTriangulationLogicOptions(IPointPrimitive primitive)
|
public PointTriangulationLogicOptions(IPointPrimitive primitive)
|
||||||
{
|
{
|
||||||
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
|
Center = new Point2D() { X = primitive.Center.X, Y = primitive.Center.Y };
|
||||||
Area = primitive.Area;
|
Area = primitive.Area;
|
||||||
Prestrain = new StrainTuple
|
Prestrain = new StrainTuple
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
|
|
||||||
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
|
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
|
||||||
{
|
{
|
||||||
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
|
Center = new Point2D() {X = primitive.Center.X, Y = primitive.Center.Y };
|
||||||
Rectangle = primitive;
|
Rectangle = primitive;
|
||||||
NdmMaxSize = primitive.NdmMaxSize;
|
NdmMaxSize = primitive.NdmMaxSize;
|
||||||
NdmMinDivision = primitive.NdmMinDivision;
|
NdmMinDivision = primitive.NdmMinDivision;
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
using StructureHelperCommon.Services.Sections;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Services.NdmCalculations
|
namespace StructureHelperLogics.Services.NdmCalculations
|
||||||
{
|
{
|
||||||
public static class InterpolateService
|
public static class InterpolateService
|
||||||
{
|
{
|
||||||
|
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
|
||||||
public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple finishDesignForce,IDesignForceTuple startDesignForce, int stepCount)
|
public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple finishDesignForce,IDesignForceTuple startDesignForce, int stepCount)
|
||||||
{
|
{
|
||||||
IForceCalculator calculator = new ForceCalculator();
|
IForceCalculator calculator = new ForceCalculator();
|
||||||
@@ -20,7 +15,7 @@ namespace StructureHelperLogics.Services.NdmCalculations
|
|||||||
calculator.LimitStatesList.Add(finishDesignForce.LimitState);
|
calculator.LimitStatesList.Add(finishDesignForce.LimitState);
|
||||||
calculator.CalcTermsList.Clear();
|
calculator.CalcTermsList.Clear();
|
||||||
calculator.CalcTermsList.Add(finishDesignForce.CalcTerm);
|
calculator.CalcTermsList.Add(finishDesignForce.CalcTerm);
|
||||||
CompressedMemberServices.CopyProperties(source.CompressedMember, calculator.CompressedMember);
|
compressedMemberUpdateStrategy.Update(calculator.CompressedMember, source.CompressedMember);
|
||||||
calculator.Accuracy = source.Accuracy;
|
calculator.Accuracy = source.Accuracy;
|
||||||
calculator.Primitives.AddRange(source.Primitives);
|
calculator.Primitives.AddRange(source.Primitives);
|
||||||
calculator.ForceActions.Clear();
|
calculator.ForceActions.Clear();
|
||||||
|
|||||||
@@ -19,32 +19,6 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
|||||||
{
|
{
|
||||||
public static class NdmPrimitivesService
|
public static class NdmPrimitivesService
|
||||||
{
|
{
|
||||||
public static void CopyVisualProperty(IVisualProperty source, IVisualProperty target)
|
|
||||||
{
|
|
||||||
target.IsVisible = source.IsVisible;
|
|
||||||
target.Color = source.Color;
|
|
||||||
target.SetMaterialColor = source.SetMaterialColor;
|
|
||||||
target.Opacity = source.Opacity;
|
|
||||||
target.ZIndex = source.ZIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
|
|
||||||
{
|
|
||||||
target.Name = source.Name + " copy" ;
|
|
||||||
if (source.HeadMaterial != null) target.HeadMaterial = source.HeadMaterial;
|
|
||||||
CopyVisualProperty(source.VisualProperty, target.VisualProperty);
|
|
||||||
target.CenterX = source.CenterX;
|
|
||||||
target.CenterY = source.CenterY;
|
|
||||||
target.Triangulate = source.Triangulate;
|
|
||||||
ForceTupleService.CopyProperties(source.UsersPrestrain, target.UsersPrestrain);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
|
||||||
{
|
|
||||||
target.NdmMaxSize = source.NdmMaxSize;
|
|
||||||
target.NdmMinDivision = source.NdmMinDivision;
|
|
||||||
target.ClearUnderlying = source.ClearUnderlying;
|
|
||||||
}
|
|
||||||
public static List<INdm> GetNdms(INdmPrimitive primitive, LimitStates limitState, CalcTerms calcTerm)
|
public static List<INdm> GetNdms(INdmPrimitive primitive, LimitStates limitState, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user