using System; using System.Collections.Generic; using Deltares.Standard; using Deltares.Standard.Language; using Deltares.Standard.Logging; namespace Deltares.Stability.Calculation2 { public class SlidingCurvesProcessor { public double newPhi = 0; private SlidingCurveCalculation calculation = null; private List cohesionList = new List(); private double maxAllowedAngleBetweenSlices; private double maximumSliceWidth; private double minReqPercForcePoints; private double newCohesion = 0; private List phiList = new List(); private List slidingCurveValidators = new List(); public SlidingCurveCalculation Calculation { get { return calculation; } set { calculation = value; } } public List SlidingCurveValidators { get { return slidingCurveValidators; } } public virtual void Initialize(StabilityModel stabilityModel) { maximumSliceWidth = stabilityModel.MaximumSliceWidth; maxAllowedAngleBetweenSlices = stabilityModel.MaxAllowedAngleBetweenSlices; minReqPercForcePoints = stabilityModel.RequiredForcePointsInSlices; } public virtual SlidingCurve Calculate() { return null; } /// /// for a probabilistic calculation soil data (unit weight, pore pressures) might be changed /// if this is the case a new preproces calculation must be executed. /// furthermore the phi and cohesion in certain slices might changed (random field) /// this new value must be added to newcohesion and newphi and for each value /// an array with slice indexes where the data must be changed has to be supplied /// /// /// public double GetUpdatedSafetyFactor(SlidingCurve slidingCurve) { // Fill slices with updated data (stresses) calculation.FillSlices(slidingCurve); // for random field it is needed to change slidingCurve.UpdateCohesioniInSlices(newCohesion, cohesionList); slidingCurve.UpdatePhiInSlices(newPhi, phiList); return calculation.GetSafetyFactor(slidingCurve); } public double GetSafetyFactor(SlidingCurve slidingCurve) { // if no slice width is given use 1 m if (Math.Abs(maximumSliceWidth) < 0.1) { maximumSliceWidth = 0.1; } slidingCurve.MaximumSliceWidth = maximumSliceWidth; calculation.CreateSlices(slidingCurve); if (slidingCurve.Slices.Count == 0) { var message = new LogMessage(LogMessageType.Warning, slidingCurve, LocalizationManager.GetTranslatedText(typeof(SlidingCurvesProcessor), "SlidingCurveIsNotValid")); LogManager.Add(message); } slidingCurve.SetSliceIndices(); // Check the 4 first "slidingCurveValidators" which are: SlidingCurveValidator, StabilityModelSlidingCurveValidator, SlidingCurveWithGeometryValidator, IntersectsForbiddenLineValidation for (int i = 0; i < slidingCurveValidators.Count; i++) { if (!slidingCurveValidators[i].SlicesMustBeFilled() && !slidingCurveValidators[i].IsValid(slidingCurve)) { slidingCurve.SafetyFactor = Double.MaxValue; return slidingCurve.SafetyFactor; } } // Only if the sliding curve is valid, the slices are filled and the stability factor is calculated calculation.FillSlices(slidingCurve); calculation.GetSafetyFactor(slidingCurve); // Only when the slices are filled and the safety factor is calculated, the last "slidingCurveValidators" can be checked (i.e. SmoothSlidingPlaneValidator = Spencer acceptance criterium) for (int i = 0; i < slidingCurveValidators.Count; i++) { if (slidingCurveValidators[i].SlicesMustBeFilled() && !slidingCurveValidators[i].IsValid(slidingCurve)) { slidingCurve.SafetyFactor = Double.MaxValue; return slidingCurve.SafetyFactor; } } return slidingCurve.SafetyFactor; } } }