SectionTemlate was added
This commit is contained in:
1
App.xaml
1
App.xaml
@@ -10,6 +10,7 @@
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ITemEditPanels.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
22
Infrastructure/UI/Resources/ItemEditPanels.xaml
Normal file
22
Infrastructure/UI/Resources/ItemEditPanels.xaml
Normal file
@@ -0,0 +1,22 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<DataTemplate x:Key="SourceToTarget">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox ItemsSource="{Binding SourceItems}" SelectedItem="{Binding SelectedSourceItem}" ItemTemplate="{StaticResource ResourceKey=SimpleItemTemplate}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="Add all" Command="{Binding AddAll}"/>
|
||||
<Button Content="Clear all" Command="{Binding ClearAll}"/>
|
||||
<Button Content=">>" Command="{Binding AddSelected}"/>
|
||||
<Button Content="<<" Command="{Binding RemoveSelected}"/>
|
||||
</StackPanel>
|
||||
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}" SelectedItem="{Binding SelectedTargetItem}" ItemTemplate="{StaticResource ResourceKey=SimpleItemTemplate}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -15,5 +15,7 @@
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="SimpleItemTemplate">
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -187,6 +187,9 @@
|
||||
<Compile Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceCalculatorView.xaml.cs">
|
||||
<DependentUpon>ForceCalculatorView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForcesResultsView.xaml.cs">
|
||||
<DependentUpon>ForcesResultsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\CalculationWindows\CalculatorsViews\SourceToTargetControl.xaml.cs">
|
||||
<DependentUpon>SourceToTargetControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -234,6 +237,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\Calculators\ForcesResultsViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\SourceToTargetViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\Calculators\ForceCalculatorViewModel.cs" />
|
||||
<Compile Include="Windows\ViewModels\Calculations\Calculators\ICombinationSourceToTargetViewModel.cs" />
|
||||
@@ -271,6 +275,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Infrastructure\UI\Resources\ItemEditPanels.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Infrastructure\UI\Resources\PrimitiveTemplates.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -307,6 +315,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForcesResultsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\CalculationWindows\CalculatorsViews\SourceToTargetControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IHasForceCombinations
|
||||
{
|
||||
List<IForceCombinationList> ForceCombinationLists { get; }
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,16 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public IForceTuple ForceTuple { get; private set; }
|
||||
public IForceTuple ForceTuple { get; set; }
|
||||
|
||||
public DesignForceTuple(LimitStates limitState, CalcTerms calcTerm)
|
||||
public DesignForceTuple(LimitStates limitState, CalcTerms calcTerm) : this()
|
||||
{
|
||||
LimitState = limitState;
|
||||
CalcTerm = calcTerm;
|
||||
}
|
||||
|
||||
public DesignForceTuple()
|
||||
{
|
||||
ForceTuple = new ForceTuple();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,15 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool SetInGravityCenter { get; set; }
|
||||
public Point2D ForcePoint { get; private set; }
|
||||
public List<IDesignForceTuple> DesignForces { get; private set; }
|
||||
|
||||
|
||||
public ForceCombinationList()
|
||||
{
|
||||
SetInGravityCenter = true;
|
||||
ForcePoint = new Point2D() { X = 0, Y = 0 };
|
||||
DesignForces = new List<IDesignForceTuple>();
|
||||
DesignForces.Add(new DesignForceTuple(LimitStates.ULS, CalcTerms.ShortTerm));
|
||||
DesignForces.Add(new DesignForceTuple(LimitStates.ULS, CalcTerms.LongTerm));
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
IForceTuple ForceTuple {get;}
|
||||
IForceTuple ForceTuple { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public interface IForceCombinationList
|
||||
{
|
||||
string Name { get; set; }
|
||||
bool SetInGravityCenter { get; set; }
|
||||
Point2D ForcePoint {get ;}
|
||||
List<IDesignForceTuple> DesignForces { get; }
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<Compile Include="Infrastructures\Enums\LimitStates.cs" />
|
||||
<Compile Include="Infrastructures\Enums\UnitTypes.cs" />
|
||||
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
||||
<Compile Include="Infrastructures\Interfaces\IHasForceCombinations.cs" />
|
||||
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
|
||||
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
|
||||
<Compile Include="Infrastructures\Settings\ProgramSetting.cs" />
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface ICalculatorLogic
|
||||
{
|
||||
IEnumerable<INdmCalculator> GetNdmCalculators();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
public interface ICrossSectionTemplate
|
||||
{
|
||||
ICrossSection GetCrossSection();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface IForceLogic
|
||||
{
|
||||
IEnumerable<IForceCombinationList> GetCombinationList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface IMaterialLogic
|
||||
{
|
||||
IEnumerable<IHeadMaterial> GetHeadMaterials();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface ISectionGeometryLogic
|
||||
{
|
||||
IEnumerable<INdmPrimitive> GetNdmPrimitives();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
public class RCSectionTemplate : ICrossSectionTemplate
|
||||
{
|
||||
IForceLogic forceLogic;
|
||||
IMaterialLogic materialLogic;
|
||||
ISectionGeometryLogic geometryLogic;
|
||||
ICalculatorLogic calculatorLogic;
|
||||
IEnumerable<INdmPrimitive> primitives;
|
||||
IEnumerable<IForceCombinationList> combinations;
|
||||
IEnumerable<INdmCalculator> calculators;
|
||||
|
||||
public ICrossSection GetCrossSection()
|
||||
{
|
||||
ICrossSection section = new CrossSection();
|
||||
var repository = section.SectionRepository;
|
||||
var materials = materialLogic.GetHeadMaterials();
|
||||
primitives = geometryLogic.GetNdmPrimitives();
|
||||
#error
|
||||
repository.HeadMaterials.AddRange(materials);
|
||||
repository.Primitives.AddRange(primitives);
|
||||
combinations = forceLogic.GetCombinationList();
|
||||
repository.ForceCombinationLists.AddRange(combinations);
|
||||
calculators = calculatorLogic.GetNdmCalculators();
|
||||
ProcessCalculatorsSetForce();
|
||||
ProcessCalculatorsSetPrimitives();
|
||||
repository.CalculatorsList.AddRange(calculators);
|
||||
return section;
|
||||
}
|
||||
|
||||
private void ProcessCalculatorsSetForce()
|
||||
{
|
||||
foreach (var calculator in calculators)
|
||||
{
|
||||
if (calculator is IHasForceCombinations)
|
||||
{
|
||||
var forceCalculator = calculator as IHasForceCombinations;
|
||||
forceCalculator.ForceCombinationLists.AddRange(combinations);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ProcessCalculatorsSetPrimitives()
|
||||
{
|
||||
foreach (var calculator in calculators)
|
||||
{
|
||||
if (calculator is IHasPrimitives)
|
||||
{
|
||||
var primitiveCalculator = calculator as IHasPrimitives;
|
||||
primitiveCalculator.Primitives.AddRange(primitives);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Services.Forces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculator : INdmCalculator
|
||||
public class ForceCalculator : IForceCalculator
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public double IterationAccuracy { get; set; }
|
||||
@@ -15,10 +27,59 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public List<CalcTerms> CalcTermsList { get; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; }
|
||||
public List<INdmPrimitive> NdmPrimitives { get; }
|
||||
public INdmResult Result { get; }
|
||||
public INdmResult Result { get; private set; }
|
||||
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var checkResult = CheckInputData();
|
||||
if (checkResult != "")
|
||||
{
|
||||
Result = new ForcesResults() { IsValid = false, Desctription = checkResult };
|
||||
return;
|
||||
}
|
||||
else { CalculateResult(); }
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
var ndmResult = new ForcesResults() { IsValid = true };
|
||||
foreach (var combination in ForceCombinationLists)
|
||||
{
|
||||
foreach (var tuple in combination.DesignForces)
|
||||
{
|
||||
var limitState = tuple.LimitState;
|
||||
var calcTerm = tuple.CalcTerm;
|
||||
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
|
||||
{
|
||||
var ndms = NdmPrimitivesService.GetNdms(NdmPrimitives, limitState, calcTerm);
|
||||
IPoint2D point2D;
|
||||
if (combination.SetInGravityCenter == true)
|
||||
{
|
||||
var loaderPoint = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||
point2D = new Point2D() { X = loaderPoint[0], Y = loaderPoint[1] };
|
||||
}
|
||||
else point2D = combination.ForcePoint;
|
||||
var newTuple = TupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
|
||||
var result = GetPrimitiveStrainMatrix(ndms, newTuple);
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
||||
result.DesignForceTuple.ForceTuple = newTuple;
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Result = ndmResult;
|
||||
}
|
||||
|
||||
private string CheckInputData()
|
||||
{
|
||||
string result = "";
|
||||
if (NdmPrimitives.Count == 0) { result += "Calculator does not contain any primitives \n"; }
|
||||
if (ForceCombinationLists.Count == 0) { result += "Calculator does not contain any forces \n"; }
|
||||
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; }
|
||||
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; }
|
||||
return result;
|
||||
}
|
||||
|
||||
public ForceCalculator()
|
||||
@@ -30,5 +91,47 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
LimitStatesList = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||
CalcTermsList = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
}
|
||||
|
||||
private ForcesResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple)
|
||||
{
|
||||
var mx = tuple.Mx;
|
||||
var my = tuple.My;
|
||||
var nz = tuple.Nz;
|
||||
|
||||
try
|
||||
{
|
||||
var loaderData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = IterationAccuracy,
|
||||
MaxIterationCount = MaxIterationCount,
|
||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
var calculator = new Calculator();
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
var calcResult = calculator.Result;
|
||||
if (calcResult.AccuracyRate <= IterationAccuracy)
|
||||
{
|
||||
return new ForcesResult() { IsValid = true, Desctription = "Analysis is done succsefully", LoaderResults = calcResult };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ForcesResult() { IsValid = false, Desctription = "Required accuracy rate has not achived", LoaderResults = calcResult };
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var result = new ForcesResult() { IsValid = false };
|
||||
if (ex.Message == "") { result.Desctription = "Stiffness matrix is equal to zero"; }
|
||||
else { result.Desctription = $"Error is appeared due to analysis. Error: {ex}"; }
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,7 +11,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForcesResult : INdmResult
|
||||
{
|
||||
public bool IsValid { get; private set; }
|
||||
public bool IsValid { get; set; }
|
||||
public IDesignForceTuple DesignForceTuple { get; set; }
|
||||
/// <summary>
|
||||
/// Text of result of calculations
|
||||
/// </summary>
|
||||
@@ -17,6 +20,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
/// <summary>
|
||||
/// Keep result of calculations from ndm-library
|
||||
/// </summary>
|
||||
public ILoaderResults LoaderResults { get; }
|
||||
public ILoaderResults LoaderResults { get; set; }
|
||||
|
||||
public ForcesResult()
|
||||
{
|
||||
DesignForceTuple = new DesignForceTuple();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForcesResults : IForcesResults
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public List<ForcesResult> ForcesResultList { get; }
|
||||
public string Desctription { get; set; }
|
||||
|
||||
public ForcesResults()
|
||||
{
|
||||
ForcesResultList = new List<ForcesResult>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations
|
||||
{
|
||||
List<CalcTerms> CalcTermsList { get; }
|
||||
double IterationAccuracy { get; set; }
|
||||
List<LimitStates> LimitStatesList { get; }
|
||||
int MaxIterationCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForcesResults : INdmResult
|
||||
{
|
||||
string Desctription { get; set; }
|
||||
List<ForcesResult> ForcesResultList { get; }
|
||||
bool IsValid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
/// <summary>
|
||||
/// True if result of calculation is valid
|
||||
/// </summary>
|
||||
bool IsValid { get; }
|
||||
bool IsValid { get; set; }
|
||||
string Desctription { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
21
StructureHelperLogics/Services/Forces/TupleService.cs
Normal file
21
StructureHelperLogics/Services/Forces/TupleService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services.Forces
|
||||
{
|
||||
internal static class TupleService
|
||||
{
|
||||
public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D)
|
||||
{
|
||||
var newTuple = forceTuple.Clone() as IForceTuple;
|
||||
newTuple.Mx += newTuple.Nz * point2D.Y;
|
||||
newTuple.My -= newTuple.Nz * point2D.X;
|
||||
return newTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
|
||||
namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
internal static class NdmPrimitivesService
|
||||
public static class NdmPrimitivesService
|
||||
{
|
||||
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
|
||||
{
|
||||
@@ -25,5 +30,17 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
target.NdmMaxSize = source.NdmMaxSize;
|
||||
target.NdmMinDivision = source.NdmMinDivision;
|
||||
}
|
||||
|
||||
public static List<INdm> GetNdms(IEnumerable<INdmPrimitive> primitives, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
//Настройки триангуляции
|
||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = limitState, CalcTerm = calcTerm };
|
||||
|
||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||
List<INdm> ndmCollection = new List<INdm>();
|
||||
ndmCollection.AddRange(Triangulation.GetNdms(primitives, options));
|
||||
|
||||
return ndmCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,26 +12,6 @@
|
||||
<Style x:Key="cbStyle" TargetType="CheckBox">
|
||||
<Setter Property="Margin" Value="0,5,0,5"/>
|
||||
</Style>
|
||||
<DataTemplate x:Key="SimpleItemTemplate">
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="SourceToTarget">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox ItemsSource="{Binding SourceItems}" SelectedItem="{Binding SelectedSourceItem}" ItemTemplate="{StaticResource ResourceKey=SimpleItemTemplate}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="Add all" Command="{Binding AddAll}"/>
|
||||
<Button Content="Clear all" Command="{Binding ClearAll}"/>
|
||||
<Button Content=">>" Command="{Binding AddSelected}"/>
|
||||
<Button Content="<<" Command="{Binding RemoveSelected}"/>
|
||||
</StackPanel>
|
||||
<ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}" SelectedItem="{Binding SelectedTargetItem}" ItemTemplate="{StaticResource ResourceKey=SimpleItemTemplate}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators"
|
||||
d:DataContext="{d:DesignInstance vm:ForcesResultsViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="ForceResultsView" Height="350" Width="650" MinHeight="300" MinWidth="400">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding ForcesResults.ForcesResultList}" SelectedItem="{Binding SelectedResult}" >
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter Property="Background" Value="Pink"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||
<DataGridTextColumn Header="LimitState" Width="70" Binding="{Binding DesignForceTuple.LimitState}"/>
|
||||
<DataGridTextColumn Header="Duration" Width="70" Binding="{Binding DesignForceTuple.CalcTerm}"/>
|
||||
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding DesignForceTuple.ForceTuple.Mx, Converter={StaticResource MomentConverter}}"/>
|
||||
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding DesignForceTuple.ForceTuple.My, Converter={StaticResource MomentConverter}}"/>
|
||||
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding DesignForceTuple.ForceTuple.Nz, Converter={StaticResource ForceConverter}}"/>
|
||||
<DataGridTextColumn Header="Kx" Width="90" Binding="{Binding LoaderResults.ForceStrainPair.StrainMatrix.Kx}"/>
|
||||
<DataGridTextColumn Header="Ky" Width="90" Binding="{Binding LoaderResults.ForceStrainPair.StrainMatrix.Ky}"/>
|
||||
<DataGridTextColumn Header="EpsZ" Width="90" Binding="{Binding LoaderResults.ForceStrainPair.StrainMatrix.EpsZ}"/>
|
||||
<DataGridTextColumn Header="Accuracy" Width="90" Binding="{Binding LoaderResults.AccuracyRate}"/>
|
||||
<DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding LoaderResults.IterationCounter}"/>
|
||||
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Desctription}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Margin="3" Content="Graphic" Command="{Binding ShowIsoFieldCommand}"/>
|
||||
<Button Margin="3" Content="Export" Command="{Binding ShowIsoFieldCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для ForceResultsView.xaml
|
||||
/// </summary>
|
||||
public partial class ForceResultsView : Window
|
||||
{
|
||||
readonly ForcesResultsViewModel viewModel;
|
||||
|
||||
public ForceResultsView(ForcesResultsViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.viewModel = viewModel;
|
||||
this.DataContext = this.viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
|
||||
d:DataContext="{d:DesignInstance vm:ForceCombinationViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Force Combination" Height="250" Width="450" MinHeight="300" MinWidth="400">
|
||||
Title="Force Combination" Height="250" Width="450" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<DataTemplate x:Key="ForceTemplate">
|
||||
|
||||
@@ -19,24 +19,27 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Name"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||
<TextBlock Grid.Row="1" Text="Center X"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CenterX}"/>
|
||||
<TextBlock Grid.Row="2" Text="Center Y"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterY}"/>
|
||||
<TextBlock Grid.Row="1" Text="Set force into initial Gravity Center"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="1" Margin="3,5,3,5" IsChecked="{Binding SetInGravityCenter}"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterX}" IsEnabled="{Binding CoordEnable}"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CenterY}" IsEnabled="{Binding CoordEnable}"/>
|
||||
</Grid>
|
||||
<DataGrid x:Name="ForceGrid" AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding ForceTuples}"
|
||||
SelectedItem="{Binding SelectedTuple}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Limit State" Width="90" Binding="{Binding LimitState}"/>
|
||||
<DataGridTextColumn Header="Duration" Width="90" Binding="{Binding CalcTerm}"/>
|
||||
<DataGridTextColumn Header="Limit State" Width="90" Binding="{Binding LimitState}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Duration" Width="90" Binding="{Binding CalcTerm}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
|
||||
public class CalculationResultViewModel
|
||||
{
|
||||
public ICalculationResult SelectedResult { get; set; }
|
||||
public ICommand ShowIsoFieldCommand { get; set; }
|
||||
public ICommand ShowIsoFieldCommand { get;}
|
||||
private ObservableCollection<ICalculationResult> calculationResults;
|
||||
private IEnumerable<INdm> ndms;
|
||||
private IReport isoFieldReport;
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
@@ -47,6 +48,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
public bool LongTerm { get; set; }
|
||||
|
||||
public ISourceToTargetViewModel<IForceCombinationList> CombinationViewModel { get; }
|
||||
//public ISourceToTargetViewModel<PrimitiveBase> PrimitivesViewModel { get; }
|
||||
|
||||
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
@@ -148,6 +150,13 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
CombinationViewModel.SetTargetItems(forcesCalculator.ForceCombinationLists);
|
||||
CombinationViewModel.SetSourceItems(allowedForceCombinations);
|
||||
|
||||
//PrimitivesViewModel = new SourceToTargetViewModel<PrimitiveBase>();
|
||||
//var targetItems = forcesCalculator.NdmPrimitives;
|
||||
//var viewPrimitives = ConvertNdmPrimitivesToPrimitiveBase(targetItems);
|
||||
//PrimitivesViewModel.SetTargetItems(viewPrimitives);
|
||||
//var sourceViewPrimitives = ConvertNdmPrimitivesToPrimitiveBase(allowedPrimitives) ;
|
||||
//PrimitivesViewModel.SetSourceItems(sourceViewPrimitives);
|
||||
|
||||
InputRefresh();
|
||||
}
|
||||
|
||||
@@ -187,6 +196,11 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
forcesCalculator.ForceCombinationLists.Add(item);
|
||||
}
|
||||
//forcesCalculator.NdmPrimitives.Clear();
|
||||
//foreach (var item in PrimitivesViewModel.GetTargetItems())
|
||||
//{
|
||||
// forcesCalculator.NdmPrimitives.Add(item.GetNdmPrimitive());
|
||||
//}
|
||||
forcesCalculator.LimitStatesList.Clear();
|
||||
if (ULS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.ULS); }
|
||||
if (SLS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.SLS); }
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
using FieldVisualizer.Infrastructure.Commands;
|
||||
using FieldVisualizer.ViewModels;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.Reports;
|
||||
using StructureHelper.Services.Reports.CalculationReports;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
public class ForcesResultsViewModel : ViewModelBase
|
||||
{
|
||||
private IForceCalculator forceCalculator;
|
||||
private IForcesResults forcesResults;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private IEnumerable<INdm> ndms;
|
||||
private IReport isoFieldReport;
|
||||
|
||||
public ForcesResult SelectedResult { get; set; }
|
||||
private ICommand showIsoFieldCommand;
|
||||
|
||||
public IForcesResults ForcesResults
|
||||
{
|
||||
get => forcesResults;
|
||||
}
|
||||
|
||||
public ICommand ShowIsoFieldCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return showIsoFieldCommand ??
|
||||
(
|
||||
showIsoFieldCommand = new RelayCommand(o =>
|
||||
{
|
||||
GetNdms();
|
||||
ShowIsoField();
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ForcesResultsViewModel(IForceCalculator forceCalculator)
|
||||
{
|
||||
this.forceCalculator = forceCalculator;
|
||||
this.forcesResults = this.forceCalculator.Result as IForcesResults;
|
||||
ndmPrimitives = this.forceCalculator.NdmPrimitives;
|
||||
}
|
||||
|
||||
private void ShowIsoField()
|
||||
{
|
||||
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
||||
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||
isoFieldReport.Show();
|
||||
}
|
||||
|
||||
private void GetNdms()
|
||||
{
|
||||
var limitState = SelectedResult.DesignForceTuple.LimitState;
|
||||
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
||||
ndms = NdmPrimitivesService.GetNdms(ndmPrimitives, limitState, calcTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,40 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
combinationList.Name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetInGravityCenter
|
||||
{
|
||||
get => combinationList.SetInGravityCenter;
|
||||
set
|
||||
{
|
||||
combinationList.SetInGravityCenter = value;
|
||||
OnPropertyChanged(nameof(SetInGravityCenter));
|
||||
OnPropertyChanged(nameof(CoordEnable));
|
||||
}
|
||||
}
|
||||
|
||||
public bool CoordEnable => !SetInGravityCenter;
|
||||
|
||||
public double CenterX
|
||||
{
|
||||
get => combinationList.ForcePoint.X;
|
||||
set
|
||||
{
|
||||
combinationList.ForcePoint.X = value;
|
||||
OnPropertyChanged(nameof(CenterX));
|
||||
}
|
||||
}
|
||||
|
||||
public double CenterY
|
||||
{
|
||||
get => combinationList.ForcePoint.Y;
|
||||
set
|
||||
{
|
||||
combinationList.ForcePoint.Y = value;
|
||||
OnPropertyChanged(nameof(CenterY));
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IDesignForceTuple> ForceTuples { get => combinationList.DesignForces; }
|
||||
|
||||
public ForceCombinationViewModel(IForceCombinationList combinationList)
|
||||
|
||||
@@ -98,7 +98,19 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
(
|
||||
runCommand = new RelayCommand(o =>
|
||||
{
|
||||
(SelectedItem as INdmCalculator).Run();
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
var calculator = SelectedItem as IForceCalculator;
|
||||
var vm = new ForcesResultsViewModel(calculator);
|
||||
var wnd = new ForceResultsView(vm);
|
||||
wnd.Show();
|
||||
}
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,5 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
public interface ICalculatorsViewModelLogic : ICRUDViewModel<INdmCalculator>
|
||||
{
|
||||
RelayCommand Run { get; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user