Value point graph was added
This commit is contained in:
@@ -85,11 +85,16 @@ namespace FieldVisualizer.Services.ColorServices
|
||||
return map.Colors[^1];
|
||||
}
|
||||
double colorPerc = 1d / (map.Colors.Count - 1d); // % of each block of color. the last is the "100% Color"
|
||||
double blockOfColor = valPerc / colorPerc;// the integer part repersents how many block to skip
|
||||
double blockOfColor = valPerc / colorPerc;// the integer part represents how many block to skip
|
||||
int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
|
||||
double valPercResidual = valPerc - (blockIdx * colorPerc);//remove the part represented of block
|
||||
double percOfColor = valPercResidual / colorPerc;// % of color of this block that will be filled
|
||||
|
||||
//in some cases due to accuracy of double type percent of color may be less than zero
|
||||
if (percOfColor <= 0d)
|
||||
{
|
||||
return map.Colors[blockIdx];
|
||||
}
|
||||
Color c = GetColorByColorMap(map, blockIdx, percOfColor);
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
</StackPanel>
|
||||
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
|
||||
SelectedItem="{Binding SelectedTargetItem}"
|
||||
ItemTemplate="{Binding ItemDataDemplate}">
|
||||
ItemTemplate="{Binding ItemDataDemplate}"
|
||||
>
|
||||
<!--<InputBindingCollection>
|
||||
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding RemoveSelected}"/>
|
||||
</InputBindingCollection>-->
|
||||
@@ -41,8 +42,9 @@
|
||||
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
|
||||
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>
|
||||
</StackPanel>
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
||||
<ListBox.ItemTemplate>
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible">
|
||||
<ListBox ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -54,7 +56,8 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ListBox>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
Binary file not shown.
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2024-03-10T14:11:27.6834663Z;True|2024-02-02T12:22:50.1454015+05:00;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;</History>
|
||||
<History>True|2024-03-11T15:33:14.1457807Z;True|2024-03-10T19:11:27.6834663+05:00;True|2024-02-02T12:22:50.1454015+05:00;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -12,6 +12,7 @@ namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
string Name { get; }
|
||||
Func<IStrainMatrix, INdm, double> ResultFunction { get; }
|
||||
string UnitName { get; set; }
|
||||
double UnitFactor { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public Func<IStrainMatrix, INdm, double> ResultFunction { get; set; }
|
||||
public string UnitName { get; set; }
|
||||
public double UnitFactor { get; set; }
|
||||
|
||||
public ResultFunc()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using LoaderCalculator.Logics;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -18,6 +20,11 @@ namespace StructureHelper.Services.ResultViewers
|
||||
}
|
||||
public static class ResultFuncFactory
|
||||
{
|
||||
static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||
static IUnit unitStress = CommonOperation.GetUnit(UnitTypes.Stress);
|
||||
static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||
static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
|
||||
static readonly IStressLogic stressLogic = new StressLogic();
|
||||
public static List<IResultFunc> GetResultFuncs(FuncsTypes funcsType = FuncsTypes.Full)
|
||||
{
|
||||
@@ -50,7 +57,7 @@ namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
||||
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 = "Total Strain with prestrain", ResultFunction = stressLogic.GetTotalStrainWithPrestrain });
|
||||
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
||||
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
||||
return resultFuncs;
|
||||
@@ -58,17 +65,17 @@ namespace StructureHelper.Services.ResultViewers
|
||||
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 = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||
resultFuncs.Add(new ResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||
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 });
|
||||
resultFuncs.Add(new ResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = unitForce.Multiplyer, UnitName = unitForce.Name });
|
||||
resultFuncs.Add(new ResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||
resultFuncs.Add(new ResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||
return resultFuncs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
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 DiagramFactory
|
||||
{
|
||||
private ArrayParameter<double> arrayParameter;
|
||||
public List<IForcesTupleResult> TupleList { get; set; }
|
||||
|
||||
public Action<int> SetProgress { get; set; }
|
||||
|
||||
public ArrayParameter<double> GetCommonArray()
|
||||
{
|
||||
var labels = LabelsFactory.GetCommonLabels();
|
||||
arrayParameter = new ArrayParameter<double>(TupleList.Count(), labels);
|
||||
Calculate();
|
||||
return arrayParameter;
|
||||
}
|
||||
|
||||
private void Calculate()
|
||||
{
|
||||
var data = arrayParameter.Data;
|
||||
for (int i = 0; i < TupleList.Count(); i++)
|
||||
{
|
||||
var valueList = ProcessResult(i);
|
||||
for (int j = 0; j < valueList.Count; j++)
|
||||
{
|
||||
data[i, j] = valueList[j];
|
||||
}
|
||||
SetProgress?.Invoke(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<double> ProcessResult(int i)
|
||||
{
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
|
||||
return new List<double>
|
||||
{
|
||||
TupleList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||
TupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||
TupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||
TupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||
TupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||
TupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
{
|
||||
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||
|
||||
var labels = LabelsFactory.GetCommonLabels();
|
||||
arrayParameter = new ArrayParameter<double>(validTupleList.Count(), labels);
|
||||
Calculate();
|
||||
var factory = new DiagramFactory()
|
||||
{
|
||||
TupleList = validTupleList,
|
||||
SetProgress = SetProgress,
|
||||
};
|
||||
arrayParameter = factory.GetCommonArray();
|
||||
}
|
||||
|
||||
public ShowDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
@@ -69,37 +72,5 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
this.ndmPrimitives = ndmPrimitives;
|
||||
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||
}
|
||||
|
||||
private void Calculate()
|
||||
{
|
||||
var data = arrayParameter.Data;
|
||||
for (int i = 0; i < validTupleList.Count(); i++)
|
||||
{
|
||||
var valueList = ProcessResult(i);
|
||||
for (int j = 0; j < valueList.Count; j++)
|
||||
{
|
||||
data[i, j] = valueList[j];
|
||||
}
|
||||
SetProgress?.Invoke(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<double> ProcessResult(int i)
|
||||
{
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
|
||||
return new List<double>
|
||||
{
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Windows.CalculationWindows.ProgressViews;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
@@ -82,8 +83,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
throw new StructureHelperException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
@@ -25,7 +28,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
private IEnumerable<IForcesTupleResult> tupleList;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private List<IForcesTupleResult> validTupleList;
|
||||
private List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)> valuePoints;
|
||||
private List<(PrimitiveBase PrimitiveBase, List<INamedAreaPoint> namedPoints)> valuePoints;
|
||||
private List<IResultFunc> resultFuncList;
|
||||
|
||||
public ForceCalculator Calculator { get; set; }
|
||||
@@ -42,8 +45,19 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
this.tupleList = tupleList;
|
||||
this.ndmPrimitives = ndmPrimitives;
|
||||
validTupleList = this.tupleList.Where(x => x.IsValid == true).ToList();
|
||||
valuePoints = new List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)>();
|
||||
foreach (var item in PrimitiveLogic.Collection.CollectionItems)
|
||||
valuePoints = new List<(PrimitiveBase PrimitiveBase, List<INamedAreaPoint>)>();
|
||||
}
|
||||
|
||||
public void SetParameters()
|
||||
{
|
||||
var factory = new DiagramFactory()
|
||||
{
|
||||
TupleList = validTupleList,
|
||||
SetProgress = SetProgress,
|
||||
};
|
||||
arrayParameter = factory.GetCommonArray();
|
||||
|
||||
foreach (var item in PrimitiveLogic.Collection.CollectionItems)
|
||||
{
|
||||
var pointsCount = item.Item.ValuePoints.SelectedCount;
|
||||
if (pointsCount > 0)
|
||||
@@ -53,7 +67,79 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
valuePoints.Add((primitive, points));
|
||||
}
|
||||
}
|
||||
|
||||
var selectedDelegates = ValueDelegatesLogic.ResultFuncs.SelectedItems;
|
||||
if (selectedDelegates.Count() == 0) { return; }
|
||||
var labels = GetLabels(valuePoints, selectedDelegates);
|
||||
var pointCount = valuePoints.Sum(x => x.namedPoints.Count());
|
||||
List<double> values = new();
|
||||
var tuplesList = tupleList
|
||||
.Where(x => x.IsValid == true)
|
||||
.ToList();
|
||||
var newArray = new ArrayParameter<double>(tuplesList.Count(), labels);
|
||||
for (int i = 0; i < tuplesList.Count(); i++)
|
||||
{
|
||||
var strainMatrix = tuplesList[i].LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
values.Clear();
|
||||
foreach (var valuePoint in valuePoints)
|
||||
{
|
||||
foreach (var point in valuePoint.namedPoints)
|
||||
{
|
||||
var limitState = tuplesList[i].DesignForceTuple.LimitState;
|
||||
var calcTerm = tuplesList[i].DesignForceTuple.CalcTerm;
|
||||
var ndm = GetNdm(valuePoint, point, limitState, calcTerm);
|
||||
|
||||
foreach (var valDelegate in selectedDelegates)
|
||||
{
|
||||
|
||||
double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
|
||||
values.Add(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
newArray.AddRow(i, values);
|
||||
}
|
||||
arrayParameter.AddArray(newArray);
|
||||
}
|
||||
|
||||
private List<string> GetLabels(List<(PrimitiveBase PrimitiveBase, List<INamedAreaPoint> namedPoints)> valuePoints, IEnumerable<IResultFunc> selectedDelegates)
|
||||
{
|
||||
List<string> strings = new();
|
||||
foreach (var valuePoint in valuePoints)
|
||||
{
|
||||
foreach (var item in valuePoint.namedPoints)
|
||||
{
|
||||
foreach (var deleg in selectedDelegates)
|
||||
{
|
||||
string s = valuePoint.PrimitiveBase.Name;
|
||||
s += "_" + item.Name;
|
||||
s += "_" + deleg.Name + ", " + deleg.UnitName;
|
||||
strings.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
private static RebarNdm GetNdm((PrimitiveBase PrimitiveBase, List<INamedAreaPoint> namedPoints) valuePoint, INamedAreaPoint point, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var ndmPrimitive = valuePoint.PrimitiveBase.GetNdmPrimitive();
|
||||
var material = ndmPrimitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm);
|
||||
var userPrestrain = ndmPrimitive.UsersPrestrain;
|
||||
var autoPrestrain = ndmPrimitive.AutoPrestrain;
|
||||
var ndm = new RebarNdm()
|
||||
{
|
||||
Area = point.Area,
|
||||
CenterX = point.Point.X,
|
||||
CenterY = point.Point.Y,
|
||||
Material = material,
|
||||
};
|
||||
ndm.Prestrain = (userPrestrain.Mx + autoPrestrain.Mx) * point.Point.Y
|
||||
+ (userPrestrain.My + autoPrestrain.My) * point.Point.X
|
||||
+ userPrestrain.Nz + autoPrestrain.Nz;
|
||||
return ndm;
|
||||
}
|
||||
|
||||
public void ShowWindow()
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(() =>
|
||||
@@ -89,7 +175,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
|
||||
private void Show()
|
||||
{
|
||||
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||
|
||||
var factory = new DiagramFactory()
|
||||
{
|
||||
TupleList = validTupleList,
|
||||
SetProgress = SetProgress,
|
||||
};
|
||||
arrayParameter = factory.GetCommonArray();
|
||||
}
|
||||
|
||||
private List<string> GetColumnNames()
|
||||
|
||||
@@ -152,12 +152,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
{
|
||||
get => showGraphsCommand ??= new RelayCommand(o =>
|
||||
{
|
||||
InterpolateTuplesViewModel interploateTuplesViewModel;
|
||||
InterpolateTuplesViewModel interpolateTuplesViewModel;
|
||||
InterpolateTuplesView wndTuples;
|
||||
ShowInterpolationWindow(out interploateTuplesViewModel, out wndTuples);
|
||||
ShowInterpolationWindow(out interpolateTuplesViewModel, out wndTuples);
|
||||
if (wndTuples.DialogResult != true) return;
|
||||
|
||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
|
||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interpolateTuplesViewModel.ForceInterpolationViewModel.Result);
|
||||
showProgressLogic = new(interpolationLogic)
|
||||
{
|
||||
WindowTitle = "Interpolate forces"
|
||||
@@ -298,18 +298,27 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult != true) { return; }
|
||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, viewModel.ForceInterpolationViewModel.Result);
|
||||
ShowValuePointDiagramLogic pointGraphLogic = new(ForcesResults.ForcesResultList, ndmPrimitives)
|
||||
{
|
||||
Calculator = interpolationLogic.InterpolateCalculator,
|
||||
PrimitiveLogic = viewModel.PrimitiveLogic,
|
||||
ValueDelegatesLogic = viewModel.ValueDelegatesLogic
|
||||
};
|
||||
progressLogic = interpolationLogic;
|
||||
showProgressLogic = new(interpolationLogic)
|
||||
{
|
||||
ShowResult = pointGraphLogic.ShowWindow
|
||||
WindowTitle = "Interpolate forces",
|
||||
};
|
||||
showProgressLogic.Show();
|
||||
var result = interpolationLogic.InterpolateCalculator.Result;
|
||||
if (result.IsValid == false) { return; }
|
||||
if (result is IForcesResults)
|
||||
{
|
||||
var tupleResult = result as IForcesResults;
|
||||
var pointGraphLogic = new ShowValuePointDiagramLogic(tupleResult.ForcesResultList, ndmPrimitives)
|
||||
{
|
||||
Calculator = interpolationLogic.InterpolateCalculator,
|
||||
PrimitiveLogic = viewModel.PrimitiveLogic,
|
||||
ValueDelegatesLogic = viewModel.ValueDelegatesLogic
|
||||
};
|
||||
pointGraphLogic.SetParameters();
|
||||
pointGraphLogic.ShowWindow();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ShowInterpolationWindow(out InterpolateTuplesViewModel interploateTuplesViewModel, out InterpolateTuplesView wndTuples)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -13,13 +14,13 @@ namespace StructureHelper.Windows.Forces
|
||||
public class PrimitiveValuePoints
|
||||
{
|
||||
public PrimitiveBase PrimitiveBase {get;set;}
|
||||
public SelectItemsVM<NamedValue<IPoint2D>> ValuePoints { get; set; }
|
||||
public SelectItemsVM<INamedAreaPoint> ValuePoints { get; set; }
|
||||
|
||||
public PrimitiveValuePoints(PrimitiveBase primitiveBase)
|
||||
{
|
||||
var ndmPrimitive = primitiveBase.GetNdmPrimitive();
|
||||
var pointCollection = ndmPrimitive.GetValuePoints();
|
||||
ValuePoints = new SelectItemsVM<NamedValue<IPoint2D>>(pointCollection)
|
||||
ValuePoints = new SelectItemsVM<INamedAreaPoint>(pointCollection)
|
||||
{
|
||||
ShowButtons = false
|
||||
};
|
||||
|
||||
@@ -16,8 +16,7 @@ namespace StructureHelper.Windows.Forces
|
||||
public ValueDelegatesLogic()
|
||||
{
|
||||
resultFuncs = new List<IResultFunc>();
|
||||
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Strain));
|
||||
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Stress));
|
||||
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Full));
|
||||
ResultFuncs = new SelectItemsVM<IResultFunc>(resultFuncs)
|
||||
{
|
||||
ShowButtons = true
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
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;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.Forces
|
||||
{
|
||||
@@ -22,10 +10,11 @@ namespace StructureHelper.Windows.Forces
|
||||
private ValuePointsInterpolateViewModel viewModel;
|
||||
public ValuePointsInterpolateView(ValuePointsInterpolateViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.viewModel = viewModel;
|
||||
this.viewModel.ParentWindow = this;
|
||||
this.DataContext = this.viewModel;
|
||||
InitializeComponent();
|
||||
InterpolationControl.Properties = viewModel.ForceInterpolationViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -7,5 +7,9 @@ namespace StructureHelperCommon.Infrastructures.Exceptions
|
||||
public StructureHelperException(string errorString) : base(errorString)
|
||||
{
|
||||
}
|
||||
public StructureHelperException(Exception ex) : this(ex.Message)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,5 +43,62 @@ namespace StructureHelperCommon.Models.Parameters
|
||||
}
|
||||
}
|
||||
public ArrayParameter(int rowCount, List<string> columnLabels) : this(rowCount, columnLabels.Count, columnLabels) { }
|
||||
public void AddArray(IArrayParameter<T> array)
|
||||
{
|
||||
var rowCount = array.Data.GetLength(0);
|
||||
int existingRowCount = this.Data.GetLength(0);
|
||||
if (rowCount != existingRowCount)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": number of rows in new array {rowCount} is not equal existing row count {existingRowCount}");
|
||||
}
|
||||
var existingColumnCount = this.Data.GetLength(1);
|
||||
var newColumnCount = array.Data.GetLength(1);
|
||||
var totalCount = existingColumnCount + newColumnCount;
|
||||
var newData = new T[rowCount, totalCount];
|
||||
var lackColumns = existingColumnCount - ColumnLabels.Count;
|
||||
if (lackColumns > 0)
|
||||
{
|
||||
for (int i = 0; i < lackColumns; i++)
|
||||
{
|
||||
ColumnLabels.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
ColumnLabels.AddRange(array.ColumnLabels);
|
||||
for (int i = 0; i < rowCount; i++)
|
||||
{
|
||||
for (int j = 0; j < existingColumnCount; j++)
|
||||
{
|
||||
newData[i, j] = Data[i, j];
|
||||
}
|
||||
for (int j = 0; j < newColumnCount; j++)
|
||||
{
|
||||
newData[i, existingColumnCount + j] = array.Data[i,j];
|
||||
}
|
||||
}
|
||||
Data = newData;
|
||||
}
|
||||
|
||||
public void AddRow(int rowNumber, IEnumerable<T> values)
|
||||
{
|
||||
CheckParams(rowNumber, values);
|
||||
var valueList = values.ToList();
|
||||
for (int i = 0; i < values.Count(); i++)
|
||||
{
|
||||
Data[rowNumber, i] = valueList[i];
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckParams(int rowNumber, IEnumerable<T> values)
|
||||
{
|
||||
int rowCount = Data.GetLength(0) - 1;
|
||||
if (rowNumber > rowCount)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": number of rows {rowNumber} is greater than length of array {rowCount}");
|
||||
}
|
||||
if (values.Count() != Data.GetLength(1))
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": number of colums in values {values.Count()} is not equal existing column count {Data.GetLength(1)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
forcelogic = new ForceTupleMoveToPointDecorator(forcelogic) { Point2D = point2D};
|
||||
}
|
||||
var newTuple = forcelogic.GetValue();
|
||||
TraceLogger?.AddMessage($"Input force combination");
|
||||
TraceLogger?.AddMessage("Input force combination");
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||
if (CompressedMember.Buckling == true)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
var concreteNdm = ndms[0];
|
||||
var rebarNdm = ndms[1];
|
||||
data.ConcreteStrain = concreteNdm.Prestrain;// stressLogic.GetTotalStrain(strainMatrix, concreteNdm) - stressLogic.GetTotalStrainWithPresrain(strainMatrix, concreteNdm);
|
||||
data.RebarStrain = stressLogic.GetTotalStrainWithPresrain(strainMatrix, rebarNdm);
|
||||
data.RebarStrain = stressLogic.GetTotalStrainWithPrestrain(strainMatrix, rebarNdm);
|
||||
data.Length = inputData.Length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
var concreteArea = concreteCollection
|
||||
.Sum(x => x.Area * x.StressScale);
|
||||
var concreteTensileArea = concreteCollection
|
||||
.Where(x => stressLogic.GetTotalStrainWithPresrain(StrainMatrix, x) > 0d)
|
||||
.Where(x => stressLogic.GetTotalStrainWithPrestrain(StrainMatrix, x) > 0d)
|
||||
.Sum(x => x.Area * x.StressScale);
|
||||
|
||||
concreteTensileArea = Math.Max(concreteTensileArea, rebarArea * minRebarFactor);
|
||||
|
||||
@@ -74,14 +74,43 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
return true;
|
||||
}
|
||||
|
||||
List<NamedValue<IPoint2D>> INdmPrimitive.GetValuePoints()
|
||||
List<INamedAreaPoint> INdmPrimitive.GetValuePoints()
|
||||
{
|
||||
var points = new List<NamedValue<IPoint2D>>();
|
||||
NamedValue<IPoint2D> newPoint;
|
||||
newPoint = new NamedValue<IPoint2D>()
|
||||
var points = new List<INamedAreaPoint>();
|
||||
INamedAreaPoint newPoint;
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Center",
|
||||
Value = Center.Clone() as Point2D
|
||||
Point = Center.Clone() as Point2D,
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Left",
|
||||
Point = new Point2D() { X = Center.X - Diameter / 2d, Y = Center.Y},
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Top",
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y + Diameter / 2d },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Right",
|
||||
Point = new Point2D() { X = Center.X + Diameter / 2d, Y = Center.Y },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Bottom",
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y - Diameter / 2d },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
return points;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface INamedAreaPoint
|
||||
{
|
||||
double Area { get; set; }
|
||||
string Name { get; set; }
|
||||
Point2D Point { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
IVisualProperty VisualProperty {get; }
|
||||
|
||||
IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions);
|
||||
List<NamedValue<IPoint2D>> GetValuePoints();
|
||||
List<INamedAreaPoint> GetValuePoints();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class NamedAreaPoint : INamedAreaPoint
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public Point2D Point { get; set; }
|
||||
public double Area { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -56,14 +56,14 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
return logic.GetNdmCollection();
|
||||
}
|
||||
|
||||
public List<NamedValue<IPoint2D>> GetValuePoints()
|
||||
public List<INamedAreaPoint> GetValuePoints()
|
||||
{
|
||||
var points = new List<NamedValue<IPoint2D>>();
|
||||
NamedValue<IPoint2D> newPoint;
|
||||
newPoint = new NamedValue<IPoint2D>()
|
||||
var points = new List<INamedAreaPoint>();
|
||||
var newPoint = new NamedAreaPoint()
|
||||
{
|
||||
Name = "Center",
|
||||
Value = Center.Clone() as Point2D
|
||||
Point = Center.Clone() as Point2D,
|
||||
Area = Area
|
||||
};
|
||||
points.Add(newPoint);
|
||||
return points;
|
||||
|
||||
@@ -77,14 +77,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
return logic.GetNdmCollection();
|
||||
}
|
||||
|
||||
public List<NamedValue<IPoint2D>> GetValuePoints()
|
||||
public List<INamedAreaPoint> GetValuePoints()
|
||||
{
|
||||
var points = new List<NamedValue<IPoint2D>>();
|
||||
NamedValue<IPoint2D> newPoint;
|
||||
newPoint = new NamedValue<IPoint2D>()
|
||||
var points = new List<INamedAreaPoint>();
|
||||
var newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Center",
|
||||
Value = Center.Clone() as Point2D
|
||||
Point = Center.Clone() as Point2D,
|
||||
Area = Area
|
||||
};
|
||||
points.Add(newPoint);
|
||||
return points;
|
||||
|
||||
@@ -82,20 +82,38 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<NamedValue<IPoint2D>> GetValuePoints()
|
||||
public List<INamedAreaPoint> GetValuePoints()
|
||||
{
|
||||
var points = new List<NamedValue<IPoint2D>>();
|
||||
NamedValue<IPoint2D> newPoint;
|
||||
newPoint = new NamedValue<IPoint2D>()
|
||||
var points = new List<INamedAreaPoint>();
|
||||
INamedAreaPoint newPoint;
|
||||
newPoint = new NamedAreaPoint()
|
||||
{
|
||||
Name = "Center",
|
||||
Value = Center.Clone() as Point2D
|
||||
Point = Center.Clone() as Point2D
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedValue<IPoint2D>()
|
||||
newPoint = new NamedAreaPoint()
|
||||
{
|
||||
Name = "LeftTop",
|
||||
Value = new Point2D() { X = Center.X - Width / 2d, Y = Center.Y + Height / 2d}
|
||||
Point = new Point2D() { X = Center.X - Width / 2d, Y = Center.Y + Height / 2d}
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint()
|
||||
{
|
||||
Name = "RightTop",
|
||||
Point = new Point2D() { X = Center.X + Width / 2d, Y = Center.Y + Height / 2d }
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint()
|
||||
{
|
||||
Name = "LeftBottom",
|
||||
Point = new Point2D() { X = Center.X - Width / 2d, Y = Center.Y - Height / 2d }
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint()
|
||||
{
|
||||
Name = "RightBottom",
|
||||
Point = new Point2D() { X = Center.X + Width / 2d, Y = Center.Y - Height / 2d }
|
||||
};
|
||||
points.Add(newPoint);
|
||||
return points;
|
||||
|
||||
Reference in New Issue
Block a user