Add calculators saving
This commit is contained in:
@@ -13,7 +13,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
public class CircleGeometryLogic : IRCGeometryLogic
|
||||
{
|
||||
ICircleTemplate template;
|
||||
EllipsePrimitive concreteBlock;
|
||||
EllipseNdmPrimitive concreteBlock;
|
||||
|
||||
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
var diameter = template.Shape.Diameter;
|
||||
var concreteMaterial = HeadMaterials.ToList()[0];
|
||||
var primitives = new List<INdmPrimitive>();
|
||||
concreteBlock = new EllipsePrimitive() { Width = diameter, Name = "Concrete block"};
|
||||
concreteBlock = new EllipseNdmPrimitive() { Width = diameter, Name = "Concrete block"};
|
||||
concreteBlock.NdmElement.HeadMaterial = concreteMaterial;
|
||||
primitives.Add(concreteBlock);
|
||||
return primitives;
|
||||
@@ -53,7 +53,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
var angle = i * dAngle;
|
||||
var x = radius * Math.Sin(angle);
|
||||
var y = radius * Math.Cos(angle);
|
||||
var point = new RebarPrimitive()
|
||||
var point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = barArea,
|
||||
Name = "Left bottom point",
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
IRectangleBeamTemplate template;
|
||||
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
||||
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
||||
RectanglePrimitive concreteBlock;
|
||||
RectangleNdmPrimitive concreteBlock;
|
||||
|
||||
RectangleShape rect => template.Shape as RectangleShape;
|
||||
double width => rect.Width;
|
||||
@@ -48,7 +48,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
||||
{
|
||||
var primitives = new List<INdmPrimitive>();
|
||||
concreteBlock = new RectanglePrimitive() { Width = width, Height = height, Name = "Concrete block" };
|
||||
concreteBlock = new RectangleNdmPrimitive() { Width = width, Height = height, Name = "Concrete block" };
|
||||
concreteBlock.NdmElement.HeadMaterial = concrete;
|
||||
primitives.Add(concreteBlock);
|
||||
return primitives;
|
||||
@@ -60,7 +60,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||
var point = new RebarPrimitive()
|
||||
var point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = "Left bottom rebar",
|
||||
@@ -71,7 +71,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
point.Center.X = xs[0];
|
||||
point.Center.Y = ys[0];
|
||||
primitives.Add(point);
|
||||
point = new RebarPrimitive()
|
||||
point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = "Right bottom rebar",
|
||||
@@ -81,7 +81,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
point.Center.X = xs[1];
|
||||
point.Center.Y = ys[0];
|
||||
primitives.Add(point);
|
||||
point = new RebarPrimitive()
|
||||
point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area2,
|
||||
Name = "Left top rebar",
|
||||
@@ -91,7 +91,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
point.Center.X = xs[0];
|
||||
point.Center.Y = ys[1];
|
||||
primitives.Add(point);
|
||||
point = new RebarPrimitive()
|
||||
point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area2,
|
||||
Name = "Right top rebar",
|
||||
@@ -110,14 +110,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||
IPointPrimitive point;
|
||||
IPointNdmPrimitive point;
|
||||
if (template.WidthCount > 2)
|
||||
{
|
||||
int count = template.WidthCount - 1;
|
||||
double dist = (xs[1] - xs[0]) / count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
point = new RebarPrimitive()
|
||||
point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = $"Bottom rebar {i}",
|
||||
@@ -127,7 +127,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
point.Center.X = xs[0] + dist * i;
|
||||
point.Center.Y = ys[0];
|
||||
primitives.Add(point);
|
||||
point = new RebarPrimitive()
|
||||
point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area2,
|
||||
Name = $"Top rebar {i}",
|
||||
@@ -145,7 +145,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
double dist = (ys[1] - ys[0]) / count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
point = new RebarPrimitive()
|
||||
point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = $"Left point {i}",
|
||||
@@ -155,7 +155,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
point.Center.X = xs[0];
|
||||
point.Center.Y = ys[0] + dist * i;
|
||||
primitives.Add(point);
|
||||
point = new RebarPrimitive()
|
||||
point = new RebarNdmPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = $"Right point {i}",
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients()
|
||||
{
|
||||
var (DX, DY) = GetStiffness();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public RebarStressCalculator(IStressLogic stressLogic)
|
||||
{
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class EllipsePrimitive : IEllipsePrimitive
|
||||
public class EllipseNdmPrimitive : IEllipseNdmPrimitive
|
||||
{
|
||||
private static readonly EllipsePrimitiveUpdateStrategy updateStrategy = new();
|
||||
private readonly RectangleShape rectangleShape = new();
|
||||
@@ -45,19 +45,19 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public IDivisionSize DivisionSize { get; } = new DivisionSize();
|
||||
/// <inheritdoc/>
|
||||
public IShape Shape => rectangleShape;
|
||||
/// <inheritdoc/>
|
||||
public double RotationAngle { get; set; }
|
||||
|
||||
public double Angle { get; set; }
|
||||
|
||||
public EllipsePrimitive(Guid id)
|
||||
public EllipseNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Circle";
|
||||
}
|
||||
public EllipsePrimitive() : this (Guid.NewGuid()) {}
|
||||
public EllipseNdmPrimitive() : this (Guid.NewGuid()) {}
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new EllipsePrimitive();
|
||||
var primitive = new EllipseNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IEllipsePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
public interface IEllipseNdmPrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <summary>
|
||||
/// Geometry primitive of point
|
||||
/// </summary>
|
||||
public interface IPointPrimitive : INdmPrimitive, IPointShape
|
||||
public interface IPointNdmPrimitive : INdmPrimitive, IPointShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <summary>
|
||||
/// Geometry primitive of rebar (bar of reinforcement)
|
||||
/// </summary>
|
||||
public interface IRebarPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||
public interface IRebarNdmPrimitive : IPointNdmPrimitive, IHasHostPrimitive
|
||||
{
|
||||
Ndm GetConcreteNdm(ITriangulationOptions triangulationOptions);
|
||||
RebarNdm GetRebarNdm(ITriangulationOptions triangulationOptions);
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IRectanglePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
public interface IRectangleNdmPrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
}
|
||||
targetObject.NdmElement.Triangulate = sourceObject.NdmElement.Triangulate;
|
||||
point2DUpdateStrategy.Update(targetObject.Center, sourceObject.Center);
|
||||
targetObject.RotationAngle = sourceObject.RotationAngle;
|
||||
visualPropsUpdateStrategy.Update(targetObject.VisualProperty, sourceObject.VisualProperty);
|
||||
tupleUpdateStrategy.Update(targetObject.NdmElement.UsersPrestrain, sourceObject.NdmElement.UsersPrestrain);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
foreach (var primitive in HasPrimitives.Primitives)
|
||||
{
|
||||
if (primitive is IRebarPrimitive rebar)
|
||||
if (primitive is IRebarNdmPrimitive rebar)
|
||||
{
|
||||
CheckRebar(rebar);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRebar(IRebarPrimitive rebar)
|
||||
private void CheckRebar(IRebarNdmPrimitive rebar)
|
||||
{
|
||||
if (checkRebarPrimitiveLogic is null)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
private string checkResult;
|
||||
private bool result;
|
||||
|
||||
public IRebarPrimitive RebarPrimitive { get; set; }
|
||||
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class EllipsePrimitiveUpdateStrategy : IUpdateStrategy<IEllipsePrimitive>
|
||||
public class EllipsePrimitiveUpdateStrategy : IUpdateStrategy<IEllipseNdmPrimitive>
|
||||
{
|
||||
private IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy;
|
||||
private IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy;
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
|
||||
}
|
||||
public void Update(IEllipsePrimitive targetObject, IEllipsePrimitive sourceObject)
|
||||
public void Update(IEllipseNdmPrimitive targetObject, IEllipseNdmPrimitive sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, "source object");
|
||||
CheckObject.IsNull(targetObject, "target object");
|
||||
|
||||
@@ -9,6 +9,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public interface ICheckRebarPrimitiveLogic : ICheckLogic
|
||||
{
|
||||
IRebarPrimitive RebarPrimitive { get; set; }
|
||||
IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,21 +11,21 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
if (targetObject is PointPrimitive point)
|
||||
if (targetObject is PointNdmPrimitive point)
|
||||
{
|
||||
new PointUpdateStrategy().Update(point, (PointPrimitive)sourceObject);
|
||||
new PointPrimitiveUpdateStrategy().Update(point, (PointNdmPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is RebarPrimitive rebar)
|
||||
else if (targetObject is RebarNdmPrimitive rebar)
|
||||
{
|
||||
new RebarUpdateStrategy().Update(rebar, (RebarPrimitive)sourceObject);
|
||||
new RebarNdmPrimitiveUpdateStrategy().Update(rebar, (RebarNdmPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is RectanglePrimitive rectangle)
|
||||
else if (targetObject is RectangleNdmPrimitive rectangle)
|
||||
{
|
||||
new RectanglePrimitiveUpdateStrategy().Update(rectangle, (RectanglePrimitive)sourceObject);
|
||||
new RectanglePrimitiveUpdateStrategy().Update(rectangle, (RectangleNdmPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is EllipsePrimitive circle)
|
||||
else if (targetObject is EllipseNdmPrimitive circle)
|
||||
{
|
||||
new EllipsePrimitiveUpdateStrategy().Update(circle, (EllipsePrimitive)sourceObject);
|
||||
new EllipsePrimitiveUpdateStrategy().Update(circle, (EllipseNdmPrimitive)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class PointUpdateStrategy : IUpdateStrategy<PointPrimitive>
|
||||
public class PointPrimitiveUpdateStrategy : IUpdateStrategy<IPointNdmPrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
public void Update(PointPrimitive targetObject, PointPrimitive sourceObject)
|
||||
public void Update(IPointNdmPrimitive targetObject, IPointNdmPrimitive sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
@@ -7,12 +7,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RebarUpdateStrategy : IUpdateStrategy<RebarPrimitive>
|
||||
public class RebarNdmPrimitiveUpdateStrategy : IUpdateStrategy<IRebarNdmPrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
public void Update(RebarPrimitive targetObject, RebarPrimitive sourceObject)
|
||||
public void Update(IRebarNdmPrimitive targetObject, IRebarNdmPrimitive sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
if (sourceObject.HostPrimitive is not null)
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.Area = sourceObject.Area;
|
||||
targetObject.HostPrimitive = sourceObject.HostPrimitive;
|
||||
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RectanglePrimitiveUpdateStrategy : IUpdateStrategy<IRectanglePrimitive>
|
||||
public class RectanglePrimitiveUpdateStrategy : IUpdateStrategy<IRectangleNdmPrimitive>
|
||||
{
|
||||
private IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy;
|
||||
private IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy;
|
||||
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
}
|
||||
|
||||
public void Update(IRectanglePrimitive targetObject, IRectanglePrimitive sourceObject)
|
||||
public void Update(IRectangleNdmPrimitive targetObject, IRectangleNdmPrimitive sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, "source object");
|
||||
CheckObject.IsNull(targetObject, "target object");
|
||||
|
||||
@@ -9,9 +9,9 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class PointPrimitive : IPointPrimitive
|
||||
public class PointNdmPrimitive : IPointNdmPrimitive
|
||||
{
|
||||
static readonly PointUpdateStrategy updateStrategy = new();
|
||||
static readonly PointPrimitiveUpdateStrategy updateStrategy = new();
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; }
|
||||
public IPoint2D Center { get; set; }
|
||||
@@ -25,19 +25,21 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
|
||||
public IShape Shape => throw new NotImplementedException();
|
||||
|
||||
public PointPrimitive(Guid id)
|
||||
public double RotationAngle { get; set; } = 0d;
|
||||
|
||||
public PointNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
}
|
||||
public PointPrimitive() : this (Guid.NewGuid())
|
||||
public PointNdmPrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new PointPrimitive();
|
||||
var primitive = new PointNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -20,9 +20,9 @@ using System.Windows.Media.Media3D;
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class RebarPrimitive : IRebarPrimitive
|
||||
public class RebarNdmPrimitive : IRebarNdmPrimitive
|
||||
{
|
||||
static readonly RebarUpdateStrategy updateStrategy = new();
|
||||
static readonly RebarNdmPrimitiveUpdateStrategy updateStrategy = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
@@ -43,21 +43,23 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IShape Shape => throw new NotImplementedException();
|
||||
|
||||
public RebarPrimitive(Guid id)
|
||||
public double RotationAngle { get; set; } = 0d;
|
||||
|
||||
public RebarNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Reinforcement";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
}
|
||||
public RebarPrimitive() : this(Guid.NewGuid())
|
||||
public RebarNdmPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new RebarPrimitive();
|
||||
var primitive = new RebarNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
public class RectangleNdmPrimitive : IRectangleNdmPrimitive
|
||||
{
|
||||
private readonly RectanglePrimitiveUpdateStrategy updateStrategy = new();
|
||||
private readonly RectangleShape rectangleShape = new();
|
||||
@@ -17,7 +17,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public string Name { get; set; }
|
||||
public double Width { get => rectangleShape.Width; set => rectangleShape.Width = value; }
|
||||
public double Height { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
||||
public double Angle { get => rectangleShape.Angle; set => rectangleShape.Angle = value; }
|
||||
public IVisualProperty VisualProperty { get; } = new VisualProperty() { Opacity = 0.8d };
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
@@ -29,19 +28,21 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IShape Shape => rectangleShape;
|
||||
|
||||
public RectanglePrimitive(Guid id)
|
||||
public double RotationAngle { get; set; } = 0d;
|
||||
|
||||
public RectangleNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Rectangle";
|
||||
}
|
||||
public RectanglePrimitive() : this(Guid.NewGuid())
|
||||
public RectangleNdmPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new RectanglePrimitive();
|
||||
var primitive = new RectangleNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
@@ -13,9 +14,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
public class CircleTriangulationLogicOptions : IShapeTriangulationLogicOptions
|
||||
{
|
||||
public ICircleShape Circle { get; }
|
||||
public ICircleShape Circle { get;}
|
||||
|
||||
public IPoint2D Center { get; }
|
||||
public IPoint2D Center { get; set; }
|
||||
|
||||
public double NdmMaxSize { get; }
|
||||
|
||||
@@ -24,8 +25,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
public StrainTuple Prestrain { get; set; }
|
||||
public ITriangulationOptions triangulationOptions { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
public double RotationAngle { get; set; }
|
||||
|
||||
public CircleTriangulationLogicOptions(IEllipsePrimitive primitive)
|
||||
public CircleTriangulationLogicOptions(IEllipseNdmPrimitive primitive)
|
||||
{
|
||||
Center = primitive.Center.Clone() as Point2D;
|
||||
//to do change to ellipse
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
public interface IShapeTriangulationLogicOptions : ITriangulationLogicOptions
|
||||
public interface IShapeTriangulationLogicOptions : ITriangulationLogicOptions, IHasCenter2D
|
||||
{
|
||||
/// <summary>
|
||||
/// Center of shape
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
public PointTriangulationLogicOptions(IPointPrimitive primitive)
|
||||
public PointTriangulationLogicOptions(IPointNdmPrimitive primitive)
|
||||
{
|
||||
Center = primitive.Center.Clone() as Point2D;
|
||||
Area = primitive.Area;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public RebarTriangulationLogicOptions(RebarPrimitive primitive)
|
||||
public RebarTriangulationLogicOptions(RebarNdmPrimitive primitive)
|
||||
{
|
||||
Center = primitive.Center.Clone() as Point2D;
|
||||
Area = primitive.Area;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
|
||||
});
|
||||
TriangulationService.CommonTransform(ndmCollection, options);
|
||||
double angle = options.Rectangle.Angle;
|
||||
double angle = options.RotationAngle;
|
||||
NdmTransform.Rotate(ndmCollection, angle);
|
||||
TriangulationService.SetPrestrain(ndmCollection, options.Prestrain);
|
||||
return ndmCollection;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
@@ -10,7 +11,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
public class RectangleTriangulationLogicOptions : IShapeTriangulationLogicOptions
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public IPoint2D Center { get; }
|
||||
public IPoint2D Center { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double RotationAngle { get; set; } = 0d;
|
||||
/// <inheritdoc />
|
||||
public IRectangleShape Rectangle { get; }
|
||||
/// <inheritdoc />
|
||||
@@ -31,9 +34,10 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
Prestrain = new StrainTuple();
|
||||
}
|
||||
|
||||
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
|
||||
public RectangleTriangulationLogicOptions(IRectangleNdmPrimitive primitive)
|
||||
{
|
||||
Center = new Point2D() {X = primitive.Center.X, Y = primitive.Center.Y };
|
||||
RotationAngle = primitive.RotationAngle;
|
||||
Rectangle = primitive;
|
||||
NdmMaxSize = primitive.DivisionSize.NdmMaxSize;
|
||||
NdmMinDivision = primitive.DivisionSize.NdmMinDivision;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
ProcessICracked(ndmCollection);
|
||||
}
|
||||
else if (Primitive is RebarPrimitive rebar)
|
||||
else if (Primitive is RebarNdmPrimitive rebar)
|
||||
{
|
||||
ProcessRebar(ndmCollection, rebar);
|
||||
}
|
||||
@@ -52,10 +52,10 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
ndmCollection.AddRange(ndms);
|
||||
}
|
||||
|
||||
private void ProcessRebar(List<INdm> ndmCollection, RebarPrimitive rebar)
|
||||
private void ProcessRebar(List<INdm> ndmCollection, RebarNdmPrimitive rebar)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Primitive {Primitive.Name} is rebar primitive", TraceLogStatuses.Service);
|
||||
var newPrimititve = rebar.Clone() as RebarPrimitive;
|
||||
var newPrimititve = rebar.Clone() as RebarNdmPrimitive;
|
||||
var newHostPrimitive = rebar.HostPrimitive.Clone() as INdmPrimitive;
|
||||
SetNewMaterial(newHostPrimitive);
|
||||
newPrimititve.HostPrimitive = newHostPrimitive;
|
||||
|
||||
Reference in New Issue
Block a user