Interactin diagram was added
This commit is contained in:
@@ -12,7 +12,7 @@ using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculator : IForceCalculator
|
||||
public class ForceCalculator : IForceCalculator, IHasActionByResult
|
||||
{
|
||||
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||
public string Name { get; set; }
|
||||
|
||||
@@ -6,7 +6,7 @@ using StructureHelperCommon.Models.Calculators;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceTupleCalculator : IForceTupleCalculator
|
||||
public class ForceTupleCalculator : IForceTupleCalculator, IHasActionByResult
|
||||
{
|
||||
public IForceTupleInputData InputData { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurveLogic
|
||||
public interface ILimitCurveLogic : IHasActionByResult
|
||||
{
|
||||
List<IPoint2D> GetPoints(List<IPoint2D> points);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurveParameterLogic
|
||||
public interface ILimitCurveParameterLogic : IHasActionByResult
|
||||
{
|
||||
IPoint2D CurrentPoint { get; set; }
|
||||
double GetParameter();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveCalculator : ICalculator
|
||||
public class LimitCurveCalculator : ICalculator, IHasActionByResult
|
||||
{
|
||||
private LimitCurveResult result;
|
||||
private List<IPoint2D> surroundList;
|
||||
@@ -50,14 +51,26 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
surroundList = SurroundProcLogic.GetPoints();
|
||||
try
|
||||
{
|
||||
limitCurveLogic.ActionToOutputResults = GetCurrentStepNumber;
|
||||
factoredList = limitCurveLogic.GetPoints(surroundList);
|
||||
result.Points = factoredList;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description = ex.Message;
|
||||
result.Description += ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GetCurrentStepNumber(IResult calcResult)
|
||||
{
|
||||
if (calcResult is not FindParameterResult)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(FindParameterResult), calcResult));
|
||||
}
|
||||
var parameterResult = calcResult as FindParameterResult;
|
||||
result.IterationNumber = parameterResult.IterationNumber;
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveLogic : ILimitCurveLogic
|
||||
{
|
||||
private FindParameterResult result;
|
||||
private IPoint2D currentPoint;
|
||||
private ILimitCurveParameterLogic parameterLogic;
|
||||
public Predicate<IPoint2D> LimitPredicate { get; set; }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public LimitCurveLogic(ILimitCurveParameterLogic parameterLogic)
|
||||
{
|
||||
this.parameterLogic = parameterLogic;
|
||||
@@ -24,6 +27,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
}
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
{
|
||||
result = new();
|
||||
List<IPoint2D> resultList = new();
|
||||
if (LimitPredicate(new Point2D()) == true)
|
||||
{
|
||||
@@ -48,6 +52,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
Y = currentPoint.Y * parameter
|
||||
};
|
||||
resultList.Add(resultPoint);
|
||||
result.IterationNumber = resultList.Count;
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveParameterLogic : ILimitCurveParameterLogic
|
||||
{
|
||||
private FindParameterResult result;
|
||||
private Predicate<Point2D> limitPredicate;
|
||||
public IPoint2D CurrentPoint { get; set; }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public LimitCurveParameterLogic(Predicate<Point2D> limitPredicate)
|
||||
{
|
||||
@@ -31,8 +33,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate for point (x={CurrentPoint.X}, y={CurrentPoint.Y}) is not valid");
|
||||
}
|
||||
var result = parameterCalculator.Result as FindParameterResult;
|
||||
result = parameterCalculator.Result as FindParameterResult;
|
||||
var parameter = result.Parameter;
|
||||
if (parameter < 0.1d)
|
||||
{
|
||||
parameterCalculator.Accuracy.IterationAccuracy = 0.0001d;
|
||||
parameterCalculator.Run();
|
||||
result = parameterCalculator.Result as FindParameterResult;
|
||||
parameter = result.Parameter;
|
||||
}
|
||||
|
||||
return parameter;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveResult : IResult
|
||||
public class LimitCurveResult : IResult, IiterationResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<IPoint2D> Points { get; set; }
|
||||
public int IterationNumber { get; set; }
|
||||
|
||||
public LimitCurveResult()
|
||||
{
|
||||
Points = new List<IPoint2D>();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -12,17 +13,52 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class PredicateFactory
|
||||
{
|
||||
|
||||
private ForceTupleCalculator calculator;
|
||||
private ForceTuple tuple;
|
||||
private ForceTupleInputData inputData;
|
||||
public IEnumerable<INdm> Ndms { get; set; }
|
||||
public double My { get; set; }
|
||||
public bool GetResult(IPoint2D point)
|
||||
public PredicateFactory()
|
||||
{
|
||||
var calculator = new ForceTupleCalculator();
|
||||
var tuple = new ForceTuple() { Nz = point.Y, Mx = point.X, My = My };
|
||||
var inputData = new ForceTupleInputData() { Tuple = tuple, NdmCollection = Ndms };
|
||||
calculator.InputData = inputData;
|
||||
inputData = new();
|
||||
calculator = new() { InputData = inputData };
|
||||
}
|
||||
public bool IsSectionFailure(IPoint2D point)
|
||||
{
|
||||
tuple = new()
|
||||
{
|
||||
Nz = point.Y,
|
||||
Mx = point.X,
|
||||
My = My
|
||||
};
|
||||
inputData.Tuple = tuple;
|
||||
inputData.NdmCollection = Ndms;
|
||||
calculator.Run();
|
||||
var result = calculator.Result;
|
||||
return !result.IsValid;
|
||||
}
|
||||
|
||||
public bool IsSectionCracked(IPoint2D point)
|
||||
{
|
||||
var logic = new HoleSectionCrackedLogic();
|
||||
tuple = new()
|
||||
{
|
||||
Nz = point.Y,
|
||||
Mx = point.X,
|
||||
My = My
|
||||
};
|
||||
logic.Tuple = tuple;
|
||||
logic.NdmCollection = Ndms;
|
||||
try
|
||||
{
|
||||
var result = logic.IsSectionCracked();
|
||||
return result;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,6 +10,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class StabLimitCurveLogic : ILimitCurveLogic
|
||||
{
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
{
|
||||
var result = new List<IPoint2D>();
|
||||
|
||||
@@ -12,6 +12,15 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public double XMin { get; set; }
|
||||
public double YMax { get; set; }
|
||||
public double YMin { get; set; }
|
||||
public double ConstZ { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
public SurroundData()
|
||||
{
|
||||
XMax = 1e7d;
|
||||
XMin = -1e7d;
|
||||
YMax = 1e7d;
|
||||
YMin = -1e7d;
|
||||
PointCount = 80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
public Accuracy Accuracy {get;set; }
|
||||
public IResult Result => result;
|
||||
|
||||
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public CrackForceCalculator(IForceTupleCalculator forceTupleCalculator)
|
||||
{
|
||||
StartTuple ??= new ForceTuple();
|
||||
|
||||
@@ -6,6 +6,7 @@ using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
@@ -23,8 +24,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
public CrackWidthCalculatorInputData InputData { get; set; }
|
||||
public IResult Result => result;
|
||||
|
||||
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public void Run()
|
||||
{
|
||||
result = new() { IsValid = true, Description = ""};
|
||||
@@ -96,10 +95,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
rebarPrimitives.Add(item as RebarPrimitive);
|
||||
}
|
||||
}
|
||||
//rebarPrimitives = ndmPrimitives
|
||||
// .Select(x => x is RebarPrimitive) as IEnumerable<RebarPrimitive>;
|
||||
var options = new TriangulationOptions() { LimiteState = InputData.LimitState, CalcTerm = InputData.CalcTerm };
|
||||
ndmCollection = ndmPrimitives.SelectMany(x => x.GetNdms(options));
|
||||
ndmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, InputData.LimitState, InputData.CalcTerm);
|
||||
}
|
||||
|
||||
private void CalcCrackForce()
|
||||
|
||||
@@ -8,20 +8,20 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
public static class Triangulation1
|
||||
{
|
||||
public static IEnumerable<INdm> GetNdms(IEnumerable<INdmPrimitive> ndmPrimitives, ITriangulationOptions options)
|
||||
{
|
||||
return ndmPrimitives.SelectMany(x => x.GetNdms(options));
|
||||
//var headMaterials = GetPrimitiveMaterials(ndmPrimitives);
|
||||
//Dictionary<Guid, IMaterial> materials = GetMaterials(headMaterials, options);
|
||||
//foreach (var ndmPrimitive in ndmPrimitives)
|
||||
//{
|
||||
// IHeadMaterial headMaterial = ndmPrimitive.HeadMaterial;
|
||||
// IMaterial material;
|
||||
// if (materials.TryGetValue(headMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); }
|
||||
// IEnumerable<INdm> localNdms = GetNdmsByPrimitive(ndmPrimitive, options);
|
||||
// ndms.AddRange(localNdms);
|
||||
//}
|
||||
}
|
||||
//public static IEnumerable<INdm> GetNdms(IEnumerable<INdmPrimitive> ndmPrimitives, ITriangulationOptions options)
|
||||
//{
|
||||
// return ndmPrimitives.SelectMany(x => x.GetNdms(options));
|
||||
// var headMaterials = GetPrimitiveMaterials(ndmPrimitives);
|
||||
// Dictionary<Guid, IMaterial> materials = GetMaterials(headMaterials, options);
|
||||
// foreach (var ndmPrimitive in ndmPrimitives)
|
||||
// {
|
||||
// IHeadMaterial headMaterial = ndmPrimitive.HeadMaterial;
|
||||
// IMaterial material;
|
||||
// if (materials.TryGetValue(headMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); }
|
||||
// IEnumerable<INdm> localNdms = GetNdmsByPrimitive(ndmPrimitive, options);
|
||||
// ndms.AddRange(localNdms);
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// Returns dictionary of unique materials by collection of primitives
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user