Change curvature calculator
This commit is contained in:
@@ -9,11 +9,16 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||
{
|
||||
private readonly IUpdateStrategy<IForceAction> forceActionUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceFactoredList> factorUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceCombinationFromFile> fileCombinationUpdateStrategy;
|
||||
private IUpdateStrategy<IForceAction> forceUpdateStrategy;
|
||||
private IUpdateStrategy<IDesignForcePair> pairUpdateStrategy;
|
||||
private IUpdateStrategy<IForceFactoredList> factorUpdateStrategy;
|
||||
private IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy;
|
||||
private IUpdateStrategy<IForceCombinationFromFile> fileCombinationUpdateStrategy;
|
||||
private IUpdateStrategy<IForceAction> ForceUpdateStrategy => forceUpdateStrategy ??= new ForceActionBaseUpdateStrategy();
|
||||
private IUpdateStrategy<IDesignForcePair> PairUpdateStrategy => pairUpdateStrategy ??= new ForcePairUpdateStrategy();
|
||||
private IUpdateStrategy<IForceFactoredList> FactorUpdateStrategy => factorUpdateStrategy ??= new ForceFactoredListUpdateStrategy();
|
||||
private IUpdateStrategy<IForceCombinationList> ForceListUpdateStrategy => forceListUpdateStrategy ??= new ForceCombinationListUpdateStrategy();
|
||||
private IUpdateStrategy<IForceCombinationFromFile> FileCombinationUpdateStrategy => fileCombinationUpdateStrategy ??= new ForceCombinationFromFileUpdateStrategy();
|
||||
|
||||
public ForceActionUpdateStrategy(
|
||||
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
|
||||
@@ -22,20 +27,14 @@ namespace StructureHelperCommon.Models.Forces
|
||||
IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy,
|
||||
IUpdateStrategy<IForceCombinationFromFile> fileCombinationUpdateStrategy)
|
||||
{
|
||||
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
|
||||
this.forcePairUpdateStrategy = forcePairUpdateStrategy;
|
||||
this.forceUpdateStrategy = forceActionUpdateStrategy;
|
||||
this.pairUpdateStrategy = forcePairUpdateStrategy;
|
||||
this.factorUpdateStrategy = factorUpdateStrategy;
|
||||
this.forceListUpdateStrategy = forceListUpdateStrategy;
|
||||
this.fileCombinationUpdateStrategy = fileCombinationUpdateStrategy;
|
||||
}
|
||||
|
||||
public ForceActionUpdateStrategy() : this(
|
||||
new ForceActionBaseUpdateStrategy(),
|
||||
new ForcePairUpdateStrategy(),
|
||||
new ForceFactoredListUpdateStrategy(),
|
||||
new ForceCombinationListUpdateStrategy(),
|
||||
new ForceCombinationFromFileUpdateStrategy()
|
||||
)
|
||||
public ForceActionUpdateStrategy()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -45,27 +44,31 @@ namespace StructureHelperCommon.Models.Forces
|
||||
CheckObject.ThrowIfNull(targetObject);
|
||||
CheckObject.ThrowIfNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
forceActionUpdateStrategy.Update(targetObject, sourceObject);
|
||||
ForceUpdateStrategy.Update(targetObject, sourceObject);
|
||||
UpdateChildProperties(targetObject, sourceObject);
|
||||
}
|
||||
|
||||
private void UpdateChildProperties(IForceAction targetObject, IForceAction sourceObject)
|
||||
{
|
||||
if (sourceObject.GetType() != targetObject.GetType())
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ExpectedWas(targetObject.GetType(), sourceObject.GetType() + $": source object type is not {targetObject.GetType()}"));
|
||||
}
|
||||
if (targetObject is IDesignForcePair pair)
|
||||
{
|
||||
forcePairUpdateStrategy.Update(pair, (IDesignForcePair)sourceObject);
|
||||
PairUpdateStrategy.Update(pair, (IDesignForcePair)sourceObject);
|
||||
}
|
||||
else if (targetObject is IForceFactoredList combination)
|
||||
{
|
||||
factorUpdateStrategy.Update(combination, (IForceFactoredList)sourceObject);
|
||||
FactorUpdateStrategy.Update(combination, (IForceFactoredList)sourceObject);
|
||||
}
|
||||
else if (targetObject is IForceCombinationList forceCombinationList)
|
||||
{
|
||||
forceListUpdateStrategy.Update(forceCombinationList, (IForceCombinationList)sourceObject);
|
||||
ForceListUpdateStrategy.Update(forceCombinationList, (IForceCombinationList)sourceObject);
|
||||
}
|
||||
else if (targetObject is IForceCombinationFromFile fileCombination)
|
||||
{
|
||||
fileCombinationUpdateStrategy.Update(fileCombination, (IForceCombinationFromFile)sourceObject);
|
||||
FileCombinationUpdateStrategy.Update(fileCombination, (IForceCombinationFromFile)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace StructureHelperCommon.Models.Forces.Logics
|
||||
private IForceTuple? fullSLSTuple;
|
||||
private List<LimitStates> limitStates = new() { LimitStates.ULS, LimitStates.SLS };
|
||||
private List<CalcTerms> calcTerms = new() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
private IForceTupleServiceLogic forceTupleServiceLogic;
|
||||
private IForceTupleServiceLogic ForceTupleServiceLogic => forceTupleServiceLogic ??= new ForceTupleServiceLogic();
|
||||
|
||||
public IForceTuple? SourceForceTuple { get; set; }
|
||||
public IFactoredCombinationProperty? CombinationProperty { get; set; }
|
||||
@@ -45,7 +47,7 @@ namespace StructureHelperCommon.Models.Forces.Logics
|
||||
{
|
||||
factor /= CombinationProperty.ULSFactor;
|
||||
}
|
||||
fullSLSTuple = ForceTupleService.MultiplyTupleByFactor(SourceForceTuple, factor);
|
||||
fullSLSTuple = ForceTupleServiceLogic.MultiplyTupleByFactor(SourceForceTuple, factor);
|
||||
}
|
||||
|
||||
private void Check()
|
||||
@@ -84,7 +86,7 @@ namespace StructureHelperCommon.Models.Forces.Logics
|
||||
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);
|
||||
IForceTuple forceTuple = ForceTupleServiceLogic.MultiplyTupleByFactor(fullSLSTuple, stateFactor * factor);
|
||||
var designForceTuple = new DesignForceTuple
|
||||
{
|
||||
LimitState = limitState,
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace StructureHelperCommon.Models.Forces.Logics
|
||||
public class GetForceTupleByFactoredTupleLogic : IGetForceTupleByFactoredTupleLogic
|
||||
{
|
||||
private IGetLoadFactor getFactorLogic;
|
||||
private IForceTupleServiceLogic forceTupleServiceLogic;
|
||||
private IForceTupleServiceLogic ForceTupleServiceLogic => forceTupleServiceLogic ??= new ForceTupleServiceLogic();
|
||||
|
||||
public GetForceTupleByFactoredTupleLogic(IGetLoadFactor getFactorLogic)
|
||||
{
|
||||
@@ -36,7 +38,7 @@ namespace StructureHelperCommon.Models.Forces.Logics
|
||||
CalcTerm = CalcTerm
|
||||
};
|
||||
double factor = getFactorLogic.GetFactor();
|
||||
return ForceTupleService.MultiplyTupleByFactor(FactoredForceTuple.ForceTuple, factor);
|
||||
return ForceTupleServiceLogic.MultiplyTupleByFactor(FactoredForceTuple.ForceTuple, factor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user