Add calculators saving

This commit is contained in:
Evgeny Redikultsev
2024-10-19 20:32:25 +05:00
parent d16c0e1f79
commit d3a1992f4d
131 changed files with 1742 additions and 375 deletions

View File

@@ -25,11 +25,15 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private IUpdateStrategy<ICrackCalculator> updateStrategy;
private ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic;
public Guid Id { get; } = Guid.NewGuid();
public string Name { get; set; }
public ICrackCalculatorInputData InputData { get; set; }
public IResult Result => result;
public IShiftTraceLogger? TraceLogger { get; set; }
public CrackCalculator(ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic,
IUpdateStrategy<ICrackCalculator> updateStrategy,
IShiftTraceLogger traceLogger

View File

@@ -12,16 +12,16 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackCalculatorInputData : ICrackCalculatorInputData
{
public Guid Id { get; } = new();
/// <inheritdoc/>
public List<INdmPrimitive> Primitives { get; private set; }
public List<INdmPrimitive> Primitives { get; private set; } = new();
/// <inheritdoc/>
public List<IForceAction> ForceActions { get; private set; }
public IUserCrackInputData UserCrackInputData { get; set; }
public CrackCalculatorInputData()
public List<IForceAction> ForceActions { get; private set; } = new();
public IUserCrackInputData UserCrackInputData { get; set; } = GetNewUserData();
private static UserCrackInputData GetNewUserData()
{
Primitives = new();
ForceActions = new();
UserCrackInputData = new UserCrackInputData()
return new UserCrackInputData()
{
SetSofteningFactor = true,
SofteningFactor = 1d,

View File

@@ -19,7 +19,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public CrackCalculatorUpdateStrategy() : this(new CrackInputDataUpdateStrategy()) { }
public void Update(ICrackCalculator targetObject, ICrackCalculator sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Name = sourceObject.Name;

View File

@@ -30,6 +30,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public IShiftTraceLogger? TraceLogger { get; set; }
public Guid Id => throw new NotImplementedException();
public CrackForceBynarySearchCalculator(
IIsSectionCrackedByFactorLogic crackedByFactorLogic,
ICheckInputDataLogic<ICrackForceCalculatorInputData> checkInputDataLogic

View File

@@ -17,6 +17,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public IShiftTraceLogger? TraceLogger { get; set; }
public Guid Id => throw new NotImplementedException();
public object Clone()
{
throw new NotImplementedException();

View File

@@ -22,7 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
}
public void Update(ICrackCalculatorInputData targetObject, ICrackCalculatorInputData sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.ForceActions.Clear();
targetObject.ForceActions.AddRange(sourceObject.ForceActions);

View File

@@ -70,14 +70,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
}
/// <inheritdoc/>
public List<IRebarPrimitive> GetRebarPrimitives()
public List<IRebarNdmPrimitive> GetRebarPrimitives()
{
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
List<IRebarPrimitive> rebarPrimitives = new();
List<IRebarNdmPrimitive> rebarPrimitives = new();
foreach (var item in NdmPrimitives)
{
if (item is IRebarPrimitive rebar)
if (item is IRebarNdmPrimitive rebar)
{
TraceLogger?.AddMessage($"Primitive {rebar.Name} is rebar primitive", TraceLogStatuses.Service);
rebarPrimitives.Add(rebar);

View File

@@ -5,7 +5,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface ICrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceCombinations
public interface ICrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceCombinations, ISaveable
{
List<IForceAction> ForceActions { get; }
List<INdmPrimitive> Primitives { get; }

View File

@@ -37,6 +37,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// Return collection of primitives which contain only rebars
/// </summary>
/// <returns></returns>
List<IRebarPrimitive> GetRebarPrimitives();
List<IRebarNdmPrimitive> GetRebarPrimitives();
}
}

View File

@@ -7,7 +7,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
TupleCrackInputData InputData { get; set; }
double LongLength { get; set; }
IEnumerable<IRebarPrimitive> Rebars { get; set; }
IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
double ShortLength { get; set; }
List<IRebarCrackCalculator> GetCalculators();

View File

@@ -19,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Rebar primitive
/// </summary>
IRebarPrimitive RebarPrimitive { get; set; }
IRebarNdmPrimitive RebarPrimitive { get; set; }
/// <summary>
/// User settings for crack calculations
/// </summary>

View File

@@ -4,7 +4,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface IRebarCrackInputDataFactory
{
IRebarPrimitive Rebar { get; set; }
IRebarNdmPrimitive Rebar { get; set; }
TupleCrackInputData InputData { get; set; }
double LongLength { get; set; }
double ShortLength { get; set; }

View File

@@ -26,6 +26,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Rebar which stress and strain will be obtained for
/// </summary>
IRebarPrimitive RebarPrimitive { get; set; }
IRebarNdmPrimitive RebarPrimitive { get; set; }
}
}

View File

@@ -6,7 +6,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public interface IRebarStressResultLogic : ILogic
{
IRebarCrackInputData RebarCrackInputData { get; set; }
IRebarPrimitive RebarPrimitive { get; set; }
IRebarNdmPrimitive RebarPrimitive { get; set; }
IRebarStressResult GetRebarStressResult();
}

View File

@@ -9,7 +9,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
TupleCrackInputData InputData { get; set; }
bool IsResultValid { get; }
double LongLength { get; set; }
IEnumerable<IRebarPrimitive> Rebars { get; set; }
IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
List<RebarCrackResult> Result { get; }
double ShortLength { get; set; }

View File

@@ -1,8 +1,9 @@
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface IUserCrackInputData : IInputData
public interface IUserCrackInputData : IInputData, ISaveable
{
double LengthBetweenCracks { get; set; }
bool SetLengthBetweenCracks { get; set; }

View File

@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
private IRebarCrackInputDataFactory inputFactory;
public IEnumerable<IRebarPrimitive> Rebars { get; set; }
public IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
public TupleCrackInputData InputData { get; set; }
public double LongLength { get; set; }
public double ShortLength { get; set; }

View File

@@ -22,6 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public Action<IResult> ActionToOutputResults { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public Guid Id => throw new NotImplementedException();
public RebarCrackCalculator(ICheckInputDataLogic<IRebarCrackCalculatorInputData> checkInputDataLogic,
ICrackWidthCalculationLogic crackWidthCalculationLogic,
IShiftTraceLogger? traceLogger)

View File

@@ -19,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/>
public IRebarCrackInputData? ShortRebarData { get; set; }
/// <inheritdoc/>
public IRebarPrimitive RebarPrimitive { get; set; }
public IRebarNdmPrimitive RebarPrimitive { get; set; }
/// <inheritdoc/>
public IUserCrackInputData? UserCrackInputData { get; set; }
}

View File

@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
}
public IRebarPrimitive Rebar { get; set; }
public IRebarNdmPrimitive Rebar { get; set; }
public TupleCrackInputData InputData { get; set; }
public double LongLength { get; set; }
public double ShortLength { get; set; }
@@ -41,9 +41,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
IEnumerable<INdm> crackableNdmsLoc = null;
IEnumerable<INdm> crackedNdmsLoc = null;
INdm concreteNdmUnderRebar;
RebarPrimitive rebarCopy = null;
RebarNdmPrimitive rebarCopy = null;
rebarCopy = Rebar.Clone() as RebarPrimitive;
rebarCopy = Rebar.Clone() as RebarNdmPrimitive;
rebarCopy.NdmElement.HeadMaterial = rebarCopy.NdmElement.HeadMaterial.Clone() as IHeadMaterial;
triangulationLogicLoc = new CrackedSectionTriangulationLogic(InputData.Primitives);
crackableNdmsLoc = triangulationLogicLoc.GetNdmCollection();

View File

@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Specific rebar primitive
/// </summary>
public IRebarPrimitive RebarPrimitive { get; set; }
public IRebarNdmPrimitive RebarPrimitive { get; set; }
/// <summary>
/// Result of calculation of crack for long term
/// </summary>

View File

@@ -28,6 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public IShiftTraceLogger? TraceLogger { get; set; }
public Guid Id => throw new NotImplementedException();
public RebarStressCalculator(IStressLogic stressLogic)
{

View File

@@ -17,6 +17,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/>
public IEnumerable<INdm> NdmCollection { get; set; }
/// <inheritdoc/>
public IRebarPrimitive RebarPrimitive { get; set; }
public IRebarNdmPrimitive RebarPrimitive { get; set; }
}
}

View File

@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public class RebarStressResultLogic : IRebarStressResultLogic
{
private IRebarStressCalculator rebarStressCalculator;
public IRebarPrimitive RebarPrimitive { get; set; }
public IRebarNdmPrimitive RebarPrimitive { get; set; }
public IRebarCrackInputData RebarCrackInputData { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }

View File

@@ -37,7 +37,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private double rebarActualStress;
private double softeningFactor;
private double minValueOfFactor = 0.2d;
private IRebarPrimitive rebarPrimitive;
private IRebarNdmPrimitive rebarPrimitive;
private IRebarCrackInputData inputData;
public double MinValueOfFactor
@@ -48,7 +48,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
IsResultActual = false;
}
}
public IRebarPrimitive RebarPrimitive
public IRebarNdmPrimitive RebarPrimitive
{
get => rebarPrimitive; set
{

View File

@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private TupleCrackResult result;
private ICrackedSectionTriangulationLogic triangulationLogic;
private ITupleRebarsCrackSolver solver;
private List<IRebarPrimitive>? rebarPrimitives;
private List<IRebarNdmPrimitive>? rebarPrimitives;
private IEnumerable<INdm> crackableNdms;
private IEnumerable<INdm> crackedNdms;
private IEnumerable<INdm> elasticNdms;
@@ -43,6 +43,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public IShiftTraceLogger? TraceLogger { get; set; }
public Guid Id => throw new NotImplementedException();
public TupleCrackCalculator(ICheckInputDataLogic<TupleCrackInputData> checkInputDataLogic,
ILengthBetweenCracksLogic lengthLogic, ICrackedSectionTriangulationLogic triangulationLogic, ITupleRebarsCrackSolver solver)
{

View File

@@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
private IRebarCalulatorsFactory calculatorsFactory;
public IEnumerable<IRebarPrimitive> Rebars { get; set; }
public IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
public TupleCrackInputData InputData { get; set; }
public double LongLength { get; set; }
public double ShortLength { get; set; }

View File

@@ -12,6 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// </summary>
public class UserCrackInputData : IUserCrackInputData
{
public Guid Id { get; } = new();
/// <summary>
/// Flag of assigning of user value of softening factor
/// </summary>
@@ -36,5 +37,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// Ultimate short-term crack width, m
/// </summary>
public double UltimateShortCrackWidth { get; set; }
}
}

View File

@@ -12,8 +12,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
public void Update(IUserCrackInputData targetObject, IUserCrackInputData sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
CheckObject.CompareTypes(targetObject, sourceObject);
targetObject.SetSofteningFactor = sourceObject.SetSofteningFactor;
targetObject.SofteningFactor = sourceObject.SofteningFactor;