Crack Calculator was added

This commit is contained in:
Evgeny Redikultsev
2023-07-16 17:21:28 +05:00
parent 3e0e51d0c9
commit d7a4b1f0a7
108 changed files with 1523 additions and 565 deletions

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IDecoratorOption : IMaterialOption
{
}
}

View File

@@ -0,0 +1,57 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Services;
using StructureHelperLogics.MaterialBuilders.Decorators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal class RestrictStrainDecorator : IMaterialBuilder
{
IMaterialBuilder builder;
public IMaterialOption MaterialOption { get; set; }
public RestrictStrainDecorator(IMaterialBuilder builder)
{
this.builder = builder;
}
public IMaterial GetMaterial()
{
CheckOptions();
var option = (RestrictStrainOption)MaterialOption;
var material = new Material();
material.InitModulus = builder.GetMaterial().InitModulus;
material.DiagramParameters = new List<double>()
{
option.MaxTensileStrain,
option.MaxCompessionStrain
};
material.Diagram = GetStressDiagram;
return material;
}
private void CheckOptions()
{
CheckObject.CompareTypes(typeof(RestrictStrainOption), MaterialOption.GetType());
}
private double GetStressDiagram(IEnumerable<double> parameters, double strain)
{
var maxTensileStrain = parameters.ToList()[0];
var maxCompressionStrain = parameters.ToList()[1];
if (strain > maxTensileStrain || strain < maxCompressionStrain)
{
return 0d;
}
else
{
var material = builder.GetMaterial();
return material.Diagram.Invoke(parameters, strain);
}
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders.Decorators
{
internal class RestrictStrainOption : IDecoratorOption
{
private double maxTensileStrain;
private double maxCompessionStrain;
public double MaxTensileStrain
{
get => maxTensileStrain;
set
{
if (value < 0d)
{
//to do exception
}
maxTensileStrain = value;
}
}
public double MaxCompessionStrain { get => maxCompessionStrain; set => maxCompessionStrain = value; }
}
}

View File

@@ -0,0 +1,19 @@
using LoaderCalculator.Data.Materials.MaterialBuilders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IBearingOption : IMaterialOption
{
double InitModulus { get; set; }
double Strength { get; set; }
LimitStates LimitState { get; set; }
bool IsShortTerm { get; set; }
CodesType CodesType { get; set; }
IPartialFactor ExternalFactor { get; }
}
}

View File

@@ -0,0 +1,15 @@
using LoaderCalculator.Data.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IMaterialBuilder
{
IMaterialOption MaterialOption { get; set; }
IMaterial GetMaterial();
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IMaterialOption
{
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IPartialFactor
{
double YoungsModulus { get; set; }
double Compressive { get; set; }
double Tensile { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Analyses;
@@ -16,14 +17,14 @@ namespace StructureHelperLogics.Models.CrossSections
public List<IForceAction> ForceActions { get; private set; }
public List<IHeadMaterial> HeadMaterials { get; private set; }
public List<INdmPrimitive> Primitives { get; }
public List<INdmCalculator> CalculatorsList { get; private set; }
public List<ICalculator> CalculatorsList { get; private set; }
public CrossSectionRepository()
{
ForceActions = new List<IForceAction>();
HeadMaterials = new List<IHeadMaterial>();
Primitives = new List<INdmPrimitive>();
CalculatorsList = new List<INdmCalculator>();
CalculatorsList = new List<ICalculator>();
}
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Primitives;
@@ -15,6 +16,6 @@ namespace StructureHelperLogics.Models.CrossSections
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
{
List<IForceAction> ForceActions { get; }
List<INdmCalculator> CalculatorsList { get; }
List<ICalculator> CalculatorsList { get; }
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
@@ -10,9 +11,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
{
internal class CalculatorLogic : ICalculatorLogic
{
public IEnumerable<INdmCalculator> GetNdmCalculators()
public IEnumerable<ICalculator> GetNdmCalculators()
{
var calculators = new List<INdmCalculator>();
var calculators = new List<ICalculator>();
calculators.Add(new ForceCalculator() { Name = "New Force Calculator"});
return calculators;
}

View File

@@ -1,14 +1,9 @@
using StructureHelperLogics.NdmCalculations.Analyses;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureHelperCommon.Models.Calculators;
namespace StructureHelperLogics.Models.Templates.CrossSections
{
internal interface ICalculatorLogic
{
IEnumerable<INdmCalculator> GetNdmCalculators();
IEnumerable<ICalculator> GetNdmCalculators();
}
}

View File

@@ -52,13 +52,14 @@ 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 ReinforcementPrimitive()
{ CenterX = x,
CenterY = y,
var point = new RebarPrimitive()
{
Area = barArea,
Name = "Left bottom point",
HeadMaterial = reinforcementMaterial,
HostPrimitive=concreteBlock };
point.Center.X = x;
point.Center.Y = y;
primitives.Add(point);
}
return primitives;

View File

@@ -59,13 +59,45 @@ 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 ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point", HeadMaterial = reinforcement, HostPrimitive=concreteBlock };
var point = new RebarPrimitive()
{
Area = area1,
Name = "Left bottom point",
HeadMaterial = reinforcement,
HostPrimitive=concreteBlock
};
point.Center.X = xs[0];
point.Center.Y = ys[0];
primitives.Add(point);
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive()
{
Area = area1,
Name = "Right bottom point",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.Center.X = xs[1];
point.Center.Y = ys[0];
primitives.Add(point);
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive()
{
Area = area2,
Name = "Left top point",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.Center.X = xs[0];
point.Center.Y = ys[1];
primitives.Add(point);
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive()
{
Area = area2,
Name = "Right top point",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.Center.X = xs[1];
point.Center.Y = ys[1];
primitives.Add(point);
return primitives;
}
@@ -83,10 +115,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
double dist = (xs[1] - xs[0]) / count;
for (int i = 1; i < count; i++)
{
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
primitives.Add(point);
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive() { Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point.Center.X = xs[0] + dist * i;
point.Center.Y = ys[0];
primitives.Add(point);
point = new RebarPrimitive() {Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point.Center.X = xs[0] + dist * i;
point.Center.Y = ys[1];
primitives.Add(point);
}
}
if (template.HeightCount > 2)
@@ -95,9 +131,25 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
double dist = (ys[1] - ys[0]) / count;
for (int i = 1; i < count; i++)
{
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive()
{
Area = area1,
Name = $"Left point {i}",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.Center.X = xs[0];
point.Center.Y = ys[0] + dist * i;
primitives.Add(point);
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive()
{
Area = area1,
Name = $"Right point {i}",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.Center.X = xs[1];
point.Center.Y = ys[0] + dist * i;
primitives.Add(point);
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Templates.RCs;
@@ -20,7 +21,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
ICalculatorLogic calculatorLogic;
IEnumerable<INdmPrimitive> primitives;
IEnumerable<IForceAction> combinations;
IEnumerable<INdmCalculator> calculators;
IEnumerable<ICalculator> calculators;
public SectionTemplate(IRCGeometryLogic geometryLogic)
{

View File

@@ -1,33 +1,26 @@
using LoaderCalculator;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.SourceData;
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Sections;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Calculations;
using StructureHelperCommon.Services.Forces;
using StructureHelperCommon.Services.Sections;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
using StructureHelperLogics.NdmCalculations.Buckling;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public class ForceCalculator : IForceCalculator
{
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
public string Name { get; set; }
public List<LimitStates> LimitStatesList { get; }
public List<CalcTerms> CalcTermsList { get; }
public List<IForceAction> ForceActions { get; }
public List<INdmPrimitive> Primitives { get; }
public INdmResult Result { get; private set; }
public IResult Result { get; private set; }
public ICompressedMember CompressedMember { get; }
public IAccuracy Accuracy { get; set; }
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
@@ -184,16 +177,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public object Clone()
{
IForceCalculator target = new ForceCalculator { Name = Name + " copy"};
target.LimitStatesList.Clear();
target.LimitStatesList.AddRange(LimitStatesList);
target.CalcTermsList.Clear();
target.CalcTermsList.AddRange(CalcTermsList);
AccuracyService.CopyProperties(Accuracy, target.Accuracy);
CompressedMemberServices.CopyProperties(CompressedMember, target.CompressedMember);
target.Primitives.AddRange(Primitives);
target.ForceActions.AddRange(ForceActions);
return target;
var newCalculator = new ForceCalculator();
updateStrategy.Update(newCalculator, this);
return newCalculator;
}
}
}

View File

@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public class ForceTupleCalculator : IForceTupleCalculator
{
public string Name { get; set; }
public INdmResult Result { get; private set; }
public IResult Result { get; private set; }
private IForceTupleInputData inputData;

View File

@@ -4,12 +4,10 @@ using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Sections;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations
public interface IForceCalculator : ICalculator, IHasPrimitives, IHasForceCombinations
{
List<CalcTerms> CalcTermsList { get; }
List<LimitStates> LimitStatesList { get; }

View File

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IForceTupleCalculator : INdmCalculator
public interface IForceTupleCalculator : ICalculator
{
}
}

View File

@@ -1,8 +1,9 @@
using System.Collections.Generic;
using StructureHelperCommon.Models.Calculators;
using System.Collections.Generic;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IForcesResults : INdmResult
public interface IForcesResults : IResult
{
string Description { get; set; }
List<IForcesTupleResult> ForcesResultList { get; }

View File

@@ -1,9 +1,10 @@
using LoaderCalculator.Data.ResultData;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IForcesTupleResult : INdmResult
public interface IForcesTupleResult : IResult
{
IDesignForceTuple DesignForceTuple { get; set; }
ILoaderResults LoaderResults { get; set; }

View File

@@ -0,0 +1,26 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Sections;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
{
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<IForceCalculator>
{
static readonly AccuracyUpdateStrategy accuracyUpdateStrategy = new();
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
public void Update(IForceCalculator targetObject, IForceCalculator sourceObject)
{
targetObject.Name = sourceObject.Name;
targetObject.LimitStatesList.Clear();
targetObject.LimitStatesList.AddRange(sourceObject.LimitStatesList);
targetObject.CalcTermsList.Clear();
targetObject.CalcTermsList.AddRange(sourceObject.CalcTermsList);
accuracyUpdateStrategy.Update(targetObject.Accuracy, sourceObject.Accuracy);
compressedMemberUpdateStrategy.Update(targetObject.CompressedMember, sourceObject.CompressedMember);
targetObject.Primitives.Clear();
targetObject.Primitives.AddRange(sourceObject.Primitives);
targetObject.ForceActions.Clear();
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
}
}
}

View File

@@ -1,5 +1,6 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
@@ -15,7 +16,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
IGeometryResult geometryResult;
public string Name { get; set; }
public INdmResult Result => geometryResult;
public IResult Result => geometryResult;
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
{

View File

@@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureHelperCommon.Models.Calculators;
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
{
public interface IGeometryCalculator : INdmCalculator
public interface IGeometryCalculator : ICalculator
{
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Parameters;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
{
public interface IGeometryResult : INdmResult
public interface IGeometryResult : IResult
{
List<IValueParameter<string>> TextParameters { get; set; }
}

View File

@@ -1,24 +0,0 @@
using StructureHelperCommon.Models.Calculators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TaskManager;
namespace StructureHelperLogics.NdmCalculations.Analyses
{
public interface INdmCalculator : ICloneable
{
string Name { get; set; }
/// <summary>
/// Method for calculating
/// </summary>
void Run();
/// <summary>
/// Result of Calculations
/// </summary>
INdmResult Result { get; }
}
}

View File

@@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses
{
public interface INdmResult
{
/// <summary>
/// True if result of calculation is valid
/// </summary>
bool IsValid { get; set; }
string Description { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Services;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.Logics
{
public class CalculatorUpdateStrategy : IUpdateStrategy<ICalculator>
{
public void Update(ICalculator targetObject, ICalculator sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (targetObject is IForceCalculator force)
{
new ForceCalculatorUpdateStrategy().Update(force, (IForceCalculator)sourceObject);
}
else
{
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(INdmPrimitive), sourceObject.GetType());
}
}
}
}

View File

@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
public static class InputDataFactory
{
private static IStressLogic stressLogic => new StressLogic();
public static IAnchorageInputData GetInputData(ReinforcementPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
public static IAnchorageInputData GetInputData(RebarPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
{
var inputData = new AnchorageInputData();
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
@@ -43,7 +43,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
return inputData;
}
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
{
if (primitive.HostPrimitive is not null)
{
@@ -59,7 +59,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, ReinforcementPrimitive primitive)
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
{
if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
{

View File

@@ -24,7 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public string Name { get; set; }
public INdmResult Result { get; private set; }
public IResult Result { get; private set; }
public IAccuracy Accuracy { get; set; }

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling
{
internal interface IConcreteBucklingCalculator : INdmCalculator
internal interface IConcreteBucklingCalculator : ICalculator
{
IAccuracy Accuracy { get; set; }
}

View File

@@ -1,4 +1,5 @@
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Analyses;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
/// <summary>
/// Results of calculation of buckling of reinforced concrete section
/// </summary>
public interface IConcreteBucklingResult : INdmResult
public interface IConcreteBucklingResult : IResult
{
/// <summary>
/// Factor of increasing of bending moment (p-delta effect) in the plain XOZ

View File

@@ -0,0 +1,100 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Services;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackForceCalculator : ICalculator
{
static readonly CrackedLogic crackedLogic = new();
private CrackForceResult result;
public string Name { get; set; }
public IForceTuple StartTuple { get; set; }
public IForceTuple EndTuple { get; set; }
public IEnumerable<INdm> NdmCollection { get; set; }
public Accuracy Accuracy {get;set; }
public IResult Result => result;
public CrackForceCalculator()
{
StartTuple ??= new ForceTuple();
Accuracy ??= new Accuracy() { IterationAccuracy = 0.0001d, MaxIterationCount = 10000 };
}
public void Run()
{
result = new CrackForceResult();
crackedLogic.StartTuple = StartTuple;
crackedLogic.EndTuple = EndTuple;
crackedLogic.NdmCollection = NdmCollection;
try
{
Check();
}
catch(Exception ex)
{
result.IsValid = false;
result.Description += ex;
return;
}
if (crackedLogic.IsSectionCracked(0d) == true)
{
result.IsValid = true;
result.ActualFactor = 0d;
result.ActualTuple = (IForceTuple)StartTuple.Clone();
result.IsSectionCracked = true;
result.Description += "Section cracked in start tuple";
return;
}
if (crackedLogic.IsSectionCracked(1d) == false)
{
result.IsValid = true;
result.IsSectionCracked = false;
result.Description = "Section is not cracked";
return;
}
var parameterCalculator = new FindParameterCalculator()
{
Accuracy = Accuracy,
Predicate = crackedLogic.IsSectionCracked
};
parameterCalculator.Run();
var paramResult = parameterCalculator.Result as FindParameterResult;
if (paramResult.IsValid == true)
{
result.IsValid = true;
result.IsSectionCracked = true;
result.Description += paramResult.Description;
result.ActualFactor = paramResult.Parameter;
result.ActualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, paramResult.Parameter);
}
else
{
result.IsValid = false;
result.Description += paramResult.Description;
}
}
private void Check()
{
CheckObject.IsNull(EndTuple);
if (StartTuple == EndTuple)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Section is not cracked");
}
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,19 @@
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackForceResult : IResult
{
public bool IsValid { get; set; }
public string Description { get; set; }
public bool IsSectionCracked { get; set; }
public double ActualFactor { get; set; }
public IForceTuple ActualTuple { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
internal class CrackedLogic : ICrackedLogic
{
ISectionCrackedLogic sectionCrackedLogic;
public IForceTuple StartTuple { get; set; }
public IForceTuple EndTuple { get; set; }
public IEnumerable<INdm> NdmCollection { get; set; }
public CrackedLogic(ISectionCrackedLogic sectionLogic)
{
sectionCrackedLogic = sectionLogic;
}
public CrackedLogic() : this (new HoleSectionCrackedLogic())
{
}
public bool IsSectionCracked(double factor)
{
var actualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, factor);
sectionCrackedLogic.Tuple = actualTuple;
sectionCrackedLogic.NdmCollection = NdmCollection;
return sectionCrackedLogic.IsSectionCracked();
}
}
}

View File

@@ -0,0 +1,59 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class ExponentialSofteningLogic : ICrackSofteningLogic
{
private double forceRatio;
private double powerFactor;
public double PowerFactor
{
get => powerFactor;
set
{
if (value < 0)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Power Factor must not be less than zero");
}
powerFactor = value;
}
}
public double BettaFactor { get; set; }
public double ForceRatio
{
get => forceRatio;
set
{
if (value < 0)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be less than zero");
}
else if (value > 1)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be greater than 1.0");
}
forceRatio = value;
}
}
public double FiMin {get;set;}
public ExponentialSofteningLogic()
{
FiMin = 0.2d;
PowerFactor = 2d;
BettaFactor = 0.8;
}
public double SofteningFactor()
{
double fi;
fi = 1 - BettaFactor * Math.Pow(ForceRatio, PowerFactor);
fi = Math.Max(fi, FiMin);
return fi;
}
}
}

View File

@@ -0,0 +1,47 @@
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
internal class HoleSectionCrackedLogic : ISectionCrackedLogic
{
static readonly IStressLogic stressLogic = new StressLogic();
public IForceTuple Tuple { get; set; }
public IEnumerable<INdm> NdmCollection { get; set; }
public Accuracy Accuracy { get; set; }
public HoleSectionCrackedLogic()
{
if (Accuracy is null)
{
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 10000 };
}
}
public bool IsSectionCracked()
{
var inputData = new ForceTupleInputData()
{
Accuracy = Accuracy,
Tuple = Tuple,
NdmCollection = NdmCollection
};
var calculator = new ForceTupleCalculator(inputData);
calculator.Run();
var calcResult = calculator.Result as ForcesTupleResult;
if (calcResult.IsValid == false)
{
throw new StructureHelperException(ErrorStrings.ResultIsNotValid + ": Result of Section Calculation is not valid");
}
var strainMatrix = calcResult.LoaderResults.ForceStrainPair.StrainMatrix;
return stressLogic.IsSectionCracked(strainMatrix, NdmCollection);
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface ICrackSofteningLogic
{
double SofteningFactor();
}
}

View File

@@ -0,0 +1,18 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
internal interface ICrackedLogic
{
IForceTuple StartTuple { get; set; }
IForceTuple EndTuple { get; set; }
IEnumerable<INdm> NdmCollection { get; set; }
bool IsSectionCracked(double factor);
}
}

View File

@@ -0,0 +1,17 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
internal interface ISectionCrackedLogic
{
IForceTuple Tuple { get; set; }
IEnumerable<INdm> NdmCollection { get; set; }
bool IsSectionCracked();
}
}

View File

@@ -3,24 +3,20 @@ using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public class CirclePrimitive : ICirclePrimitive
{
static readonly CircleUpdateStrategy updateStrategy = new();
/// <inheritdoc/>
public Guid Id { get; set; }
/// <inheritdoc/>
public string Name { get; set; }
public double CenterX { get; set; }
public double CenterY { get; set; }
/// <inheritdoc/>
public IPoint2D Center { get; private set; }
public IHeadMaterial? HeadMaterial { get; set; }
public StrainTuple UsersPrestrain { get; }
public StrainTuple AutoPrestrain { get; }
@@ -32,12 +28,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public bool Triangulate { get; set; }
public ICrossSection? CrossSection { get; set; }
public CirclePrimitive(Guid id)
{
Id = id;
Name = "New Circle";
NdmMaxSize = 0.01d;
NdmMinDivision = 10;
Center = new Point2D();
VisualProperty = new VisualProperty { Opacity = 0.8d };
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
@@ -46,16 +44,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
}
public CirclePrimitive() : this (Guid.NewGuid())
{}
/// <inheritdoc/>
public object Clone()
{
var primitive = new CirclePrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
ShapeService.CopyCircleProperties(this, primitive);
updateStrategy.Update(primitive, this);
return primitive;
}
/// <inheritdoc/>
public IEnumerable<INdm> GetNdms(IMaterial material)
{
var ndms = new List<INdm>();
@@ -64,24 +60,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
ndms.AddRange(logic.GetNdmCollection(material));
return ndms;
}
public void Save()
{
throw new NotImplementedException();
}
/// <inheritdoc/>
public bool IsPointInside(IPoint2D point)
{
var dX = CenterX - point.X;
var dY = CenterY - point.Y;
var dX = Center.X - point.X;
var dY = Center.Y - point.Y;
var distance = Math.Sqrt(dX * dX + dY * dY);
if (distance > Diameter / 2) { return false; }
return true;
}
public void Load()
{
throw new NotImplementedException();
}
}
}

View File

@@ -15,8 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public interface INdmPrimitive : ISaveable, ICloneable
{
string? Name { get; set; }
double CenterX { get; set; }
double CenterY { get; set; }
IPoint2D Center { get; }
ICrossSection? CrossSection { get; set; }
IHeadMaterial? HeadMaterial { get; set; }
/// <summary>

View File

@@ -1,17 +1,9 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
@@ -54,8 +46,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public object Clone()
{
var primitive = new LinePrimitive();
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
ShapeService.CopyLineProperties(this, primitive);
throw new NotImplementedException();
return primitive;
}

View File

@@ -0,0 +1,30 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes.Logics;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
internal class BaseUpdateStrategy : IUpdateStrategy<INdmPrimitive>
{
static readonly PointShapeUpdateStrategy pointShapeUpdateStrategy = new();
readonly ForceTupleUpdateStrategy tupleUpdateStrategy = new();
readonly VisualPropsUpdateStrategy visualPropsUpdateStrategy = new();
public void Update(INdmPrimitive target, INdmPrimitive source)
{
target.Name = source.Name;
if (source.HeadMaterial != null) target.HeadMaterial = source.HeadMaterial;
target.Triangulate = source.Triangulate;
pointShapeUpdateStrategy.Update(target.Center, source.Center);
visualPropsUpdateStrategy.Update(target.VisualProperty, source.VisualProperty);
tupleUpdateStrategy.Update(target.UsersPrestrain, source.UsersPrestrain);
}
}
}

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
internal class CircleUpdateStrategy : IUpdateStrategy<CirclePrimitive>
{
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
static readonly CircleShapeUpdateStrategy shapeUpdateStrategy = new();
public void Update(CirclePrimitive targetObject, CirclePrimitive sourceObject)
{
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
shapeUpdateStrategy.Update(targetObject, sourceObject);
}
}
}

View File

@@ -0,0 +1,19 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
internal class DivisionPropsUpdateStrategy : IUpdateStrategy<IHasDivisionSize>
{
public void Update(IHasDivisionSize targetObject, IHasDivisionSize sourceObject)
{
targetObject.NdmMaxSize = sourceObject.NdmMaxSize;
targetObject.NdmMinDivision = sourceObject.NdmMinDivision;
targetObject.ClearUnderlying = sourceObject.ClearUnderlying;
}
}
}

View File

@@ -0,0 +1,35 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using StructureHelperLogics.Models.Primitives;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public class NdmPrimitiveUpdateStrategy : IUpdateStrategy<INdmPrimitive>
{
public void Update(INdmPrimitive targetObject, INdmPrimitive sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (targetObject is PointPrimitive point)
{
new PointUpdateStrategy().Update(point, (PointPrimitive)sourceObject);
}
else if (targetObject is RebarPrimitive rebar)
{
new RebarUpdateStrategy().Update(rebar, (RebarPrimitive)sourceObject);
}
else if (targetObject is RectanglePrimitive rectangle)
{
new RectangleUpdateStrategy().Update(rectangle, (RectanglePrimitive)sourceObject);
}
else if (targetObject is CirclePrimitive circle)
{
new CircleUpdateStrategy().Update(circle, (CirclePrimitive)sourceObject);
}
else
{
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(INdmPrimitive), sourceObject.GetType());
}
}
}
}

View File

@@ -0,0 +1,20 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.Models.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
internal class PointUpdateStrategy : IUpdateStrategy<PointPrimitive>
{
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
public void Update(PointPrimitive targetObject, PointPrimitive sourceObject)
{
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
targetObject.Area = sourceObject.Area;
}
}
}

View File

@@ -0,0 +1,20 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
internal class RebarUpdateStrategy : IUpdateStrategy<RebarPrimitive>
{
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
public void Update(RebarPrimitive targetObject, RebarPrimitive sourceObject)
{
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
targetObject.Area = sourceObject.Area;
targetObject.HostPrimitive = sourceObject.HostPrimitive;
}
}
}

View File

@@ -0,0 +1,23 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
internal class RectangleUpdateStrategy : IUpdateStrategy<RectanglePrimitive>
{
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
static readonly RectangleShapeUpdateStrategy shapeUpdateStrategy = new();
public void Update(RectanglePrimitive targetObject, RectanglePrimitive sourceObject)
{
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
shapeUpdateStrategy.Update(targetObject, sourceObject);
}
}
}

View File

@@ -0,0 +1,21 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public class VisualPropsUpdateStrategy : IUpdateStrategy<IVisualProperty>
{
public void Update(IVisualProperty targetObject, IVisualProperty sourceObject)
{
targetObject.IsVisible = sourceObject.IsVisible;
targetObject.Color = sourceObject.Color;
targetObject.SetMaterialColor = sourceObject.SetMaterialColor;
targetObject.Opacity = sourceObject.Opacity;
targetObject.ZIndex = sourceObject.ZIndex;
}
}
}

View File

@@ -16,10 +16,10 @@ namespace StructureHelperLogics.Models.Primitives
{
public class PointPrimitive : IPointPrimitive
{
static readonly PointUpdateStrategy updateStrategy = new();
public Guid Id { get; }
public string? Name { get; set; }
public double CenterX { get; set; }
public double CenterY { get; set; }
public IPoint2D Center { get; private set; }
public IHeadMaterial HeadMaterial { get; set; }
//public double NdmMaxSize { get; set; }
//public int NdmMinDivision { get; set; }
@@ -31,11 +31,13 @@ namespace StructureHelperLogics.Models.Primitives
public bool Triangulate { get; set; }
public ICrossSection? CrossSection { get; set; }
public PointPrimitive(Guid id)
{
Id = id;
Name = "New Point";
Area = 0.0005d;
Center = new Point2D();
VisualProperty = new VisualProperty();
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
@@ -52,16 +54,10 @@ namespace StructureHelperLogics.Models.Primitives
return logic.GetNdmCollection(material);
}
public void Save()
{
throw new NotImplementedException();
}
public object Clone()
{
var primitive = new PointPrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
primitive.Area = Area;
updateStrategy.Update(primitive, this);
return primitive;
}
}

View File

@@ -3,7 +3,9 @@ using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
@@ -17,15 +19,14 @@ using System.Windows.Media.Media3D;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
/// <inheritdoc/>
public class ReinforcementPrimitive : IPointPrimitive, IHasHostPrimitive
public class RebarPrimitive : IPointPrimitive, IHasHostPrimitive
{
IDataRepository<ReinforcementPrimitive> repository;
static readonly RebarUpdateStrategy updateStrategy = new();
IDataRepository<RebarPrimitive> repository;
/// <inheritdoc/>
public string Name { get; set; }
/// <inheritdoc/>
public double CenterX { get; set; }
/// <inheritdoc/>
public double CenterY { get; set; }
public IPoint2D Center { get; private set; }
/// <inheritdoc/>
public IHeadMaterial? HeadMaterial { get; set; }
public bool Triangulate { get; set; }
@@ -41,27 +42,27 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public INdmPrimitive HostPrimitive { get; set; }
public ICrossSection? CrossSection { get; set; }
public ReinforcementPrimitive(Guid id)
public RebarPrimitive(Guid id)
{
Id = id;
Name = "New Reinforcement";
Area = 0.0005d;
Center = new Point2D();
VisualProperty = new VisualProperty();
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
Triangulate = true;
}
public ReinforcementPrimitive() : this(Guid.NewGuid())
public RebarPrimitive() : this(Guid.NewGuid())
{
}
public object Clone()
{
var primitive = new ReinforcementPrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
primitive.Area = Area;
primitive.HostPrimitive = HostPrimitive;
var primitive = new RebarPrimitive();
updateStrategy.Update(primitive, this);
return primitive;
}

View File

@@ -1,28 +1,18 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public class RectanglePrimitive : IRectanglePrimitive
{
readonly RectangleUpdateStrategy updateStrategy = new();
public Guid Id { get;}
public string Name { get; set; }
public double CenterX { get; set; }
public double CenterY { get; set; }
public IHeadMaterial? HeadMaterial { get; set; }
public StrainTuple UsersPrestrain { get; private set; }
public StrainTuple AutoPrestrain { get; private set; }
@@ -36,12 +26,15 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public IVisualProperty VisualProperty { get; }
public ICrossSection? CrossSection { get; set; }
public IPoint2D Center { get; private set; }
public RectanglePrimitive(Guid id)
{
Id = id;
Name = "New Rectangle";
NdmMaxSize = 0.01d;
NdmMinDivision = 10;
Center = new Point2D();
VisualProperty = new VisualProperty { Opacity = 0.8d};
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
@@ -58,9 +51,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public object Clone()
{
var primitive = new RectanglePrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
ShapeService.CopyRectangleProperties(this, primitive);
updateStrategy.Update(primitive, this);
return primitive;
}
@@ -73,17 +64,12 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
return ndms;
}
public void Save()
{
throw new NotImplementedException();
}
public bool IsPointInside(IPoint2D point)
{
var xMax = CenterX + Width / 2;
var xMin = CenterX - Width / 2;
var yMax = CenterY + Height / 2;
var yMin = CenterY - Height / 2;
var xMax = Center.X + Width / 2;
var xMin = Center.X - Width / 2;
var yMax = Center.Y + Height / 2;
var yMin = Center.Y - Height / 2;
if (point.X > xMax ||
point.X < xMin ||
point.Y > yMax ||

View File

@@ -23,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public CircleTriangulationLogicOptions(ICirclePrimitive primitive)
{
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Center = new Point2D() { X = primitive.Center.X, Y = primitive.Center.Y };
Circle = primitive;
NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision;

View File

@@ -28,7 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public PointTriangulationLogicOptions(IPointPrimitive primitive)
{
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Center = new Point2D() { X = primitive.Center.X, Y = primitive.Center.Y };
Area = primitive.Area;
Prestrain = new StrainTuple
{

View File

@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
{
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
Center = new Point2D() {X = primitive.Center.X, Y = primitive.Center.Y };
Rectangle = primitive;
NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision;

View File

@@ -1,18 +1,13 @@
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Sections;
using StructureHelperCommon.Services.Forces;
using StructureHelperCommon.Services.Sections;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmCalculations
{
public static class InterpolateService
{
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple finishDesignForce,IDesignForceTuple startDesignForce, int stepCount)
{
IForceCalculator calculator = new ForceCalculator();
@@ -20,7 +15,7 @@ namespace StructureHelperLogics.Services.NdmCalculations
calculator.LimitStatesList.Add(finishDesignForce.LimitState);
calculator.CalcTermsList.Clear();
calculator.CalcTermsList.Add(finishDesignForce.CalcTerm);
CompressedMemberServices.CopyProperties(source.CompressedMember, calculator.CompressedMember);
compressedMemberUpdateStrategy.Update(calculator.CompressedMember, source.CompressedMember);
calculator.Accuracy = source.Accuracy;
calculator.Primitives.AddRange(source.Primitives);
calculator.ForceActions.Clear();

View File

@@ -19,32 +19,6 @@ namespace StructureHelperLogics.Services.NdmPrimitives
{
public static class NdmPrimitivesService
{
public static void CopyVisualProperty(IVisualProperty source, IVisualProperty target)
{
target.IsVisible = source.IsVisible;
target.Color = source.Color;
target.SetMaterialColor = source.SetMaterialColor;
target.Opacity = source.Opacity;
target.ZIndex = source.ZIndex;
}
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
{
target.Name = source.Name + " copy" ;
if (source.HeadMaterial != null) target.HeadMaterial = source.HeadMaterial;
CopyVisualProperty(source.VisualProperty, target.VisualProperty);
target.CenterX = source.CenterX;
target.CenterY = source.CenterY;
target.Triangulate = source.Triangulate;
ForceTupleService.CopyProperties(source.UsersPrestrain, target.UsersPrestrain);
}
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
{
target.NdmMaxSize = source.NdmMaxSize;
target.NdmMinDivision = source.NdmMinDivision;
target.ClearUnderlying = source.ClearUnderlying;
}
public static List<INdm> GetNdms(INdmPrimitive primitive, LimitStates limitState, CalcTerms calcTerm)
{
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)

View File

@@ -37,7 +37,6 @@ namespace StructureHelperLogics.Services.NdmPrimitives
parameters.AddRange(GetMomentOfInertiaRatio(ndms, strainMatrix));
return parameters;
}
private IEnumerable<IValueParameter<string>> GetSimpleArea(IEnumerable<INdm> ndms)
{
const string name = "Summary Area";
@@ -67,7 +66,6 @@ namespace StructureHelperLogics.Services.NdmPrimitives
parameters.Add(firstParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetMomentOfInertia(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
const string name = "Bending stiffness";