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

@@ -0,0 +1,16 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
public interface IResultFunc
{
string Name { get; }
Func<IStrainMatrix, INdm, double> ResultFunction { get; }
}
}

View File

@@ -0,0 +1,16 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
public class ResultFunc : IResultFunc
{
public string Name { get; set; }
public Func<IStrainMatrix, INdm, double> ResultFunction { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using LoaderCalculator.Logics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
public static class ResultFuncFactory
{
public static IEnumerable<IResultFunc> GetResultFuncs()
{
List<IResultFunc> resultFuncs = new List<IResultFunc>();
IStressLogic stressLogic = new StressLogic();
resultFuncs.Add(new ResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
resultFuncs.Add(new ResultFunc() { Name = "Elastic Srtain", ResultFunction = stressLogic.GetElasticStrain });
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress });
return resultFuncs;
}
}
}

View File

@@ -0,0 +1,46 @@
using FieldVisualizer.Entities.Values.Primitives;
using FieldVisualizer.WindowsOperation;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData;
using LoaderCalculator.Logics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Services.ResultViewers
{
public static class ShowIsoFieldResult
{
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> 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 (INdm ndm in ndms)
{
double val = valDelegate.ResultFunction.Invoke(strainMatrix, ndm);
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);
}
primitiveSet.ValuePrimitives = primitives;
primitiveSets.Add(primitiveSet);
}
FieldViewerOperation.ShowViewer(primitiveSets);
}
}
}