Add version processor window
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperLogics.Models.Analyses;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperLogic.Models.Analyses
|
||||
{
|
||||
@@ -11,6 +13,8 @@ namespace StructureHelperLogic.Models.Analyses
|
||||
public string Name { get; set; }
|
||||
public string Tags { get; set; }
|
||||
public IVersionProcessor VersionProcessor { get; set; }
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public Color Color { get; set; } = Color.FromRgb(128, 0, 0);
|
||||
|
||||
public CrossSectionNdmAnalysis(Guid id, IVersionProcessor versionProcessor)
|
||||
{
|
||||
@@ -33,6 +37,10 @@ namespace StructureHelperLogic.Models.Analyses
|
||||
{
|
||||
CrossSectionNdmAnalysis newAnalysis = new();
|
||||
updateStrategy.Update(newAnalysis, this);
|
||||
var currentVersion = VersionProcessor.GetCurrentVersion().AnalysisVersion as ICloneable;
|
||||
ISaveable newCrossSection = currentVersion.Clone() as ISaveable;
|
||||
newAnalysis.VersionProcessor.Versions.Clear();
|
||||
newAnalysis.VersionProcessor.AddVersion(newCrossSection);
|
||||
return newAnalysis;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,6 +9,7 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSection : ICrossSection
|
||||
{
|
||||
private ICloneStrategy<ICrossSection> cloneStrategy = new CrossSectionCloneStrategy();
|
||||
public ICrossSectionRepository SectionRepository { get; set; } = new CrossSectionRepository();
|
||||
|
||||
public Guid Id { get; private set; }
|
||||
@@ -24,7 +26,7 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return cloneStrategy.GetClone(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionCloneStrategy : ICloneStrategy<ICrossSection>
|
||||
{
|
||||
private ICloneStrategy<ICrossSectionRepository> repositoryCloneStrategy;
|
||||
private CrossSection targetObject;
|
||||
|
||||
public CrossSectionCloneStrategy(ICloneStrategy<ICrossSectionRepository> repositoryCloneStrategy)
|
||||
{
|
||||
this.repositoryCloneStrategy = repositoryCloneStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionCloneStrategy() : this (new CrossSectionRepositoryCloneStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ICrossSection GetClone(ICrossSection sourceObject)
|
||||
{
|
||||
ICrossSectionRepository newRepository = repositoryCloneStrategy.GetClone(sourceObject.SectionRepository);
|
||||
targetObject = new()
|
||||
{
|
||||
SectionRepository = newRepository
|
||||
};
|
||||
return targetObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionRepositoryCloneStrategy : ICloneStrategy<ICrossSectionRepository>
|
||||
{
|
||||
private ICloningStrategy cloningStrategy;
|
||||
private CrossSectionRepository targetRepository;
|
||||
private IUpdateStrategy<ILimitCurvesCalculatorInputData> limitCurvesInputDataUpdateStrategy;
|
||||
|
||||
public CrossSectionRepositoryCloneStrategy(
|
||||
ICloningStrategy cloningStrategy,
|
||||
IUpdateStrategy<ILimitCurvesCalculatorInputData> limitCurvesInputDataUpdateStrategy)
|
||||
{
|
||||
this.cloningStrategy = cloningStrategy;
|
||||
this.limitCurvesInputDataUpdateStrategy = limitCurvesInputDataUpdateStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionRepositoryCloneStrategy() : this (
|
||||
new DeepCloningStrategy(),
|
||||
new LimitCurvesCalculatorInputDataUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ICrossSectionRepository GetClone(ICrossSectionRepository sourceObject)
|
||||
{
|
||||
targetRepository = new();
|
||||
ProcessForces(targetRepository, sourceObject);
|
||||
ProcessMaterials(targetRepository, sourceObject);
|
||||
ProcessPrimitives(targetRepository, sourceObject);
|
||||
ProcessCalculators(targetRepository, sourceObject);
|
||||
return targetRepository;
|
||||
}
|
||||
|
||||
private void ProcessCalculators(IHasCalculators targetObject, IHasCalculators sourceObject)
|
||||
{
|
||||
targetObject.Calculators.Clear();
|
||||
foreach (var calculator in sourceObject.Calculators)
|
||||
{
|
||||
var newCalculator = cloningStrategy.Clone(calculator);
|
||||
if (calculator is IForceCalculator forceCalculator)
|
||||
{
|
||||
ProcessForceCalculator(newCalculator, forceCalculator);
|
||||
}
|
||||
else if (calculator is CrackCalculator crackCalculator)
|
||||
{
|
||||
ProcessCrackCalculator(newCalculator, crackCalculator);
|
||||
}
|
||||
else if (calculator is ILimitCurvesCalculator limitCalculator)
|
||||
{
|
||||
ProcessLimitCurvesCalculator(newCalculator, limitCalculator);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(calculator));
|
||||
}
|
||||
targetRepository.Calculators.Add(newCalculator);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessLimitCurvesCalculator(ICalculator newCalculator, ILimitCurvesCalculator limitCalculator)
|
||||
{
|
||||
var sourceData = limitCalculator.InputData;
|
||||
var targetData = ((ILimitCurvesCalculator)newCalculator).InputData;
|
||||
limitCurvesInputDataUpdateStrategy.Update(targetData, sourceData);
|
||||
foreach (var series in targetData.PrimitiveSeries)
|
||||
{
|
||||
List<INdmPrimitive> collection = UpdatePrimitivesCollection(series);
|
||||
series.Collection.AddRange(collection);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessCrackCalculator(ICalculator newCalculator, CrackCalculator crackCalculator)
|
||||
{
|
||||
var sourceData = crackCalculator.InputData;
|
||||
var targetData = ((ICrackCalculator)newCalculator).InputData;
|
||||
ProcessPrimitives(targetData, sourceData);
|
||||
ProcessForces(targetData, sourceData);
|
||||
}
|
||||
|
||||
private void ProcessForceCalculator(ICalculator newCalculator, IForceCalculator forceCalculator)
|
||||
{
|
||||
var sourceData = forceCalculator.InputData;
|
||||
var targetData = ((IForceCalculator)newCalculator).InputData;
|
||||
ProcessPrimitives(targetData, sourceData);
|
||||
ProcessForces(targetData, sourceData);
|
||||
}
|
||||
|
||||
private List<INdmPrimitive> UpdatePrimitivesCollection(NamedCollection<INdmPrimitive> series)
|
||||
{
|
||||
List<INdmPrimitive> collection = new();
|
||||
foreach (var item in series.Collection)
|
||||
{
|
||||
var newItem = cloningStrategy.Clone(item);
|
||||
collection.Add(newItem);
|
||||
}
|
||||
series.Collection.Clear();
|
||||
return collection;
|
||||
}
|
||||
|
||||
private void ProcessMaterials(IHasHeadMaterials targetObject, IHasHeadMaterials sourceObject)
|
||||
{
|
||||
targetObject.HeadMaterials.Clear();
|
||||
foreach (var material in sourceObject.HeadMaterials)
|
||||
{
|
||||
var newMaterial = cloningStrategy.Clone(material);
|
||||
targetRepository.HeadMaterials.Add(newMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessForces(IHasForceActions targetObject, IHasForceActions sourceObject)
|
||||
{
|
||||
targetObject.ForceActions.Clear();
|
||||
foreach (var force in sourceObject.ForceActions)
|
||||
{
|
||||
var newForce = cloningStrategy.Clone(force);
|
||||
targetObject.ForceActions.Add(newForce);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessPrimitives(IHasPrimitives targetObject, IHasPrimitives sourceObject)
|
||||
{
|
||||
targetObject.Primitives.Clear();
|
||||
foreach (var primitive in sourceObject.Primitives)
|
||||
{
|
||||
var newPrimitive = cloningStrategy.Clone(primitive);
|
||||
var material = cloningStrategy.Clone(primitive.NdmElement.HeadMaterial);
|
||||
newPrimitive.NdmElement.HeadMaterial = material;
|
||||
targetObject.Primitives.Add(newPrimitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
|
||||
@@ -6,21 +6,29 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class HeadMaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
|
||||
{
|
||||
private IUpdateStrategy<IHeadMaterial> updateStrategy = new HeadMaterialBaseUpdateStrategy();
|
||||
private IUpdateStrategy<IHeadMaterial> baseUpdateStrategy;
|
||||
private IUpdateStrategy<IHelperMaterial> helperMaterialUpdateStrategy;
|
||||
|
||||
public HeadMaterialUpdateStrategy(IUpdateStrategy<IHelperMaterial> helperMaterialUpdateStrategy)
|
||||
public HeadMaterialUpdateStrategy(
|
||||
IUpdateStrategy<IHeadMaterial> baseUpdateStrategy,
|
||||
IUpdateStrategy<IHelperMaterial> helperMaterialUpdateStrategy)
|
||||
{
|
||||
this.baseUpdateStrategy = baseUpdateStrategy;
|
||||
this.helperMaterialUpdateStrategy = helperMaterialUpdateStrategy;
|
||||
}
|
||||
public HeadMaterialUpdateStrategy() : this(new HelperMaterialUpdateStrategy()) { }
|
||||
public HeadMaterialUpdateStrategy() : this(
|
||||
new HeadMaterialBaseUpdateStrategy(),
|
||||
new HelperMaterialUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
updateStrategy.Update(targetObject, sourceObject);
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.HelperMaterial = sourceObject.HelperMaterial.Clone() as IHelperMaterial;
|
||||
helperMaterialUpdateStrategy.Update(targetObject.HelperMaterial, sourceObject.HelperMaterial);
|
||||
}
|
||||
|
||||
@@ -63,13 +63,13 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
private void UpdateLibMaterial(IHelperMaterial targetObject, IHelperMaterial sourceObject)
|
||||
{
|
||||
if (sourceObject is IConcreteLibMaterial)
|
||||
if (sourceObject is IConcreteLibMaterial concreteLibMaterial)
|
||||
{
|
||||
concreteStrategy.Update(targetObject as IConcreteLibMaterial, sourceObject as IConcreteLibMaterial);
|
||||
concreteStrategy.Update(targetObject as IConcreteLibMaterial, concreteLibMaterial);
|
||||
}
|
||||
else if (sourceObject is IReinforcementLibMaterial)
|
||||
else if (sourceObject is IReinforcementLibMaterial reinforcementLibMaterial)
|
||||
{
|
||||
reinforcementStrategy.Update(targetObject as IReinforcementLibMaterial, sourceObject as IReinforcementLibMaterial);
|
||||
reinforcementStrategy.Update(targetObject as IReinforcementLibMaterial, reinforcementLibMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,6 +8,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides calculations of ndm primitives for force actions
|
||||
/// </summary>
|
||||
public interface IForceCalculator : ICalculator, IHasActionByResult
|
||||
{
|
||||
IForceCalculatorInputData InputData { get; set; }
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public interface ILimitCurveCalculator : ICalculator, IHasActionByResult
|
||||
{
|
||||
Action<IResult> ActionToOutputResults { get; set; }
|
||||
SurroundData SurroundData { get; set; }
|
||||
ISurroundData SurroundData { get; set; }
|
||||
int PointCount { get; set; }
|
||||
ISurroundProc SurroundProcLogic { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurvesCalculator : ISaveable, ICalculator, IHasActionByResult
|
||||
{
|
||||
LimitCurvesCalculatorInputData InputData { get; set; }
|
||||
string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurvesCalculatorInputData : IInputData, ICloneable
|
||||
{
|
||||
List<CalcTerms> CalcTerms { get; }
|
||||
List<LimitStates> LimitStates { get; }
|
||||
int PointCount { get; set; }
|
||||
List<PredicateEntry> PredicateEntries { get; }
|
||||
List<NamedCollection<INdmPrimitive>> PrimitiveSeries { get; }
|
||||
ISurroundData SurroundData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ISurroundData : ICloneable
|
||||
{
|
||||
double ConstZ { get; set; }
|
||||
ConstOneDirectionConverter ConvertLogicEntity { get; set; }
|
||||
double XMax { get; set; }
|
||||
double XMin { get; set; }
|
||||
double YMax { get; set; }
|
||||
double YMin { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ISurroundProc
|
||||
{
|
||||
SurroundData SurroundData { get; set; }
|
||||
ISurroundData SurroundData { get; set; }
|
||||
int PointCount { get; set; }
|
||||
List<IPoint2D> GetPoints();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
private ILimitCurveLogic limitCurveLogic;
|
||||
|
||||
public string Name { get; set; }
|
||||
public SurroundData SurroundData { get; set; }
|
||||
public ISurroundData SurroundData { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
public ISurroundProc SurroundProcLogic { get; set; }
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public LimitCurveCalculator(ILimitCurveLogic limitCurveLogic)
|
||||
{
|
||||
this.limitCurveLogic = limitCurveLogic;
|
||||
SurroundData = new();
|
||||
SurroundData = new SurroundData();
|
||||
SurroundProcLogic = new RectSurroundProc();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveInputData : IInputData, ICloneable
|
||||
{
|
||||
public List<LimitStates> LimitStates { get; private set; }
|
||||
public List<CalcTerms> CalcTerms { get; private set; }
|
||||
public List<NamedCollection<INdmPrimitive>> PrimitiveSeries {get; private set; }
|
||||
public List<PredicateEntry> PredicateEntries { get; private set; }
|
||||
public SurroundData SurroundData { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
public LimitCurveInputData()
|
||||
{
|
||||
LimitStates = new();
|
||||
CalcTerms = new();
|
||||
PredicateEntries = new();
|
||||
SurroundData = new();
|
||||
PointCount = 80;
|
||||
PrimitiveSeries = new List<NamedCollection<INdmPrimitive>>();
|
||||
}
|
||||
public LimitCurveInputData(IEnumerable<INdmPrimitive> primitives) : this()
|
||||
{
|
||||
PrimitiveSeries.Add
|
||||
(new NamedCollection<INdmPrimitive>()
|
||||
{
|
||||
Name = "V1",
|
||||
Collection = primitives.ToList()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new LimitCurveInputData()
|
||||
{
|
||||
LimitStates = LimitStates.ToList(),
|
||||
CalcTerms = CalcTerms.ToList(),
|
||||
PredicateEntries = PredicateEntries.ToList(),
|
||||
SurroundData = SurroundData.Clone() as SurroundData,
|
||||
PointCount = PointCount
|
||||
};
|
||||
foreach (var item in PrimitiveSeries)
|
||||
{
|
||||
var collection = item.Collection.ToList();
|
||||
newItem.PrimitiveSeries.Add
|
||||
(
|
||||
new NamedCollection<INdmPrimitive>()
|
||||
{
|
||||
Name = item.Name,
|
||||
Collection = collection
|
||||
}
|
||||
);
|
||||
}
|
||||
return newItem;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurvesCalculator : ISaveable, ICalculator, IHasActionByResult
|
||||
public class LimitCurvesCalculator : ILimitCurvesCalculator
|
||||
{
|
||||
private LimitCurvesResult result;
|
||||
private int curvesIterationCount;
|
||||
@@ -21,7 +21,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public LimitCurveInputData InputData { get; set; }
|
||||
public LimitCurvesCalculatorInputData InputData { get; set; }
|
||||
public IResult Result => result;
|
||||
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
@@ -89,7 +89,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
};
|
||||
var ndms = triangulateLogic.GetNdms();
|
||||
TraceLogger?.AddMessage($"Number of elementary parts N={ndms.Count()} were obtainded successfully");
|
||||
TraceLogger?.AddMessage($"Summary area of elementary parts Asum={ndms.Sum(x=>x.Area * x.StressScale)}", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Summary area of elementary parts Asum={ndms.Sum(x => x.Area * x.StressScale)}", TraceLogStatuses.Debug);
|
||||
foreach (var predicateEntry in InputData.PredicateEntries)
|
||||
{
|
||||
string calcName = $"{primitiveSeries.Name}_{predicateEntry.Name}_{limitState}_{calcTerm}";
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurvesCalculatorInputData : ILimitCurvesCalculatorInputData
|
||||
{
|
||||
private ICloneStrategy<ILimitCurvesCalculatorInputData> cloneStrategy = new LimitCurvesCalculatorInputDataCloneStrategy();
|
||||
public List<LimitStates> LimitStates { get; private set; } = new();
|
||||
public List<CalcTerms> CalcTerms { get; private set; } = new();
|
||||
public List<NamedCollection<INdmPrimitive>> PrimitiveSeries { get; private set; } = new();
|
||||
public List<PredicateEntry> PredicateEntries { get; private set; } = new();
|
||||
public ISurroundData SurroundData { get; set; } = new SurroundData();
|
||||
public int PointCount { get; set; } = 80;
|
||||
public LimitCurvesCalculatorInputData()
|
||||
{
|
||||
}
|
||||
public LimitCurvesCalculatorInputData(IEnumerable<INdmPrimitive> primitives)
|
||||
{
|
||||
PrimitiveSeries.Add
|
||||
(new NamedCollection<INdmPrimitive>()
|
||||
{
|
||||
Name = "V1",
|
||||
Collection = primitives.ToList()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = cloneStrategy.GetClone(this);
|
||||
return newItem;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
{
|
||||
|
||||
public class LimitCurvesCalculatorInputDataCloneStrategy : ICloneStrategy<ILimitCurvesCalculatorInputData>
|
||||
{
|
||||
private IUpdateStrategy<ILimitCurvesCalculatorInputData> updateStrategy;
|
||||
|
||||
public LimitCurvesCalculatorInputDataCloneStrategy(IUpdateStrategy<ILimitCurvesCalculatorInputData> updateStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
public LimitCurvesCalculatorInputDataCloneStrategy() : this (new LimitCurvesCalculatorInputDataUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ILimitCurvesCalculatorInputData GetClone(ILimitCurvesCalculatorInputData sourceObject)
|
||||
{
|
||||
LimitCurvesCalculatorInputData newItem = new();
|
||||
updateStrategy.Update(newItem, sourceObject);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
{
|
||||
public class LimitCurvesCalculatorInputDataUpdateStrategy : IUpdateStrategy<ILimitCurvesCalculatorInputData>
|
||||
{
|
||||
public void Update(ILimitCurvesCalculatorInputData targetObject, ILimitCurvesCalculatorInputData sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject, "Limit curve calculator input data");
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.LimitStates.Clear();
|
||||
targetObject.CalcTerms.Clear();
|
||||
targetObject.PredicateEntries.Clear();
|
||||
targetObject.LimitStates.AddRange(sourceObject.LimitStates);
|
||||
targetObject.CalcTerms.AddRange(sourceObject.CalcTerms);
|
||||
targetObject.PredicateEntries.AddRange(sourceObject.PredicateEntries);
|
||||
targetObject.SurroundData = sourceObject.SurroundData.Clone() as ISurroundData;
|
||||
targetObject.PointCount = sourceObject.PointCount;
|
||||
foreach (var item in sourceObject.PrimitiveSeries)
|
||||
{
|
||||
var collection = item.Collection.ToList();
|
||||
targetObject.PrimitiveSeries.Add
|
||||
(
|
||||
new NamedCollection<INdmPrimitive>()
|
||||
{
|
||||
Name = item.Name,
|
||||
Collection = collection
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
private List<IPoint2D> surroundList;
|
||||
|
||||
public SurroundData SurroundData { get; set; }
|
||||
public ISurroundData SurroundData { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
|
||||
public RectSurroundProc()
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
private List<IPoint2D> surroundList;
|
||||
|
||||
public SurroundData SurroundData { get; set; }
|
||||
public ISurroundData SurroundData { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
|
||||
public RoundSurroundProc()
|
||||
{
|
||||
SurroundData = new();
|
||||
SurroundData = new SurroundData();
|
||||
}
|
||||
public List<IPoint2D> GetPoints()
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
/// <summary>
|
||||
/// Limits of coordinates for workplane
|
||||
/// </summary>
|
||||
public class SurroundData : ICloneable
|
||||
public class SurroundData : ISurroundData
|
||||
{
|
||||
public double XMax { get; set; }
|
||||
public double XMin { get; set; }
|
||||
|
||||
@@ -3,10 +3,10 @@ using StructureHelperCommon.Models.Parameters;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
internal class LimitCurveInputDataUpdateStrategy : IUpdateStrategy<LimitCurveInputData>
|
||||
internal class LimitCurveInputDataUpdateStrategy : IUpdateStrategy<ILimitCurvesCalculatorInputData>
|
||||
{
|
||||
SurroundDataUpdateStrategy surroundDataUpdateStrategy => new();
|
||||
public void Update(LimitCurveInputData targetObject, LimitCurveInputData sourceObject)
|
||||
IUpdateStrategy<ISurroundData> surroundDataUpdateStrategy = new SurroundDataUpdateStrategy();
|
||||
public void Update(ILimitCurvesCalculatorInputData targetObject, ILimitCurvesCalculatorInputData sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.LimitStates.Clear();
|
||||
|
||||
@@ -8,9 +8,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
internal class SurroundDataUpdateStrategy : IUpdateStrategy<SurroundData>
|
||||
internal class SurroundDataUpdateStrategy : IUpdateStrategy<ISurroundData>
|
||||
{
|
||||
public void Update(SurroundData targetObject, SurroundData sourceObject)
|
||||
public void Update(ISurroundData targetObject, ISurroundData sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.XMax = sourceObject.XMax;
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
const string prefixInitial = "Initial";
|
||||
const string prefixActual = "Actual";
|
||||
private const string errorValue = "----";
|
||||
IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||
IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||
|
||||
@@ -186,60 +187,60 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private List<IValueParameter<string>> GetDistance(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix, PosNegFlag flag, string excentricityName, Func<IEnumerable<INdm>, IStrainMatrix, PosNegFlag, (double dX, double dY, double dSum)> func)
|
||||
private List<IValueParameter<string>> GetDistance(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix, PosNegFlag flag, string eccentricityName, Func<IEnumerable<INdm>, IStrainMatrix, PosNegFlag, (double dX, double dY, double dSum)> func)
|
||||
{
|
||||
var parameters = new List<IValueParameter<string>>();
|
||||
var unitType = UnitTypes.Length;
|
||||
var unit = unitLogic.GetUnit(unitType, "mm");
|
||||
var unitName = unit.Name;
|
||||
var unitMultiPlayer = unit.Multiplyer;
|
||||
var sumExcenticityX = new ValueParameter<string>()
|
||||
var sumEccenticityX = new ValueParameter<string>()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{excentricityName} excentricity",
|
||||
Name = $"{eccentricityName} eccentricity",
|
||||
ShortName = $"e{firstAxisName.ToLower()},sum",
|
||||
Text = unitName,
|
||||
Description = $"{excentricityName} force excentricity along {firstAxisName.ToUpper()}-axis"
|
||||
Description = $"{eccentricityName} force excentricity along {firstAxisName.ToUpper()}-axis"
|
||||
};
|
||||
var sumExcenticityY = new ValueParameter<string>()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{excentricityName} excentricity",
|
||||
Name = $"{eccentricityName} eccentricity",
|
||||
ShortName = $"e{secondAxisName.ToLower()},sum",
|
||||
Text = unitName,
|
||||
Description = $"{excentricityName} force excentricity along {secondAxisName.ToUpper()}-axis"
|
||||
Description = $"{eccentricityName} force eccentricity along {secondAxisName.ToUpper()}-axis"
|
||||
};
|
||||
var sumExcenticity = new ValueParameter<string>()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{excentricityName} excentricity",
|
||||
Name = $"{eccentricityName} eccentricity",
|
||||
ShortName = $"e,sum",
|
||||
Text = unitName,
|
||||
Description = $"{excentricityName} force excentricity"
|
||||
Description = $"{eccentricityName} force eccentricity"
|
||||
};
|
||||
try
|
||||
{
|
||||
var sumExcentricityValue = func.Invoke(locNdms, locStrainMatrix, flag);
|
||||
sumExcenticityX.Value = (sumExcentricityValue.dX * unitMultiPlayer).ToString();
|
||||
sumExcenticityY.Value = (sumExcentricityValue.dY * unitMultiPlayer).ToString();
|
||||
sumExcenticity.Value = (sumExcentricityValue.dSum * unitMultiPlayer).ToString();
|
||||
var sumEccentricityValue = func.Invoke(locNdms, locStrainMatrix, flag);
|
||||
sumEccenticityX.Value = (sumEccentricityValue.dX * unitMultiPlayer).ToString();
|
||||
sumExcenticityY.Value = (sumEccentricityValue.dY * unitMultiPlayer).ToString();
|
||||
sumExcenticity.Value = (sumEccentricityValue.dSum * unitMultiPlayer).ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sumExcenticityX.IsValid = false;
|
||||
sumExcenticityX.Value = (double.NaN).ToString();
|
||||
sumExcenticityX.Description += $": {ex}";
|
||||
sumEccenticityX.IsValid = false;
|
||||
sumEccenticityX.Value = errorValue;
|
||||
sumEccenticityX.Description += $": {ex}";
|
||||
|
||||
sumExcenticityY.IsValid = false;
|
||||
sumExcenticityY.Value = (double.NaN).ToString();
|
||||
sumExcenticityY.Value = errorValue;
|
||||
sumExcenticityY.Description += $": {ex}";
|
||||
|
||||
sumExcenticity.IsValid = false;
|
||||
sumExcenticity.Value = (double.NaN).ToString();
|
||||
sumExcenticity.Value = errorValue;
|
||||
sumExcenticity.Description += $": {ex}";
|
||||
}
|
||||
|
||||
parameters.Add(sumExcenticityX);
|
||||
parameters.Add(sumEccenticityX);
|
||||
parameters.Add(sumExcenticityY);
|
||||
parameters.Add(sumExcenticity);
|
||||
return parameters;
|
||||
@@ -254,7 +255,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<IValueParameter<string>> GetLiverArms(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix, string excentricityName, Func<IEnumerable<INdm>, IStrainMatrix, (double dX, double dY, double dSum)> func)
|
||||
private IEnumerable<IValueParameter<string>> GetLiverArms(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix, string eccentricityName, Func<IEnumerable<INdm>, IStrainMatrix, (double dX, double dY, double dSum)> func)
|
||||
{
|
||||
const string liverArm = "liver arm";
|
||||
var parameters = new List<IValueParameter<string>>();
|
||||
@@ -265,26 +266,26 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
var sumLiverArmX = new ValueParameter<string>()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{excentricityName} {liverArm}",
|
||||
Name = $"{eccentricityName} {liverArm}",
|
||||
ShortName = $"z,{firstAxisName.ToLower()}",
|
||||
Text = unitName,
|
||||
Description = $"{excentricityName} {liverArm} along {firstAxisName.ToUpper()}-axis"
|
||||
Description = $"{eccentricityName} {liverArm} along {firstAxisName.ToUpper()}-axis"
|
||||
};
|
||||
var sumLiverArmY = new ValueParameter<string>()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{excentricityName} {liverArm}",
|
||||
Name = $"{eccentricityName} {liverArm}",
|
||||
ShortName = $"z,{secondAxisName.ToLower()}",
|
||||
Text = unitName,
|
||||
Description = $"{excentricityName} {liverArm} along {secondAxisName.ToUpper()}-axis"
|
||||
Description = $"{eccentricityName} {liverArm} along {secondAxisName.ToUpper()}-axis"
|
||||
};
|
||||
var sumLiverArm = new ValueParameter<string>()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{excentricityName} {liverArm}",
|
||||
Name = $"{eccentricityName} {liverArm}",
|
||||
ShortName = $"z,sum",
|
||||
Text = unitName,
|
||||
Description = $"{excentricityName} {liverArm}"
|
||||
Description = $"{eccentricityName} {liverArm}"
|
||||
};
|
||||
try
|
||||
{
|
||||
@@ -296,15 +297,15 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
catch (Exception ex)
|
||||
{
|
||||
sumLiverArmX.IsValid = false;
|
||||
sumLiverArmX.Value = (double.NaN).ToString();
|
||||
sumLiverArmX.Value = errorValue;
|
||||
sumLiverArmX.Description += $": {ex}";
|
||||
|
||||
sumLiverArmY.IsValid = false;
|
||||
sumLiverArmY.Value = (double.NaN).ToString();
|
||||
sumLiverArmY.Value = errorValue;
|
||||
sumLiverArmY.Description += $": {ex}";
|
||||
|
||||
sumLiverArm.IsValid = false;
|
||||
sumLiverArm.Value = (double.NaN).ToString();
|
||||
sumLiverArm.Value = errorValue;
|
||||
sumLiverArm.Description += $": {ex}";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user