Add calculators saving
This commit is contained in:
@@ -13,13 +13,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
internal class CheckForceCalculatorInputData : ICheckInputDataLogic<IForceInputData>
|
||||
internal class CheckForceCalculatorInputData : ICheckInputDataLogic<IForceCalculatorInputData>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IAccuracy> checkAccuracyLogic;
|
||||
|
||||
public IForceInputData InputData { get; set; }
|
||||
public IForceCalculatorInputData InputData { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
|
||||
@@ -6,29 +6,35 @@ using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculator : ICalculator, IHasActionByResult
|
||||
public class ForceCalculator : IForceCalculator
|
||||
{
|
||||
private IUpdateStrategy<ForceCalculator> updateStrategy;
|
||||
private ICheckInputDataLogic<IForceInputData> checkInputDataLogic;
|
||||
private IUpdateStrategy<IForceCalculator> updateStrategy;
|
||||
private ICheckInputDataLogic<IForceCalculatorInputData> checkInputDataLogic;
|
||||
private IForceCalculatorLogic forceCalculatorLogic;
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; } = Guid.NewGuid();
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
public ForceInputData InputData {get;set;}
|
||||
/// <inheritdoc/>
|
||||
public IForceCalculatorInputData InputData { get; set; } = new ForceCalculatorInputData();
|
||||
/// <inheritdoc/>
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IResult Result { get; private set; }
|
||||
|
||||
public ForceCalculator(ICheckInputDataLogic<IForceInputData> checkInputDataLogic,
|
||||
|
||||
public ForceCalculator(
|
||||
ICheckInputDataLogic<IForceCalculatorInputData> checkInputDataLogic,
|
||||
IForceCalculatorLogic forceCalculatorLogic,
|
||||
IUpdateStrategy<ForceCalculator> updateStrategy
|
||||
IUpdateStrategy<IForceCalculator> updateStrategy
|
||||
)
|
||||
{
|
||||
this.checkInputDataLogic = checkInputDataLogic;
|
||||
this.forceCalculatorLogic = forceCalculatorLogic;
|
||||
this.updateStrategy = updateStrategy;
|
||||
|
||||
InputData = new ForceInputData();
|
||||
}
|
||||
|
||||
public ForceCalculator() :
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
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
|
||||
{
|
||||
public class ForceCalculatorInputData : IForceCalculatorInputData
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public List<LimitStates> LimitStatesList { get; private set; } = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS};
|
||||
public List<CalcTerms> CalcTermsList { get; private set; } = new List<CalcTerms>() {CalcTerms.ShortTerm, CalcTerms.LongTerm};
|
||||
public List<IForceAction> ForceActions { get; private set; } = new();
|
||||
public List<INdmPrimitive> Primitives { get; private set; } = new();
|
||||
public ICompressedMember CompressedMember { get; set; } = new CompressedMember() { Buckling = false};
|
||||
public IAccuracy Accuracy { get; set; } = new Accuracy() {IterationAccuracy = 0.001d, MaxIterationCount = 1000};
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||
|
||||
public ForceCalculatorInputData(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public ForceCalculatorInputData() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculatorInputDataUpdateStrategy : IUpdateStrategy<ForceInputData>
|
||||
public class ForceCalculatorInputDataUpdateStrategy : IUpdateStrategy<IForceCalculatorInputData>
|
||||
{
|
||||
private IUpdateStrategy<IHasPrimitives> primitivesUpdateStrategy;
|
||||
private IUpdateStrategy<IHasForceCombinations> forceCombinationUpdateStrategy;
|
||||
@@ -39,7 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
)
|
||||
{
|
||||
}
|
||||
public void Update(ForceInputData targetObject, ForceInputData sourceObject)
|
||||
public void Update(IForceCalculatorInputData targetObject, IForceCalculatorInputData sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject, "Force calculator input data");
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||
private ForceTupleBucklingLogic bucklingLogic;
|
||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||
public IForceInputData InputData { get; set; }
|
||||
public IForceCalculatorInputData InputData { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
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
|
||||
{
|
||||
public class ForceInputData : IForceInputData
|
||||
{
|
||||
public List<LimitStates> LimitStatesList { get; private set; }
|
||||
public List<CalcTerms> CalcTermsList { get; private set; }
|
||||
public List<IForceAction> ForceActions { get; private set; }
|
||||
public List<INdmPrimitive> Primitives { get; private set; }
|
||||
public ICompressedMember CompressedMember { get; set; }
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||
|
||||
public ForceInputData()
|
||||
{
|
||||
ForceActions = new List<IForceAction>();
|
||||
ForceCombinationLists = new List<IForceCombinationList>();
|
||||
Primitives = new List<INdmPrimitive>();
|
||||
CompressedMember = new CompressedMember()
|
||||
{
|
||||
Buckling = false
|
||||
};
|
||||
Accuracy = new Accuracy()
|
||||
{
|
||||
IterationAccuracy = 0.001d,
|
||||
MaxIterationCount = 1000
|
||||
};
|
||||
LimitStatesList = new List<LimitStates>()
|
||||
{
|
||||
LimitStates.ULS,
|
||||
LimitStates.SLS
|
||||
};
|
||||
CalcTermsList = new List<CalcTerms>()
|
||||
{
|
||||
CalcTerms.ShortTerm,
|
||||
CalcTerms.LongTerm
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public ForceTupleCalculator(ICheckInputDataLogic<IForceTupleInputData> checkInputDataLogic, IForceTupleCalcLogic calcLogic)
|
||||
{
|
||||
this.checkInputDataLogic = checkInputDataLogic;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceCalculator : ICalculator, IHasActionByResult
|
||||
{
|
||||
IForceCalculatorInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
||||
public interface IForceCalculatorInputData : IInputData, ISaveable, IHasPrimitives, IHasForceCombinations
|
||||
{
|
||||
IAccuracy Accuracy { get; set; }
|
||||
List<CalcTerms> CalcTermsList { get; }
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceCalculatorLogic : ILogic, IHasActionByResult
|
||||
{
|
||||
IForceInputData InputData { get; set; }
|
||||
IForceCalculatorInputData InputData { get; set; }
|
||||
ForcesResults GetForcesResults();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public LimitCurveCalculator(ILimitCurveLogic limitCurveLogic)
|
||||
{
|
||||
this.limitCurveLogic = limitCurveLogic;
|
||||
|
||||
@@ -5,20 +5,21 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<ForceCalculator>
|
||||
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<IForceCalculator>
|
||||
{
|
||||
private readonly IUpdateStrategy<ForceInputData> inputDataUpdateStrategy;
|
||||
public ForceCalculatorUpdateStrategy(IUpdateStrategy<ForceInputData> inputDataUpdateStrategy)
|
||||
private readonly IUpdateStrategy<IForceCalculatorInputData> inputDataUpdateStrategy;
|
||||
public ForceCalculatorUpdateStrategy(IUpdateStrategy<IForceCalculatorInputData> inputDataUpdateStrategy)
|
||||
{
|
||||
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
|
||||
}
|
||||
public ForceCalculatorUpdateStrategy() : this(new ForceCalculatorInputDataUpdateStrategy()) { }
|
||||
public void Update(ForceCalculator targetObject, ForceCalculator sourceObject)
|
||||
public void Update(IForceCalculator targetObject, IForceCalculator sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.InputData ??= new ForceInputData();
|
||||
targetObject.InputData ??= new ForceCalculatorInputData();
|
||||
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||
{
|
||||
parametersLogic = new TextParametersLogic(ndms, strainMatrix);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
||||
public static class InputDataFactory
|
||||
{
|
||||
private static IStressLogic stressLogic => new StressLogic();
|
||||
public static IAnchorageInputData GetInputData(RebarPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
||||
public static IAnchorageInputData GetInputData(RebarNdmPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
||||
{
|
||||
var inputData = new AnchorageInputData();
|
||||
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
|
||||
@@ -47,7 +47,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
||||
return inputData;
|
||||
}
|
||||
|
||||
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
||||
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, RebarNdmPrimitive primitive)
|
||||
{
|
||||
if (primitive.HostPrimitive is not null)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host material is incorrect or null");
|
||||
}
|
||||
|
||||
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
||||
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, RebarNdmPrimitive primitive)
|
||||
{
|
||||
if (primitive.NdmElement.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user