Added reviewing of results in graphic mode

This commit is contained in:
Evgeny Redikultsev
2022-09-10 20:16:05 +05:00
parent c12e9f70f9
commit 78ec7bdc6f
26 changed files with 389 additions and 85 deletions

View File

@@ -1,8 +1,18 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData;
using LoaderCalculator.Data.SourceData;
using StructureHelper.Services;
using StructureHelper.UnitSystem;
using StructureHelper.UnitSystem.Systems;
using StructureHelperLogics.Infrastructures.CommonEnums;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace StructureHelper.Windows.MainWindow
{
@@ -26,5 +36,39 @@ namespace StructureHelper.Windows.MainWindow
.Select(x => x.GetNdmPrimitive(unitSystem))
.Concat(primitiveRepository.GetPoints().Select(x => x.GetNdmPrimitive(unitSystem))).ToArray(), mx, my, nz);
}
public IEnumerable<INdm> GetNdms()
{
var unitSystem = unitSystemService.GetCurrentSystem();
var ndmPrimitives = primitiveRepository.GetRectangles()
.Select(x => x.GetNdmPrimitive(unitSystem))
.Concat(primitiveRepository.GetPoints().Select(x => x.GetNdmPrimitive(unitSystem))).ToArray();
//Настройки триангуляции, пока опции могут быть только такие
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.Collapse, CalcTerm = CalcTerms.ShortTerm };
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
List<INdm> ndmCollection = new List<INdm>();
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
return ndmCollection;
}
public ILoaderResults CalculateResult(IEnumerable<INdm> ndmCollection, IForceMatrix forceMatrix)
{
var loaderData = new LoaderOptions
{
Preconditions = new Preconditions
{
ConditionRate = 0.01,
MaxIterationCount = 100,
StartForceMatrix = forceMatrix
},
NdmCollection = ndmCollection
};
var calculator = new Calculator();
calculator.Run(loaderData, new CancellationToken());
return calculator.Result;
}
}
}

View File

@@ -13,6 +13,9 @@ using StructureHelper.Services;
using StructureHelper.Windows.ColorPickerWindow;
using StructureHelper.UnitSystem;
using StructureHelper.Models.Materials;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using StructureHelper.Services.ResultViewers;
namespace StructureHelper.Windows.MainWindow
{
@@ -232,12 +235,13 @@ namespace StructureHelper.Windows.MainWindow
Calculate = new RelayCommand(o =>
{
var matrix = model.Calculate(10e3, 0d, 0d);
MessageBox.Show(
$"{nameof(matrix.EpsZ)} = {matrix.EpsZ};\n" +
$"{nameof(matrix.Kx)} = {matrix.Kx};\n" +
$"{nameof(matrix.Ky)} = {matrix.Ky}",
"StructureHelper");
//var matrix = model.Calculate(10e3, 0d, 0d);
//MessageBox.Show(
// $"{nameof(matrix.EpsZ)} = {matrix.EpsZ};\n" +
// $"{nameof(matrix.Kx)} = {matrix.Kx};\n" +
// $"{nameof(matrix.Ky)} = {matrix.Ky}",
// "StructureHelper");
CalculateResult();
});
SetPopupCanBeClosedTrue = new RelayCommand(o =>
@@ -253,6 +257,14 @@ namespace StructureHelper.Windows.MainWindow
});
}
private void CalculateResult()
{
IForceMatrix forceMatrix = new ForceMatrix() { Mx = 10e3, My = 10e3, Nz = 0 };
IEnumerable<INdm> ndms = Model.GetNdms();
var loaderResult = Model.CalculateResult(ndms, forceMatrix);
ShowIsoFieldResult.ShowResult(loaderResult.StrainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
}
private IEnumerable<PrimitiveBase> GetTestCasePrimitives()
{
var width = 400;