Add ForceCombinationPropertyUserControl
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces.Logics
|
||||
{
|
||||
public class FactoredCombinationPropertyUpdateStrategy : IUpdateStrategy<IFactoredCombinationProperty>
|
||||
{
|
||||
public void Update(IFactoredCombinationProperty targetObject, IFactoredCombinationProperty sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.ULSFactor = sourceObject.ULSFactor;
|
||||
targetObject.LongTermFactor = sourceObject.LongTermFactor;
|
||||
targetObject.CalcTerm = sourceObject.CalcTerm;
|
||||
targetObject.LimitState = sourceObject.LimitState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
private readonly IUpdateStrategy<IForceAction> forceActionUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceFactoredList> factorUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy;
|
||||
|
||||
public ForceActionUpdateStrategy(
|
||||
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
|
||||
IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy,
|
||||
IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy,
|
||||
IUpdateStrategy<IForceFactoredList> factorUpdateStrategy,
|
||||
IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy)
|
||||
{
|
||||
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
|
||||
@@ -34,7 +34,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public ForceActionUpdateStrategy() : this(
|
||||
new ForceActionBaseUpdateStrategy(),
|
||||
new ForcePairUpdateStrategy(),
|
||||
new ForceCombinationByFactorUpdateStrategy(),
|
||||
new ForceFactoredListUpdateStrategy(),
|
||||
new ForceCombinationListUpdateStrategy()
|
||||
)
|
||||
{
|
||||
@@ -56,9 +56,9 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
forcePairUpdateStrategy.Update(pair, (IDesignForcePair)sourceObject);
|
||||
}
|
||||
else if (targetObject is IForceCombinationByFactor combination)
|
||||
else if (targetObject is IForceFactoredList combination)
|
||||
{
|
||||
factorUpdateStrategy.Update(combination, (IForceCombinationByFactor)sourceObject);
|
||||
factorUpdateStrategy.Update(combination, (IForceFactoredList)sourceObject);
|
||||
}
|
||||
else if (targetObject is IForceCombinationList forceCombinationList)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy<IForceColumnProperty>
|
||||
public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy<IColumnProperty>
|
||||
{
|
||||
public void Update(IForceColumnProperty targetObject, IForceColumnProperty sourceObject)
|
||||
public void Update(IColumnProperty targetObject, IColumnProperty sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceCombinationByFactorUpdateStrategy : IUpdateStrategy<IForceCombinationByFactor>
|
||||
{
|
||||
private IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
|
||||
public ForceCombinationByFactorUpdateStrategy(IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
|
||||
{
|
||||
this.tupleUpdateStrategy = tupleUpdateStrategy;
|
||||
}
|
||||
public ForceCombinationByFactorUpdateStrategy() : this(new ForceTupleUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
public void Update(IForceCombinationByFactor targetObject, IForceCombinationByFactor sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
tupleUpdateStrategy.Update(targetObject.FullSLSForces, sourceObject.FullSLSForces);
|
||||
targetObject.ULSFactor = sourceObject.ULSFactor;
|
||||
targetObject.LongTermFactor = sourceObject.LongTermFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceFactoredListUpdateStrategy : IUpdateStrategy<IForceFactoredList>
|
||||
{
|
||||
private IUpdateStrategy<IForceAction> forceActionUpdateStrategy;
|
||||
private IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
|
||||
private IUpdateStrategy<IFactoredCombinationProperty> propertyUpdateStrategy;
|
||||
public ForceFactoredListUpdateStrategy
|
||||
(
|
||||
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
|
||||
IUpdateStrategy<IForceTuple> tupleUpdateStrategy,
|
||||
IUpdateStrategy<IFactoredCombinationProperty> propertyUpdateStrategy)
|
||||
{
|
||||
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
|
||||
this.tupleUpdateStrategy = tupleUpdateStrategy;
|
||||
this.propertyUpdateStrategy = propertyUpdateStrategy;
|
||||
}
|
||||
public ForceFactoredListUpdateStrategy() : this
|
||||
(
|
||||
new ForceActionBaseUpdateStrategy(),
|
||||
new ForceTupleUpdateStrategy(),
|
||||
new FactoredCombinationPropertyUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
public void Update(IForceFactoredList targetObject, IForceFactoredList sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
forceActionUpdateStrategy.Update(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject.CombinationProperty);
|
||||
CheckObject.IsNull(targetObject.CombinationProperty);
|
||||
propertyUpdateStrategy.Update(targetObject.CombinationProperty, sourceObject.CombinationProperty);
|
||||
CheckObject.IsNull(sourceObject.ForceTuples);
|
||||
CheckObject.IsNull(targetObject.ForceTuples);
|
||||
targetObject.ForceTuples.Clear();
|
||||
foreach (var item in sourceObject.ForceTuples)
|
||||
{
|
||||
ForceTuple newTuple = new();
|
||||
tupleUpdateStrategy.Update(newTuple, item);
|
||||
targetObject.ForceTuples.Add(newTuple);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceFilePropertyUpdateStrategy : IUpdateStrategy<IForceFileProperty>
|
||||
{
|
||||
private IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy;
|
||||
private IUpdateStrategy<IColumnProperty> columnUpdateStrategy;
|
||||
|
||||
public ForceFilePropertyUpdateStrategy(IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy)
|
||||
public ForceFilePropertyUpdateStrategy(IUpdateStrategy<IColumnProperty> columnUpdateStrategy)
|
||||
{
|
||||
this.columnUpdateStrategy = columnUpdateStrategy;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces.Logics
|
||||
{
|
||||
public class GetCombinationByFactoredTupleLogic : IGetCombinationByFactoredTupleLogic
|
||||
{
|
||||
private ForceCombinationList? result;
|
||||
private IForceTuple? fullSLSTuple;
|
||||
private List<LimitStates> limitStates = new() { LimitStates.ULS, LimitStates.SLS };
|
||||
private List<CalcTerms> calcTerms = new() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
|
||||
public IForceTuple? SourceForceTuple { get; set; }
|
||||
public IFactoredCombinationProperty? CombinationProperty { get; set; }
|
||||
public IForceActionProperty? ForceActionProperty { get; set; }
|
||||
public IForceCombinationList GetCombinationList()
|
||||
{
|
||||
Check();
|
||||
GetFullSLSTuple();
|
||||
GetNewResult();
|
||||
ProcessResult();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void GetFullSLSTuple()
|
||||
{
|
||||
double factor = 1d;
|
||||
if (CombinationProperty.CalcTerm == CalcTerms.LongTerm)
|
||||
{
|
||||
factor /= CombinationProperty.LongTermFactor;
|
||||
}
|
||||
if (CombinationProperty.LimitState == LimitStates.ULS)
|
||||
{
|
||||
factor /= CombinationProperty.ULSFactor;
|
||||
}
|
||||
fullSLSTuple = ForceTupleService.MultiplyTupleByFactor(SourceForceTuple, factor);
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
if (SourceForceTuple is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(SourceForceTuple)}");
|
||||
}
|
||||
if (CombinationProperty is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(CombinationProperty)}");
|
||||
}
|
||||
if (ForceActionProperty is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(ForceActionProperty)}");
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessResult()
|
||||
{
|
||||
foreach (var limitState in limitStates)
|
||||
{
|
||||
ProcessLimitState(limitState);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessLimitState(LimitStates limitState)
|
||||
{
|
||||
var factor = limitState is LimitStates.SLS ? 1d : CombinationProperty.ULSFactor;
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
ProcessCalcTerm(limitState, factor, calcTerm);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessCalcTerm(LimitStates limitState, double stateFactor, CalcTerms calcTerm)
|
||||
{
|
||||
var factor = calcTerm is CalcTerms.ShortTerm ? 1d : CombinationProperty.LongTermFactor;
|
||||
IForceTuple forceTuple = ForceTupleService.MultiplyTupleByFactor(fullSLSTuple, stateFactor * factor);
|
||||
var designForceTuple = new DesignForceTuple
|
||||
{
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
ForceTuple = forceTuple
|
||||
};
|
||||
result.DesignForces.Add(designForceTuple);
|
||||
}
|
||||
|
||||
private void GetNewResult()
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
SetInGravityCenter = ForceActionProperty.SetInGravityCenter,
|
||||
ForcePoint = ForceActionProperty.ForcePoint
|
||||
};
|
||||
result.DesignForces.Clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace StructureHelperCommon.Models.Forces.Logics
|
||||
{
|
||||
/// <summary>
|
||||
/// Return combinations for source combination and properties
|
||||
/// </summary>
|
||||
public interface IGetCombinationByFactoredTupleLogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Source combination of forces
|
||||
/// </summary>
|
||||
IForceTuple? SourceForceTuple { get; set; }
|
||||
/// <inheritdoc/>
|
||||
IFactoredCombinationProperty? CombinationProperty { get; set; }
|
||||
/// <inheritdoc/>
|
||||
IForceActionProperty? ForceActionProperty { get; set; }
|
||||
/// <summary>
|
||||
/// Returns combination list
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IForceCombinationList GetCombinationList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user