Value points were added

This commit is contained in:
Evgeny Redikultsev
2024-03-02 21:40:13 +05:00
parent 2e8ebccc13
commit 4359b2c49b
41 changed files with 1127 additions and 439 deletions

View File

@@ -33,10 +33,10 @@
<DataTemplate x:Key="SelectItems">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Height="25" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
<Button Content="Select All" Command="{Binding SelectAllCommand}"/>
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>

View File

@@ -1,5 +1,6 @@
using LoaderCalculator.Logics;
using StructureHelper.Infrastructure.UI.Converters.Units;
using StructureHelperCommon.Infrastructures.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,19 +9,63 @@ using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
public enum FuncsTypes
{
Strain,
Stress,
Forces,
Full,
}
public static class ResultFuncFactory
{
public static IEnumerable<IResultFunc> GetResultFuncs()
static readonly IStressLogic stressLogic = new StressLogic();
public static List<IResultFunc> GetResultFuncs(FuncsTypes funcsType = FuncsTypes.Full)
{
List<IResultFunc> results = new();
if (funcsType == FuncsTypes.Strain)
{
results.AddRange(GetStrainResultFuncs());
}
else if (funcsType == FuncsTypes.Stress)
{
results.AddRange(GetStressResultFuncs());
}
else if (funcsType == FuncsTypes.Forces)
{
results.AddRange(GetForcesResultFuncs());
}
else if (funcsType == FuncsTypes.Full)
{
results.AddRange(GetStrainResultFuncs());
results.AddRange(GetStressResultFuncs());
results.AddRange(GetForcesResultFuncs());
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(funcsType));
}
return results;
}
private static List<IResultFunc> GetStrainResultFuncs()
{
List<IResultFunc> resultFuncs = new List<IResultFunc>();
IStressLogic stressLogic = new StressLogic();
resultFuncs.Add(new ResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
resultFuncs.Add(new ResultFunc() { Name = "Total Strain with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPresrain });
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
return resultFuncs;
}
private static List<IResultFunc> GetStressResultFuncs()
{
List<IResultFunc> resultFuncs = new List<IResultFunc>();
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = UnitConstants.Stress });
resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = UnitConstants.Stress });
resultFuncs.Add(new ResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
return resultFuncs;
}
private static List<IResultFunc> GetForcesResultFuncs()
{
List<IResultFunc> resultFuncs = new List<IResultFunc>();
resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = UnitConstants.Force });
resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = UnitConstants.Force });
resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = UnitConstants.Force });

View File

@@ -36,6 +36,15 @@
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Forces\ForceInterpolationControl.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Forces\ForceTupleInterpolationControl.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Forces\ValuePointsInterpolateView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Graphs\GraphView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -101,6 +110,15 @@
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Forces\ForceInterpolationControl.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Forces\ForceTupleInterpolationControl.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Forces\ValuePointsInterpolateView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Graphs\GraphView.xaml">
<SubType>Designer</SubType>
</Page>

View File

@@ -1,4 +1,5 @@
using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
@@ -64,7 +65,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
string[] labels = GetCrackLabels(unitForce, unitMoment, unitCurvature);
List<string> labels = GetCrackLabels(unitForce, unitMoment, unitCurvature);
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
CalculateWithCrack(ValidTupleList, NdmPrimitives, unitForce, unitMoment, unitCurvature);
}
@@ -131,18 +132,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
}
}
private static string[] GetCrackLabels(IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
private static List<string> GetCrackLabels(IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
{
const string crc = "Crc";
const string crcFactor = "CrcSofteningFactor";
return new string[]
var labels = LabelsFactory.GetLabels();
var crclabels = new List<string>
{
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
$"{GeometryNames.MomSndName}, {unitMoment.Name}",
$"{GeometryNames.LongForceName}, {unitForce.Name}",
$"{GeometryNames.CurvFstName}, {unitCurvature.Name}",
$"{GeometryNames.CurvSndName}, {unitCurvature.Name}",
$"{GeometryNames.StrainTrdName}",
$"{crc}{GeometryNames.CurvFstName}, {unitCurvature.Name}",
$"{crc}{GeometryNames.CurvSndName}, {unitCurvature.Name}",
$"{crc}{GeometryNames.StrainTrdName}",
@@ -151,6 +147,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
$"{crcFactor}Az",
$"PsiFactor"
};
labels.AddRange(crclabels);
return labels;
}
}

View File

@@ -90,7 +90,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private ArrayParameter<double> GetParametersByCurveResult(LimitCurveResult curveResult)
{
string[] labels = GetLabels();
var labels = GetLabels();
var items = curveResult.Points;
var arrayParameter = new ArrayParameter<double>(items.Count(), labels.Count(), labels);
var data = arrayParameter.Data;
@@ -121,11 +121,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
SetProgress?.Invoke(parameterResult.IterationNumber);
}
private string[] GetLabels()
private List<string> GetLabels()
{
string[] strings = new string[2];
strings[0] = GetLabel(InputData.SurroundData.ConvertLogicEntity.XForceType);
strings[1] = GetLabel(InputData.SurroundData.ConvertLogicEntity.YForceType);
List<string> strings = new()
{
GetLabel(InputData.SurroundData.ConvertLogicEntity.XForceType),
GetLabel(InputData.SurroundData.ConvertLogicEntity.YForceType)
};
return strings;
}

View File

@@ -0,0 +1,32 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
public static class LabelsFactory
{
private static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
private static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
private static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public static List<string> GetLabels()
{
var labels = new List<string>
{
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
$"{GeometryNames.MomSndName}, {unitMoment.Name}",
$"{GeometryNames.LongForceName}, {unitForce.Name}",
$"{GeometryNames.CurvFstName}, {unitCurvature.Name}",
$"{GeometryNames.CurvSndName}, {unitCurvature.Name}",
$"{GeometryNames.StrainTrdName}",
};
return labels;
}
}
}

View File

@@ -27,12 +27,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public void Show(IDesignForceTuple finishDesignTuple)
{
var viewModel = new InterpolateTuplesViewModel(finishDesignTuple, null);
viewModel.StepCountVisible = false;
viewModel.ForceInterpolationViewModel.StepCountVisible = false;
var wndTuples = new InterpolateTuplesView(viewModel);
wndTuples.ShowDialog();
if (wndTuples.DialogResult != true) return;
var startDesignTuple = viewModel.StartDesignForce.ForceTuple;
var endDesignTuple = viewModel.FinishDesignForce.ForceTuple;
var startDesignTuple = viewModel.ForceInterpolationViewModel.StartDesignForce.ForceTuple;
var endDesignTuple = viewModel.ForceInterpolationViewModel.FinishDesignForce.ForceTuple;
FindCrackFactor(endDesignTuple, startDesignTuple);
}

View File

@@ -22,8 +22,6 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private IEnumerable<INdmPrimitive> NdmPrimitives;
private List<IForcesTupleResult> ValidTupleList;
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public int StepCount => ValidTupleList.Count();
public Action<int> SetProgress { get; set; }
@@ -63,7 +61,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
string[] labels = GetLabels(unitForce, unitMoment, unitCurvature);
var labels = LabelsFactory.GetLabels();
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
CalculateWithoutCrack(ValidTupleList, unitForce, unitMoment, unitCurvature);
}
@@ -102,18 +100,5 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
};
}
private static string[] GetLabels(IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
{
return new string[]
{
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
$"{GeometryNames.MomSndName}, {unitMoment.Name}",
$"{GeometryNames.LongForceName}, {unitForce.Name}",
$"{GeometryNames.CurvFstName}, {unitCurvature.Name}",
$"{GeometryNames.CurvSndName}, {unitCurvature.Name}",
$"{GeometryNames.StrainTrdName}"
};
}
}
}

View File

@@ -0,0 +1,21 @@
using StructureHelper.Windows.Forces;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
{
public class ShowValuePointDiagramLogic
{
public ForceCalculator Calculator { get; set; }
public PointPrimitiveLogic PrimitiveLogic { get; set; }
public ValueDelegatesLogic ValueDelegatesLogic { get; set; }
public void ShowGraph()
{
}
}
}

View File

@@ -19,6 +19,9 @@
<Button Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
</Button>
<Button Command="{Binding GraphValuePointsCommand}" ToolTip="Show diagram by value points">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
</Button>
<Button Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram">
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/>
</Button>

View File

@@ -1,6 +1,7 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Services.Exports;
using StructureHelper.Services.Reports;
using StructureHelper.Services.Reports.CalculationReports;
@@ -52,17 +53,18 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public ForcesTupleResult SelectedResult { get; set; }
private ICommand showIsoFieldCommand;
private ICommand exportToCSVCommand;
private ICommand interpolateCommand;
private ICommand setPrestrainCommand;
private ICommand showAnchorageCommand;
private ICommand showGeometryResultCommand;
private ICommand showGraphsCommand;
private ICommand showCrackResult;
private ICommand showCrackGraphsCommand;
private RelayCommand showCrackWidthResult;
private ICommand showInteractionDiagramCommand;
private ICommand? showIsoFieldCommand;
private ICommand? exportToCSVCommand;
private ICommand? interpolateCommand;
private ICommand? setPrestrainCommand;
private ICommand? showAnchorageCommand;
private ICommand? showGeometryResultCommand;
private ICommand? showGraphsCommand;
private ICommand? showCrackResult;
private ICommand? showCrackGraphsCommand;
private ICommand? showCrackWidthResult;
private ICommand? showInteractionDiagramCommand;
private ICommand? graphValuepointsCommand;
public IForcesResults ForcesResults
{
@@ -155,7 +157,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
if (wndTuples.DialogResult != true) return;
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.Result);
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
showProgressLogic = new(interpolationLogic)
{
WindowTitle = "Interpolate forces"
@@ -186,7 +188,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
if (wndTuples.DialogResult != true) return;
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.Result);
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
showProgressLogic = new(interpolationLogic)
{
WindowTitle = "Interpolate forces"
@@ -259,13 +261,53 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
if (wndTuples.DialogResult != true) return;
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.Result);
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
progressLogic = interpolationLogic;
showProgressLogic = new(interpolationLogic);
showProgressLogic.ShowResult = ShowInterpolationProgressDialog;
showProgressLogic.Show();
}
public ICommand GraphValuePointsCommand
{
get
{
return graphValuepointsCommand ??
(graphValuepointsCommand = new RelayCommand(o =>
{
InterpolateValuePoints();
}, o => SelectedResult != null));
}
}
private void InterpolateValuePoints()
{
var inputData = new ValuePointsInterpolationInputData()
{
FinishDesignForce = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple,
LimitState = SelectedResult.DesignForceTuple.LimitState,
CalcTerm = SelectedResult.DesignForceTuple.CalcTerm,
};
inputData.PrimitiveBases.AddRange(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(ndmPrimitives));
var viewModel = new ValuePointsInterpolateViewModel(inputData);
var wnd = new ValuePointsInterpolateView(viewModel);
wnd.ShowDialog();
if (wnd.DialogResult != true) { return; }
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, viewModel.ForceInterpolationViewModel.Result);
ShowValuePointDiagramLogic pointGraphLogic = new()
{
Calculator = interpolationLogic.InterpolateCalculator,
PrimitiveLogic = viewModel.PrimitiveLogic,
ValueDelegatesLogic = viewModel.ValueDelegatesLogic
};
progressLogic = interpolationLogic;
showProgressLogic = new(interpolationLogic)
{
ShowResult = pointGraphLogic.ShowGraph
};
showProgressLogic.Show();
}
private void ShowInterpolationWindow(out InterpolateTuplesViewModel interploateTuplesViewModel, out InterpolateTuplesView wndTuples)
{
IDesignForceTuple finishDesignTuple = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple;

View File

@@ -0,0 +1,88 @@
<UserControl x:Class="StructureHelper.Windows.Forces.ForceInterpolationControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="460">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
<TextBlock Grid.Row="1" Text="Start Combination"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
<Button Grid.Row="2" Grid.Column="1" Command="{Binding CopyToStartCommand}">
<Viewbox>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</Button>
<Button Grid.Row="2" Grid.Column="2" Command="{Binding InvertForcesCommand}">
<StackPanel Orientation="Horizontal">
<Viewbox>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
<Viewbox RenderTransformOrigin="0.5,0.5">
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</Viewbox.RenderTransform>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</StackPanel>
</Button>
<Button Grid.Row="2" Grid.Column="3" Command="{Binding CopyToFinishCommand}">
<Viewbox RenderTransformOrigin="0.5,0.5">
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</Viewbox.RenderTransform>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</Button>
<TextBlock Grid.Row="3" Text="Finish Combination"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, 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}}"/>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
<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" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
</UserControl>

View File

@@ -0,0 +1,67 @@
using StructureHelper.Windows.UserControls;
using StructureHelper.Windows.ViewModels.Materials;
using StructureHelperCommon.Services.Forces;
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.Navigation;
using System.Windows.Shapes;
namespace StructureHelper.Windows.Forces
{
/// <summary>
/// Логика взаимодействия для ForceInterpolationControl.xaml
/// </summary>
public partial class ForceInterpolationControl : UserControl
{
private ForceTupleInterpolationViewModel? properties;
public ForceTupleInterpolationViewModel? Properties
{
get => properties; set
{
properties = value;
DataContext = Properties;
}
}
public ForceInterpolationControl()
{
InitializeComponent();
}
private void StartValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(Properties.StartDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, Properties.StartDesignForce.ForceTuple, 1d);
Properties.RefreshStartTuple();
}
private void FinishValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(Properties.FinishDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, Properties.FinishDesignForce.ForceTuple, 1d);
Properties.RefreshFinishTuple();
}
private void StepCountValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var factor = obj.DoubleFactor;
if (factor > 0d)
{
Properties.StepCount = Convert.ToInt32(Properties.StepCount * factor);
}
}
}
}

View File

@@ -1,26 +0,0 @@
<UserControl x:Class="StructureHelper.Windows.Forces.ForceTupleControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="70"/>
<ColumnDefinition Width="Auto" MinWidth="70"/>
<ColumnDefinition Width="Auto" MinWidth="70"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="20"/>
<RowDefinition Height="Auto" MinHeight="20"/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Center" Text="Mx"/>
<TextBlock HorizontalAlignment="Center" Grid.Column="1" Text="My"/>
<TextBlock HorizontalAlignment="Center" Grid.Column="2" Text="Nz"/>
<TextBox Grid.Row="1" Text=""/>
<TextBox Grid.Row="1" Grid.Column="1" Text=""/>
<TextBox Grid.Row="1" Grid.Column="2" Text=""/>
</Grid>
</UserControl>

View File

@@ -0,0 +1,89 @@
<UserControl x:Class="StructureHelper.Windows.Forces.ForceTupleInterpolationControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="460">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
<TextBlock Grid.Row="1" Text="Start Combination"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
<Button Grid.Row="2" Grid.Column="1" Command="{Binding CopyToStartCommand}">
<Viewbox>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</Button>
<Button Grid.Row="2" Grid.Column="2" Command="{Binding InvertForcesCommand}">
<StackPanel Orientation="Horizontal">
<Viewbox>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
<Viewbox RenderTransformOrigin="0.5,0.5">
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</Viewbox.RenderTransform>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</StackPanel>
</Button>
<Button Grid.Row="2" Grid.Column="3" Command="{Binding CopyToFinishCommand}">
<Viewbox RenderTransformOrigin="0.5,0.5">
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</Viewbox.RenderTransform>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</Button>
<TextBlock Grid.Row="3" Text="Finish Combination"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, 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}}"/>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
<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" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
</UserControl>

View File

@@ -18,9 +18,10 @@ namespace StructureHelper.Windows.Forces
/// <summary>
/// Логика взаимодействия для ForceTupleControl.xaml
/// </summary>
public partial class ForceTupleControl : UserControl
public partial class ForceTupleInterpolationControl : UserControl
{
public ForceTupleControl()
public ForceTupleInterpolationViewModel? Properties { get; set; }
public ForceTupleInterpolationControl()
{
InitializeComponent();
}

View File

@@ -0,0 +1,212 @@
using StructureHelper.Infrastructure;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace StructureHelper.Windows.Forces
{
public class ForceTupleInterpolationViewModel : ViewModelBase
{
private RelayCommand invertForcesCommand;
private RelayCommand copyToStartCommand;
private RelayCommand copyToFinishCommand;
private int stepCount;
private IDesignForceTuple startDesignForce;
private IDesignForceTuple finishDesignForce;
public IDesignForceTuple StartDesignForce
{
get => startDesignForce; set
{
startDesignForce = value;
}
}
public IDesignForceTuple FinishDesignForce
{
get => finishDesignForce; set
{
finishDesignForce = value;
}
}
public double StartFactor { get; set; }
public double FinishFactor { get; set; }
public double StepCountFactor { get; set; }
public bool StepCountVisible { get; set; }
public double StartMx
{
get => StartDesignForce.ForceTuple.Mx;
set
{
StartDesignForce.ForceTuple.Mx = value;
OnPropertyChanged(nameof(StartMx));
}
}
public double StartMy
{
get => StartDesignForce.ForceTuple.My;
set
{
StartDesignForce.ForceTuple.My = value;
OnPropertyChanged(nameof(StartMy));
}
}
public double StartNz
{
get => StartDesignForce.ForceTuple.Nz;
set
{
StartDesignForce.ForceTuple.Nz = value;
OnPropertyChanged(nameof(StartNz));
}
}
public double FinishMx
{
get => FinishDesignForce.ForceTuple.Mx;
set
{
FinishDesignForce.ForceTuple.Mx = value;
OnPropertyChanged(nameof(FinishMx));
}
}
public double FinishMy
{
get => FinishDesignForce.ForceTuple.My;
set
{
FinishDesignForce.ForceTuple.My = value;
OnPropertyChanged(nameof(FinishMy));
}
}
public double FinishNz
{
get => FinishDesignForce.ForceTuple.Nz;
set
{
FinishDesignForce.ForceTuple.Nz = value;
OnPropertyChanged(nameof(FinishNz));
}
}
public int StepCount
{
get => stepCount; set
{
stepCount = value;
OnPropertyChanged(nameof(StepCount));
}
}
public ICommand InvertForcesCommand
{
get => invertForcesCommand ??= new RelayCommand(o => InvertForces());
}
public ICommand CopyToStartCommand
{
get => copyToStartCommand ??= new RelayCommand(o => CopyFinishToStart());
}
public ICommand CopyToFinishCommand
{
get => copyToFinishCommand ??= new RelayCommand(o => CopyStartToFinish());
}
public InterpolateTuplesResult Result
{
get => new()
{
StartTuple = StartDesignForce,
FinishTuple = FinishDesignForce,
StepCount = StepCount
};
}
private void InvertForces()
{
var tmpForce = StartDesignForce.Clone() as IDesignForceTuple;
StartDesignForce = FinishDesignForce;
FinishDesignForce = tmpForce;
StepCountVisible = true;
RefreshStartTuple();
RefreshFinishTuple();
}
private void CopyStartToFinish()
{
FinishDesignForce = StartDesignForce.Clone() as IDesignForceTuple;
RefreshFinishTuple();
}
private void CopyFinishToStart()
{
StartDesignForce = FinishDesignForce.Clone() as IDesignForceTuple;
RefreshStartTuple();
}
public void RefreshFinishTuple()
{
OnPropertyChanged(nameof(FinishDesignForce));
OnPropertyChanged(nameof(FinishMx));
OnPropertyChanged(nameof(FinishMy));
OnPropertyChanged(nameof(FinishNz));
}
public void RefreshStartTuple()
{
OnPropertyChanged(nameof(StartDesignForce));
OnPropertyChanged(nameof(StartMx));
OnPropertyChanged(nameof(StartMy));
OnPropertyChanged(nameof(StartNz));
}
public ForceTupleInterpolationViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce = null, int stepCount = 100)
{
if (startDesignForce != null)
{
CheckDesignForces(finishDesignForce, startDesignForce);
StartDesignForce = startDesignForce;
}
else
{
GetNewDesignForce(finishDesignForce);
}
FinishDesignForce = finishDesignForce;
StepCount = stepCount;
StepCountVisible = true;
}
public ForceTupleInterpolationViewModel()
{
}
private static void CheckDesignForces(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce)
{
if (startDesignForce.LimitState != finishDesignForce.LimitState)
{
throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
}
if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm)
{
throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
}
}
private void GetNewDesignForce(IDesignForceTuple finishDesignForce)
{
StartDesignForce = new DesignForceTuple()
{
CalcTerm = finishDesignForce.CalcTerm,
LimitState = finishDesignForce.LimitState,
ForceTuple = new ForceTuple()
{
Mx = 0,
My = 0,
Nz = 0
},
};
}
}
}

View File

@@ -8,7 +8,7 @@
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext="{d:DesignInstance local:InterpolateTuplesViewModel}"
mc:Ignorable="d"
Title="Interpolate Combinations" Height="200" Width="460" MinHeight="180" MinWidth="460" WindowStartupLocation="CenterScreen">
Title="Interpolate Combinations" Height="250" Width="460" MinHeight="250" MinWidth="460" WindowStartupLocation="CenterScreen">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<Style TargetType="Button">
@@ -20,94 +20,7 @@
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="0"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
<TextBlock Grid.Row="1" Text="Start Combination"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
<Button Grid.Row="2" Grid.Column="1" Command="{Binding CopyToStartCommand}">
<Viewbox>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</Button>
<Button Grid.Row="2" Grid.Column="2" Command="{Binding InvertForcesCommand}">
<StackPanel Orientation="Horizontal">
<Viewbox>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
<Viewbox RenderTransformOrigin="0.5,0.5">
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</Viewbox.RenderTransform>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</StackPanel>
</Button>
<Button Grid.Row="2" Grid.Column="3" Command="{Binding CopyToFinishCommand}">
<Viewbox RenderTransformOrigin="0.5,0.5">
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</Viewbox.RenderTransform>
<Canvas Width="24" Height="24">
<Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
</Canvas>
</Viewbox>
</Button>
<TextBlock Grid.Row="3" Text="Finish Combination"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="3" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, 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}}"/>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
<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" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
</Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource CancelButton}"/>
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
</StackPanel>
<local:ForceInterpolationControl x:Name="InterpolationControl"/>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
</Grid>
</Window>

View File

@@ -27,9 +27,11 @@ namespace StructureHelper.Windows.Forces
InterpolateTuplesViewModel viewModel;
public InterpolateTuplesView(InterpolateTuplesViewModel viewModel)
{
InitializeComponent();
this.viewModel = viewModel;
this.viewModel.ParentWindow = this;
DataContext = this.viewModel;
InitializeComponent();
InterpolationControl.Properties = viewModel.ForceInterpolationViewModel;
}
private void Button_Click(object sender, RoutedEventArgs e)
@@ -37,31 +39,5 @@ namespace StructureHelper.Windows.Forces
DialogResult = true;
Close();
}
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();
}
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();
}
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

@@ -8,162 +8,11 @@ namespace StructureHelper.Windows.Forces
{
public class InterpolateTuplesViewModel : OkCancelViewModelBase
{
private RelayCommand invertForcesCommand;
private RelayCommand copyToStartCommand;
private RelayCommand copyToFinishCommand;
private int stepCount;
public IDesignForceTuple StartDesignForce { 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 double StartMx
{
get => StartDesignForce.ForceTuple.Mx;
set
{
StartDesignForce.ForceTuple.Mx = value;
OnPropertyChanged(nameof(StartMx));
}
}
public double StartMy
{
get => StartDesignForce.ForceTuple.My;
set
{
StartDesignForce.ForceTuple.My = value;
OnPropertyChanged(nameof(StartMy));
}
}
public double StartNz
{
get => StartDesignForce.ForceTuple.Nz;
set
{
StartDesignForce.ForceTuple.Nz = value;
OnPropertyChanged(nameof(StartNz));
}
}
public double FinishMx
{
get => FinishDesignForce.ForceTuple.Mx;
set
{
FinishDesignForce.ForceTuple.Mx = value;
OnPropertyChanged(nameof(FinishMx));
}
}
public double FinishMy
{
get => FinishDesignForce.ForceTuple.My;
set
{
FinishDesignForce.ForceTuple.My = value;
OnPropertyChanged(nameof(FinishMy));
}
}
public double FinishNz
{
get => FinishDesignForce.ForceTuple.Nz;
set
{
FinishDesignForce.ForceTuple.Nz = value;
OnPropertyChanged(nameof(FinishNz));
}
}
public int StepCount
{
get => stepCount; set
{
stepCount = value;
OnPropertyChanged(nameof(StepCount));
}
}
public ICommand InvertForcesCommand
{
get => invertForcesCommand ??= new RelayCommand(o => InvertForces());
}
public ICommand CopyToStartCommand
{
get => copyToStartCommand ??= new RelayCommand(o => CopyFinishToStart());
}
public ICommand CopyToFinishCommand
{
get => copyToFinishCommand ??= new RelayCommand(o => CopyStartToFinish());
}
public InterpolateTuplesResult Result
{
get => new()
{
StartTuple = StartDesignForce,
FinishTuple = FinishDesignForce,
StepCount = StepCount
};
}
private void InvertForces()
{
var tmpForce = StartDesignForce.Clone() as IDesignForceTuple;
StartDesignForce = FinishDesignForce;
FinishDesignForce = tmpForce;
StepCountVisible = true;
RefreshStartTuple();
RefreshFinishTuple();
}
private void CopyStartToFinish()
{
FinishDesignForce = StartDesignForce.Clone() as IDesignForceTuple;
RefreshFinishTuple();
}
private void CopyFinishToStart()
{
StartDesignForce = FinishDesignForce.Clone() as IDesignForceTuple;
RefreshStartTuple();
}
public void RefreshFinishTuple()
{
OnPropertyChanged(nameof(FinishDesignForce));
OnPropertyChanged(nameof(FinishMx));
OnPropertyChanged(nameof(FinishMy));
OnPropertyChanged(nameof(FinishNz));
}
public void RefreshStartTuple()
{
OnPropertyChanged(nameof(StartDesignForce));
OnPropertyChanged(nameof(StartMx));
OnPropertyChanged(nameof(StartMy));
OnPropertyChanged(nameof(StartNz));
}
public ForceTupleInterpolationViewModel ForceInterpolationViewModel { get; set; }
public InterpolateTuplesViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce=null, int stepCount = 100)
{
if (startDesignForce !=null)
{
if (startDesignForce.LimitState != finishDesignForce.LimitState) throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm) throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
StartDesignForce = startDesignForce;
}
else
{
StartDesignForce = new DesignForceTuple()
{
CalcTerm = finishDesignForce.CalcTerm,
LimitState = finishDesignForce.LimitState,
ForceTuple = new ForceTuple() { Mx = 0, My = 0, Nz = 0 },
};
}
FinishDesignForce = finishDesignForce;
StepCount = stepCount;
StepCountVisible = true;
ForceInterpolationViewModel = new(finishDesignForce, startDesignForce, stepCount);
}
}
}

View File

@@ -0,0 +1,31 @@
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Windows.ViewModels;
using StructureHelperCommon.Models.Calculators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.Forces
{
public class PointPrimitiveLogic : ViewModelBase
{
public SelectItemsVM<PrimitiveValuePoints> Collection { get; private set; }
public PointPrimitiveLogic(IEnumerable<PrimitiveBase> primitiveBases)
{
List<PrimitiveValuePoints> collection = new();
foreach (var item in primitiveBases)
{
var primitiveValuePoint = new PrimitiveValuePoints(item)
{
PrimitiveBase = item
};
collection.Add(primitiveValuePoint);
}
Collection = new SelectItemsVM<PrimitiveValuePoints>(collection);
Collection.InvertSelection();
}
}
}

View File

@@ -0,0 +1,28 @@
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Windows.ViewModels;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.Forces
{
public class PrimitiveValuePoints
{
public PrimitiveBase PrimitiveBase {get;set;}
public SelectItemsVM<NamedValue<IPoint2D>> ValuePoints { get; set; }
public PrimitiveValuePoints(PrimitiveBase primitiveBase)
{
var ndmPrimitive = primitiveBase.GetNdmPrimitive();
var pointCollection = ndmPrimitive.GetValuePoints();
ValuePoints = new SelectItemsVM<NamedValue<IPoint2D>>(pointCollection)
{
ShowButtons = false
};
}
}
}

View File

@@ -0,0 +1,28 @@
using StructureHelper.Infrastructure;
using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.Forces
{
public class ValueDelegatesLogic : ViewModelBase
{
private readonly List<IResultFunc> resultFuncs;
public SelectItemsVM<IResultFunc> ResultFuncs { get; }
public ValueDelegatesLogic()
{
resultFuncs = new List<IResultFunc>();
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Strain));
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Stress));
ResultFuncs = new SelectItemsVM<IResultFunc>(resultFuncs)
{
ShowButtons = true
};
ResultFuncs.InvertSelection();
}
}
}

View File

@@ -0,0 +1,39 @@
<Window x:Class="StructureHelper.Windows.Forces.ValuePointsInterpolateView"
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.Forces"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ValuePointsInterpolateViewModel}"
Title="Value Poits Interpolation" Height="250" Width="460" MinHeight="250" MinWidth="460" MaxHeight="450" MaxWidth="460" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<TabControl>
<TabItem Header="Forces">
<local:ForceInterpolationControl x:Name="InterpolationControl"/>
</TabItem>
<TabItem Header="Points" DataContext="{Binding PrimitiveLogic}">
<ListBox DataContext="{Binding Collection}" ItemsSource="{Binding CollectionItems}">
<ListBox.ItemTemplate>
<DataTemplate>
<Expander IsExpanded="True">
<Expander.Header>
<ContentControl ContentTemplate="{StaticResource ResourceKey=ColoredItemTemplate}" Content="{Binding Item.PrimitiveBase}"/>
</Expander.Header>
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Item.ValuePoints}"/>
</Expander>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</TabItem>
<TabItem DataContext="{Binding ValueDelegatesLogic}" Header="Values">
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding ResultFuncs}"/>
</TabItem>
</TabControl>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
</Grid>
</Window>

View File

@@ -0,0 +1,31 @@
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.Forces
{
/// <summary>
/// Логика взаимодействия для ValuePoitsInterpolateView.xaml
/// </summary>
public partial class ValuePointsInterpolateView : Window
{
private ValuePointsInterpolateViewModel viewModel;
public ValuePointsInterpolateView(ValuePointsInterpolateViewModel viewModel)
{
InitializeComponent();
this.viewModel = viewModel;
this.viewModel.ParentWindow = this;
this.DataContext = this.viewModel;
}
}
}

View File

@@ -0,0 +1,26 @@
using StructureHelper.Windows.ViewModels;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.Forces
{
public class ValuePointsInterpolateViewModel : OkCancelViewModelBase
{
private readonly ValuePointsInterpolationInputData inputData;
public ForceTupleInterpolationViewModel ForceInterpolationViewModel { get; private set; }
public PointPrimitiveLogic PrimitiveLogic { get; private set; }
public ValueDelegatesLogic ValueDelegatesLogic { get; set; }
public ValuePointsInterpolateViewModel(ValuePointsInterpolationInputData inputData)
{
this.inputData = inputData;
ForceInterpolationViewModel = new(this.inputData.FinishDesignForce, this.inputData.StartDesignForce, this.inputData.StepCount);
PrimitiveLogic = new PointPrimitiveLogic(inputData.PrimitiveBases);
ValueDelegatesLogic = new();
}
}
}

View File

@@ -0,0 +1,28 @@
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.Forces
{
public class ValuePointsInterpolationInputData
{
public IDesignForceTuple FinishDesignForce { get; set; }
public IDesignForceTuple StartDesignForce { get; set; }
public int StepCount { get; set; }
public List<PrimitiveBase> PrimitiveBases { get; private set; }
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
public ValuePointsInterpolationInputData()
{
PrimitiveBases = new List<PrimitiveBase>();
StepCount = 100;
}
}
}

View File

@@ -7,10 +7,12 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Parameters
{
/// <inheritdoc/>
public class ArrayParameter<T> : IArrayParameter<T>
{
private string[] columnLabels;
public string[] ColumnLabels
private List<string> columnLabels;
/// <inheritdoc/>
public List<string> ColumnLabels
{
get { return columnLabels; }
set
@@ -25,12 +27,20 @@ namespace StructureHelperCommon.Models.Parameters
}
}
/// <inheritdoc/>
public T[,] Data { get; private set; }
public ArrayParameter(int rowCount, int columnCount, string[] columnLabels = null)
public ArrayParameter(int rowCount, int columnCount, List<string> columnLabels = null)
{
Data = new T[rowCount, columnCount];
if (columnLabels is not null) { ColumnLabels = columnLabels; }
if (columnLabels is not null)
{
if (columnLabels.Count > columnCount)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Count of column labels is greater than count of columns");
}
ColumnLabels = columnLabels;
}
}
}
}

View File

@@ -6,9 +6,19 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Parameters
{
/// <summary>
/// Rectangle table of parameters
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IArrayParameter<T>
{
/// <summary>
/// Data of rectangle table
/// </summary>
T[,] Data { get; }
string[] ColumnLabels { get; set; }
/// <summary>
/// Collection of headers of table
/// </summary>
List<string> ColumnLabels { get; set; }
}
}

View File

@@ -14,6 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public class ForceTupleCalculator : IForceTupleCalculator, IHasActionByResult
{
IForceTupleTraceResultLogic forceTupleTraceResultLogic;
public IForceTupleInputData InputData { get; set; }
public string Name { get; set; }
public IResult Result { get; private set; }
@@ -21,10 +22,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public Action<IResult> ActionToOutputResults { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public ForceTupleCalculator(IForceTupleInputData inputData)
{
InputData = inputData;
}
public ForceTupleCalculator()
{
@@ -74,13 +71,15 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
var calcResult = calculator.Result;
if (calcResult.AccuracyRate <= accuracy.IterationAccuracy)
{
TraceGoodResult(ndmCollection, calcResult);
return new ForcesTupleResult()
var result = new ForcesTupleResult()
{
IsValid = true,
Description = LoggerStrings.CalculationHasDone,
LoaderResults = calcResult
};
forceTupleTraceResultLogic = new ForceTupleTraceResultLogic(ndmCollection) { TraceLogger = TraceLogger};
forceTupleTraceResultLogic.TraceResult(result);
return result;
}
else
{
@@ -115,79 +114,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
}
}
private void TraceGoodResult(IEnumerable<INdm> ndmCollection, ILoaderResults calcResult)
{
TraceLogger?.AddMessage($"Analysis is done succsesfully");
TraceLogger?.AddMessage($"Current accuracy {calcResult.AccuracyRate} has achieved in {calcResult.IterationCounter} iteration", TraceLogStatuses.Debug);
var strainMatrix = calcResult.ForceStrainPair.StrainMatrix;
var stiffness = new StiffnessLogic().GetStiffnessMatrix(ndmCollection, strainMatrix);
TraceLogger?.AddMessage(string.Format("Next strain were obtained kx = {0}, ky = {1}, epsz = {2}", strainMatrix.Kx, strainMatrix.Ky, strainMatrix.EpsZ));
TraceMinMaxStrain(ndmCollection, strainMatrix);
TraceStrainAndStiffness(strainMatrix, stiffness);
}
private void TraceMinMaxStrain(IEnumerable<INdm> ndmCollection, IStrainMatrix strainMatrix)
{
var stressLogic = new StressLogic();
double minStrain = double.PositiveInfinity, maxStrain = double.NegativeInfinity;
Point2D minPoint = new Point2D(), maxPoint = new Point2D();
foreach (var item in ndmCollection)
{
var strain = stressLogic.GetTotalStrain(strainMatrix, item);
if (strain < minStrain)
{
minStrain = strain;
minPoint = new Point2D() { X = item.CenterX, Y = item.CenterY };
}
if (strain > maxStrain)
{
maxStrain = strain;
maxPoint = new Point2D() { X = item.CenterX, Y = item.CenterY };
}
}
TraceLogger?.AddMessage(string.Format("Max strain EpsilonMax = {0}, at point x = {1}, y = {2}", maxStrain, maxPoint.X, maxPoint.Y), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(string.Format("Min strain EpsilonMin = {0}, at point x = {1}, y = {2}", minStrain, minPoint.X, minPoint.Y), TraceLogStatuses.Debug);
}
private void TraceStrainAndStiffness(IStrainMatrix strain, IStiffnessMatrix stiffness)
{
TraceLogger?.AddMessage("Stiffness matrix");
TraceLogger?.AddMessage(string.Format("D11 = {0}, D12 = {1}, D13 = {2}", stiffness[0, 0], stiffness[0, 1], stiffness[0, 2]));
TraceLogger?.AddMessage(string.Format("D21 = {0}, D22 = {1}, D23 = {2}", stiffness[1, 0], stiffness[1, 1], stiffness[1, 2]));
TraceLogger?.AddMessage(string.Format("D31 = {0}, D32 = {1}, D33 = {2}", stiffness[2, 0], stiffness[2, 1], stiffness[2, 2]));
TraceLogger?.AddMessage("Checking equilibrium equations");
var exitMx = stiffness[0, 0] * strain.Kx + stiffness[0, 1] * strain.Ky + stiffness[0, 2] * strain.EpsZ;
var exitMy = stiffness[1, 0] * strain.Kx + stiffness[1, 1] * strain.Ky + stiffness[1, 2] * strain.EpsZ;
var exitNz = stiffness[2, 0] * strain.Kx + stiffness[2, 1] * strain.Ky + stiffness[2, 2] * strain.EpsZ;
TraceLogger?.AddMessage(string.Format("D11 * kx + D12 * ky + D13 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[0, 0], strain.Kx,
stiffness[0, 1], strain.Ky,
stiffness[0, 2], strain.EpsZ,
exitMx
));
TraceLogger?.AddMessage(string.Format("D12 * kx + D22 * ky + D23 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[1, 0], strain.Kx,
stiffness[1, 1], strain.Ky,
stiffness[1, 2], strain.EpsZ,
exitMy
));
TraceLogger?.AddMessage(string.Format("D31 * kx + D32 * ky + D33 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[2, 0], strain.Kx,
stiffness[2, 1], strain.Ky,
stiffness[2, 2], strain.EpsZ,
exitNz
));
TraceLogger?.AddMessage($"Output force combination");
var outputTuple = new ForceTuple()
{
Mx = exitMx,
My = exitMy,
Nz = exitNz
};
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(outputTuple));
}
public object Clone()
{
var newItem = new ForceTupleCalculator();

View File

@@ -0,0 +1,140 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData;
using LoaderCalculator.Logics;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Infrastructures.Exceptions;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public class ForceTupleTraceResultLogic : IForceTupleTraceResultLogic
{
private ILoaderResults calcResult;
private IEnumerable<INdm> ndmCollection;
public IShiftTraceLogger? TraceLogger { get; set; }
public ForceTupleTraceResultLogic(IEnumerable<INdm> ndmCollection)
{
this.ndmCollection = ndmCollection;
}
public void TraceResult(IResult result)
{
if (result is not IForcesTupleResult)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(result));
}
calcResult = ((IForcesTupleResult)result).LoaderResults;
TraceLogger?.AddMessage($"Analysis is done succsesfully");
TraceLogger?.AddMessage($"Current accuracy {calcResult.AccuracyRate} has achieved in {calcResult.IterationCounter} iteration", TraceLogStatuses.Debug);
var strainMatrix = calcResult.ForceStrainPair.StrainMatrix;
var stiffness = new StiffnessLogic().GetStiffnessMatrix(ndmCollection, strainMatrix);
TraceLogger?.AddMessage(string.Format("Next strain were obtained kx = {0}, ky = {1}, epsz = {2}", strainMatrix.Kx, strainMatrix.Ky, strainMatrix.EpsZ));
TraceMinMaxStrain(ndmCollection, strainMatrix);
TraceStrainAndStiffness(strainMatrix, stiffness);
}
private void TraceMinMaxStrain(IEnumerable<INdm> ndmCollection, IStrainMatrix strainMatrix)
{
var stressLogic = new StressLogic();
double minStrain = double.PositiveInfinity, maxStrain = double.NegativeInfinity;
Point2D minPoint = new(), maxPoint = new();
foreach (var item in ndmCollection)
{
var strain = stressLogic.GetTotalStrain(strainMatrix, item);
if (strain < minStrain)
{
minStrain = strain;
minPoint = new () { X = item.CenterX, Y = item.CenterY };
}
if (strain > maxStrain)
{
maxStrain = strain;
maxPoint = new () { X = item.CenterX, Y = item.CenterY };
}
}
TraceLogger?.AddMessage(string.Format("Max strain EpsilonMax = {0}, at point x = {1}, y = {2}", maxStrain, maxPoint.X, maxPoint.Y), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(string.Format("Min strain EpsilonMin = {0}, at point x = {1}, y = {2}", minStrain, minPoint.X, minPoint.Y), TraceLogStatuses.Debug);
}
private void TraceStrainAndStiffness(IStrainMatrix strain, IStiffnessMatrix stiffness)
{
var exitMx = stiffness[0, 0] * strain.Kx + stiffness[0, 1] * strain.Ky + stiffness[0, 2] * strain.EpsZ;
var exitMy = stiffness[1, 0] * strain.Kx + stiffness[1, 1] * strain.Ky + stiffness[1, 2] * strain.EpsZ;
var exitNz = stiffness[2, 0] * strain.Kx + stiffness[2, 1] * strain.Ky + stiffness[2, 2] * strain.EpsZ;
var PrestressMatrix = new ForceLogic()
.GetPrestressMatrix(new StiffnessLogic(), ndmCollection, strain);
double mx = exitMx + PrestressMatrix.Mx;
double my = exitMy + PrestressMatrix.My;
double nz = exitNz + PrestressMatrix.Nz;
TraceStiffnessMatrix(strain, stiffness, exitMx, exitMy, exitNz);
TracePrestressMatrix(exitMx, exitMy, exitNz, PrestressMatrix, mx, my, nz);
TraceOutputForceCombination(mx, my, nz);
}
private void TraceOutputForceCombination(double mx, double my, double nz)
{
TraceLogger?.AddMessage($"Output force combination");
var outputTuple = new ForceTuple()
{
Mx = mx,
My = my,
Nz = nz
};
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(outputTuple));
}
private void TracePrestressMatrix(double exitMx, double exitMy, double exitNz, IForceMatrix PrestressMatrix, double mx, double my, double nz)
{
string prestressMatrix = string.Format("Prestress force matrix for current strain matrix: Mx = {0}, My = {1}, Nz = {2}",
PrestressMatrix.Mx,
PrestressMatrix.My,
PrestressMatrix.Nz);
TraceLogger?.AddMessage(prestressMatrix);
string prestressForce = "Summary force matrix:";
prestressForce += string.Format("\nMx = {0} + ({1}) = {2},\nMy = {3} + ({4}) = {5},\nNz = {6} + ({7}) = {8}",
exitMx, PrestressMatrix.Mx, mx,
exitMy, PrestressMatrix.My, my,
exitNz, PrestressMatrix.Nz, nz
);
TraceLogger?.AddMessage(prestressForce, TraceLogStatuses.Debug);
}
private void TraceStiffnessMatrix(IStrainMatrix strain, IStiffnessMatrix stiffness, double exitMx, double exitMy, double exitNz)
{
TraceLogger?.AddMessage("Stiffness matrix");
TraceLogger?.AddMessage(string.Format("D11 = {0}, D12 = {1}, D13 = {2}", stiffness[0, 0], stiffness[0, 1], stiffness[0, 2]));
TraceLogger?.AddMessage(string.Format("D21 = {0}, D22 = {1}, D23 = {2}", stiffness[1, 0], stiffness[1, 1], stiffness[1, 2]));
TraceLogger?.AddMessage(string.Format("D31 = {0}, D32 = {1}, D33 = {2}", stiffness[2, 0], stiffness[2, 1], stiffness[2, 2]));
TraceLogger?.AddMessage("Checking equilibrium equations");
TraceLogger?.AddMessage(string.Format("D11 * kx + D12 * ky + D13 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[0, 0], strain.Kx,
stiffness[0, 1], strain.Ky,
stiffness[0, 2], strain.EpsZ,
exitMx
));
TraceLogger?.AddMessage(string.Format("D12 * kx + D22 * ky + D23 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[1, 0], strain.Kx,
stiffness[1, 1], strain.Ky,
stiffness[1, 2], strain.EpsZ,
exitMy
));
TraceLogger?.AddMessage(string.Format("D31 * kx + D32 * ky + D33 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[2, 0], strain.Kx,
stiffness[2, 1], strain.Ky,
stiffness[2, 2], strain.EpsZ,
exitNz
));
}
}
}

View File

@@ -0,0 +1,12 @@
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IForceTupleTraceResultLogic : ILogic
{
void TraceResult(IResult result);
}
}

View File

@@ -145,7 +145,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
NdmCollection = ndmCollection,
Tuple = tuple, Accuracy = Accuracy
};
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
IForceTupleCalculator calculator = new ForceTupleCalculator() { InputData = inputData };
return calculator;
}

View File

@@ -65,7 +65,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private void CalcStrainMatrix()
{
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = InputData.ForceTuple};
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
IForceTupleCalculator calculator = new ForceTupleCalculator() { InputData = inputData };
calculator.Run();
var forceResult = calculator.Result as IForcesTupleResult;
strainTuple = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);

View File

@@ -39,7 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
Tuple = Tuple,
NdmCollection = NdmCollection
};
var calculator = new ForceTupleCalculator(inputData);
var calculator = new ForceTupleCalculator() { InputData = inputData };
if (TraceLogger is not null)
{
calculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);

View File

@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Triangulations;
@@ -72,5 +73,18 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
if (distance > Diameter / 2) { return false; }
return true;
}
List<NamedValue<IPoint2D>> INdmPrimitive.GetValuePoints()
{
var points = new List<NamedValue<IPoint2D>>();
NamedValue<IPoint2D> newPoint;
newPoint = new NamedValue<IPoint2D>()
{
Name = "Center",
Value = Center.Clone() as Point2D
};
points.Add(newPoint);
return points;
}
}
}

View File

@@ -10,6 +10,7 @@ using System;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperCommon.Models.Parameters;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
@@ -28,5 +29,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
IVisualProperty VisualProperty {get; }
IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions);
List<NamedValue<IPoint2D>> GetValuePoints();
}
}

View File

@@ -1,6 +1,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Primitives;
@@ -54,5 +55,18 @@ namespace StructureHelperLogics.Models.Primitives
var logic = new PointTriangulationLogic(options);
return logic.GetNdmCollection();
}
public List<NamedValue<IPoint2D>> GetValuePoints()
{
var points = new List<NamedValue<IPoint2D>>();
NamedValue<IPoint2D> newPoint;
newPoint = new NamedValue<IPoint2D>()
{
Name = "Center",
Value = Center.Clone() as Point2D
};
points.Add(newPoint);
return points;
}
}
}

View File

@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials;
@@ -75,5 +76,18 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
var logic = new RebarTriangulationLogic(options);
return logic.GetNdmCollection();
}
public List<NamedValue<IPoint2D>> GetValuePoints()
{
var points = new List<NamedValue<IPoint2D>>();
NamedValue<IPoint2D> newPoint;
newPoint = new NamedValue<IPoint2D>()
{
Name = "Center",
Value = Center.Clone() as Point2D
};
points.Add(newPoint);
return points;
}
}
}

View File

@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Triangulations;
@@ -80,5 +81,24 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
{ return false; }
return true;
}
public List<NamedValue<IPoint2D>> GetValuePoints()
{
var points = new List<NamedValue<IPoint2D>>();
NamedValue<IPoint2D> newPoint;
newPoint = new NamedValue<IPoint2D>()
{
Name = "Center",
Value = Center.Clone() as Point2D
};
points.Add(newPoint);
newPoint = new NamedValue<IPoint2D>()
{
Name = "LeftTop",
Value = new Point2D() { X = Center.X - Width / 2d, Y = Center.Y + Height / 2d}
};
points.Add(newPoint);
return points;
}
}
}

View File

@@ -12,7 +12,7 @@ namespace StructureHelperTests.ViewModelTests
public void RunShouldPass(int rowCount, int columnCount)
{
//Arrange
string[] labels = new string[columnCount];
var labels = new List<string>();
for (int i = 0; i < columnCount; i++)
{
labels[i] = $"Column{i}";