Tuple crack calculator was changed

This commit is contained in:
Evgeny Redikultsev
2024-05-10 20:27:57 +05:00
parent e75521dc20
commit 871355e07b
29 changed files with 745 additions and 148 deletions

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials
{
public interface ICrackedMaterial
{
bool TensionForULS { get; set; }
bool TensionForSLS { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,10 +8,8 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
public interface IConcreteLibMaterial : ILibMaterial
public interface IConcreteLibMaterial : ILibMaterial, ICrackedMaterial
{
bool TensionForULS { get; set; }
bool TensionForSLS { get; set; }
/// <summary>
/// Humidity of concrete
/// </summary>

View File

@@ -40,7 +40,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
var checkResult = CheckInputData();
if (checkResult != "")
if (checkResult != string.Empty)
{
Result = new ForcesResults()
{
@@ -49,12 +49,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
};
return;
}
else
{
GetCombinations();
CalculateResult();
}
}
private void CalculateResult()
{
@@ -199,18 +196,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private string CheckInputData()
{
string result = "";
try
string result = string.Empty;
if (! Primitives.Any())
{
triangulateLogic = new TriangulatePrimitiveLogic()
{
Primitives = Primitives
};
triangulateLogic.CheckPrimitives(Primitives);
}
catch (Exception ex)
{
result += ex;
result += "Calculator does not contain any primitives \n";
}
if (ForceActions.Count == 0)
{
@@ -222,8 +211,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
}
if (CalcTermsList.Count == 0)
{
result += "Calculator does not contain any duration \n";
result += "Calculator does not contain any calc term \n";
}
//try
//{
// triangulateLogic = new TriangulatePrimitiveLogic()
// {
// Primitives = Primitives
// };
// triangulateLogic.CheckPrimitives(Primitives);
//}
//catch (Exception ex)
//{
// result += ex;
//}
return result;
}

View File

@@ -1,5 +1,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,22 +13,30 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public class AverageDiameterLogic : IAverageDiameterLogic
{
public IEnumerable<RebarNdm> Rebars { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetAverageDiameter()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
Check();
var rebarArea = Rebars
.Sum(x => x.Area);
TraceLogger?.AddMessage($"Summary rebar area As = {rebarArea}");
var rebarCount = Rebars.Count();
TraceLogger?.AddMessage($"Rebar count n = {rebarCount}");
var averageArea = rebarArea / rebarCount;
TraceLogger?.AddMessage($"Average rebar area As = {averageArea}");
var diameter = Math.Sqrt(averageArea / Math.PI);
TraceLogger?.AddMessage($"Average rebar diameter ds = {diameter}");
return diameter;
}
private void Check()
{
if (!Rebars.Any())
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": rebars count must be greater then zero");
string errorString = ErrorStrings.DataIsInCorrect + $": rebars count must be greater then zero";
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
}
}

View File

@@ -1,4 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,9 +13,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
CrackWidthLogicInputDataSP63 inputData;
public ICrackWidthLogicInputData InputData {get;set;}
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetCrackWidth()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage("Method of crack width calculation based on SP 63.13330.2018");
CheckOptions();
//check if strain of concrete greater than strain of rebar
if (inputData.ConcreteStrain > inputData.RebarStrain) { return 0d; }
@@ -24,31 +29,42 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private void CheckOptions()
{
string errorString = string.Empty;
if (InputData is not CrackWidthLogicInputDataSP63)
{
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(CrackWidthLogicInputDataSP63), InputData.GetType()));
errorString = ErrorStrings.ExpectedWas(typeof(CrackWidthLogicInputDataSP63), InputData.GetType());
}
inputData = InputData as CrackWidthLogicInputDataSP63;
if (inputData.Length <=0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": length between cracks L={inputData.Length} must be greate than zero");
errorString = ErrorStrings.DataIsInCorrect + $": length between cracks L={inputData.Length} must be greate than zero";
}
if (inputData.TermFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Term factor {inputData.TermFactor} must be greate than zero");
errorString = ErrorStrings.DataIsInCorrect + $": Term factor {inputData.TermFactor} must be greate than zero";
}
if (inputData.BondFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.BondFactor} must be greate than zero");
errorString = ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.BondFactor} must be greate than zero";
}
if (inputData.StressStateFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.StressStateFactor} must be greate than zero");
errorString = ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.StressStateFactor} must be greate than zero";
}
if (inputData.PsiSFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": PsiS factor {inputData.PsiSFactor} must be greate than zero");
}
errorString = ErrorStrings.DataIsInCorrect + $": PsiS factor {inputData.PsiSFactor} must be greate than zero";
}
if (errorString != string.Empty)
{
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
}
}
}

View File

@@ -0,0 +1,82 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackedSectionTriangulationLogic : ICrackedSectionTriangulationLogic
{
const LimitStates limitState = LimitStates.SLS;
const CalcTerms shortTerm = CalcTerms.ShortTerm;
private ITriangulatePrimitiveLogic triangulateLogic;
private string ndmPrimitiveCountMessage;
public IEnumerable<INdmPrimitive> NdmPrimitives { get; private set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public CrackedSectionTriangulationLogic(IEnumerable<INdmPrimitive> ndmPrimitives)
{
NdmPrimitives = ndmPrimitives;
ndmPrimitiveCountMessage = $"Source collection containes {NdmPrimitives.Count()} primitives";
triangulateLogic = new TriangulatePrimitiveLogic
{
Primitives = NdmPrimitives,
LimitState = limitState,
CalcTerm = shortTerm,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
}
public List<INdm> GetNdmCollection()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
triangulateLogic = new TriangulatePrimitiveLogic()
{
LimitState = limitState,
CalcTerm = shortTerm,
Primitives = NdmPrimitives,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
return triangulateLogic.GetNdms();
}
public List<INdm> GetCrackedNdmCollection()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
triangulateLogic = new TriangulatePrimitiveLogic(new MeshCrackedConcreteLogic())
{
LimitState = limitState,
CalcTerm = shortTerm,
Primitives = NdmPrimitives,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
return triangulateLogic.GetNdms();
}
public List<RebarPrimitive> GetRebarPrimitives()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
List<RebarPrimitive> rebarPrimitives = new();
foreach (var item in NdmPrimitives)
{
if (item is RebarPrimitive rebar)
{
TraceLogger?.AddMessage($"Primitive {rebar.Name} is rebar primitive", TraceLogStatuses.Service);
rebarPrimitives.Add(rebar);
}
}
TraceLogger?.AddMessage($"Obtained {rebarPrimitives.Count} rebar primitives");
return rebarPrimitives;
}
}
}

View File

@@ -1,4 +1,5 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface IAverageDiameterLogic
public interface IAverageDiameterLogic : ILogic
{
IEnumerable<RebarNdm> Rebars { get; set; }
double GetAverageDiameter();

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -9,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Logic for calculating width of crack
/// </summary>
public interface ICrackWidthLogic
public interface ICrackWidthLogic : ILogic
{
ICrackWidthLogicInputData InputData { get; set; }
/// <summary>

View File

@@ -0,0 +1,37 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
/// <summary>
/// Logic for obtaining of collection of nms elementary part for regular and fully cracked section
/// </summary>
public interface ICrackedSectionTriangulationLogic : ILogic
{
/// <summary>
/// Source collection of ndm primitives
/// </summary>
IEnumerable<INdmPrimitive> NdmPrimitives { get; }
/// <summary>
/// Returns collection of ndm elementary parts
/// </summary>
/// <returns></returns>
List<INdm> GetNdmCollection();
/// <summary>
/// Returns collection of ndm elementary parts where concrete doesn't work in tension
/// </summary>
/// <returns></returns>
List<INdm> GetCrackedNdmCollection();
/// <summary>
/// Return collection of primitives which contain only rebars
/// </summary>
/// <returns></returns>
List<RebarPrimitive> GetRebarPrimitives();
}
}

View File

@@ -1,5 +1,6 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
@@ -12,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <summary>
/// Logic fo calculating of tensile area of RC crosssection
/// </summary>
public interface ITensileAreaLogic
public interface ITensileAreaLogic : ILogic
{
IEnumerable<INdm> NdmCollection { get; set; }
IStrainMatrix StrainMatrix { get; set; }

View File

@@ -1,6 +1,10 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperLogics.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -18,6 +22,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
readonly IAverageDiameterLogic diameterLogic;
readonly ITensileAreaLogic tensileAreaLogic;
IStressLogic stressLogic;
public IEnumerable<INdm> NdmCollection { get; set; }
public IStrainMatrix StrainMatrix { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
@@ -26,6 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
this.diameterLogic = diameterLogic;
this.tensileAreaLogic = tensileAreaLogic;
stressLogic = new StressLogic();
}
public LengthBetweenCracksLogicSP63() :
this
@@ -34,18 +40,43 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{ }
public double GetLength()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
var rebars = NdmCollection
.Where(x => x is RebarNdm)
.Where(x => x is RebarNdm & stressLogic.GetTotalStrain(StrainMatrix, x) > 0d)
.Select(x => x as RebarNdm);
if (! rebars.Any())
{
string errorString = ErrorStrings.DataIsInCorrect + ": Collection of rebars does not contain any tensile rebars";
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
if (TraceLogger is not null)
{
TraceService.TraceNdmCollection(TraceLogger, rebars);
}
var rebarArea = rebars.Sum(x => x.Area * x.StressScale);
TraceLogger?.AddMessage($"Summary rebar area As = {rebarArea}");
diameterLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
diameterLogic.Rebars = rebars;
var rebarDiameter = diameterLogic.GetAverageDiameter();
TraceLogger?.AddMessage($"Average rebar diameter ds = {rebarDiameter}");
tensileAreaLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
tensileAreaLogic.NdmCollection = NdmCollection;
tensileAreaLogic.StrainMatrix = StrainMatrix;
var concreteArea = tensileAreaLogic.GetTensileArea();
TraceLogger?.AddMessage($"Concrete effective area Ac,eff = {concreteArea}(m^2)");
var length = concreteArea / rebarArea * rebarDiameter;
length = new List<double> { length, minDiameterFactor * rebarDiameter, minLength }.Max();
length = new List<double> { length, maxDiameterFactor * rebarDiameter, maxLength }.Min();
TraceLogger?.AddMessage($"Base length between cracks Lcrc = {concreteArea} / {rebarArea} * {rebarDiameter} = {length}(m)");
double minLengthByDiameter = minDiameterFactor * rebarDiameter;
TraceLogger?.AddMessage($"Minimum length by diameter Lcrc = {minDiameterFactor} * {rebarDiameter} = {minLengthByDiameter}(m)");
TraceLogger?.AddMessage($"Minimum length Lcrc = {minLength}");
length = new List<double> { length, minLengthByDiameter, minLength }.Max();
TraceLogger?.AddMessage($"Minimum length Lcrc = max({length}, {minLengthByDiameter}, {minLength}) = {length}(m)");
double maxLengthByDiameter = maxDiameterFactor * rebarDiameter;
TraceLogger?.AddMessage($"Maximum length by diameter Lcrc = {maxDiameterFactor} * {rebarDiameter} = {maxLengthByDiameter}(m)");
TraceLogger?.AddMessage($"Maximum length Lcrc = {maxLength}");
length = new List<double> { length, maxLengthByDiameter, maxLength }.Min();
TraceLogger?.AddMessage($"Maximun length Lcrc = min({length}, {maxLengthByDiameter}, {maxLength}) = {length}(m)");
return length;
}
}

View File

@@ -2,7 +2,9 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
@@ -16,29 +18,44 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
const double maxConcreteFactor = 0.5d;
const double minConcreteFactor = 0.1d;
const double minRebarFactor = 3d;
const double minRebarFactor = 9d;
private static IStressLogic stressLogic => new StressLogic();
public IEnumerable<INdm> NdmCollection { get; set; }
public IStrainMatrix StrainMatrix { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetTensileArea()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
var rebarCollection = NdmCollection
.Where(x => x is RebarNdm);
.Where(x => x is RebarNdm & stressLogic.GetTotalStrain(StrainMatrix, x) > 0d);
var rebarArea = rebarCollection.
Sum(x => x.Area * x.StressScale);
TraceLogger?.AddMessage($"Summary rebar area As = {rebarArea}");
var concreteCollection = NdmCollection
.Where(x => x.Material is ConcreteMaterial);
var concreteArea = concreteCollection
.Sum(x => x.Area * x.StressScale);
TraceLogger?.AddMessage($"Concrete area Ac = {concreteArea}");
var concreteTensileArea = concreteCollection
.Where(x => stressLogic.GetTotalStrainWithPrestrain(StrainMatrix, x) > 0d)
.Sum(x => x.Area * x.StressScale);
TraceLogger?.AddMessage($"Concrete tensile area Ac,t = {concreteTensileArea}");
concreteTensileArea = Math.Max(concreteTensileArea, rebarArea * minRebarFactor);
concreteTensileArea = Math.Max(concreteTensileArea, concreteArea * minConcreteFactor);
concreteTensileArea = Math.Min(concreteTensileArea, concreteArea * maxConcreteFactor);
double areaByRebar = rebarArea * minRebarFactor;
TraceLogger?.AddMessage($"Concrete area is considered not less than {minRebarFactor} of area of rebars");
TraceLogger?.AddMessage($"Minimum concrete effective area from area of rebar Ac,eff = {rebarArea} * {minRebarFactor} = {areaByRebar}");
concreteTensileArea = Math.Max(concreteTensileArea, areaByRebar);
double areaByMinConcreteFactor = concreteArea * minConcreteFactor;
TraceLogger?.AddMessage($"Concrete area is considered not less than {minConcreteFactor} of area of rebars");
TraceLogger?.AddMessage($"Minimum concrete effective area Ac,eff = {concreteArea} * {minConcreteFactor} = {areaByMinConcreteFactor}");
concreteTensileArea = Math.Max(concreteTensileArea, areaByMinConcreteFactor);
double areaByMaxConcreteFactor = concreteArea * maxConcreteFactor;
TraceLogger?.AddMessage($"Concrete area is considered not greater than {maxConcreteFactor} of area of rebars");
TraceLogger?.AddMessage($"Maximum concrete effective area Ac,eff = {concreteArea} * {maxConcreteFactor} = {areaByMaxConcreteFactor}");
concreteTensileArea = Math.Min(concreteTensileArea, areaByMaxConcreteFactor);
TraceLogger?.AddMessage($"Concrete effective area Ac,eff = {concreteTensileArea}");
return concreteTensileArea;
}
}

View File

@@ -17,11 +17,13 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private static readonly ILengthBetweenCracksLogic lengthLogic = new LengthBetweenCracksLogicSP63();
private TupleCrackResult result;
private IEnumerable<INdmPrimitive> ndmPrimitives;
private ICrackedSectionTriangulationLogic triangulationLogic;
private List<RebarPrimitive>? rebarPrimitives;
private IEnumerable<INdm> defaultNdm;
private IEnumerable<INdm> fulyCrackedNdm;
private IEnumerable<INdm> defaultNdms;
private IEnumerable<INdm> fulyCrackedNdms;
private CrackForceResult crackForceResult;
private StrainTuple strainTuple;
private StrainTuple longDefaultStrainTuple;
private StrainTuple shortDefaultStrainTuple;
private ITriangulatePrimitiveLogic triangulateLogic;
public string Name { get; set; }
@@ -37,6 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
try
{
TraceLogger?.AddMessage($"Calculation of crack width by force combination");
ProcessCalculations();
TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone);
@@ -46,7 +49,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
result.IsValid = false;
result.Description += ex;
TraceLogger?.AddMessage(LoggerStrings.CalculationError + ex, TraceLogStatuses.Error);
}
}
@@ -64,7 +66,10 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
CheckInputData();
Triangulate();
CalcStrainMatrix();
longDefaultStrainTuple = CalcStrainMatrix(InputData.LongTermTuple, defaultNdms);
shortDefaultStrainTuple = CalcStrainMatrix(InputData.LongTermTuple, defaultNdms);
var longLength = GetLengthBetweenCracks(longDefaultStrainTuple);
var shortLength = GetLengthBetweenCracks(shortDefaultStrainTuple);
CalcCrackForce();
var crackInputData = GetCrackInputData();
var calculator = new RebarCrackCalculator
@@ -77,63 +82,69 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
crackInputData.RebarPrimitive = item;
calculator.Run();
var rebarResult = calculator.Result as RebarCrackResult;
//if (crackForceResult.IsSectionCracked == false)
//{
// rebarResult.CrackWidth = 0d;
//}
result.RebarResults.Add(rebarResult);
}
}
private void CalcStrainMatrix()
private StrainTuple CalcStrainMatrix(IForceTuple forceTuple, IEnumerable<INdm> ndms)
{
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = defaultNdm, Tuple = InputData.LongTermTuple};
IForceTupleCalculator calculator = new ForceTupleCalculator() { InputData = inputData };
IForceTupleInputData inputData = new ForceTupleInputData()
{
NdmCollection = ndms,
Tuple = forceTuple
};
IForceTupleCalculator calculator = new ForceTupleCalculator()
{
InputData = inputData,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
calculator.Run();
var forceResult = calculator.Result as IForcesTupleResult;
strainTuple = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
var strain = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
return strain;
}
private RebarCrackInputData GetCrackInputData()
{
lengthLogic.NdmCollection = defaultNdm;
lengthLogic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
lengthLogic.NdmCollection = defaultNdms;
lengthLogic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(longDefaultStrainTuple);
var length = lengthLogic.GetLength();
var crackInputData = new RebarCrackInputData
{
PsiSFactor = crackForceResult.PsiS,
Length = length,
StrainTuple = strainTuple
StrainTuple = longDefaultStrainTuple
};
return crackInputData;
}
private double GetLengthBetweenCracks(StrainTuple strainTuple)
{
var logic = new LengthBetweenCracksLogicSP63()
{
NdmCollection = defaultNdms,
TraceLogger = TraceLogger
};
logic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
return logic.GetLength();
}
private void Triangulate()
{
ndmPrimitives = InputData.NdmPrimitives;
rebarPrimitives = new List<RebarPrimitive>();
foreach (var item in ndmPrimitives)
triangulationLogic = new CrackedSectionTriangulationLogic(InputData.NdmPrimitives)
{
if (item is RebarPrimitive)
{
rebarPrimitives.Add(item as RebarPrimitive);
}
}
triangulateLogic = new TriangulatePrimitiveLogic()
{
Primitives = ndmPrimitives,
LimitState = LimitStates.SLS,
CalcTerm = CalcTerms.ShortTerm,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
defaultNdm = triangulateLogic.GetNdms();
rebarPrimitives = triangulationLogic.GetRebarPrimitives();
defaultNdms = triangulationLogic.GetNdmCollection();
fulyCrackedNdms = triangulationLogic.GetCrackedNdmCollection();
}
private void CalcCrackForce()
{
var calculator = new CrackForceCalculator();
calculator.EndTuple = InputData.LongTermTuple;
calculator.NdmCollection = defaultNdm;
calculator.NdmCollection = defaultNdms;
calculator.Run();
crackForceResult = calculator.Result as CrackForceResult;
}

View File

@@ -14,18 +14,42 @@ using StructureHelperCommon.Models.Parameters;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
/// <summary>
/// Geometrical primitive which generates ndm elemtntary part
/// </summary>
public interface INdmPrimitive : ISaveable, ICloneable
{
/// <summary>
/// Name of primitive
/// </summary>
string? Name { get; set; }
/// <summary>
/// Base point of primitive
/// </summary>
IPoint2D Center { get; }
/// <summary>
/// Host cross-section for primitive
/// </summary>
ICrossSection? CrossSection { get; set; }
/// <summary>
/// Material of primitive
/// </summary>
IHeadMaterial? HeadMaterial { get; set; }
/// <summary>
/// Flag of triangulation
/// </summary>
bool Triangulate { get; set; }
/// <summary>
/// Prestrain assigned from user
/// </summary>
StrainTuple UsersPrestrain { get; }
/// <summary>
/// Prestrain assigned from calculations
/// </summary>
StrainTuple AutoPrestrain { get; }
/// <summary>
/// Visual settings
/// </summary>
IVisualProperty VisualProperty {get; }
IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions);

View File

@@ -9,10 +9,22 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface IVisualProperty
{
/// <summary>
/// Flag of visibility
/// </summary>
bool IsVisible { get; set; }
Color Color { get; set; }
/// <summary>
/// Flag of assigning of color from material or from primitive's settings
/// </summary>
bool SetMaterialColor { get; set; }
/// <summary>
/// Index by z-coordinate
/// </summary>
int ZIndex { get; set; }
/// <summary>
/// Opacity of filling
/// </summary>
double Opacity { get; set; }
}
}

View File

@@ -68,13 +68,35 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
}
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
{
List<INdm> ndms = new()
{
GetConcreteNdm(triangulationOptions),
GetRebarNdm(triangulationOptions)
};
return ndms;
}
public RebarNdm GetRebarNdm(ITriangulationOptions triangulationOptions)
{
var options = new RebarTriangulationLogicOptions(this)
{
triangulationOptions = triangulationOptions
};
var logic = new RebarTriangulationLogic(options);
return logic.GetNdmCollection();
var rebar = logic.GetRebarNdm();
return rebar;
}
public Ndm GetConcreteNdm(ITriangulationOptions triangulationOptions)
{
var options = new RebarTriangulationLogicOptions(this)
{
triangulationOptions = triangulationOptions
};
var logic = new RebarTriangulationLogic(options);
var concrete = logic.GetConcreteNdm();
return concrete;
}
public List<INamedAreaPoint> GetValuePoints()

View File

@@ -3,8 +3,10 @@ using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.Ndms.Transformations;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.Models.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,14 +25,20 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
}
public IEnumerable<INdm> GetNdmCollection()
{
var concreteNdm = new Ndm
List<INdm> ndmCollection = new();
if (options.HostPrimitive is not null)
{
var concreteNdm = GetConcreteNdm();
ndmCollection.Add(concreteNdm);
}
var rebarNdm = GetRebarNdm();
ndmCollection.Add(rebarNdm);
return ndmCollection;
}
public RebarNdm GetRebarNdm()
{
CenterX = options.Center.X,
CenterY = options.Center.Y,
Area = options.Area,
Material = options.HostMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm),
StressScale = -1d
};
var rebarNdm = new RebarNdm
{
CenterX = options.Center.X,
@@ -38,9 +46,32 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Area = options.Area,
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
};
List<INdm> ndmCollection = new() { concreteNdm, rebarNdm};
NdmTransform.SetPrestrain(ndmCollection, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
return ndmCollection;
;
NdmTransform.SetPrestrain(rebarNdm, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
return rebarNdm;
}
public Ndm GetConcreteNdm()
{
var hostPrimitive = options.HostPrimitive;
var material = hostPrimitive
.HeadMaterial
.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm);
var prestrain = ForceTupleService.SumTuples(hostPrimitive.UsersPrestrain,
hostPrimitive.AutoPrestrain)
as StrainTuple;
var concreteNdm = new Ndm
{
CenterX = options.Center.X,
CenterY = options.Center.Y,
Area = options.Area,
Material = material,
StressScale = -1d
};
NdmTransform.SetPrestrain(concreteNdm, TupleConverter.ConvertToLoaderStrainMatrix(prestrain));
return concreteNdm;
}
public void ValidateOptions(ITriangulationLogicOptions options)

View File

@@ -22,7 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public double Area { get; }
public StrainTuple Prestrain { get; set; }
public IHeadMaterial HeadMaterial { get; set; }
public IHeadMaterial HostMaterial { get; set; }
public INdmPrimitive HostPrimitive { get; set; }
/// <inheritdoc />
public RebarTriangulationLogicOptions(RebarPrimitive primitive)
@@ -30,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Center = primitive.Center.Clone() as Point2D;
Area = primitive.Area;
HeadMaterial = primitive.HeadMaterial;
HostMaterial = primitive.HostPrimitive.HeadMaterial;
HostPrimitive = primitive.HostPrimitive;
Prestrain = ForceTupleService.SumTuples(primitive.UsersPrestrain, primitive.AutoPrestrain) as StrainTuple;
}
}

View File

@@ -0,0 +1,47 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public class CheckPrimitivesForMeshingLogic : ICheckPrimitivesForMeshingLogic
{
public IEnumerable<INdmPrimitive> Primitives { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public bool Check()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
if (!Primitives.Any())
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
if (!Primitives.Any(x => x.Triangulate == true))
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
foreach (var item in Primitives)
{
if (item.Triangulate == true &
item.HeadMaterial is null)
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Primitive: {item.Name} can't be triangulated since material is null");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
}
return true;
}
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public interface ICheckPrimitivesForMeshingLogic : ILogic
{
IEnumerable<INdmPrimitive> Primitives { get; set; }
bool Check();
}
}

View File

@@ -0,0 +1,18 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public interface IMeshHasDivisionLogic : ILogic
{
List<INdm> NdmCollection { get; set; }
IHasDivisionSize Primitive { get; set; }
void MeshHasDivision();
}
}

View File

@@ -0,0 +1,19 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public interface IMeshPrimitiveLogic : ILogic
{
INdmPrimitive Primitive { get; set; }
ITriangulationOptions TriangulationOptions { get; set; }
List<INdm> MeshPrimitive();
}
}

View File

@@ -11,6 +11,5 @@ namespace StructureHelperLogics.Services.NdmPrimitives
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
List<INdm> GetNdms();
bool CheckPrimitives(IEnumerable<INdmPrimitive> primitives);
}
}

View File

@@ -0,0 +1,98 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
internal class MeshCrackedConcreteLogic : IMeshPrimitiveLogic
{
private IMeshPrimitiveLogic regularMeshLogic;
public List<INdm> NdmCollection { get; set; }
public INdmPrimitive Primitive { get; set; }
public ITriangulationOptions TriangulationOptions { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
List<INdm> IMeshPrimitiveLogic.MeshPrimitive()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
CheckPrimitive();
List<INdm> ndmCollection = new();
if (Primitive.HeadMaterial.HelperMaterial is ICrackedMaterial)
{
TraceLogger?.AddMessage($"Primitive {Primitive.Name} is crackable primitive", TraceLogStatuses.Service);
var newPrimititve = Primitive.Clone() as INdmPrimitive;
SetNewMaterial(newPrimititve);
List<INdm> ndms = GetNdms(newPrimititve);
ndmCollection.AddRange(ndms);
}
else if (Primitive is RebarPrimitive rebar)
{
TraceLogger?.AddMessage($"Primitive {Primitive.Name} is rebar primitive", TraceLogStatuses.Service);
var newPrimititve = rebar.Clone() as RebarPrimitive;
var newHostPrimitive = rebar.HostPrimitive.Clone() as INdmPrimitive;
SetNewMaterial(newHostPrimitive);
newPrimititve.HostPrimitive = newHostPrimitive;
List<INdm> ndms = GetNdms(newPrimititve);
ndmCollection.AddRange(ndms);
}
else
{
TraceLogger?.AddMessage($"Primitive {Primitive.Name} is non-crackable primitive", TraceLogStatuses.Service);
List<INdm> ndms = GetNdms(Primitive);
ndmCollection.AddRange(ndms);
}
return ndmCollection;
}
private void SetNewMaterial(INdmPrimitive? newPrimititve)
{
TraceLogger?.AddMessage($"Process material {newPrimititve.HeadMaterial.Name} has started");
var newMaterial = newPrimititve.HeadMaterial.HelperMaterial.Clone() as ICrackedMaterial;
TraceLogger?.AddMessage($"Set work in tension zone for material {newPrimititve.HeadMaterial.Name}");
newMaterial.TensionForSLS = false;
newPrimititve.HeadMaterial.HelperMaterial = newMaterial as IHelperMaterial;
}
private List<INdm> GetNdms(INdmPrimitive primitive)
{
TraceLogger?.AddMessage($"Triangulation primitive has started");
regularMeshLogic = new MeshPrimitiveLogic()
{
Primitive = primitive,
TriangulationOptions = TriangulationOptions,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
List<INdm> ndms = regularMeshLogic.MeshPrimitive();
return ndms;
}
private void CheckPrimitive()
{
if (TriangulationOptions.LimiteState is not LimitStates.SLS)
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Limit state for cracking must correspondent limit state of serviceability");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
if (TriangulationOptions.CalcTerm is not CalcTerms.ShortTerm)
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Calc term for cracked concrete must correspondent short term");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
TraceLogger?.AddMessage($"Primitive check is ok");
}
}
}

View File

@@ -0,0 +1,41 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public class MeshHasDivisionLogic : IMeshHasDivisionLogic
{
public List<INdm> NdmCollection { get; set; }
public IHasDivisionSize Primitive { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public void MeshHasDivision()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
if (Primitive is IHasDivisionSize hasDivision)
{
if (hasDivision.ClearUnderlying == true)
{
TraceLogger?.AddMessage("Removing of background part has started", TraceLogStatuses.Service);
NdmCollection
.RemoveAll(x =>
hasDivision
.IsPointInside(new Point2D()
{
X = x.CenterX,
Y = x.CenterY
}) == true);
}
}
}
}
}

View File

@@ -0,0 +1,34 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public class MeshPrimitiveLogic : IMeshPrimitiveLogic
{
public INdmPrimitive Primitive { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public ITriangulationOptions TriangulationOptions { get; set; }
public List<INdm> MeshPrimitive()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
List<INdm> ndmCollection = new();
var itemNdms = Primitive.GetNdms(TriangulationOptions);
ndmCollection.AddRange(itemNdms);
TraceLogger?.AddMessage($"Triangulation of primitive {Primitive.Name} has finished, {itemNdms.Count()} part(s) were obtained", TraceLogStatuses.Service);
return ndmCollection;
}
}
}

View File

@@ -2,7 +2,10 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
@@ -10,49 +13,85 @@ namespace StructureHelperLogics.Services.NdmPrimitives
{
public class TriangulatePrimitiveLogic : ITriangulatePrimitiveLogic
{
private IMeshHasDivisionLogic divisionLogic;
private IMeshPrimitiveLogic meshLogic;
private List<INdm> ndmCollection;
private ICheckPrimitivesForMeshingLogic checkLogic;
public IEnumerable<INdmPrimitive> Primitives { get; set; }
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
public bool ConsiderCracking { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public TriangulatePrimitiveLogic()
public TriangulatePrimitiveLogic(IMeshPrimitiveLogic meshPrimitiveLogic)
{
ConsiderCracking = false;
meshLogic = meshPrimitiveLogic;
}
public TriangulatePrimitiveLogic() : this (new MeshPrimitiveLogic()) { }
public List<INdm> GetNdms()
{
TraceLogger?.AddMessage($"Total count of primitives n = {Primitives.Count()}", TraceLogStatuses.Service);
TraceLogger?.AddMessage($"Limit state is {LimitState}", TraceLogStatuses.Service);
TraceLogger?.AddMessage($"Calc term is {CalcTerm}", TraceLogStatuses.Service);
var orderedNdmPrimitives = Primitives.OrderBy(x => x.VisualProperty.ZIndex);
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
CheckPrimitives();
ndmCollection = new List<INdm>();
foreach (var item in orderedNdmPrimitives)
SetLogics();
TraceInitialSettings();
TriangulatePrimitives();
return ndmCollection;
}
private void TriangulatePrimitives()
{
TraceLogger?.AddMessage($"Triangulation of primitive {item.Name} has started", TraceLogStatuses.Service);
ProcessHasDivision(item);
TriangulatePrimitive(item);
var orderedNdmPrimitives = Primitives.OrderBy(x => x.VisualProperty.ZIndex);
foreach (var primitive in orderedNdmPrimitives)
{
TriangulatePrimitive(primitive);
}
if (TraceLogger is not null)
{
TraceService.TraceNdmCollection(TraceLogger, ndmCollection);
}
return ndmCollection;
TraceLogger?.AddMessage($"Triangulation of primitives has finished, {ndmCollection.Count} part(s) were obtained", TraceLogStatuses.Service);
}
private void TriangulatePrimitive(INdmPrimitive item)
private void TraceInitialSettings()
{
if (item.Triangulate == true)
TraceLogger?.AddMessage($"Total count of primitives n = {Primitives.Count()}", TraceLogStatuses.Service);
TraceLogger?.AddMessage($"Limit state is {LimitState}", TraceLogStatuses.Service);
TraceLogger?.AddMessage($"Calc term is {CalcTerm}", TraceLogStatuses.Service);
}
private void SetLogics()
{
divisionLogic = new MeshHasDivisionLogic()
{
NdmCollection = ndmCollection,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
var triangulationOptions = new TriangulationOptions()
{
LimiteState = LimitState,
CalcTerm = CalcTerm
};
var itemNdms = item.GetNdms(triangulationOptions);
ndmCollection.AddRange(itemNdms);
TraceLogger?.AddMessage($"Triangulation of primitive {item.Name} was finished, {itemNdms.Count()} part(s) were obtained", TraceLogStatuses.Service);
meshLogic.TriangulationOptions = triangulationOptions;
meshLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
}
private void TriangulatePrimitive(INdmPrimitive primitive)
{
TraceLogger?.AddMessage($"Triangulation of primitive {primitive.Name} has started", TraceLogStatuses.Service);
if (primitive is IHasDivisionSize hasDivision)
{
divisionLogic.Primitive = hasDivision;
divisionLogic.MeshHasDivision();
}
if (primitive.Triangulate == true)
{
meshLogic.Primitive = primitive;
var ndms = meshLogic.MeshPrimitive();
ndmCollection.AddRange(ndms);
}
else
{
@@ -60,45 +99,14 @@ namespace StructureHelperLogics.Services.NdmPrimitives
}
}
private void ProcessHasDivision(INdmPrimitive? item)
private bool CheckPrimitives()
{
if (item is IHasDivisionSize hasDivision)
checkLogic = new CheckPrimitivesForMeshingLogic()
{
if (hasDivision.ClearUnderlying == true)
{
TraceLogger?.AddMessage("Removing of background part has started", TraceLogStatuses.Service);
ndmCollection
.RemoveAll(x =>
hasDivision
.IsPointInside(new Point2D() { X = x.CenterX, Y = x.CenterY }) == true);
}
}
}
public bool CheckPrimitives(IEnumerable<INdmPrimitive> primitives)
{
if (!primitives.Any())
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
if (!primitives.Any(x => x.Triangulate == true))
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
foreach (var item in primitives)
{
if (item.Triangulate == true &
item.HeadMaterial is null)
{
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Primitive: {item.Name} can't be triangulated since material is null");
TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
throw new StructureHelperException(errorMessage);
}
}
Primitives = Primitives,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
checkLogic.Check();
return true;
}
}

View File

@@ -15,7 +15,13 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
public void Run_ShouldPass(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, bool isBuckling, double expectedKx, double expectedKy, double expectedEpsZ)
{
//Arrange
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount};
var template = new RectangleBeamTemplate(width, height)
{
TopDiameter = topDiametr,
BottomDiameter = bottomDiametr,
WidthCount = widthCount,
HeightCount = heightCount
};
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
var calculator = newSection.SectionRepository.CalculatorsList[0] as IForceCalculator;
calculator.CompressedMember.Buckling = isBuckling;