Checkig Iput data of crack calculator was changed
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/IconDictionary.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/GraphsTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/LimitCurveTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ServiceColors.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
27
StructureHelper/Infrastructure/UI/Resources/Cracks.xaml
Normal file
27
StructureHelper/Infrastructure/UI/Resources/Cracks.xaml
Normal file
@@ -0,0 +1,27 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<DataTemplate x:Key="CrackTextBox">
|
||||
<TextBlock Grid.Row="0" Text="{Binding CrackWidth, Converter={StaticResource LengthConverter}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsCrackLessThanUltimate}" Value="false">
|
||||
<Setter Property="Background" Value="{StaticResource WarningColorBrush}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CrackGrid">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ContentControl ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding LongTermResult}"/>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding ShortTermResult}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Color x:Key="ErrorColor" R="255" G="192" B="203" A="100" />
|
||||
<Color x:Key="WarningColor" R="255" G="255" B="0" A="100" />
|
||||
<SolidColorBrush x:Key="ErrorColorBrush" Color="{DynamicResource ErrorColor}"/>
|
||||
<SolidColorBrush x:Key="WarningColorBrush" Color="{DynamicResource WarningColor}"/>
|
||||
</ResourceDictionary>
|
||||
Binary file not shown.
20
StructureHelper/Services/ResultViewers/CrackResultFunc.cs
Normal file
20
StructureHelper/Services/ResultViewers/CrackResultFunc.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
public class CrackResultFunc : IResultFunc<Func<RebarCrackResult, double>>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public Func<RebarCrackResult, double> ResultFunction { get; set; }
|
||||
|
||||
public string UnitName { get; set; }
|
||||
|
||||
public double UnitFactor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
|
||||
public static class CrackResultFuncFactory
|
||||
{
|
||||
static IUnit unitStress = CommonOperation.GetUnit(UnitTypes.Stress);
|
||||
static IUnit unitLength = CommonOperation.GetUnit(UnitTypes.Length, "mm");
|
||||
|
||||
public static List<CrackResultFunc> GetResultFuncs()
|
||||
{
|
||||
List<CrackResultFunc> results = new()
|
||||
{
|
||||
new()
|
||||
{
|
||||
Name = "Long crack width",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.CrackWidth,
|
||||
UnitFactor = unitLength.Multiplyer,
|
||||
UnitName = unitLength.Name
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Short crack width",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.CrackWidth,
|
||||
UnitFactor = unitLength.Multiplyer,
|
||||
UnitName = unitLength.Name
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Long rebar stress",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStress,
|
||||
UnitFactor = unitStress.Multiplyer,
|
||||
UnitName = unitStress.Name
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Short rebar stress",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStress,
|
||||
UnitFactor = unitStress.Multiplyer,
|
||||
UnitName = unitStress.Name
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Long rebar strain",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStrain,
|
||||
UnitFactor = 1d,
|
||||
UnitName = string.Empty
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Short rebar strain",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStrain,
|
||||
UnitFactor = 1d,
|
||||
UnitName = string.Empty
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Long concrete strain",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.ConcreteStrain,
|
||||
UnitFactor = 1d,
|
||||
UnitName = string.Empty
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Short concrete strain",
|
||||
ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.ConcreteStrain,
|
||||
UnitFactor = 1d,
|
||||
UnitName = string.Empty
|
||||
}
|
||||
};
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
public class ResultFunc : IResultFunc
|
||||
public class ForceResultFunc : IResultFunc<Func<IStrainMatrix, INdm, double>>
|
||||
{
|
||||
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()
|
||||
public ForceResultFunc()
|
||||
{
|
||||
UnitFactor = 1d;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
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;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
public enum FuncsTypes
|
||||
{
|
||||
Strain,
|
||||
Stress,
|
||||
Forces,
|
||||
Full,
|
||||
}
|
||||
public static class ForceResultFuncFactory
|
||||
{
|
||||
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<ForceResultFunc> GetResultFuncs(FuncsTypes funcsType = FuncsTypes.Full)
|
||||
{
|
||||
List<ForceResultFunc> 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<ForceResultFunc> GetStrainResultFuncs()
|
||||
{
|
||||
List<ForceResultFunc> resultFuncs = new ();
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Section Strain", ResultFunction = stressLogic.GetSectionStrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrainWithPrestrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Prestrain", ResultFunction = stressLogic.GetPrestrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
||||
return resultFuncs;
|
||||
}
|
||||
private static List<ForceResultFunc> GetStressResultFuncs()
|
||||
{
|
||||
List<ForceResultFunc> resultFuncs = new ();
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Secant modulus", ResultFunction = stressLogic.GetSecantModulus, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Modulus degradation", ResultFunction = stressLogic.GetModulusDegradation });
|
||||
return resultFuncs;
|
||||
}
|
||||
private static List<ForceResultFunc> GetForcesResultFuncs()
|
||||
{
|
||||
List<ForceResultFunc> resultFuncs = new ();
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Force", ResultFunction = stressLogic.GetForce, UnitFactor = unitForce.Multiplyer, UnitName = unitForce.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Moment X", ResultFunction = stressLogic.GetMomentX, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||
resultFuncs.Add(new ForceResultFunc() { Name = "Moment Y", ResultFunction = stressLogic.GetMomentY, UnitFactor = unitMoment.Multiplyer, UnitName = unitMoment.Name });
|
||||
return resultFuncs;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
public interface IResultFunc
|
||||
public interface IResultFunc <T>
|
||||
{
|
||||
string Name { get; }
|
||||
Func<IStrainMatrix, INdm, double> ResultFunction { get; }
|
||||
T ResultFunction { get; }
|
||||
string UnitName { get; set; }
|
||||
double UnitFactor { get; }
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
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;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
public enum FuncsTypes
|
||||
{
|
||||
Strain,
|
||||
Stress,
|
||||
Forces,
|
||||
Full,
|
||||
}
|
||||
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)
|
||||
{
|
||||
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>();
|
||||
resultFuncs.Add(new ResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
|
||||
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;
|
||||
}
|
||||
private static List<IResultFunc> GetStressResultFuncs()
|
||||
{
|
||||
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
||||
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 = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,9 @@ using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using LoaderCalculator.Logics;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,13 +17,13 @@ namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
public static class ShowIsoFieldResult
|
||||
{
|
||||
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> resultFuncs)
|
||||
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<ForceResultFunc> resultFuncs)
|
||||
{
|
||||
var primitiveSets = GetPrimitiveSets(strainMatrix, ndms, resultFuncs);
|
||||
FieldViewerOperation.ShowViewer(primitiveSets);
|
||||
}
|
||||
|
||||
public static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> resultFuncs)
|
||||
public static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<ForceResultFunc> resultFuncs)
|
||||
{
|
||||
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||
foreach (var valDelegate in resultFuncs)
|
||||
@@ -29,23 +32,81 @@ namespace StructureHelper.Services.ResultViewers
|
||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||
foreach (INdm ndm in ndms)
|
||||
{
|
||||
double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
|
||||
IValuePrimitive valuePrimitive;
|
||||
if (ndm is IRectangleNdm)
|
||||
{
|
||||
var shapeNdm = ndm as IRectangleNdm;
|
||||
valuePrimitive = new RectanglePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Height = shapeNdm.Height, Width = shapeNdm.Width, Value = val };
|
||||
}
|
||||
else
|
||||
{
|
||||
valuePrimitive = new CirclePrimitive() { CenterX = ndm.CenterX, CenterY = ndm.CenterY, Diameter = Math.Sqrt(ndm.Area / Math.PI) * 2, Value = val };
|
||||
}
|
||||
primitives.Add(valuePrimitive);
|
||||
primitives.Add(ProcessNdm(strainMatrix, valDelegate, ndm));
|
||||
}
|
||||
primitiveSet.ValuePrimitives = primitives;
|
||||
primitiveSets.Add(primitiveSet);
|
||||
}
|
||||
return primitiveSets;
|
||||
}
|
||||
|
||||
public static List<IPrimitiveSet> GetPrimitiveSets(IEnumerable<RebarCrackResult> rebarResults, IEnumerable<CrackResultFunc> resultFuncs)
|
||||
{
|
||||
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||
foreach (var valDelegate in resultFuncs)
|
||||
{
|
||||
PrimitiveSet primitiveSet = new PrimitiveSet() { Name = valDelegate.Name };
|
||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||
foreach (var rebarResult in rebarResults)
|
||||
{
|
||||
primitives.Add(ProcessNdm(valDelegate, rebarResult));
|
||||
}
|
||||
primitiveSet.ValuePrimitives = primitives;
|
||||
primitiveSets.Add(primitiveSet);
|
||||
}
|
||||
return primitiveSets;
|
||||
}
|
||||
|
||||
private static IValuePrimitive ProcessNdm(CrackResultFunc valDelegate, RebarCrackResult rebarResult)
|
||||
{
|
||||
var val = valDelegate.ResultFunction.Invoke(rebarResult) * valDelegate.UnitFactor;
|
||||
IValuePrimitive valuePrimitive;
|
||||
var rebarNdm = rebarResult.RebarPrimitive.GetRebarNdm(new TriangulationOptions()
|
||||
{
|
||||
LimiteState = LimitStates.SLS,
|
||||
CalcTerm = CalcTerms.ShortTerm
|
||||
}
|
||||
);
|
||||
valuePrimitive = ProcessCircle(rebarNdm, val);
|
||||
return valuePrimitive;
|
||||
}
|
||||
|
||||
private static IValuePrimitive ProcessNdm(IStrainMatrix strainMatrix, ForceResultFunc valDelegate, INdm ndm)
|
||||
{
|
||||
double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm) * valDelegate.UnitFactor;
|
||||
IValuePrimitive valuePrimitive;
|
||||
if (ndm is IRectangleNdm shapeNdm)
|
||||
{
|
||||
valuePrimitive = ProcessRectangle(shapeNdm, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
valuePrimitive = ProcessCircle(ndm, val);
|
||||
}
|
||||
return valuePrimitive;
|
||||
}
|
||||
|
||||
private static IValuePrimitive ProcessRectangle(IRectangleNdm shapeNdm, double val)
|
||||
{
|
||||
return new RectanglePrimitive()
|
||||
{
|
||||
CenterX = shapeNdm.CenterX,
|
||||
CenterY = shapeNdm.CenterY,
|
||||
Height = shapeNdm.Height,
|
||||
Width = shapeNdm.Width,
|
||||
Value = val
|
||||
};
|
||||
}
|
||||
|
||||
private static IValuePrimitive ProcessCircle(INdm ndm, double val)
|
||||
{
|
||||
return new CirclePrimitive()
|
||||
{
|
||||
CenterX = ndm.CenterX,
|
||||
CenterY = ndm.CenterY,
|
||||
Diameter = Math.Sqrt(ndm.Area / Math.PI) * 2,
|
||||
Value = val
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Infrastructure\UI\Resources\Cracks.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -92,6 +95,9 @@
|
||||
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\ServiceColors.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\Arrays\ArrayView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -101,6 +107,9 @@
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\Cracks\CrackResultView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\Cracks\Cracks.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\Cracks\TupleCrackResultView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -6,11 +6,18 @@
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
|
||||
d:DataContext="{d:DesignInstance local:CrackResultViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000">
|
||||
Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Windows/CalculationWindows/CalculatorsViews/Cracks/Cracks.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowRebarsCommand}" ToolTip="Show isofield results">
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowRebarsCommand}" ToolTip="Show results by rebars">
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource ShowRebarsResult}"/>
|
||||
</Viewbox>
|
||||
@@ -32,13 +39,14 @@
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter Property="Background" Value="Pink"/>
|
||||
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||
<DataGridTextColumn Header="Action name" Binding="{Binding InputData.TupleName}" Width="120"/>
|
||||
<DataGridTemplateColumn Header="Combination term" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
@@ -98,34 +106,7 @@
|
||||
<DataGridTemplateColumn Header="Crack width" Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.CrackWidth, Converter={StaticResource LengthConverter}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding LongTermResult.IsCrackLessThanUltimate}" Value="false">
|
||||
<Setter Property="Background" Value="Red" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.CrackWidth, Converter={StaticResource LengthConverter}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ShortTermResult.IsCrackLessThanUltimate}" Value="false">
|
||||
<Setter Property="Background" Value="Red" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
@@ -5,14 +5,41 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public class CrackResultViewModel : ViewModelBase
|
||||
{
|
||||
CrackResult crackResult;
|
||||
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
|
||||
private CrackResult crackResult;
|
||||
private RelayCommand? showIsoFieldCommand;
|
||||
private RelayCommand? showRebarsCommand;
|
||||
|
||||
public TupleCrackResult SelectedResult { get; set; }
|
||||
public List<TupleCrackResult> TupleResults => CrackResult.TupleResults;
|
||||
public ICommand ShowRebarsCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return showRebarsCommand ??= new RelayCommand(o =>
|
||||
{
|
||||
var wnd = new TupleCrackResultView(SelectedResult);
|
||||
wnd.ShowDialog();
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ShowIsoFieldCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return showIsoFieldCommand ??= new RelayCommand(o =>
|
||||
{
|
||||
showCrackIsoFieldsLogic.ShowIsoField(SelectedResult.RebarResults);
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid);
|
||||
}
|
||||
}
|
||||
|
||||
public CrackResult CrackResult => crackResult;
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<DataTemplate x:Key="CrackTextBox">
|
||||
<TextBlock Grid.Row="0" Text="{Binding CrackWidth, Converter={StaticResource LengthConverter}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsCrackLessThanUltimate}" Value="false">
|
||||
<Setter Property="Background" Value="{StaticResource WarningColorBrush}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CrackGrid">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ContentControl ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding LongTermResult}"/>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource CrackTextBox}" Content="{Binding ShortTermResult}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,10 @@
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public interface IShowCrackIsoFieldsLogic
|
||||
{
|
||||
void ShowIsoField(IEnumerable<RebarCrackResult> rebarResults);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using StructureHelper.Services.Reports.CalculationReports;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public class ShowCrackIsoFieldsLogic : IShowCrackIsoFieldsLogic
|
||||
{
|
||||
private IsoFieldReport isoFieldReport;
|
||||
|
||||
public void ShowIsoField(IEnumerable<RebarCrackResult> rebarResults)
|
||||
{
|
||||
try
|
||||
{
|
||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(rebarResults, CrackResultFuncFactory.GetResultFuncs());
|
||||
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||
isoFieldReport.Show();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = "Errors apearred during showing isofield, see detailed information",
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,104 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
|
||||
d:DataContext="{d:DesignInstance local:TupleCrackResultViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="TupleCrackResultView" Height="450" Width="800">
|
||||
Title="TupleCrackResultView" Height="450" Width="800" MinHeight="300" MinWidth="500" MaxHeight="1000" MaxWidth="1200" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Windows/CalculationWindows/CalculatorsViews/Cracks/Cracks.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}" ToolTip="Show isofield results">
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding RebarResults}" SelectedItem="{Binding SelectedResult}">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding IsValid}"/>
|
||||
<DataGridTextColumn Header="Rebar name" Binding="{Binding RebarPrimitive.Name}" Width="120" CanUserSort="True"/>
|
||||
<DataGridTemplateColumn Header="Combination term" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<DataGrid>
|
||||
|
||||
</DataGrid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Long-term" />
|
||||
<TextBlock Grid.Row="1" Text="Short-term" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Rebar stress" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.RebarStress, Converter={StaticResource StressConverter}}"/>
|
||||
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.RebarStress, Converter={StaticResource StressConverter}}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Rebar strain" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.RebarStrain}"/>
|
||||
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.RebarStrain}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Ref. concrete strain" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding LongTermResult.RebarStressResult.ConcreteStrain}"/>
|
||||
<TextBlock Grid.Row="1" Text="{Binding ShortTermResult.RebarStressResult.ConcreteStrain}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Crack width" Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -19,9 +20,16 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
/// </summary>
|
||||
public partial class TupleCrackResultView : Window
|
||||
{
|
||||
public TupleCrackResultView()
|
||||
TupleCrackResultViewModel viewModel;
|
||||
public TupleCrackResultView(TupleCrackResultViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.viewModel = viewModel;
|
||||
DataContext = this.viewModel;
|
||||
}
|
||||
public TupleCrackResultView(TupleCrackResult crackResult) : this(new TupleCrackResultViewModel(crackResult))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,45 @@
|
||||
using System;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Services.Reports.CalculationReports;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public class TupleCrackResultViewModel
|
||||
public class TupleCrackResultViewModel : ViewModelBase
|
||||
{
|
||||
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
|
||||
private TupleCrackResult crackResult;
|
||||
private RelayCommand showIsoFieldCommand;
|
||||
private IsoFieldReport isoFieldReport;
|
||||
|
||||
public TupleCrackResult CrackResult => crackResult;
|
||||
public List<RebarCrackResult> RebarResults => crackResult.RebarResults;
|
||||
public RebarCrackResult SelectedResult { get; set; }
|
||||
public ICommand ShowIsoFieldCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return showIsoFieldCommand ??= new RelayCommand(o =>
|
||||
{
|
||||
showCrackIsoFieldsLogic.ShowIsoField(crackResult.RebarResults);
|
||||
});
|
||||
}
|
||||
}
|
||||
public TupleCrackResultViewModel(TupleCrackResult crackResult)
|
||||
{
|
||||
this.crackResult = crackResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
//LimitState = LimitState,
|
||||
//CalcTerm = CalcTerm,
|
||||
LongTermTuple = ForceTuple,
|
||||
NdmPrimitives = ndmPrimitives
|
||||
Primitives = ndmPrimitives
|
||||
};
|
||||
var calculator = new TupleCrackCalculator() { InputData = inputData };
|
||||
calculator.Run();
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
private List<(INamedAreaPoint areaPoint, INdmPrimitive ndmPrimitive)> pointCollection;
|
||||
private List<IForcesTupleResult> validTuplesList;
|
||||
private ArrayParameter<double> arrayOfValuesByPoint;
|
||||
private IEnumerable<IResultFunc> selectedDelegates;
|
||||
private IEnumerable<ForceResultFunc> selectedDelegates;
|
||||
private string exceptionMessage;
|
||||
|
||||
public IEnumerable<IForcesTupleResult> TupleList { get; set; }
|
||||
@@ -154,7 +154,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
+ userPrestrain.Nz + autoPrestrain.Nz;
|
||||
return ndm;
|
||||
}
|
||||
private List<string> GetValueLabels(IEnumerable<IResultFunc> selectedDelegates)
|
||||
private List<string> GetValueLabels(IEnumerable<ForceResultFunc> selectedDelegates)
|
||||
{
|
||||
List<string> strings = new();
|
||||
foreach (var valuePoint in pointCollection)
|
||||
|
||||
@@ -416,7 +416,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
try
|
||||
{
|
||||
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ForceResultFuncFactory.GetResultFuncs());
|
||||
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||
isoFieldReport.Show();
|
||||
}
|
||||
@@ -429,7 +429,6 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
private void GetNdms()
|
||||
{
|
||||
|
||||
@@ -11,13 +11,13 @@ namespace StructureHelper.Windows.Forces
|
||||
{
|
||||
public class ValueDelegatesLogic : ViewModelBase
|
||||
{
|
||||
private readonly List<IResultFunc> resultFuncs;
|
||||
public SelectItemsVM<IResultFunc> ResultFuncs { get; }
|
||||
private readonly List<ForceResultFunc> resultFuncs;
|
||||
public SelectItemsVM<ForceResultFunc> ResultFuncs { get; }
|
||||
public ValueDelegatesLogic()
|
||||
{
|
||||
resultFuncs = new List<IResultFunc>();
|
||||
resultFuncs.AddRange(ResultFuncFactory.GetResultFuncs(FuncsTypes.Full));
|
||||
ResultFuncs = new SelectItemsVM<IResultFunc>(resultFuncs)
|
||||
resultFuncs = new List<ForceResultFunc>();
|
||||
resultFuncs.AddRange(ForceResultFuncFactory.GetResultFuncs(FuncsTypes.Full));
|
||||
ResultFuncs = new SelectItemsVM<ForceResultFunc>(resultFuncs)
|
||||
{
|
||||
ShowButtons = true
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
|
||||
private void ShowIsoField()
|
||||
{
|
||||
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ForceResultFuncFactory.GetResultFuncs());
|
||||
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||
isoFieldReport.Show();
|
||||
}
|
||||
|
||||
@@ -184,7 +184,6 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}
|
||||
if (SelectedItem is LimitCurvesCalculator calculator)
|
||||
{
|
||||
var inputData = calculator.InputData;
|
||||
ShowInteractionDiagramByInputData(calculator);
|
||||
}
|
||||
else
|
||||
@@ -193,7 +192,13 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = "Errors apearred during calculations, see detailed information",
|
||||
DetailText = SelectedItem.Result.Description
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface ICheckInputDataLogic : ICheckLogic
|
||||
{
|
||||
IInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface ICheckLogic : ILogic
|
||||
{
|
||||
string CheckResult { get; }
|
||||
bool Check();
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,17 @@ namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
GetLoaderOptions();
|
||||
IBuilderDirector director = GetMaterialDirector();
|
||||
try
|
||||
{
|
||||
var material = director.BuildMaterial();
|
||||
return material;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private IBuilderDirector GetMaterialDirector()
|
||||
{
|
||||
|
||||
@@ -30,9 +30,18 @@ namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
GetLoaderOptions();
|
||||
IBuilderDirector director = GetMaterialDirector();
|
||||
try
|
||||
{
|
||||
var material = director.BuildMaterial();
|
||||
return material;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IBuilderDirector GetMaterialDirector()
|
||||
{
|
||||
@@ -45,7 +54,7 @@ namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
materialOptions = new ReinforcementOptions()
|
||||
{
|
||||
DiagramType = DiagramType
|
||||
DiagramType = DiagramType,
|
||||
};
|
||||
optionLogic = new MaterialCommonOptionLogic(options);
|
||||
optionLogic.SetMaterialOptions(materialOptions);
|
||||
|
||||
@@ -60,14 +60,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
private void MultiThreadProc(IEnumerable<IPoint2D> points)
|
||||
{
|
||||
Task<IPoint2D>[] tasks = new Task<IPoint2D>[points.Count()];
|
||||
for (int i = 0; i < points.Count(); i++)
|
||||
int pointCount = points.Count();
|
||||
List<IPoint2D> PointList = points.ToList();
|
||||
for (int i = 0; i < pointCount; i++)
|
||||
{
|
||||
var point = points.ToList()[i];
|
||||
var point = PointList[i];
|
||||
tasks[i] = new Task<IPoint2D>(() => FindResultPoint(point));
|
||||
tasks[i].Start();
|
||||
}
|
||||
Task.WaitAll(tasks);
|
||||
for (int j = 0; j < points.Count(); j++)
|
||||
for (int j = 0; j < pointCount; j++)
|
||||
{
|
||||
var taskResult = tasks[j].Result;
|
||||
resultList.Add(taskResult);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
Point2D minPoint = new(), maxPoint = new();
|
||||
foreach (var item in ndmCollection)
|
||||
{
|
||||
var strain = stressLogic.GetTotalStrain(strainMatrix, item);
|
||||
var strain = stressLogic.GetSectionStrain(strainMatrix, item);
|
||||
if (strain < minStrain)
|
||||
{
|
||||
minStrain = strain;
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
var stressLogic = new StressLogic();
|
||||
foreach (var item in ndmCollection)
|
||||
{
|
||||
var strain = stressLogic.GetTotalStrain(strains, item);
|
||||
var strain = stressLogic.GetSectionStrain(strains, item);
|
||||
if (strain > maxStrain)
|
||||
{
|
||||
maxStrain = strain;
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Logic of checking of input data for crack calcultor
|
||||
/// </summary>
|
||||
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic
|
||||
{
|
||||
private string checkResult;
|
||||
private CrackInputData inputData;
|
||||
private bool result;
|
||||
|
||||
public IInputData InputData
|
||||
{
|
||||
get => inputData;
|
||||
set
|
||||
{
|
||||
if (value is CrackInputData data)
|
||||
{
|
||||
inputData = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(CrackInputData), value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public CheckCrackCalculatorInputDataLogic(CrackInputData inputData)
|
||||
{
|
||||
this.inputData = inputData;
|
||||
}
|
||||
public bool Check()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
result = true;
|
||||
checkResult = string.Empty;
|
||||
CheckPrimitives();
|
||||
CheckActions();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckActions()
|
||||
{
|
||||
if (inputData.ForceActions is null || (!inputData.ForceActions.Any()))
|
||||
{
|
||||
result = false;
|
||||
string message = "Calculator does not contain any actions\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
};
|
||||
}
|
||||
|
||||
private void CheckPrimitives()
|
||||
{
|
||||
if (inputData.Primitives is null || (!inputData.Primitives.Any()))
|
||||
{
|
||||
result = false;
|
||||
string message = "Calculator does not contain any primitives\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var primitive in inputData.Primitives)
|
||||
{
|
||||
if (primitive is RebarPrimitive rebar)
|
||||
{
|
||||
CheckRebar(rebar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRebar(RebarPrimitive rebar)
|
||||
{
|
||||
if (rebar.HostPrimitive is null)
|
||||
{
|
||||
result = false;
|
||||
string message = $"Primitive {rebar.Name} does not have a host\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isPrimitivesContainRebarHost = inputData.Primitives.Contains(rebar.HostPrimitive);
|
||||
if (isPrimitivesContainRebarHost == false)
|
||||
{
|
||||
result = false;
|
||||
string message = $"Host {rebar.Name}({rebar.HostPrimitive.Name}) is not included in primitives\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
if (rebar.HostPrimitive.HeadMaterial.HelperMaterial is not ICrackedMaterial)
|
||||
{
|
||||
result = false;
|
||||
string message = $"Material of host of {rebar.Name} does not support cracking\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
private CrackResult result;
|
||||
private IGetTupleInputDatasLogic datasLogic;
|
||||
private CrackCalculatorUpdateStrategy updateStrategy = new();
|
||||
private ICheckInputDataLogic checkInputDataLogic;
|
||||
|
||||
public string Name { get; set; }
|
||||
public CrackInputData InputData { get; set; }
|
||||
@@ -44,6 +45,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
public void Run()
|
||||
{
|
||||
PrepareNewResult();
|
||||
CheckInputData();
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
try
|
||||
{
|
||||
@@ -58,6 +60,19 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckInputData()
|
||||
{
|
||||
checkInputDataLogic = new CheckCrackCalculatorInputDataLogic(InputData)
|
||||
{
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
if (checkInputDataLogic.Check() == false)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += checkInputDataLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessCalculations()
|
||||
{
|
||||
datasLogic = new GetTupleInputDatasLogic(InputData.Primitives, InputData.ForceActions, InputData.UserCrackInputData)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
TraceLogger?.AddMessage($"Rebar elongation Epsilon = {inputData.RebarStrain} - {inputData.ConcreteStrain} = {rebarElongation}(dimensionless)");
|
||||
double width = rebarElongation * inputData.Length;
|
||||
width *= inputData.TermFactor * inputData.BondFactor * inputData.StressStateFactor * inputData.PsiSFactor;
|
||||
TraceLogger?.AddMessage($"Width of crack a,crc = {width}(m)");
|
||||
TraceLogger?.AddMessage($"Width of crack a,crc = {inputData.TermFactor} * {inputData.BondFactor} * {inputData.StressStateFactor} * {inputData.PsiSFactor} * {rebarElongation} * {inputData.Length}(m) = {width}(m)");
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,10 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
resultList.Add(new TupleCrackInputData()
|
||||
{
|
||||
IsValid = true,
|
||||
TupleName = action.Name,
|
||||
LongTermTuple = tuple.LongTuple,
|
||||
ShortTermTuple = tuple.ShortTuple,
|
||||
NdmPrimitives = Primitives,
|
||||
Primitives = Primitives,
|
||||
UserCrackInputData = UserCrackInputData
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
{
|
||||
public interface ICrackWidthTupleResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Calculated crack width
|
||||
/// </summary>
|
||||
double CrackWidth { get; set; }
|
||||
bool IsCrackLessThanUltimate { get; }
|
||||
double UltimateCrackWidth { get; set; }
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
private double GetAverageDiameter(IEnumerable<RebarNdm?> rebars)
|
||||
{
|
||||
var tesileRebars = rebars
|
||||
.Where(x => stressLogic.GetTotalStrain(StrainMatrix, x) > 0d);
|
||||
.Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);
|
||||
diameterLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
||||
diameterLogic.Rebars = tesileRebars;
|
||||
var rebarDiameter = diameterLogic.GetAverageDiameter();
|
||||
|
||||
@@ -8,12 +8,26 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Result of calculation of crack for specific result
|
||||
/// </summary>
|
||||
public class RebarCrackResult : IResult
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool IsValid { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// Specific rebar primitive
|
||||
/// </summary>
|
||||
public RebarPrimitive RebarPrimitive { get; set; }
|
||||
/// <summary>
|
||||
/// Result of calculation of crack for long term
|
||||
/// </summary>
|
||||
public CrackWidthRebarTupleResult LongTermResult { get; set; }
|
||||
/// <summary>
|
||||
/// Result of calculation of crack for short term
|
||||
/// </summary>
|
||||
public CrackWidthRebarTupleResult ShortTermResult { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public void Run()
|
||||
{
|
||||
GetNdms();
|
||||
GetNdmCollectionFromPrimitives();
|
||||
result = new RebarStressResult()
|
||||
{
|
||||
IsValid = true,
|
||||
@@ -71,13 +71,13 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
var strainTuple = GetStrainTuple();
|
||||
result.StrainTuple = strainTuple;
|
||||
var strainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||
result.RebarStrain = stressLogic.GetTotalStrain(strainMatrix, rebarNdm);
|
||||
result.RebarStrain = stressLogic.GetSectionStrain(strainMatrix, rebarNdm);
|
||||
result.RebarStress = stressLogic.GetStress(strainMatrix, rebarNdm);
|
||||
result.ConcreteStrain = concreteNdm.Prestrain;
|
||||
}
|
||||
|
||||
|
||||
private void GetNdms()
|
||||
private void GetNdmCollectionFromPrimitives()
|
||||
{
|
||||
var options = new TriangulationOptions()
|
||||
{
|
||||
|
||||
@@ -10,7 +10,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class RebarStressResult : IResult
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool IsValid { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string? Description { get; set; }
|
||||
public StrainTuple StrainTuple { get; set; }
|
||||
public double RebarStress { get; set; }
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
|
||||
var rebarCollection = NdmCollection
|
||||
.Where(x => x is RebarNdm & stressLogic.GetTotalStrain(StrainMatrix, x) > 0d);
|
||||
.Where(x => x is RebarNdm & stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);
|
||||
var rebarArea = rebarCollection.
|
||||
Sum(x => x.Area * x.StressScale);
|
||||
TraceLogger?.AddMessage($"Summary rebar area As = {rebarArea}");
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage("Method of obtaining of summary area of rebars in tension based on areas which are proportional by maximum strain");
|
||||
var rebars = Rebars
|
||||
.Where(x => stressLogic.GetTotalStrain(StrainMatrix, x) > 0d);
|
||||
.Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);
|
||||
if (!rebars.Any())
|
||||
{
|
||||
string errorString = ErrorStrings.DataIsInCorrect + ": Collection of rebars does not contain any tensile rebars";
|
||||
@@ -40,7 +40,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
var maxStrain = rebars
|
||||
.Select(x => stressLogic.GetTotalStrain(StrainMatrix, x))
|
||||
.Select(x => stressLogic.GetSectionStrain(StrainMatrix, x))
|
||||
.Max();
|
||||
TraceLogger?.AddMessage($"Maximum strain maxStrain = {maxStrain}");
|
||||
if (TraceLogger is not null)
|
||||
@@ -51,7 +51,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
foreach (var rebar in rebars)
|
||||
{
|
||||
double area = rebar.Area * rebar.StressScale;
|
||||
double strain = stressLogic.GetTotalStrain(StrainMatrix, rebar);
|
||||
double strain = stressLogic.GetSectionStrain(StrainMatrix, rebar);
|
||||
TraceLogger?.AddMessage($"Rebar area = {area}(m^2)");
|
||||
TraceLogger?.AddMessage($"Rebar strain = {strain}");
|
||||
var reducedArea = area * strain / maxStrain;
|
||||
|
||||
@@ -11,6 +11,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2024 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class TensionRebarAreaSimpleSumLogic : ITensionRebarAreaLogic
|
||||
@@ -32,7 +35,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage("Method of obtaining of summary area of rebars in tension based on ordinary summarizing of areas");
|
||||
var rebars = Rebars
|
||||
.Where(x => stressLogic.GetTotalStrain(StrainMatrix, x) > 0d);
|
||||
.Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);
|
||||
if (!rebars.Any())
|
||||
{
|
||||
string errorString = ErrorStrings.DataIsInCorrect + ": Collection of rebars does not contain any tensile rebars";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
@@ -26,6 +27,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
private StrainTuple shortDefaultStrainTuple;
|
||||
private double longLength;
|
||||
private double shortLength;
|
||||
private object locker = new();
|
||||
|
||||
public string Name { get; set; }
|
||||
public TupleCrackInputData InputData { get; set; }
|
||||
@@ -68,6 +70,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
CheckInputData();
|
||||
Triangulate();
|
||||
|
||||
longDefaultStrainTuple = CalcStrainMatrix(InputData.LongTermTuple as ForceTuple, crackableNdms);
|
||||
shortDefaultStrainTuple = CalcStrainMatrix(InputData.LongTermTuple as ForceTuple, crackableNdms);
|
||||
var longElasticStrainTuple = CalcStrainMatrix(InputData.LongTermTuple as ForceTuple, elasticNdms);
|
||||
@@ -85,17 +88,28 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
shortLength = GetLengthBetweenCracks(shortElasticStrainTuple);
|
||||
}
|
||||
CalcCrackForce();
|
||||
foreach (var rebar in rebarPrimitives)
|
||||
//for (int j = 0; j < 100000; j++)
|
||||
//{
|
||||
result.RebarResults.Clear();
|
||||
int rebarCount = rebarPrimitives.Count;
|
||||
Task<RebarCrackResult>[] tasks = new Task<RebarCrackResult>[rebarCount];
|
||||
for (int i = 0; i < rebarCount; i++)
|
||||
{
|
||||
RebarCrackCalculatorInputData rebarCalculatorData = GetRebarCalculatorInputData(rebar);
|
||||
var calculator = new RebarCrackCalculator
|
||||
var rebar = rebarPrimitives[i];
|
||||
tasks[i] = new Task<RebarCrackResult>(() => ProcessRebar(rebar));
|
||||
tasks[i].Start();
|
||||
}
|
||||
Task.WaitAll(tasks);
|
||||
for (int i = 0; i < rebarCount; i++)
|
||||
{
|
||||
InputData = rebarCalculatorData,
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
calculator.Run();
|
||||
var rebarResult = calculator.Result as RebarCrackResult;
|
||||
result.RebarResults.Add(rebarResult);
|
||||
result.RebarResults.Add(tasks[i].Result);
|
||||
}
|
||||
//}
|
||||
|
||||
if (result.RebarResults.Any(x => x.IsValid == false))
|
||||
{
|
||||
result.IsValid = false;
|
||||
return;
|
||||
}
|
||||
result.LongTermResult = new()
|
||||
{
|
||||
@@ -109,25 +123,50 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
};
|
||||
}
|
||||
|
||||
private RebarCrackResult ProcessRebar(RebarPrimitive rebar)
|
||||
{
|
||||
RebarCrackCalculatorInputData rebarCalculatorData = GetRebarCalculatorInputData(rebar);
|
||||
var calculator = new RebarCrackCalculator
|
||||
{
|
||||
InputData = rebarCalculatorData,
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
calculator.Run();
|
||||
var rebarResult = calculator.Result as RebarCrackResult;
|
||||
return rebarResult;
|
||||
}
|
||||
|
||||
private RebarCrackCalculatorInputData GetRebarCalculatorInputData(RebarPrimitive rebar)
|
||||
{
|
||||
IEnumerable<INdm> crackableNdmsLoc = null;
|
||||
IEnumerable<INdm> crackedNdmsLoc = null;
|
||||
RebarPrimitive rebarCopy = null;
|
||||
lock (locker)
|
||||
{
|
||||
rebarCopy = rebar.Clone() as RebarPrimitive;
|
||||
rebarCopy.HeadMaterial = rebarCopy.HeadMaterial.Clone() as IHeadMaterial;
|
||||
var triangulationLogicLoc = new CrackedSectionTriangulationLogic(InputData.Primitives);
|
||||
crackableNdmsLoc = triangulationLogicLoc.GetNdmCollection();
|
||||
crackedNdmsLoc = triangulationLogicLoc.GetCrackedNdmCollection();
|
||||
}
|
||||
|
||||
var longRebarData = new RebarCrackInputData()
|
||||
{
|
||||
CrackableNdmCollection = crackableNdms,
|
||||
CrackedNdmCollection = crackedNdms,
|
||||
ForceTuple = InputData.LongTermTuple as ForceTuple,
|
||||
CrackableNdmCollection = crackableNdmsLoc,
|
||||
CrackedNdmCollection = crackedNdmsLoc,
|
||||
ForceTuple = InputData.LongTermTuple.Clone() as ForceTuple,
|
||||
Length = longLength
|
||||
};
|
||||
var shortRebarData = new RebarCrackInputData()
|
||||
{
|
||||
CrackableNdmCollection = crackableNdms,
|
||||
CrackedNdmCollection = crackedNdms,
|
||||
ForceTuple = InputData.ShortTermTuple as ForceTuple,
|
||||
ForceTuple = InputData.ShortTermTuple.Clone() as ForceTuple,
|
||||
Length = shortLength
|
||||
};
|
||||
var rebarCalculatorData = new RebarCrackCalculatorInputData()
|
||||
{
|
||||
RebarPrimitive = rebar,
|
||||
RebarPrimitive = rebarCopy,
|
||||
LongRebarData = longRebarData,
|
||||
ShortRebarData = shortRebarData,
|
||||
UserCrackInputData = InputData.UserCrackInputData
|
||||
@@ -153,6 +192,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += forceResult.Description;
|
||||
TraceLogger?.AddMessage("Bearing capacity of cross-section is not enough for action", TraceLogStatuses.Error);
|
||||
return null;
|
||||
}
|
||||
var strain = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
||||
return strain;
|
||||
@@ -171,7 +212,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
private void Triangulate()
|
||||
{
|
||||
triangulationLogic = new CrackedSectionTriangulationLogic(InputData.NdmPrimitives)
|
||||
triangulationLogic = new CrackedSectionTriangulationLogic(InputData.Primitives)
|
||||
{
|
||||
//TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
@@ -192,7 +233,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
private void CheckInputData()
|
||||
{
|
||||
if (InputData.NdmPrimitives is null || InputData.NdmPrimitives.Count == 0)
|
||||
if (InputData.Primitives is null || InputData.Primitives.Count == 0)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": input data doesn't have any primitives");
|
||||
}
|
||||
|
||||
@@ -8,14 +8,32 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2024 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class TupleCrackInputData : IInputData
|
||||
/// <summary>
|
||||
/// Input data for calculation of crack for specific force tuple
|
||||
/// </summary>
|
||||
public class TupleCrackInputData : IInputData, IHasPrimitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool IsValid { get; set; }
|
||||
public string TupleName { get; set; }
|
||||
/// <summary>
|
||||
/// Force tuple for long term calculations
|
||||
/// </summary>
|
||||
public IForceTuple? LongTermTuple { get; set; }
|
||||
/// <summary>
|
||||
/// Force tuple for short term calculations
|
||||
/// </summary>
|
||||
public IForceTuple? ShortTermTuple { get; set; }
|
||||
public List<INdmPrimitive>? NdmPrimitives {get;set;}
|
||||
/// <inheritdoc/>
|
||||
public List<INdmPrimitive>? Primitives { get; set;}
|
||||
/// <summary>
|
||||
/// Settings ajusted by user
|
||||
/// </summary>
|
||||
public UserCrackInputData UserCrackInputData { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,25 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2024 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
/// <summary>
|
||||
/// Result of crack calculation for specific force tuple
|
||||
/// </summary>
|
||||
public class TupleCrackResult : IResult
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool IsValid { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string Description { get; set; }
|
||||
public TupleCrackInputData InputData { get; set; }
|
||||
public bool IsCracked { get; set; }
|
||||
public List<RebarCrackResult> RebarResults { get; private set; }
|
||||
public CrackWidthRebarTupleResult LongTermResult { get; set; }
|
||||
public CrackWidthRebarTupleResult ShortTermResult { get; set; }
|
||||
//public double MaxLongTermCrackWidth => RebarResults.Select(x => x.LongTermResult.CrackWidth).Max();
|
||||
//public double MaxShortTermCrackWidth => RebarResults.Select(x => x.ShortTermResult.CrackWidth).Max();
|
||||
//public bool IsLongCrackLessThanUltimate => MaxLongTermCrackWidth <= InputData.UserCrackInputData.UltimateLongCrackWidth;
|
||||
//public bool IsShortCrackLessThanUltimate => MaxShortTermCrackWidth <= InputData.UserCrackInputData.UltimateShortCrackWidth;
|
||||
|
||||
public TupleCrackResult()
|
||||
{
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
};
|
||||
|
||||
// Setup the mock to return positive strains
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 1.0)))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 1.0)))
|
||||
.Returns(0.5);
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 2.0)))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 2.0)))
|
||||
.Returns(1.0);
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 3.0)))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 3.0)))
|
||||
.Returns(1.5);
|
||||
|
||||
var logic = new TensionRebarAreaSimpleSumLogic(mockStressLogic.Object)
|
||||
@@ -64,7 +64,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
};
|
||||
|
||||
// Setup the mock to return non-positive strain
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.IsAny<RebarNdm>()))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.IsAny<RebarNdm>()))
|
||||
.Returns(0.0);
|
||||
|
||||
var logic = new TensionRebarAreaSimpleSumLogic(mockStressLogic.Object)
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
};
|
||||
|
||||
// Setup the mock to return positive strains
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 1.0)))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 1.0)))
|
||||
.Returns(0.5);
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 2.0)))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 2.0)))
|
||||
.Returns(1.0);
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 3.0)))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.Is<RebarNdm>(r => r.Area == 3.0)))
|
||||
.Returns(1.5);
|
||||
|
||||
var logic = new TensionRebarAreaByStrainLogic(mockStressLogic.Object)
|
||||
@@ -69,7 +69,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||
};
|
||||
|
||||
// Setup the mock to return non-positive strain
|
||||
mockStressLogic.Setup(s => s.GetTotalStrain(It.IsAny<IStrainMatrix>(), It.IsAny<RebarNdm>()))
|
||||
mockStressLogic.Setup(s => s.GetSectionStrain(It.IsAny<IStrainMatrix>(), It.IsAny<RebarNdm>()))
|
||||
.Returns(0.0);
|
||||
|
||||
var logic = new TensionRebarAreaByStrainLogic(mockStressLogic.Object)
|
||||
|
||||
Reference in New Issue
Block a user