diff --git a/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml.user b/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml.user index 06d5d54..387ec16 100644 --- a/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/StructureHelper/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2024-12-27T08:24:44.0055462Z||;True|2024-11-13T09:16:22.8894163+05:00||;True|2024-08-13T14:00:35.8311260+05:00||;True|2024-08-12T12:59:16.1785759+05:00||;True|2024-03-11T20:33:14.1457807+05:00||;True|2024-03-10T19:11:27.6834663+05:00||;True|2024-02-02T12:22:50.1454015+05:00||;True|2023-02-25T13:37:39.2738786+05:00||;False|2023-02-25T13:37:24.0284261+05:00||;True|2023-02-25T13:34:01.6858860+05:00||;True|2023-02-25T13:31:18.8295711+05:00||;False|2023-02-25T13:25:21.5807199+05:00||;False|2023-02-25T13:24:41.7164398+05:00||; + True|2024-12-29T15:48:11.7280613Z;True|2024-12-27T13:24:44.0055462+05:00;True|2024-11-13T09:16:22.8894163+05:00;True|2024-08-13T14:00:35.8311260+05:00;True|2024-08-12T12:59:16.1785759+05:00;True|2024-03-11T20:33:14.1457807+05:00;True|2024-03-10T19:11:27.6834663+05:00;True|2024-02-02T12:22:50.1454015+05:00;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00; \ No newline at end of file diff --git a/StructureHelper/Services/ResultViewers/CrackResultFunc.cs b/StructureHelper/Services/ResultViewers/CrackResultFunc.cs index b66aa96..95e975b 100644 --- a/StructureHelper/Services/ResultViewers/CrackResultFunc.cs +++ b/StructureHelper/Services/ResultViewers/CrackResultFunc.cs @@ -7,11 +7,11 @@ using System.Threading.Tasks; namespace StructureHelper.Services.ResultViewers { - public class CrackResultFunc : IResultFunc> + public class CrackResultFunc : IResultFunc> { public string Name { get; set; } - public Func ResultFunction { get; set; } + public Func ResultFunction { get; set; } public string UnitName { get; set; } diff --git a/StructureHelper/Services/ResultViewers/CrackResultFuncFactory.cs b/StructureHelper/Services/ResultViewers/CrackResultFuncFactory.cs index b44a902..7130ff9 100644 --- a/StructureHelper/Services/ResultViewers/CrackResultFuncFactory.cs +++ b/StructureHelper/Services/ResultViewers/CrackResultFuncFactory.cs @@ -25,70 +25,70 @@ namespace StructureHelper.Services.ResultViewers new() { Name = "Long crack width", - ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.CrackWidth, + ResultFunction = (IRebarCrackResult rebar) => rebar.LongTermResult.CrackWidth, UnitFactor = unitLength.Multiplyer, UnitName = unitLength.Name }, new() { Name = "Short crack width", - ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.CrackWidth, + ResultFunction = (IRebarCrackResult rebar) => rebar.ShortTermResult.CrackWidth, UnitFactor = unitLength.Multiplyer, UnitName = unitLength.Name }, new() { Name = "Long softening factor", - ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.SofteningFactor, + ResultFunction = (IRebarCrackResult rebar) => rebar.LongTermResult.SofteningFactor, UnitFactor = 1, UnitName = "Dimensionless" }, new() { Name = "Short softening factor", - ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.SofteningFactor, + ResultFunction = (IRebarCrackResult rebar) => rebar.ShortTermResult.SofteningFactor, UnitFactor = 1, UnitName = "Dimensionless" }, new() { Name = "Long rebar stress", - ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStress, + ResultFunction = (IRebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStress, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name }, new() { Name = "Short rebar stress", - ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStress, + ResultFunction = (IRebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStress, UnitFactor = unitStress.Multiplyer, UnitName = unitStress.Name }, new() { Name = "Long rebar strain", - ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStrain, + ResultFunction = (IRebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.RebarStrain, UnitFactor = 1d, UnitName = string.Empty }, new() { Name = "Short rebar strain", - ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStrain, + ResultFunction = (IRebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.RebarStrain, UnitFactor = 1d, UnitName = string.Empty }, new() { Name = "Long concrete strain", - ResultFunction = (RebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.ConcreteStrain, + ResultFunction = (IRebarCrackResult rebar) => rebar.LongTermResult.RebarStressResult.ConcreteStrain, UnitFactor = 1d, UnitName = string.Empty }, new() { Name = "Short concrete strain", - ResultFunction = (RebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.ConcreteStrain, + ResultFunction = (IRebarCrackResult rebar) => rebar.ShortTermResult.RebarStressResult.ConcreteStrain, UnitFactor = 1d, UnitName = string.Empty } diff --git a/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs b/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs index ef0762a..fd225e0 100644 --- a/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs +++ b/StructureHelper/Services/ResultViewers/ShowIsoFieldResult.cs @@ -42,7 +42,7 @@ namespace StructureHelper.Services.ResultViewers return primitiveSets; } - public static List GetPrimitiveSets(IEnumerable rebarResults, IEnumerable resultFuncs) + public static List GetPrimitiveSets(IEnumerable rebarResults, IEnumerable resultFuncs) { List primitiveSets = new List(); foreach (var valDelegate in resultFuncs) @@ -59,7 +59,7 @@ namespace StructureHelper.Services.ResultViewers return primitiveSets; } - private static IValuePrimitive ProcessNdm(CrackResultFunc valDelegate, RebarCrackResult rebarResult) + private static IValuePrimitive ProcessNdm(CrackResultFunc valDelegate, IRebarCrackResult rebarResult) { double delegateResult = valDelegate.ResultFunction.Invoke(rebarResult); var val = delegateResult * valDelegate.UnitFactor; diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user index 7acfc94..c87fe02 100644 --- a/StructureHelper/StructureHelper.csproj.user +++ b/StructureHelper/StructureHelper.csproj.user @@ -1,7 +1,7 @@  - <_LastSelectedProfileId>D:\Repos\StructureHelper\StructureHelper\Properties\PublishProfiles\FolderProfile.pubxml + <_LastSelectedProfileId>C:\Source\Repos\StructureHelper\StructureHelper\Properties\PublishProfiles\FolderProfile.pubxml diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs index 9682c08..715ad19 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/CrackResultViewModel.cs @@ -17,7 +17,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews private RelayCommand? showRebarsCommand; public TupleCrackResult SelectedResult { get; set; } - public List TupleResults => CrackResult.TupleResults; + public List TupleResults => CrackResult.TupleResults; public ICommand ShowRebarsCommand { get diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/IShowCrackIsoFieldsLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/IShowCrackIsoFieldsLogic.cs index 0377302..de1fb94 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/IShowCrackIsoFieldsLogic.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/IShowCrackIsoFieldsLogic.cs @@ -5,6 +5,6 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews { public interface IShowCrackIsoFieldsLogic { - void ShowIsoField(IEnumerable rebarResults); + void ShowIsoField(IEnumerable rebarResults); } } \ No newline at end of file diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/ShowCrackIsoFieldsLogic.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/ShowCrackIsoFieldsLogic.cs index deef0fe..661400a 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/ShowCrackIsoFieldsLogic.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/ShowCrackIsoFieldsLogic.cs @@ -15,7 +15,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews { private IsoFieldReport isoFieldReport; - public void ShowIsoField(IEnumerable rebarResults) + public void ShowIsoField(IEnumerable rebarResults) { try { diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/TupleCrackResultViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/TupleCrackResultViewModel.cs index 8f5d5d5..162bb75 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/TupleCrackResultViewModel.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/Cracks/TupleCrackResultViewModel.cs @@ -25,7 +25,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews private IsoFieldReport isoFieldReport; public TupleCrackResult CrackResult => crackResult; - public List RebarResults => crackResult.RebarResults; + public List RebarResults => crackResult.RebarResults; public RebarCrackResult SelectedResult { get; set; } public string WindowTitle => "Result of calculation of cracks for action " + crackResult.InputData.TupleName; public ICommand ShowIsoFieldCommand diff --git a/StructureHelper/Windows/CalculationWindows/ProgressViews/TraceDocumentVM.cs b/StructureHelper/Windows/CalculationWindows/ProgressViews/TraceDocumentVM.cs index 4de9745..bb0ce43 100644 --- a/StructureHelper/Windows/CalculationWindows/ProgressViews/TraceDocumentVM.cs +++ b/StructureHelper/Windows/CalculationWindows/ProgressViews/TraceDocumentVM.cs @@ -101,7 +101,12 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews private Block GetBlockByEntry(ITraceLoggerEntry traceEntry) { Block block; - if (traceEntry is StringLogEntry stringEntry) + if (traceEntry is null) + { + block = new Paragraph(new Run("---")); + return block; + } + else if (traceEntry is StringLogEntry stringEntry) { block = GetBlockByStringEntry(stringEntry); } diff --git a/StructureHelper/Windows/MainWindow/Analyses/AnalysisView.xaml b/StructureHelper/Windows/MainWindow/Analyses/AnalysisView.xaml index edf77b8..84efea9 100644 --- a/StructureHelper/Windows/MainWindow/Analyses/AnalysisView.xaml +++ b/StructureHelper/Windows/MainWindow/Analyses/AnalysisView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow.Analyses" d:DataContext="{d:DesignInstance local:AnalysisViewModel}" mc:Ignorable="d" - Title="Analysis" Height="250" Width="300" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"> + Title="Analysis properties" Height="350" Width="400" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"> @@ -15,20 +15,20 @@ - + - - - + + + - - + + diff --git a/StructureHelperCommon/Infrastructures/Interfaces/IHasForceActions.cs b/StructureHelperCommon/Infrastructures/Interfaces/IHasForceActions.cs index 47a5171..eee6d89 100644 --- a/StructureHelperCommon/Infrastructures/Interfaces/IHasForceActions.cs +++ b/StructureHelperCommon/Infrastructures/Interfaces/IHasForceActions.cs @@ -1,8 +1,15 @@ using System.Collections.Generic; using StructureHelperCommon.Models.Forces; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + namespace StructureHelperCommon.Infrastructures.Interfaces { + /// + /// Interface for entities which has collection of force actions + /// public interface IHasForceActions { /// diff --git a/StructureHelperCommon/Infrastructures/Interfaces/ISaveable.cs b/StructureHelperCommon/Infrastructures/Interfaces/ISaveable.cs index 02968da..35d673d 100644 --- a/StructureHelperCommon/Infrastructures/Interfaces/ISaveable.cs +++ b/StructureHelperCommon/Infrastructures/Interfaces/ISaveable.cs @@ -2,12 +2,14 @@ namespace StructureHelperCommon.Infrastructures.Interfaces { + /// + /// Interface for entities which able to save (has unique identifier) + /// public interface ISaveable { /// /// Unique identifier /// Guid Id { get;} - //void Save(); } } diff --git a/StructureHelperCommon/Models/Loggers/ITraceCollectionLogic.cs b/StructureHelperCommon/Models/Loggers/ITraceCollectionLogic.cs new file mode 100644 index 0000000..6a548eb --- /dev/null +++ b/StructureHelperCommon/Models/Loggers/ITraceCollectionLogic.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + +namespace StructureHelperCommon.Models +{ + public interface ITraceCollectionLogic : ITraceEntityLogic + { + IEnumerable? Collection { get; set; } + int Priority { get; set; } + } +} \ No newline at end of file diff --git a/StructureHelperCommon/Models/Loggers/ITraceEntityFactory.cs b/StructureHelperCommon/Models/Loggers/ITraceEntityFactory.cs deleted file mode 100644 index 7819c0b..0000000 --- a/StructureHelperCommon/Models/Loggers/ITraceEntityFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -using StructureHelperCommon.Models; -using System.Collections.Generic; - -namespace StructureHelperCommon.Models -{ - public interface ITraceEntityFactory where T : class - { - IEnumerable? Collection { get; set; } - int Priority { get; set; } - - List GetTraceEntries(); - } -} \ No newline at end of file diff --git a/StructureHelperCommon/Models/Loggers/ITraceEntityLogic.cs b/StructureHelperCommon/Models/Loggers/ITraceEntityLogic.cs new file mode 100644 index 0000000..4233016 --- /dev/null +++ b/StructureHelperCommon/Models/Loggers/ITraceEntityLogic.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + +namespace StructureHelperCommon.Models +{ + /// + /// Creates collection of entries for trace logger of some entity + /// + public interface ITraceEntityLogic + { + /// + /// Default priority for created trace logger entries + /// + int Priority { get; set; } + /// + /// Returns list of entries + /// + /// List of entries + List GetTraceEntries(); + /// + /// Creates new collection of entries and adds it into trace logger + /// + /// + void AddEntriesToTraceLogger(IShiftTraceLogger traceLogger); + } +} \ No newline at end of file diff --git a/StructureHelperLogics/Models/Analyses/CrossSectionNdmAnalysis.cs b/StructureHelperLogics/Models/Analyses/CrossSectionNdmAnalysis.cs index e5f4213..5f1204c 100644 --- a/StructureHelperLogics/Models/Analyses/CrossSectionNdmAnalysis.cs +++ b/StructureHelperLogics/Models/Analyses/CrossSectionNdmAnalysis.cs @@ -37,7 +37,6 @@ namespace StructureHelperLogic.Models.Analyses public object Clone() { CrossSectionNdmAnalysis newAnalysis = new(); - var project = ProgramSetting.CurrentProject; updateStrategy.Update(newAnalysis, this); var currentVersion = VersionProcessor.GetCurrentVersion().AnalysisVersion as ICloneable; ISaveable newCrossSection = currentVersion.Clone() as ISaveable; diff --git a/StructureHelperLogics/Models/CrossSections/CrossSection.cs b/StructureHelperLogics/Models/CrossSections/CrossSection.cs index 8fa26ce..7374f5e 100644 --- a/StructureHelperLogics/Models/CrossSections/CrossSection.cs +++ b/StructureHelperLogics/Models/CrossSections/CrossSection.cs @@ -9,8 +9,6 @@ namespace StructureHelperLogics.Models.CrossSections { public class CrossSection : ICrossSection { - private ICloneStrategy cloneStrategy; - private IUpdateStrategy updateStrategy = new CrossSectionUpdateStrategy(); public ICrossSectionRepository SectionRepository { get; set; } = new CrossSectionRepository(); public Guid Id { get; private set; } @@ -27,7 +25,7 @@ namespace StructureHelperLogics.Models.CrossSections public object Clone() { - cloneStrategy = new CrossSectionCloneStrategy(); + ICloneStrategy cloneStrategy = new CrossSectionCloneStrategy(); return cloneStrategy.GetClone(this); } } diff --git a/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs b/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs index 1293187..88d7b7a 100644 --- a/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs +++ b/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs @@ -25,7 +25,6 @@ namespace StructureHelperLogics.Models.CrossSections public ICrossSection GetClone(ICrossSection sourceObject) { - var project = ProgramSetting.CurrentProject; ICrossSectionRepository newRepository = repositoryCloneStrategy.GetClone(sourceObject.SectionRepository); targetObject = new() { diff --git a/StructureHelperLogics/Models/CrossSections/CrossSectionRepositoryCloneStrategy.cs b/StructureHelperLogics/Models/CrossSections/CrossSectionRepositoryCloneStrategy.cs index 61c0704..d69dff3 100644 --- a/StructureHelperLogics/Models/CrossSections/CrossSectionRepositoryCloneStrategy.cs +++ b/StructureHelperLogics/Models/CrossSections/CrossSectionRepositoryCloneStrategy.cs @@ -44,7 +44,6 @@ namespace StructureHelperLogics.Models.CrossSections public ICrossSectionRepository GetClone(ICrossSectionRepository sourceObject) { - var project = ProgramSetting.CurrentProject; targetRepository = new(); forcesUpdateStrategy.Update(targetRepository, sourceObject); materialsUpdateStrategy.Update(targetRepository, sourceObject); diff --git a/StructureHelperLogics/Models/Materials/TraceMaterialsFactory.cs b/StructureHelperLogics/Models/Materials/TraceMaterialsFactory.cs index c3e43a8..d80ae0d 100644 --- a/StructureHelperLogics/Models/Materials/TraceMaterialsFactory.cs +++ b/StructureHelperLogics/Models/Materials/TraceMaterialsFactory.cs @@ -15,7 +15,7 @@ using System.Windows.Shapes; namespace StructureHelperLogics.Models.Materials { - public class TraceMaterialsFactory : ITraceEntityFactory + public class TraceMaterialsFactory : ITraceCollectionLogic { const int rowSize = 2; private List traceLoggerEntries; @@ -267,5 +267,11 @@ namespace StructureHelperLogics.Models.Materials rows.Add(ndmRow); return rows; } + + public void AddEntriesToTraceLogger(IShiftTraceLogger traceLogger) + { + var entries = GetTraceEntries(); + entries.ForEach(x => traceLogger?.AddEntry(x)); + } } } diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorInputData.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorInputData.cs index 65511d4..73aa1d8 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorInputData.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorInputData.cs @@ -1,15 +1,8 @@ using StructureHelperCommon.Infrastructures.Enums; -using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Sections; -using StructureHelperLogics.Models.Calculations.CalculationProperties; using StructureHelperLogics.NdmCalculations.Primitives; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces { diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorLogic.cs index 5ca0999..f6db798 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculatorLogic.cs @@ -53,24 +53,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces private void TraceInputData() { - TracePrimitiveFactory tracePrimitiveFactory = new() + ITraceEntityLogic tracelogic = new TracePrimitiveFactory() { Collection = InputData.Primitives }; - List traceEntries = tracePrimitiveFactory.GetTraceEntries(); - foreach (var item in traceEntries) - { - TraceLogger?.AddEntry(item); - } - TraceMaterialsFactory traceMaterialFactory = new() + tracelogic.AddEntriesToTraceLogger(TraceLogger); + tracelogic = new TraceMaterialsFactory() { Collection = InputData.Primitives.Select(x => x.NdmElement.HeadMaterial).Distinct() }; - traceEntries = traceMaterialFactory.GetTraceEntries(); - foreach (var item in traceEntries) - { - TraceLogger?.AddEntry(item); - } + tracelogic.AddEntriesToTraceLogger(TraceLogger); } private void CalculateResult() diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceCalculatorUpdateCloningStrategy.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceCalculatorUpdateCloningStrategy.cs index b4129a4..914df8c 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceCalculatorUpdateCloningStrategy.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceCalculatorUpdateCloningStrategy.cs @@ -32,7 +32,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics public void Update(IForceCalculator targetObject, IForceCalculator sourceObject) { - var project = ProgramSetting.CurrentProject; CheckObject.IsNull(cloningStrategy); CheckObject.IsNull(sourceObject); CheckObject.IsNull(targetObject); diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceTupleTraceResultLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceTupleTraceResultLogic.cs index 41c9434..f7d63aa 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceTupleTraceResultLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/ForceTupleTraceResultLogic.cs @@ -2,16 +2,11 @@ using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.ResultData; using LoaderCalculator.Logics; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Models; +using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Shapes; -using StructureHelperCommon.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using StructureHelperCommon.Models.Calculators; -using StructureHelperCommon.Infrastructures.Exceptions; namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces { diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/HasCalculatorsUpdateCloningStrategy.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/HasCalculatorsUpdateCloningStrategy.cs index 67b95bf..6dd253d 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/HasCalculatorsUpdateCloningStrategy.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/Logics/HasCalculatorsUpdateCloningStrategy.cs @@ -46,7 +46,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces public void Update(IHasCalculators targetObject, IHasCalculators sourceObject) { - var project = ProgramSetting.CurrentProject; CheckObject.IsNull(cloningStrategy); CheckObject.IsNull(sourceObject); CheckObject.IsNull(targetObject); diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceCrackResultLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceCrackResultLogic.cs new file mode 100644 index 0000000..a717740 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceCrackResultLogic.cs @@ -0,0 +1,182 @@ +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Models; +using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Tables; +using StructureHelperLogics.NdmCalculations.Cracking; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces +{ + public class TraceCrackResultLogic : ITraceCollectionLogic + { + private List traceLoggerEntries; + private const int rowSize = 4; + + public IEnumerable? Collection { get; set; } + public int Priority { get; set; } = LoggerService.GetPriorityByStatus(TraceLogStatuses.Info); + + public void AddEntriesToTraceLogger(IShiftTraceLogger traceLogger) + { + var entries = GetTraceEntries(); + entries.ForEach(x => traceLogger?.AddEntry(x)); + } + + public List GetTraceEntries() + { + Check(); + traceLoggerEntries = new(); + traceLoggerEntries.Add(new StringLogEntry() + { + Message = $"There are totally {Collection.Count()} result(s), {Collection.Count(x => x.IsValid == true)} valid result(s), {Collection.Count(x => x.IsValid == false)} invalid result(s)", + Priority = Priority + } + ); + ProcessCollection(); + return traceLoggerEntries; + } + + private void ProcessCollection() + { + foreach (var item in Collection) + { + int priority = Priority; + if (item.IsValid == false) + { + priority = LoggerService.GetPriorityByStatus(TraceLogStatuses.Error); + } + var message = new StringLogEntry() + { + Message = "Force combination: " + item.InputData.TupleName, + Priority = priority + }; + traceLoggerEntries.Add(message); + if (item.IsValid == false) + { + var errorMessage = new StringLogEntry() + { + Message = "Calculation is not valid: " + item.Description, + Priority = priority + }; + traceLoggerEntries.Add(errorMessage); + continue; + } + var table = new TableLogEntry(rowSize) + { + Priority = Priority + }; + table.ColumnWidth[0] = 100; + table.ColumnWidth[1] = 250; + table.ColumnWidth[2] = 250; + table.ColumnWidth[3] = 100; + table.Table.AddRow(GetHeader(item)); + List> rows = ProcessTupleCrackResult(item); + rows.ForEach(x => table.Table.AddRow(x)); + traceLoggerEntries.Add(table); + if (item.IsValid == true) + { + ProcessRebars(item); + } + } + } + + private void ProcessRebars(ITupleCrackResult item) + { + ITraceEntityLogic traceEntityLogic = new TraceRebarCrackResultLogic() { Collection = item.RebarResults }; + traceLoggerEntries.AddRange(traceEntityLogic.GetTraceEntries()); + } + + private List> ProcessTupleCrackResult(ITupleCrackResult item) + { + List> rows = new(); + int priority = Priority; + if (item.IsValid == false) + { + priority = LoggerService.GetPriorityByStatus(TraceLogStatuses.Error); + if (item.LongTermResult is null || item.ShortTermResult is null) + { + return rows; + } + } + ShTableRow row; + string? description = item.Description; + string termName = "Long term"; + IForceTuple? tuple = item.InputData.LongTermTuple; + row = GetTupleRow(priority, termName, tuple, item.LongTermResult); + rows.Add(row); + termName = "Short term"; + tuple = item.InputData.ShortTermTuple; + row = GetTupleRow(priority, termName, tuple, item.ShortTermResult); + rows.Add(row); + return rows; + } + + private ShTableRow GetTupleRow(int priority, string longTermName, IForceTuple? tuple, CrackWidthRebarTupleResult rebarResult) + { + ShTableRow ndmRow; + ndmRow = new(rowSize); + string description = string.Empty; + if (rebarResult.IsCrackLessThanUltimate == false) + { + description = "Actual crack width is greater than ultimate one"; + priority = LoggerService.GetPriorityByStatus(TraceLogStatuses.Error); + } + ndmRow.Elements[0].Value = new StringLogEntry() + { + Message = longTermName, + Priority = priority + }; + ndmRow.Elements[1].Value = new StringLogEntry() + { + Message = TraceStringService.GetForces(tuple), + Priority = priority + }; + ndmRow.Elements[2].Value = new StringLogEntry() + { + Message = $" Acrc = {rebarResult.CrackWidth}(m),\nAcrc,ult=({rebarResult.UltimateCrackWidth}(m))", + Priority = priority + }; + ndmRow.Elements[3].Value = new StringLogEntry() + { + Message = description, + Priority = priority + }; + return ndmRow; + } + + private IShTableRow GetHeader(ITupleCrackResult tupleCrackResult) + { + const CellRole cellRole = CellRole.Header; + string[] ColumnList = new string[] + { + "Calc term", + "Forces", + "Crack width", + "Description" + }; + var ndmRow = new ShTableRow(rowSize); + ndmRow.Elements.ForEach(x => x.Role = cellRole); + + for (int i = 0; i < rowSize; i++) + { + ndmRow.Elements[i].Value = new StringLogEntry() + { + Message = ColumnList[i], + Priority = Priority + }; + } + return ndmRow; + } + + private void Check() + { + if (Collection is null) + { + throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": Collection of primitives"); + } + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceCrackWidthTupleResultLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceCrackWidthTupleResultLogic.cs new file mode 100644 index 0000000..40da1a3 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceCrackWidthTupleResultLogic.cs @@ -0,0 +1,26 @@ +using StructureHelperCommon.Models; +using StructureHelperLogics.NdmCalculations.Cracking; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces +{ + internal class TraceCrackWidthTupleResultLogic : ITraceCollectionLogic + { + public IEnumerable? Collection { get; set; } + public int Priority { get; set; } = LoggerService.GetPriorityByStatus(TraceLogStatuses.Info); + + public void AddEntriesToTraceLogger(IShiftTraceLogger traceLogger) + { + throw new NotImplementedException(); + } + + public List GetTraceEntries() + { + throw new NotImplementedException(); + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceForcesResultLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceForcesResultLogic.cs index d2aeaf1..50b9b01 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceForcesResultLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceForcesResultLogic.cs @@ -11,7 +11,10 @@ using System.Threading.Tasks; namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces { - public class TraceForcesResultLogic : ITraceEntityFactory + /// + /// Provides trace logger inforvation for collection of force tuple results + /// + public class TraceForcesResultLogic : ITraceCollectionLogic { const int rowSize = 4; private List traceLoggerEntries; @@ -60,19 +63,19 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces ndmRow = new(rowSize); ndmRow.Elements[0].Value = new StringLogEntry() { - Message = "Limit state: " + item.DesignForceTuple.LimitState.ToString() + ", Calculation term: " + item.DesignForceTuple.CalcTerm, + Message = TraceStringService.GetLimitStateAndCalctTerm(item.DesignForceTuple), Priority = priority }; ndmRow.Elements[1].Value = new StringLogEntry() { - Message = "Mx = " + item.DesignForceTuple.ForceTuple.Mx.ToString() + "N*m, My = " + item.DesignForceTuple.ForceTuple.My.ToString() + "N*m, Nz =" + item.DesignForceTuple.ForceTuple.Nz.ToString() + "N, ", + Message = TraceStringService.GetForces(item.DesignForceTuple.ForceTuple), Priority = priority }; if (item.LoaderResults is not null) { ndmRow.Elements[2].Value = new StringLogEntry() { - Message = "Kx = " + item.LoaderResults.StrainMatrix.Kx + "(1/m), Ky = " + item.LoaderResults.StrainMatrix.Ky + "(1/m), EpsZ = " + item.LoaderResults.StrainMatrix.EpsZ + "(dimensionless)", + Message = TraceStringService.GetCuvatures(item.LoaderResults.ForceStrainPair.StrainMatrix), Priority = priority }; } @@ -96,10 +99,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces "Description" }; var ndmRow = new ShTableRow(rowSize); - foreach (var item in ndmRow.Elements) - { - item.Role = cellRole; - } + ndmRow.Elements.ForEach(x => x.Role = cellRole); for (int i = 0; i < rowSize; i++) { @@ -119,5 +119,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": Collection of primitives"); } } + + public void AddEntriesToTraceLogger(IShiftTraceLogger traceLogger) + { + var entries = GetTraceEntries(); + entries.ForEach(x => traceLogger?.AddEntry(x)); + } } } diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceStringService.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceStringService.cs new file mode 100644 index 0000000..a217789 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/TraceStringService.cs @@ -0,0 +1,35 @@ +using LoaderCalculator.Data.Matrix; +using StructureHelperCommon.Models.Forces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces +{ + public static class TraceStringService + { + public static string GetLimitStateAndCalctTerm(IDesignForceTuple designForceTuple) + { + string s = "Limit state: " + designForceTuple.LimitState.ToString(); + s += ", Calculation term: " + designForceTuple.CalcTerm; + return s; + } + + public static string GetForces(IForceTuple forceTuple) + { + string s = "Mx = " + forceTuple.Mx.ToString(); + s += "(N*m), My = " + forceTuple.My.ToString(); + s += "(N*m), Nz =" + forceTuple.Nz.ToString() + "(N), "; + return s; + } + public static string GetCuvatures(IStrainMatrix strainMatrix) + { + string s = "Kx = " + strainMatrix.Kx; + s += "(1/m), Ky = " + strainMatrix.Ky; + s += "(1/m), EpsZ = " + strainMatrix.EpsZ + "(dimensionless)"; + return s; + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Analyses/TraceRebarCrackResultLogic.cs b/StructureHelperLogics/NdmCalculations/Analyses/TraceRebarCrackResultLogic.cs new file mode 100644 index 0000000..dde98e4 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Analyses/TraceRebarCrackResultLogic.cs @@ -0,0 +1,192 @@ +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Models; +using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Tables; +using StructureHelperLogics.NdmCalculations.Analyses.ByForces; +using StructureHelperLogics.NdmCalculations.Cracking; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperLogics.NdmCalculations.Analyses +{ + internal class TraceRebarCrackResultLogic : ITraceCollectionLogic + { + private List traceLoggerEntries; + private TableLogEntry table; + private const int resultRowSize = 4; + private const int rebarRowSize = 2; + private const int calctTermColumnWidth = 80; + private const int elongationColumnWidth = 200; + private const int psiSColumnWidth = 200; + private const int crackWidthColumnWidth = 250; + + public IEnumerable? Collection { get; set; } + public int Priority { get; set; } = LoggerService.GetPriorityByStatus(TraceLogStatuses.Info); + + public void AddEntriesToTraceLogger(IShiftTraceLogger traceLogger) + { + var entries = GetTraceEntries(); + entries.ForEach(x => traceLogger?.AddEntry(x)); + } + + public List GetTraceEntries() + { + Check(); + traceLoggerEntries = new(); + ProcessCollection(); + return traceLoggerEntries; + } + + private void ProcessCollection() + { + var message = new StringLogEntry() + { + Message = "Results by rebars", + Priority = Priority + }; + traceLoggerEntries.Add(message); + table = new TableLogEntry(rebarRowSize) + { + Priority = Priority + }; + table.ColumnWidth[0] = 100; + table.ColumnWidth[1] = calctTermColumnWidth + elongationColumnWidth + psiSColumnWidth + crackWidthColumnWidth; + table.Table.AddRow(GetHeader()); + foreach (var item in Collection) + { + List> rows = ProcessRebar(item); + rows.ForEach(x => table.Table.AddRow(x)); + } + traceLoggerEntries.Add(table); + } + + private List> ProcessRebar(IRebarCrackResult item) + { + List> rows = new(); + IShTableRow rebarRow = new ShTableRow(rebarRowSize); + rebarRow.Elements[0].Value = new StringLogEntry() + { + Message = item.RebarPrimitive.Name, + Priority = Priority + }; + rebarRow.Elements[1].Value = GetResultTable(item); + rows.Add(rebarRow); + return rows; + } + + private TableLogEntry GetResultTable(IRebarCrackResult item) + { + TableLogEntry resultTable = new(4) { Priority = Priority}; + resultTable.ColumnWidth[0] = calctTermColumnWidth; + resultTable.ColumnWidth[1] = elongationColumnWidth; + resultTable.ColumnWidth[2] = psiSColumnWidth; + resultTable.ColumnWidth[3] = crackWidthColumnWidth; + ShTableRow resultRow; + string termName = "Long term"; + CrackWidthRebarTupleResult rebarResult = item.LongTermResult; + resultRow = GetResultCalcRow(termName, rebarResult); + resultTable.Table.AddRow(resultRow); + termName = "Short term"; + rebarResult = item.ShortTermResult; + resultRow = GetResultCalcRow(termName, rebarResult); + resultTable.Table.AddRow(resultRow); + return resultTable; + } + private ShTableRow GetResultCalcRow(string longTermName, CrackWidthRebarTupleResult rebarResult) + { + ShTableRow row; + row = new(resultRowSize); + int priority = Priority; + //if (item.IsValid == false) + //{ + // priority = LoggerService.GetPriorityByStatus(TraceLogStatuses.Error); + //} + row.Elements[0].Value = new StringLogEntry() + { + Message = longTermName, + Priority = priority + }; + double elongation = rebarResult.RebarStressResult.RebarStrain + rebarResult.RebarStressResult.ConcreteStrain; + row.Elements[1].Value = new StringLogEntry() + { + Message = $"{rebarResult.RebarStressResult.RebarStrain} + ({rebarResult.RebarStressResult.ConcreteStrain}) = {elongation}", + Priority = priority + }; + row.Elements[2].Value = new StringLogEntry() + { + Message = $"{rebarResult.SofteningFactor}", + Priority = priority + }; + row.Elements[3].Value = new StringLogEntry() + { + Message = $" Acrc = {rebarResult.CrackWidth}(m),\nAcrc,ult=({rebarResult.UltimateCrackWidth}(m))", + Priority = priority + }; + return row; + } + + private IShTableRow GetHeader() + { + const CellRole cellRole = CellRole.Header; + string[] ColumnList = new string[] + { + "Rebar", + "Results" + }; + var headerRow = new ShTableRow(rebarRowSize); + headerRow.Elements.ForEach(x => x.Role = cellRole); + + for (int i = 0; i < ColumnList.Length; i++) + { + headerRow.Elements[i].Value = new StringLogEntry() + { + Message = ColumnList[i], + Priority = Priority + }; + } + TableLogEntry resultTable = new(resultRowSize); + resultTable.ColumnWidth[0] = calctTermColumnWidth; + resultTable.ColumnWidth[1] = elongationColumnWidth; + resultTable.ColumnWidth[2] = psiSColumnWidth; + resultTable.ColumnWidth[3] = crackWidthColumnWidth; + resultTable.Table.AddRow(GetResultHeader()); + headerRow.Elements[1].Value = resultTable; + return headerRow; + } + + private IShTableRow GetResultHeader() + { + const CellRole cellRole = CellRole.Header; + string[] ColumnList = new string[] + { + "Calc term", + "Elongation", + "Softening factor", + "Crack width" + }; + var ndmRow = new ShTableRow(resultRowSize); + ndmRow.Elements.ForEach(x => x.Role = cellRole); + + for (int i = 0; i < resultRowSize; i++) + { + ndmRow.Elements[i].Value = new StringLogEntry() + { + Message = ColumnList[i], + Priority = Priority + }; + } + return ndmRow; + } + + private void Check() + { + if (Collection is null) + { + throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": Collection of primitives"); + } + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Cracking/CrackCalculator.cs b/StructureHelperLogics/NdmCalculations/Cracking/CrackCalculator.cs index 65900f6..9769e6a 100644 --- a/StructureHelperLogics/NdmCalculations/Cracking/CrackCalculator.cs +++ b/StructureHelperLogics/NdmCalculations/Cracking/CrackCalculator.cs @@ -5,6 +5,8 @@ using StructureHelperCommon.Models; using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Loggers; +using StructureHelperLogics.Models.Materials; +using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Primitives; using System; using System.Collections.Generic; @@ -14,6 +16,7 @@ using System.Threading.Tasks; namespace StructureHelperLogics.NdmCalculations.Cracking { + /// public class CrackCalculator : ICrackCalculator { const LimitStates limitState = LimitStates.SLS; @@ -73,11 +76,11 @@ namespace StructureHelperLogics.NdmCalculations.Cracking { PrepareNewResult(); CheckInputData(); - TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service); + TraceInputData(); try { ProcessCalculations(); - TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone); + TraceResult(); } catch (Exception ex) { @@ -87,6 +90,31 @@ namespace StructureHelperLogics.NdmCalculations.Cracking } } + private void TraceResult() + { + TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone); + ITraceEntityLogic traceLogic = new TraceCrackResultLogic() + { + Collection = result.TupleResults + }; + traceLogic.AddEntriesToTraceLogger(TraceLogger); + } + + private void TraceInputData() + { + TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service); + ITraceEntityLogic traceLogic = new TracePrimitiveFactory() + { + Collection = InputData.Primitives + }; + traceLogic.AddEntriesToTraceLogger(TraceLogger); + traceLogic = new TraceMaterialsFactory() + { + Collection = InputData.Primitives.Select(x => x.NdmElement.HeadMaterial).Distinct() + }; + traceLogic.AddEntriesToTraceLogger(TraceLogger); + } + private void CheckInputData() { checkInputDataLogic.InputData = InputData; diff --git a/StructureHelperLogics/NdmCalculations/Cracking/CrackResult.cs b/StructureHelperLogics/NdmCalculations/Cracking/CrackResult.cs index 7775cbf..0035e11 100644 --- a/StructureHelperLogics/NdmCalculations/Cracking/CrackResult.cs +++ b/StructureHelperLogics/NdmCalculations/Cracking/CrackResult.cs @@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking { public bool IsValid { get; set; } public string? Description { get; set; } - public List TupleResults {get;set;} + public List TupleResults {get;set;} public CrackResult() { TupleResults = new(); diff --git a/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculator.cs b/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculator.cs index 786cb74..da2cb41 100644 --- a/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculator.cs +++ b/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculator.cs @@ -2,8 +2,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking { + /// + /// Calculates width of cracks for cross-section by collection of combination of forces + /// public interface ICrackCalculator : ICalculator { + /// + /// Input data for crack calculations + /// ICrackCalculatorInputData InputData { get; set; } } } \ No newline at end of file diff --git a/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculatorInputData.cs b/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculatorInputData.cs index 7e23613..00b31e9 100644 --- a/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculatorInputData.cs +++ b/StructureHelperLogics/NdmCalculations/Cracking/ICrackCalculatorInputData.cs @@ -3,12 +3,19 @@ using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Forces; using StructureHelperLogics.NdmCalculations.Primitives; +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + namespace StructureHelperLogics.NdmCalculations.Cracking { + /// + /// Input data for crack calculator + /// public interface ICrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceActions, ISaveable { - List ForceActions { get; } - List Primitives { get; } + /// + /// Used difined data for crack width calculation + /// IUserCrackInputData UserCrackInputData { get; set; } } } \ No newline at end of file diff --git a/StructureHelperLogics/NdmCalculations/Cracking/IRebarCrackResult.cs b/StructureHelperLogics/NdmCalculations/Cracking/IRebarCrackResult.cs new file mode 100644 index 0000000..6374fbe --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Cracking/IRebarCrackResult.cs @@ -0,0 +1,24 @@ +using StructureHelperCommon.Models.Calculators; +using StructureHelperLogics.NdmCalculations.Primitives; + +namespace StructureHelperLogics.NdmCalculations.Cracking +{ + /// + /// Result of calculation of crack for specific result + /// + public interface IRebarCrackResult : IResult + { + /// + /// Specific rebar primitive + /// + IRebarNdmPrimitive? RebarPrimitive { get; set; } + /// + /// Result of calculation of crack for long term + /// + CrackWidthRebarTupleResult? LongTermResult { get; set; } + /// + /// Result of calculation of crack for short term + /// + CrackWidthRebarTupleResult? ShortTermResult { get; set; } + } +} \ No newline at end of file diff --git a/StructureHelperLogics/NdmCalculations/Cracking/ITupleCrackResult.cs b/StructureHelperLogics/NdmCalculations/Cracking/ITupleCrackResult.cs new file mode 100644 index 0000000..be85a33 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Cracking/ITupleCrackResult.cs @@ -0,0 +1,31 @@ +using StructureHelperCommon.Models.Calculators; + +namespace StructureHelperLogics.NdmCalculations.Cracking +{ + /// + /// Result of crack calculation for specific force tuple + /// + public interface ITupleCrackResult : IResult + { + /// + /// Reference to input data for calculation + /// + TupleCrackInputData? InputData { get; set; } + /// + /// True if cross-section has been cracked under specific force combination + /// + bool IsCracked { get; set; } + /// + /// Result of calculation of crack width for long term force combination + /// + CrackWidthRebarTupleResult? LongTermResult { get; set; } + /// + /// Collection of resuls for specific rebars + /// + List? RebarResults { get; } + /// + /// Result of calculation of crack width for short term force combination + /// + CrackWidthRebarTupleResult? ShortTermResult { get; set; } + } +} \ No newline at end of file diff --git a/StructureHelperLogics/NdmCalculations/Cracking/RebarCrackResult.cs b/StructureHelperLogics/NdmCalculations/Cracking/RebarCrackResult.cs index 46db47d..a9afe7e 100644 --- a/StructureHelperLogics/NdmCalculations/Cracking/RebarCrackResult.cs +++ b/StructureHelperLogics/NdmCalculations/Cracking/RebarCrackResult.cs @@ -8,26 +8,18 @@ using System.Threading.Tasks; namespace StructureHelperLogics.NdmCalculations.Cracking { - /// - /// Result of calculation of crack for specific result - /// - public class RebarCrackResult : IResult + /// + public class RebarCrackResult : IRebarCrackResult { /// public bool IsValid { get; set; } /// - public string Description { get; set; } - /// - /// Specific rebar primitive - /// - public IRebarNdmPrimitive RebarPrimitive { get; set; } - /// - /// Result of calculation of crack for long term - /// - public CrackWidthRebarTupleResult LongTermResult { get; set; } - /// - /// Result of calculation of crack for short term - /// - public CrackWidthRebarTupleResult ShortTermResult { get; set; } + public string? Description { get; set; } + /// + public IRebarNdmPrimitive? RebarPrimitive { get; set; } + /// + public CrackWidthRebarTupleResult? LongTermResult { get; set; } + /// + public CrackWidthRebarTupleResult? ShortTermResult { get; set; } } } diff --git a/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackResult.cs b/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackResult.cs index 6e3ca8b..d3934ad 100644 --- a/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackResult.cs +++ b/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackResult.cs @@ -6,29 +6,27 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -//Copyright (c) 2024 Redikultsev Evgeny, Ekaterinburg, Russia +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia //All rights reserved. namespace StructureHelperLogics.NdmCalculations.Cracking { - /// - /// Result of crack calculation for specific force tuple - /// - public class TupleCrackResult : IResult + /// + public class TupleCrackResult : ITupleCrackResult { /// public bool IsValid { get; set; } /// - public string Description { get; set; } - public TupleCrackInputData InputData { get; set; } + public string? Description { get; set; } + /// + public TupleCrackInputData? InputData { get; set; } + /// public bool IsCracked { get; set; } - public List RebarResults { get; private set; } - public CrackWidthRebarTupleResult LongTermResult { get; set; } - public CrackWidthRebarTupleResult ShortTermResult { get; set; } - - public TupleCrackResult() - { - RebarResults = new (); - } + /// + public List? RebarResults { get; private set; } = new(); + /// + public CrackWidthRebarTupleResult? LongTermResult { get; set; } + /// + public CrackWidthRebarTupleResult? ShortTermResult { get; set; } } } diff --git a/StructureHelperLogics/NdmCalculations/Primitives/IHasPrimitives.cs b/StructureHelperLogics/NdmCalculations/Primitives/IHasPrimitives.cs index c88cd7c..44c2218 100644 --- a/StructureHelperLogics/NdmCalculations/Primitives/IHasPrimitives.cs +++ b/StructureHelperLogics/NdmCalculations/Primitives/IHasPrimitives.cs @@ -1,7 +1,14 @@ using System.Collections.Generic; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + namespace StructureHelperLogics.NdmCalculations.Primitives { + /// + /// Interface for entities which has collection of ndm-primitives + /// public interface IHasPrimitives { /// diff --git a/StructureHelperLogics/NdmCalculations/Primitives/Logics/HasPrimitivesUpdateCloningStrategy.cs b/StructureHelperLogics/NdmCalculations/Primitives/Logics/HasPrimitivesUpdateCloningStrategy.cs index e251e28..a421dee 100644 --- a/StructureHelperLogics/NdmCalculations/Primitives/Logics/HasPrimitivesUpdateCloningStrategy.cs +++ b/StructureHelperLogics/NdmCalculations/Primitives/Logics/HasPrimitivesUpdateCloningStrategy.cs @@ -31,7 +31,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics private void ProcessPrimitive(IHasPrimitives targetObject, INdmPrimitive primitive) { - var project = ProgramSetting.CurrentProject; var newPrimitive = cloningStrategy.Clone(primitive); if (primitive.NdmElement.HeadMaterial is not null) { diff --git a/StructureHelperLogics/NdmCalculations/Primitives/TracePrimitiveFactory.cs b/StructureHelperLogics/NdmCalculations/Primitives/TracePrimitiveFactory.cs index 2185b4f..cdb6ae1 100644 --- a/StructureHelperLogics/NdmCalculations/Primitives/TracePrimitiveFactory.cs +++ b/StructureHelperLogics/NdmCalculations/Primitives/TracePrimitiveFactory.cs @@ -8,7 +8,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives /// /// Logic for creating of trace entries of primitives /// - public class TracePrimitiveFactory : ITraceEntityFactory + public class TracePrimitiveFactory : ITraceCollectionLogic { const int rowSize = 2; private List traceLoggerEntries; @@ -196,5 +196,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives } return ndmRow; } + + public void AddEntriesToTraceLogger(IShiftTraceLogger traceLogger) + { + var entries = GetTraceEntries(); + entries.ForEach(x => traceLogger?.AddEntry(x)); + } } }