Interactin diagram was added

This commit is contained in:
Evgeny Redikultsev
2023-12-02 21:50:10 +05:00
parent 8de8c00182
commit 1b635cbf69
47 changed files with 619 additions and 146 deletions

View File

@@ -13,6 +13,11 @@
<Slider x:Name="StrokeSlider" Width="195" Minimum="0" Maximum="{Binding MaxStrokeSize}" Value="{Binding StrokeSize}"/> <Slider x:Name="StrokeSlider" Width="195" Minimum="0" Maximum="{Binding MaxStrokeSize}" Value="{Binding StrokeSize}"/>
<TextBox Width="40" Text="{Binding StrokeSize,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/> <TextBox Width="40" Text="{Binding StrokeSize,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel> </StackPanel>
<TextBlock Text="Filling opacity" Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal">
<Slider x:Name="OpacitySlider" Width="195" Minimum="0" Maximum="1" Value="{Binding Opacity}"/>
<TextBox Width="40" Text="{Binding Opacity,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel>
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
</DataTemplate> </DataTemplate>

View File

@@ -12,6 +12,9 @@
<Compile Update="Windows\Arrays\ArrayView.xaml.cs"> <Compile Update="Windows\Arrays\ArrayView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\SurroundDataView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml.cs"> <Compile Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@@ -39,7 +42,7 @@
<Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs"> <Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Windows\UserControls\MultiplyTuple.xaml.cs"> <Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
@@ -59,6 +62,9 @@
<Page Update="Windows\Arrays\ArrayView.xaml"> <Page Update="Windows\Arrays\ArrayView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\SurroundDataView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml"> <Page Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
@@ -86,7 +92,7 @@
<Page Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml"> <Page Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Windows\UserControls\MultiplyTuple.xaml"> <Page Update="Windows\UserControls\MultiplyDouble.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
</ItemGroup> </ItemGroup>

View File

@@ -2,8 +2,10 @@
using StructureHelper.Windows.Graphs; using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.ViewModels.Errors; using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Parameters; using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
@@ -18,20 +20,18 @@ using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
{ {
internal class InteractionDiagramLogic : ILongProcessLogic internal class InteractionDiagramLogic : ILongProcessLogic
{ {
const double xmax = 0.7e6d;
const double xmin = -0.7e6d;
const double ymax = 1.5e6d;
const double ymin = -9e6d;
private ArrayParameter<double> arrayParameter; private ArrayParameter<double> arrayParameter;
private IResult result;
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames; private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public int StepCount { get; } public int StepCount => SurroundData.PointCount;
public Action<int> SetProgress { get; set; } public Action<int> SetProgress { get; set; }
public bool Result { get; set; } public bool Result { get; set; }
@@ -40,29 +40,40 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public CalcTerms CalcTerm { get; set; } public CalcTerms CalcTerm { get; set; }
public ForceTuple ForceTuple { get; set; } public ForceTuple ForceTuple { get; set; }
private void Show() public SurroundData SurroundData { get; set; }
public InteractionDiagramLogic(SurroundData surroundData)
{ {
var options = new TriangulationOptions() { LimiteState = LimitState, CalcTerm = CalcTerm }; SurroundData = surroundData;
var ndmCollection = NdmPrimitives.SelectMany(x => x.GetNdms(options)); }
//var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
private void DoCalculations()
{
var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
var predicateFactory = new PredicateFactory() var predicateFactory = new PredicateFactory()
{ {
My = ForceTuple.My, My = SurroundData.ConstZ,
Ndms = ndmCollection Ndms = ndmCollection
}; };
Predicate<IPoint2D> predicate = predicateFactory.GetResult; Predicate<IPoint2D> predicate = predicateFactory.IsSectionFailure;
//Predicate<IPoint2D> predicate = predicateFactory.IsSectionCracked;
//var logic = new StabLimitCurveLogic(); //var logic = new StabLimitCurveLogic();
var logic = new LimitCurveLogic(predicate); var logic = new LimitCurveLogic(predicate);
var calculator = new LimitCurveCalculator(logic); var calculator = new LimitCurveCalculator(logic);
calculator.SurroundData.XMax = xmax; calculator.SurroundData = SurroundData;
calculator.SurroundData.XMin = xmin; calculator.ActionToOutputResults = SetProgressByResult;
calculator.SurroundData.YMax = ymax; SafetyProcessor.RunSafeProcess(() =>
calculator.SurroundData.YMin = ymin; {
calculator.SurroundData.PointCount = 40; CalcResult(calculator);
}, "Errors appeared during showing a graph, see detailed information");
}
private void CalcResult(LimitCurveCalculator calculator)
{
calculator.Run(); calculator.Run();
var result = calculator.Result; result = calculator.Result;
if (result.IsValid = false) { return; } if (result.IsValid == false) { return; }
var interactionResult = result as LimitCurveResult; var interactionResult = result as LimitCurveResult;
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN"); var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm"); var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
@@ -73,18 +84,27 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
for (int i = 0; i < items.Count(); i++) for (int i = 0; i < items.Count(); i++)
{ {
var valueList = new List<double> var valueList = new List<double>
{ {
items[i].X * unitForce.Multiplyer, items[i].X * unitForce.Multiplyer,
items[i].Y * unitMoment.Multiplyer items[i].Y * unitMoment.Multiplyer
}; };
for (int j = 0; j < valueList.Count; j++) for (int j = 0; j < valueList.Count; j++)
{ {
data[i, j] = valueList[j]; data[i, j] = valueList[j];
} }
SetProgress?.Invoke(i);
} }
} }
private void SetProgressByResult(IResult calcResult)
{
if (calcResult is not LimitCurveResult)
{
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(LimitCurveResult), calcResult));
}
var parameterResult = calcResult as LimitCurveResult;
SetProgress?.Invoke(parameterResult.IterationNumber);
}
private static string[] GetLabels(IUnit unitForce, IUnit unitMoment) private static string[] GetLabels(IUnit unitForce, IUnit unitMoment)
{ {
return new string[] return new string[]
@@ -96,19 +116,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public void ShowWindow() public void ShowWindow()
{ {
Show();
Result = true; Result = true;
SafetyProcessor.RunSafeProcess(() => SafetyProcessor.RunSafeProcess(() =>
{ {
var wnd = new GraphView(arrayParameter); if (result.IsValid == true)
wnd.ShowDialog(); {
var wnd = new GraphView(arrayParameter);
wnd.ShowDialog();
}
else
{
MessageBox.Show(result.Description);
}
}, },
"Errors appeared during showing a graph, see detailed information"); "Errors appeared during showing a graph, see detailed information");
} }
public void WorkerDoWork(object sender, DoWorkEventArgs e) public void WorkerDoWork(object sender, DoWorkEventArgs e)
{ {
Show(); DoCalculations();
Result = true; Result = true;
} }

View File

@@ -0,0 +1,52 @@
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic.SurroundDataView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic"
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext ="{d:DesignInstance local:SurroundDataViewModel}"
mc:Ignorable="d"
Title="Diagram properties" Height="250" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="35"/>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Maximum axial force"/>
<TextBlock Grid.Row="1" Text="Minimum axial force"/>
<TextBlock Grid.Row="2" Text="Maximum bending moment Mx"/>
<TextBlock Grid.Row="3" Text="Minimum bending moment Mx"/>
<TextBlock Grid.Row="4" Text="Minimum bending moment My"/>
<TextBlock Grid.Row="5" Text="Point count"/>
<TextBox Grid.Column="1" Text="{Binding YMax, Converter={StaticResource ForceConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding YMin, Converter={StaticResource ForceConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding XMax, Converter={StaticResource MomentConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding XMin, Converter={StaticResource MomentConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding ConstZ, Converter={StaticResource MomentConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="5" Text="{Binding PointCount, ValidatesOnDataErrors=True}"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="0" ValueChanged="YmaxChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="1" ValueChanged="YminChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="2" ValueChanged="XmaxChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="3" ValueChanged="XminChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="4" ValueChanged="ConstZChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="5" ValueChanged="PointCountChanged"/>
</Grid>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
</Grid>
</Window>

View File

@@ -0,0 +1,67 @@
using StructureHelper.Windows.UserControls;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
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;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
{
/// <summary>
/// Логика взаимодействия для SurroundDataView.xaml
/// </summary>
public partial class SurroundDataView : Window
{
private SurroundDataViewModel viewModel;
public SurroundDataView(SurroundData surroundData) : this(new SurroundDataViewModel(surroundData)) { }
public SurroundDataView(SurroundDataViewModel vm)
{
viewModel = vm;
viewModel.ParentWindow = this;
DataContext = viewModel;
InitializeComponent();
}
private void XmaxChanged(object sender, EventArgs e)
{
viewModel.XMax *= ChangeValue(sender);
}
private void XminChanged(object sender, EventArgs e)
{
viewModel.XMin *= ChangeValue(sender);
}
private void YmaxChanged(object sender, EventArgs e)
{
viewModel.YMax *= ChangeValue(sender);
}
private void YminChanged(object sender, EventArgs e)
{
viewModel.YMin *= ChangeValue(sender);
}
private void ConstZChanged(object sender, EventArgs e)
{
viewModel.ConstZ *= ChangeValue(sender);
}
private void PointCountChanged(object sender, EventArgs e)
{
viewModel.PointCount = Convert.ToInt32(viewModel.PointCount * ChangeValue(sender));
}
private double ChangeValue(object sender)
{
var obj = (MultiplyDouble)sender;
var factor = obj.DoubleFactor;
return factor;
}
}
}

View File

@@ -0,0 +1,107 @@
using StructureHelper.Windows.ViewModels;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
{
public class SurroundDataViewModel : OkCancelViewModelBase, IDataErrorInfo
{
private readonly SurroundData surroundData;
public double XMax
{
get => surroundData.XMax; set
{
surroundData.XMax = value;
OnPropertyChanged(nameof(XMax));
}
}
public double XMin
{
get => surroundData.XMin; set
{
surroundData.XMin = value;
OnPropertyChanged(nameof(XMin));
}
}
public double YMax
{
get => surroundData.YMax; set
{
surroundData.YMax = value;
OnPropertyChanged(nameof(YMax));
}
}
public double YMin
{
get => surroundData.YMin; set
{
surroundData.YMin = value;
OnPropertyChanged(nameof(YMin));
}
}
public double ConstZ
{
get => surroundData.ConstZ; set
{
surroundData.ConstZ = value;
OnPropertyChanged(nameof(ConstZ));
}
}
public int PointCount
{
get => surroundData.PointCount; set
{
try
{
surroundData.PointCount = value;
}
catch (Exception)
{
surroundData.PointCount = 40;
}
OnPropertyChanged(nameof(PointCount));
}
}
public string Error => throw new NotImplementedException();
public string this[string columnName]
{
get
{
string error = String.Empty;
switch (columnName)
{
case nameof(PointCount):
if (PointCount < 24)
{
error = "Point count must be greater than 24";
}
break;
}
return error;
}
}
public SurroundDataViewModel(SurroundData surroundData)
{
this.surroundData = surroundData;
}
internal void RefreshAll()
{
OnPropertyChanged(nameof(XMax));
OnPropertyChanged(nameof(XMin));
OnPropertyChanged(nameof(YMax));
OnPropertyChanged(nameof(YMin));
OnPropertyChanged(nameof(ConstZ));
OnPropertyChanged(nameof(PointCount));
}
}
}

View File

@@ -5,6 +5,7 @@ using StructureHelper.Services.Exports;
using StructureHelper.Services.Reports; using StructureHelper.Services.Reports;
using StructureHelper.Services.Reports.CalculationReports; using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers; using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews; using StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews;
using StructureHelper.Windows.Errors; using StructureHelper.Windows.Errors;
using StructureHelper.Windows.Forces; using StructureHelper.Windows.Forces;
@@ -38,7 +39,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private ForceCalculator forceCalculator; private ForceCalculator forceCalculator;
private ILongProcessLogic progressLogic; private ILongProcessLogic progressLogic;
private ShowProgressLogic showProgressLogic; private ShowProgressLogic showProgressLogic;
private InteractionDiagramLogic interactionDiagramLogic = new(); private InteractionDiagramLogic interactionDiagramLogic;
private static readonly ShowCrackResultLogic showCrackResultLogic = new(); private static readonly ShowCrackResultLogic showCrackResultLogic = new();
private static readonly ShowCrackWidthLogic showCrackWidthLogic = new(); private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
private IForcesResults forcesResults; private IForcesResults forcesResults;
@@ -73,11 +74,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
return showInteractionDiagramCommand ?? return showInteractionDiagramCommand ??
(showInteractionDiagramCommand = new RelayCommand(o => (showInteractionDiagramCommand = new RelayCommand(o =>
{ {
interactionDiagramLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple; var tuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
interactionDiagramLogic.LimitState = SelectedResult.DesignForceTuple.LimitState; var data = new SurroundData();
interactionDiagramLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm; data.ConstZ = tuple.My;
interactionDiagramLogic.NdmPrimitives = ndmPrimitives; var wnd = new SurroundDataView(data);
interactionDiagramLogic.ShowWindow(); wnd.ShowDialog();
if (wnd.DialogResult != true) return;
interactionDiagramLogic = new(data)
{
ForceTuple = tuple,
LimitState = SelectedResult.DesignForceTuple.LimitState,
CalcTerm = SelectedResult.DesignForceTuple.CalcTerm,
NdmPrimitives = ndmPrimitives
};
showProgressLogic = new(interactionDiagramLogic)
{
WindowTitle = "Diagram creating...",
ShowResult = interactionDiagramLogic.ShowWindow
};
showProgressLogic.Show();
}, o => SelectedResult != null && SelectedResult.IsValid)); }, o => SelectedResult != null && SelectedResult.IsValid));
} }
} }

View File

@@ -8,7 +8,7 @@
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls" xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext="{d:DesignInstance local:InterpolateTuplesViewModel}" d:DataContext="{d:DesignInstance local:InterpolateTuplesViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
Title="Interpolate Combinations" Height="200" Width="400" MinHeight="180" MinWidth="400" WindowStartupLocation="CenterScreen"> Title="Interpolate Combinations" Height="200" Width="460" MinHeight="180" MinWidth="460" WindowStartupLocation="CenterScreen">
<Window.Resources> <Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<Style TargetType="Button"> <Style TargetType="Button">
@@ -40,7 +40,7 @@
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/> <TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/> <TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
@@ -99,8 +99,9 @@
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/> <TextBox Grid.Row="3" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="4" Text="Step count" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/> <TextBlock Grid.Row="4" Text="Step count" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/> <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<uc:MultiplyTuple Grid.Column="4" Grid.Row="1" ForceTuple="{Binding StartDesignForce.ForceTuple}" ValueChanged="StartValueChanged"/> <uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
<uc:MultiplyTuple Grid.Column="4" Grid.Row="3" ForceTuple="{Binding FinishDesignForce.ForceTuple}" ValueChanged="FinishValueChanged"/> <uc:MultiplyDouble Grid.Column="4" Grid.Row="3" DoubleFactor="{Binding FinishFactor}" ValueChanged="FinishValueChanged"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="4" DoubleFactor="{Binding FinishFactor}" ValueChanged="StepCountValueChanged"/>
</Grid> </Grid>
</Grid> </Grid>

View File

@@ -1,5 +1,7 @@
using StructureHelper.Windows.ViewModels.Forces; using StructureHelper.Windows.UserControls;
using StructureHelper.Windows.ViewModels.Forces;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Services.Forces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -38,12 +40,28 @@ namespace StructureHelper.Windows.Forces
private void StartValueChanged(object sender, EventArgs e) private void StartValueChanged(object sender, EventArgs e)
{ {
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(viewModel.StartDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, viewModel.StartDesignForce.ForceTuple, 1d);
viewModel.RefreshStartTuple(); viewModel.RefreshStartTuple();
} }
private void FinishValueChanged(object sender, EventArgs e) private void FinishValueChanged(object sender, EventArgs e)
{ {
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(viewModel.FinishDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, viewModel.FinishDesignForce.ForceTuple, 1d);
viewModel.RefreshFinishTuple(); viewModel.RefreshFinishTuple();
} }
private void StepCountValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var factor = obj.DoubleFactor;
if (factor > 0d)
{
viewModel.StepCount = Convert.ToInt32(viewModel.StepCount * factor);
}
}
} }
} }

View File

@@ -11,10 +11,15 @@ namespace StructureHelper.Windows.Forces
private RelayCommand invertForcesCommand; private RelayCommand invertForcesCommand;
private RelayCommand copyToStartCommand; private RelayCommand copyToStartCommand;
private RelayCommand copyToFinishCommand; private RelayCommand copyToFinishCommand;
private int stepCount;
public IDesignForceTuple StartDesignForce { get; set; } public IDesignForceTuple StartDesignForce { get; set; }
public IDesignForceTuple FinishDesignForce { get; set; } public IDesignForceTuple FinishDesignForce { get; set; }
public double StartFactor { get; set; }
public double FinishFactor { get; set; }
public double StepCountFactor { get; set; }
public bool StepCountVisible { get; set; } public bool StepCountVisible { get; set; }
public double StartMx public double StartMx
{ {
@@ -70,23 +75,27 @@ namespace StructureHelper.Windows.Forces
OnPropertyChanged(nameof(FinishNz)); OnPropertyChanged(nameof(FinishNz));
} }
} }
public int StepCount { get; set; } public int StepCount
{
get => stepCount; set
{
stepCount = value;
OnPropertyChanged(nameof(StepCount));
}
}
public ICommand InvertForcesCommand public ICommand InvertForcesCommand
{ {
get => invertForcesCommand ??= new RelayCommand(o => InvertForces()); get => invertForcesCommand ??= new RelayCommand(o => InvertForces());
} }
public ICommand CopyToStartCommand public ICommand CopyToStartCommand
{ {
get => copyToStartCommand ??= new RelayCommand(o => CopyFinishToStart()); get => copyToStartCommand ??= new RelayCommand(o => CopyFinishToStart());
} }
public ICommand CopyToFinishCommand public ICommand CopyToFinishCommand
{ {
get => copyToFinishCommand ??= new RelayCommand(o => CopyStartToFinish()); get => copyToFinishCommand ??= new RelayCommand(o => CopyStartToFinish());
} }
public InterpolateTuplesResult Result public InterpolateTuplesResult Result
{ {
get => new() get => new()

View File

@@ -0,0 +1,23 @@
using LiveCharts.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Ink;
using System.Windows.Media;
namespace StructureHelper.Windows.Graphs
{
internal static class GraphService
{
public static void SetVisualProps(LineSeries lineSeries, GraphVisualProps visualProps, Color color)
{
lineSeries.Stroke = new SolidColorBrush(color);
lineSeries.Fill = new SolidColorBrush(color) { Opacity = visualProps.Opacity };
lineSeries.LineSmoothness = visualProps.LineSmoothness;
lineSeries.PointGeometry = DefaultGeometries.Circle;
lineSeries.PointGeometrySize = visualProps.StrokeSize;
}
}
}

View File

@@ -7,7 +7,7 @@
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
d:DataContext="{d:DesignInstance local:GraphViewModel}" d:DataContext="{d:DesignInstance local:GraphViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
Title="Graph" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen"> Title="Graph" Height="550" Width="800" MinHeight="500" MinWidth="600" WindowStartupLocation="CenterScreen">
<DockPanel> <DockPanel>
<!--<ToolBarTray DockPanel.Dock="Top"> <!--<ToolBarTray DockPanel.Dock="Top">
<ToolBar> <ToolBar>
@@ -30,7 +30,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="70"/> <RowDefinition Height="70"/>
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="120"/> <RowDefinition Height="170"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="X-axis values"> <GroupBox Grid.Row="0" Header="X-axis values">
<StackPanel> <StackPanel>

View File

@@ -165,13 +165,8 @@ namespace StructureHelper.Windows.Graphs
.X(point => point.X) .X(point => point.X)
.Y(point => point.Y), .Y(point => point.Y),
Title = yParameter.Name, Title = yParameter.Name,
//PointGeometry = null,
Stroke = new SolidColorBrush(yParameter.Color),
Fill = Brushes.Transparent,
LineSmoothness = VisualProps.LineSmoothness,
PointGeometry = DefaultGeometries.Circle,
PointGeometrySize = VisualProps.StrokeSize
}; };
GraphService.SetVisualProps(lineSeries, VisualProps, yParameter.Color);
_ = valueList.TryGetValue(xParameter, out double[] xValues); _ = valueList.TryGetValue(xParameter, out double[] xValues);
_ = valueList.TryGetValue(yParameter, out double[] yValues); _ = valueList.TryGetValue(yParameter, out double[] yValues);
var chartValues = new ChartValues<Point2D>(); var chartValues = new ChartValues<Point2D>();

View File

@@ -7,6 +7,7 @@ namespace StructureHelper.Windows.Graphs
{ {
private double lineSmoothness; private double lineSmoothness;
private double strokeSize; private double strokeSize;
private double opacity;
public double LineSmoothness public double LineSmoothness
{ {
@@ -37,6 +38,18 @@ namespace StructureHelper.Windows.Graphs
public double MaxLineSmoothness { get; } public double MaxLineSmoothness { get; }
public double MaxStrokeSize { get; } public double MaxStrokeSize { get; }
public double Opacity
{
get => opacity; set
{
value = Math.Max(value, 0d);
value = Math.Min(value, 1d);
value = Math.Round(value, 2);
opacity = value;
OnPropertyChanged(nameof(Opacity));
}
}
public GraphVisualProps() public GraphVisualProps()
{ {
MaxLineSmoothness = 1d; MaxLineSmoothness = 1d;
@@ -44,6 +57,7 @@ namespace StructureHelper.Windows.Graphs
lineSmoothness = 0.3; lineSmoothness = 0.3;
strokeSize = 0; strokeSize = 0;
Opacity = 0d;
} }
} }
} }

View File

@@ -7,7 +7,7 @@
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
d:DataContext="{d:DesignInstance local:MaterialDiagramViewModel}" d:DataContext="{d:DesignInstance local:MaterialDiagramViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
Title="Material Diagram" Height="450" Width="800" WindowStartupLocation="CenterScreen"> Title="Material Diagram" Height="550" Width="800" MinHeight="550" MinWidth="800" WindowStartupLocation="CenterScreen">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/> <ColumnDefinition Width="250"/>
@@ -16,7 +16,7 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="120"/> <RowDefinition Height="170"/>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto">

View File

@@ -6,6 +6,7 @@ using StructureHelper.Models.Materials;
using StructureHelper.Windows.ViewModels; using StructureHelper.Windows.ViewModels;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Services.ColorServices;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -212,15 +213,14 @@ namespace StructureHelper.Windows.Graphs
var lineSeries = new LineSeries() var lineSeries = new LineSeries()
{ {
Title = $"{material.Name} ({calcTerm.ShortName} {limitState.ShortName})", Title = $"{material.Name} ({calcTerm.ShortName} {limitState.ShortName})",
//Stroke = new SolidColorBrush(material.Color),
Fill = Brushes.Transparent,
LineSmoothness = VisualProps.LineSmoothness,
PointGeometry = DefaultGeometries.Circle,
PointGeometrySize = VisualProps.StrokeSize
}; };
if (limitStates.Count() == 1 && calcTerms.Count() == 1) if (limitStates.Count() == 1 && calcTerms.Count() == 1)
{ {
lineSeries.Stroke = new SolidColorBrush(material.Color); GraphService.SetVisualProps(lineSeries, VisualProps, material.Color);
}
else
{
GraphService.SetVisualProps(lineSeries, VisualProps, ColorProcessor.GetRandomColor());
} }
var chartValues = new ChartValues<double>(); var chartValues = new ChartValues<double>();
for (double s = minValue; s < maxValue; s += step) for (double s = minValue; s < maxValue; s += step)

View File

@@ -16,6 +16,7 @@ using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Triangulations; using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services; using StructureHelperLogics.Services;
using StructureHelperLogics.Services.NdmCalculations; using StructureHelperLogics.Services.NdmCalculations;
using StructureHelperLogics.Services.NdmPrimitives;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -35,7 +36,7 @@ namespace StructureHelper.Windows.MainWindow
public IPrimitiveRepository PrimitiveRepository => primitiveRepository; public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
public ICalculationProperty CalculationProperty { get; private set; } public ICalculationProperty CalculationProperty { get; private set; }
public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService) public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
{ {
this.primitiveRepository = primitiveRepository; this.primitiveRepository = primitiveRepository;
@@ -47,16 +48,16 @@ namespace StructureHelper.Windows.MainWindow
HeadMaterials = new List<IHeadMaterial>(); HeadMaterials = new List<IHeadMaterial>();
HeadMaterialRepository = new HeadMaterialRepository(this); HeadMaterialRepository = new HeadMaterialRepository(this);
} }
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty) public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
{ {
var ndmPrimitives = Section.SectionRepository.Primitives; var ndmPrimitives = Section.SectionRepository.Primitives;
return NdmPrimitivesService.GetNdms(ndmPrimitives, calculationProperty.LimitState, calculationProperty.CalcTerm);
////Настройки триангуляции, пока опции могут быть только такие
//ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
//Настройки триангуляции, пока опции могут быть только такие ////Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm }; //return ndmPrimitives.SelectMany(x => x.GetNdms(options));
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
return ndmPrimitives.SelectMany(x => x.GetNdms(options));
} }
} }
} }

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.PrimitivePropertiesWindow" xmlns:local="clr-namespace:StructureHelper.Windows.PrimitivePropertiesWindow"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties" xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
mc:Ignorable="d" mc:Ignorable="d"
d:DataContext="{d:DesignInstance vm:SelectPrimitivesViewModel}" d:DataContext="{d:DesignInstance local:SelectPrimitivesViewModel}"
Title="Select Primitives" Height="250" Width="250" MinHeight="250" MinWidth="250" MaxHeight="500" MaxWidth="500" WindowStartupLocation="CenterScreen"> Title="Select Primitives" Height="250" Width="250" MinHeight="250" MinWidth="250" MaxHeight="500" MaxWidth="500" WindowStartupLocation="CenterScreen">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>

View File

@@ -1,5 +1,4 @@
using StructureHelper.Windows.ViewModels.PrimitiveProperties; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@@ -1,4 +1,5 @@
using StructureHelper.Infrastructure.UI.DataContexts; using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Windows.ViewModels;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -7,7 +8,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties namespace StructureHelper.Windows.PrimitivePropertiesWindow
{ {
public class SelectPrimitivesViewModel : OkCancelViewModelBase public class SelectPrimitivesViewModel : OkCancelViewModelBase
{ {

View File

@@ -1,18 +1,22 @@
<UserControl x:Class="StructureHelper.Windows.UserControls.MultiplyTuple" <UserControl x:Class="StructureHelper.Windows.UserControls.MultiplyDouble"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls" xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="25" d:DesignWidth="60"> d:DesignHeight="25" d:DesignWidth="120">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button x:Name="Multy0_5" Grid.Column="0" Content="*0.5" Click="Multy0_5_Click"/> <Button x:Name="MultyM1_2" Grid.Column="0" Content="*-1" Click="MultyM1_2_Click"/>
<Button x:Name="Multy2_0" Grid.Column="1" Content="*2.0" Click="Multy2_0_Click"/> <Button x:Name="Multy0_0" Grid.Column="1" Content="*0" Click="Multy0_Click"/>
<Button x:Name="Multy0_5" Grid.Column="2" Content="*0.5" Click="Multy0_5_Click"/>
<Button x:Name="Multy2_0" Grid.Column="3" Content="*2.0" Click="Multy2_0_Click"/>
<!--<Grid.ToolTip> <!--<Grid.ToolTip>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Button x:Name="MultyM1_2" Grid.Column="1" Content="*(-1)" Click="MultyM1_2_Click"/> <Button x:Name="MultyM1_2" Grid.Column="1" Content="*(-1)" Click="MultyM1_2_Click"/>

View File

@@ -23,11 +23,11 @@ namespace StructureHelper.Windows.UserControls
/// <summary> /// <summary>
/// Логика взаимодействия для MultiplyTuple.xaml /// Логика взаимодействия для MultiplyTuple.xaml
/// </summary> /// </summary>
public partial class MultiplyTuple : UserControl public partial class MultiplyDouble : UserControl
{ {
public event EventHandler ValueChanged; public event EventHandler ValueChanged;
public MultiplyTuple() public MultiplyDouble()
{ {
InitializeComponent(); InitializeComponent();
//DataContext = this; //DataContext = this;
@@ -51,15 +51,28 @@ namespace StructureHelper.Windows.UserControls
} }
public static readonly DependencyProperty ForceTupleProperty = DependencyProperty.Register(
"ForceTuple", typeof(ForceTuple), typeof(MultiplyTuple), new PropertyMetadata(new ForceTuple())); public double DoubleValue
{
get { return (double)GetValue(DoubleValueProperty); }
set { SetValue(DoubleValueProperty, value); }
}
// Using a DependencyProperty as the backing store for DoubleValue. This enables animation, styling, binding, etc...
public static readonly DependencyProperty DoubleValueProperty =
DependencyProperty.Register("DoubleValue", typeof(double), typeof(MultiplyDouble), new PropertyMetadata(new double()));
public static readonly DependencyProperty DoubleFactorProperty = DependencyProperty.Register(
"DoubleFactor", typeof(double), typeof(MultiplyDouble), new PropertyMetadata(new double()));
private RelayCommand muliplyByFactor; private RelayCommand muliplyByFactor;
public ForceTuple ForceTuple public double DoubleFactor
{ {
get { return (ForceTuple)GetValue(ForceTupleProperty); } get { return (double)GetValue(DoubleFactorProperty); }
set { SetValue(ForceTupleProperty, value); } set { SetValue(DoubleFactorProperty, value); }
} }
private void Multy0_5_Click(object sender, RoutedEventArgs e) private void Multy0_5_Click(object sender, RoutedEventArgs e)
@@ -73,8 +86,8 @@ namespace StructureHelper.Windows.UserControls
private void ChangeValue(double factor) private void ChangeValue(double factor)
{ {
var tmpTuple = ForceTupleService.MultiplyTuples(ForceTuple, factor); DoubleValue *= factor;
ForceTupleService.CopyProperties(tmpTuple, ForceTuple, 1d); DoubleFactor = factor;
ValueChanged?.Invoke(this, EventArgs.Empty); ValueChanged?.Invoke(this, EventArgs.Empty);
} }

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Calculators namespace StructureHelperCommon.Models.Calculators
{ {
public class FindParameterCalculator : ICalculator public class FindParameterCalculator : ICalculator, IHasActionByResult
{ {
FindParameterResult result; FindParameterResult result;
public string Name { get; set; } public string Name { get; set; }
@@ -18,21 +18,20 @@ namespace StructureHelperCommon.Models.Calculators
public IAccuracy Accuracy {get;set;} public IAccuracy Accuracy {get;set;}
public IResult Result => result; public IResult Result => result;
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public Action<IResult> ActionToOutputResults { get; set; }
public FindParameterCalculator() public FindParameterCalculator()
{ {
StartValue = 0d; StartValue = 0d;
EndValue = 1d; EndValue = 1d;
Accuracy = new Accuracy() { IterationAccuracy = 0.001, MaxIterationCount = 1000 }; Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
} }
public void Run() public void Run()
{ {
result = new() { IsValid = true}; result = new();
try try
{ {
result.Parameter = FindMinimumValue(StartValue, EndValue, Predicate); FindMinimumValue(StartValue, EndValue, Predicate);
result.Description = "Parameter was found succefully";
} }
catch(Exception ex) catch(Exception ex)
{ {
@@ -45,7 +44,7 @@ namespace StructureHelperCommon.Models.Calculators
throw new NotImplementedException(); throw new NotImplementedException();
} }
private double FindMinimumValue(double start, double end, Predicate<double> predicate) private void FindMinimumValue(double start, double end, Predicate<double> predicate)
{ {
if (predicate(end) == false) if (predicate(end) == false)
{ {
@@ -59,7 +58,7 @@ namespace StructureHelperCommon.Models.Calculators
int iterationNum = 0; int iterationNum = 0;
while (step > precision) while (step > precision)
{ {
if (predicate(current)) if (predicate(current) == true)
{ {
end = current; end = current;
} }
@@ -71,13 +70,23 @@ namespace StructureHelperCommon.Models.Calculators
current = (start + end) / 2; current = (start + end) / 2;
step = (end - start) / 2; step = (end - start) / 2;
iterationNum++; iterationNum++;
result.IsValid = false;
result.IterationNumber = iterationNum;
result.CurrentAccuracy = step;
ActionToOutputResults?.Invoke(result);
if (iterationNum > maxIterationCount) if (iterationNum > maxIterationCount)
{ {
result.Description = "Parameter was not found succefully: \n";
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count"); throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count");
} }
} }
return current; result.Parameter = current;
result.Description = "Parameter was found succefully";
result.IsValid = true;
ActionToOutputResults?.Invoke(result);
} }
} }
} }

View File

@@ -6,10 +6,12 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Calculators namespace StructureHelperCommon.Models.Calculators
{ {
public class FindParameterResult : IResult public class FindParameterResult : IResult, IiterationResult
{ {
public bool IsValid { get; set; } public bool IsValid { get; set; }
public string Description { get; set; } public string Description { get; set; }
public double Parameter { get; set; } public double Parameter { get; set; }
public int IterationNumber { get; set; }
public double CurrentAccuracy { get; set; }
} }
} }

View File

@@ -20,6 +20,5 @@ namespace StructureHelperCommon.Models.Calculators
/// Result of Calculations /// Result of Calculations
/// </summary> /// </summary>
IResult Result { get; } IResult Result { get; }
Action<IResult> ActionToOutputResults { get; set; }
} }
} }

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Calculators
{
public interface IHasActionByResult
{
Action<IResult> ActionToOutputResults { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Calculators
{
public interface IiterationResult
{
int IterationNumber { get; set; }
}
}

View File

@@ -8,6 +8,12 @@ namespace StructureHelperCommon.Services.Forces
{ {
public static class ForceTupleService public static class ForceTupleService
{ {
/// <summary>
/// Copy properties from target to source
/// </summary>
/// <param name="source">Source tuple</param>
/// <param name="target">Target tuple</param>
/// <param name="factor">factor</param>
public static void CopyProperties(IForceTuple source, IForceTuple target, double factor = 1d) public static void CopyProperties(IForceTuple source, IForceTuple target, double factor = 1d)
{ {
CheckTuples(source, target); CheckTuples(source, target);

View File

@@ -12,7 +12,7 @@ using StructureHelperLogics.Services.NdmPrimitives;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class ForceCalculator : IForceCalculator public class ForceCalculator : IForceCalculator, IHasActionByResult
{ {
static readonly ForceCalculatorUpdateStrategy updateStrategy = new(); static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
public string Name { get; set; } public string Name { get; set; }

View File

@@ -6,7 +6,7 @@ using StructureHelperCommon.Models.Calculators;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class ForceTupleCalculator : IForceTupleCalculator public class ForceTupleCalculator : IForceTupleCalculator, IHasActionByResult
{ {
public IForceTupleInputData InputData { get; set; } public IForceTupleInputData InputData { get; set; }
public string Name { get; set; } public string Name { get; set; }

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Shapes;
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.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public interface ILimitCurveLogic public interface ILimitCurveLogic : IHasActionByResult
{ {
List<IPoint2D> GetPoints(List<IPoint2D> points); List<IPoint2D> GetPoints(List<IPoint2D> points);
} }

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Shapes;
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.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public interface ILimitCurveParameterLogic public interface ILimitCurveParameterLogic : IHasActionByResult
{ {
IPoint2D CurrentPoint { get; set; } IPoint2D CurrentPoint { get; set; }
double GetParameter(); double GetParameter();

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class LimitCurveCalculator : ICalculator public class LimitCurveCalculator : ICalculator, IHasActionByResult
{ {
private LimitCurveResult result; private LimitCurveResult result;
private List<IPoint2D> surroundList; private List<IPoint2D> surroundList;
@@ -50,14 +51,26 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
surroundList = SurroundProcLogic.GetPoints(); surroundList = SurroundProcLogic.GetPoints();
try try
{ {
limitCurveLogic.ActionToOutputResults = GetCurrentStepNumber;
factoredList = limitCurveLogic.GetPoints(surroundList); factoredList = limitCurveLogic.GetPoints(surroundList);
result.Points = factoredList; result.Points = factoredList;
} }
catch (Exception ex) catch (Exception ex)
{ {
result.IsValid = false; result.IsValid = false;
result.Description = ex.Message; result.Description += ex.Message;
} }
} }
private void GetCurrentStepNumber(IResult calcResult)
{
if (calcResult is not FindParameterResult)
{
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(FindParameterResult), calcResult));
}
var parameterResult = calcResult as FindParameterResult;
result.IterationNumber = parameterResult.IterationNumber;
ActionToOutputResults?.Invoke(result);
}
} }
} }

View File

@@ -11,9 +11,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class LimitCurveLogic : ILimitCurveLogic public class LimitCurveLogic : ILimitCurveLogic
{ {
private FindParameterResult result;
private IPoint2D currentPoint; private IPoint2D currentPoint;
private ILimitCurveParameterLogic parameterLogic; private ILimitCurveParameterLogic parameterLogic;
public Predicate<IPoint2D> LimitPredicate { get; set; } public Predicate<IPoint2D> LimitPredicate { get; set; }
public Action<IResult> ActionToOutputResults { get; set; }
public LimitCurveLogic(ILimitCurveParameterLogic parameterLogic) public LimitCurveLogic(ILimitCurveParameterLogic parameterLogic)
{ {
this.parameterLogic = parameterLogic; this.parameterLogic = parameterLogic;
@@ -24,6 +27,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
} }
public List<IPoint2D> GetPoints(List<IPoint2D> points) public List<IPoint2D> GetPoints(List<IPoint2D> points)
{ {
result = new();
List<IPoint2D> resultList = new(); List<IPoint2D> resultList = new();
if (LimitPredicate(new Point2D()) == true) if (LimitPredicate(new Point2D()) == true)
{ {
@@ -48,6 +52,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
Y = currentPoint.Y * parameter Y = currentPoint.Y * parameter
}; };
resultList.Add(resultPoint); resultList.Add(resultPoint);
result.IterationNumber = resultList.Count;
ActionToOutputResults?.Invoke(result);
} }
return resultList; return resultList;
} }

View File

@@ -11,8 +11,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class LimitCurveParameterLogic : ILimitCurveParameterLogic public class LimitCurveParameterLogic : ILimitCurveParameterLogic
{ {
private FindParameterResult result;
private Predicate<Point2D> limitPredicate; private Predicate<Point2D> limitPredicate;
public IPoint2D CurrentPoint { get; set; } public IPoint2D CurrentPoint { get; set; }
public Action<IResult> ActionToOutputResults { get; set; }
public LimitCurveParameterLogic(Predicate<Point2D> limitPredicate) public LimitCurveParameterLogic(Predicate<Point2D> limitPredicate)
{ {
@@ -31,8 +33,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate for point (x={CurrentPoint.X}, y={CurrentPoint.Y}) is not valid"); throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate for point (x={CurrentPoint.X}, y={CurrentPoint.Y}) is not valid");
} }
var result = parameterCalculator.Result as FindParameterResult; result = parameterCalculator.Result as FindParameterResult;
var parameter = result.Parameter; var parameter = result.Parameter;
if (parameter < 0.1d)
{
parameterCalculator.Accuracy.IterationAccuracy = 0.0001d;
parameterCalculator.Run();
result = parameterCalculator.Result as FindParameterResult;
parameter = result.Parameter;
}
return parameter; return parameter;
} }

View File

@@ -8,11 +8,13 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class LimitCurveResult : IResult public class LimitCurveResult : IResult, IiterationResult
{ {
public bool IsValid { get; set; } public bool IsValid { get; set; }
public string Description { get; set; } public string Description { get; set; }
public List<IPoint2D> Points { get; set; } public List<IPoint2D> Points { get; set; }
public int IterationNumber { get; set; }
public LimitCurveResult() public LimitCurveResult()
{ {
Points = new List<IPoint2D>(); Points = new List<IPoint2D>();

View File

@@ -2,6 +2,7 @@
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Cracking;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -12,17 +13,52 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class PredicateFactory public class PredicateFactory
{ {
private ForceTupleCalculator calculator;
private ForceTuple tuple;
private ForceTupleInputData inputData;
public IEnumerable<INdm> Ndms { get; set; } public IEnumerable<INdm> Ndms { get; set; }
public double My { get; set; } public double My { get; set; }
public bool GetResult(IPoint2D point) public PredicateFactory()
{ {
var calculator = new ForceTupleCalculator(); inputData = new();
var tuple = new ForceTuple() { Nz = point.Y, Mx = point.X, My = My }; calculator = new() { InputData = inputData };
var inputData = new ForceTupleInputData() { Tuple = tuple, NdmCollection = Ndms }; }
calculator.InputData = inputData; public bool IsSectionFailure(IPoint2D point)
{
tuple = new()
{
Nz = point.Y,
Mx = point.X,
My = My
};
inputData.Tuple = tuple;
inputData.NdmCollection = Ndms;
calculator.Run(); calculator.Run();
var result = calculator.Result; var result = calculator.Result;
return !result.IsValid; return !result.IsValid;
} }
public bool IsSectionCracked(IPoint2D point)
{
var logic = new HoleSectionCrackedLogic();
tuple = new()
{
Nz = point.Y,
Mx = point.X,
My = My
};
logic.Tuple = tuple;
logic.NdmCollection = Ndms;
try
{
var result = logic.IsSectionCracked();
return result;
}
catch (Exception)
{
return true;
}
}
} }
} }

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Shapes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -9,6 +10,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
public class StabLimitCurveLogic : ILimitCurveLogic public class StabLimitCurveLogic : ILimitCurveLogic
{ {
public Action<IResult> ActionToOutputResults { get; set; }
public List<IPoint2D> GetPoints(List<IPoint2D> points) public List<IPoint2D> GetPoints(List<IPoint2D> points)
{ {
var result = new List<IPoint2D>(); var result = new List<IPoint2D>();

View File

@@ -12,6 +12,15 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public double XMin { get; set; } public double XMin { get; set; }
public double YMax { get; set; } public double YMax { get; set; }
public double YMin { get; set; } public double YMin { get; set; }
public double ConstZ { get; set; }
public int PointCount { get; set; } public int PointCount { get; set; }
public SurroundData()
{
XMax = 1e7d;
XMin = -1e7d;
YMax = 1e7d;
YMin = -1e7d;
PointCount = 80;
}
} }
} }

View File

@@ -30,8 +30,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public Accuracy Accuracy {get;set; } public Accuracy Accuracy {get;set; }
public IResult Result => result; public IResult Result => result;
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public CrackForceCalculator(IForceTupleCalculator forceTupleCalculator) public CrackForceCalculator(IForceTupleCalculator forceTupleCalculator)
{ {
StartTuple ??= new ForceTuple(); StartTuple ??= new ForceTuple();

View File

@@ -6,6 +6,7 @@ using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations; using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
namespace StructureHelperLogics.NdmCalculations.Cracking namespace StructureHelperLogics.NdmCalculations.Cracking
{ {
@@ -23,8 +24,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public CrackWidthCalculatorInputData InputData { get; set; } public CrackWidthCalculatorInputData InputData { get; set; }
public IResult Result => result; public IResult Result => result;
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public void Run() public void Run()
{ {
result = new() { IsValid = true, Description = ""}; result = new() { IsValid = true, Description = ""};
@@ -96,10 +95,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
rebarPrimitives.Add(item as RebarPrimitive); rebarPrimitives.Add(item as RebarPrimitive);
} }
} }
//rebarPrimitives = ndmPrimitives ndmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, InputData.LimitState, InputData.CalcTerm);
// .Select(x => x is RebarPrimitive) as IEnumerable<RebarPrimitive>;
var options = new TriangulationOptions() { LimiteState = InputData.LimitState, CalcTerm = InputData.CalcTerm };
ndmCollection = ndmPrimitives.SelectMany(x => x.GetNdms(options));
} }
private void CalcCrackForce() private void CalcCrackForce()

View File

@@ -8,20 +8,20 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
{ {
public static class Triangulation1 public static class Triangulation1
{ {
public static IEnumerable<INdm> GetNdms(IEnumerable<INdmPrimitive> ndmPrimitives, ITriangulationOptions options) //public static IEnumerable<INdm> GetNdms(IEnumerable<INdmPrimitive> ndmPrimitives, ITriangulationOptions options)
{ //{
return ndmPrimitives.SelectMany(x => x.GetNdms(options)); // return ndmPrimitives.SelectMany(x => x.GetNdms(options));
//var headMaterials = GetPrimitiveMaterials(ndmPrimitives); // var headMaterials = GetPrimitiveMaterials(ndmPrimitives);
//Dictionary<Guid, IMaterial> materials = GetMaterials(headMaterials, options); // Dictionary<Guid, IMaterial> materials = GetMaterials(headMaterials, options);
//foreach (var ndmPrimitive in ndmPrimitives) // foreach (var ndmPrimitive in ndmPrimitives)
//{ // {
// IHeadMaterial headMaterial = ndmPrimitive.HeadMaterial; // IHeadMaterial headMaterial = ndmPrimitive.HeadMaterial;
// IMaterial material; // IMaterial material;
// if (materials.TryGetValue(headMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); } // if (materials.TryGetValue(headMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); }
// IEnumerable<INdm> localNdms = GetNdmsByPrimitive(ndmPrimitive, options); // IEnumerable<INdm> localNdms = GetNdmsByPrimitive(ndmPrimitive, options);
// ndms.AddRange(localNdms); // ndms.AddRange(localNdms);
//} // }
} //}
/// <summary> /// <summary>
/// Returns dictionary of unique materials by collection of primitives /// Returns dictionary of unique materials by collection of primitives
/// </summary> /// </summary>

View File

@@ -14,6 +14,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.Services.NdmPrimitives;
namespace StructureHelperLogics.Services.NdmCalculations namespace StructureHelperLogics.Services.NdmCalculations
{ {
@@ -24,8 +25,7 @@ namespace StructureHelperLogics.Services.NdmCalculations
public IStrainMatrix GetPrimitiveStrainMatrix(INdmPrimitive[] ndmPrimitives, double mx, double my, double nz) public IStrainMatrix GetPrimitiveStrainMatrix(INdmPrimitive[] ndmPrimitives, double mx, double my, double nz)
{ {
var ndmCollection = new List<INdm>(); var ndmCollection = new List<INdm>();
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm }; ndmCollection.AddRange(NdmPrimitivesService.GetNdms(ndmPrimitives, calculationProperty.LimitState, calculationProperty.CalcTerm));
ndmCollection.AddRange(ndmPrimitives.SelectMany(x => x.GetNdms(options)));
var loaderData = new LoaderOptions var loaderData = new LoaderOptions
{ {
Preconditions = new Preconditions Preconditions = new Preconditions

View File

@@ -16,8 +16,4 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="NdmCalculations\Analyses\Interaction\" />
</ItemGroup>
</Project> </Project>

View File

@@ -11,6 +11,7 @@ using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Cracking; using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations; using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.CrackCalculatorTests namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.CrackCalculatorTests
@@ -24,8 +25,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.CrackCalculatorT
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount }; var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection(); var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
var ndmPrimitives = newSection.SectionRepository.Primitives; var ndmPrimitives = newSection.SectionRepository.Primitives;
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.SLS, CalcTerm = CalcTerms.ShortTerm }; var ndms = NdmPrimitivesService.GetNdms(ndmPrimitives, LimitStates.SLS, CalcTerms.ShortTerm);
var ndms = ndmPrimitives.SelectMany(x => x.GetNdms(options));
var calculator = new CrackForceCalculator(); var calculator = new CrackForceCalculator();
calculator.EndTuple = new ForceTuple() { Mx = -50e3d, My = -50e3d, Nz = 0d }; calculator.EndTuple = new ForceTuple() { Mx = -50e3d, My = -50e3d, Nz = 0d };
calculator.NdmCollection = ndms; calculator.NdmCollection = ndms;

View File

@@ -16,6 +16,10 @@ namespace StructureHelperTests.UnitTests.Calcuators
var calculator = new LimitCurveCalculator(new StabLimitCurveLogic()) var calculator = new LimitCurveCalculator(new StabLimitCurveLogic())
{ {
}; };
calculator.SurroundData.XMax = xmax;
calculator.SurroundData.XMin = -xmax;
calculator.SurroundData.YMax = ymax;
calculator.SurroundData.YMin = -ymax;
//Act //Act
calculator.Run(); calculator.Run();
var result = calculator.Result; var result = calculator.Result;

View File

@@ -17,7 +17,7 @@ namespace StructureHelperTests.UnitTests.Calcuators
parameterLogicMock.Setup(p => p.GetParameter()).Returns(2.0); // Mocking the GetParameter method parameterLogicMock.Setup(p => p.GetParameter()).Returns(2.0); // Mocking the GetParameter method
var limitCurveLogic = new LimitCurveLogic(parameterLogicMock.Object); var limitCurveLogic = new LimitCurveLogic(parameterLogicMock.Object);
limitCurveLogic.LimitPredicate = point => point.X <= 0.5d; // Example predicate limitCurveLogic.LimitPredicate = point => point.X >= 0.5d; // Example predicate
var inputPoints = new List<IPoint2D> var inputPoints = new List<IPoint2D>
{ {
@@ -51,7 +51,7 @@ namespace StructureHelperTests.UnitTests.Calcuators
parameterLogicMock.Setup(p => p.GetParameter()).Returns(2.0); parameterLogicMock.Setup(p => p.GetParameter()).Returns(2.0);
var limitCurveLogic = new LimitCurveLogic(parameterLogicMock.Object); var limitCurveLogic = new LimitCurveLogic(parameterLogicMock.Object);
limitCurveLogic.LimitPredicate = point => false; // Invalid predicate limitCurveLogic.LimitPredicate = point => true; // Invalid predicate
var inputPoints = new List<IPoint2D> var inputPoints = new List<IPoint2D>
{ {