Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs =================================================================== diff -u -r2942 -r2944 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 2942) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 2944) @@ -39,27 +39,35 @@ public class FillMacroStabilityWrapperInputFromEngine { - private Dictionary soilsDictionary = - new Dictionary(); + private readonly Dictionary soilsDictionary = + new Dictionary(); + /// Gets or sets the UpliftVan calculation grid. /// The uplift van calculation grid. public UpliftVanCalculationGrid UpliftVanCalculationGrid { get; set; } /// Gets or sets the traffic load. /// The traffic load. public TrafficLoad TrafficLoad { get; set; } - - - public MacroStabilityInput CreateMacroStabilityInput(DamKernelInput damKernelInput, FailureMechanismParametersMStab failureMechanismParametersMStab, Data.Geometry.Waternet waternet) + + + /// + /// Creates the macro stability input. + /// + /// The dam kernel input. + /// The failure mechanism parameters for MStab. + /// The WaterNet. + /// + public MacroStabilityInput CreateMacroStabilityInput(DamKernelInput damKernelInput, FailureMechanismParametersMStab failureMechanismParametersMStab, Data.Geometry.Waternet waterNet) { soilsDictionary.Clear(); - var macroStabilityInput = new Deltares.MacroStability.CSharpWrapper.Input.MacroStabilityInput(); + var macroStabilityInput = new MacroStabilityInput(); macroStabilityInput.StabilityModel = new StabilityInput(); // ToDo check whether this is needed. macroStabilityInput.PreprocessingInput = new PreprocessingInput(); // ToDo check whether this is needed. macroStabilityInput.StabilityModel.UpliftVanCalculationGrid = new KernelUpliftVanCalculationGrid(); failureMechanismParametersMStab.MStabParameters.Model = MStabModelType.UpliftVanWti; TransferStabilityModelProperties(failureMechanismParametersMStab, macroStabilityInput.StabilityModel); - TransferSoils(damKernelInput.Location.SoilList, damKernelInput.SubSoilScenario.SoilProfile2D, macroStabilityInput.StabilityModel.Soils); + TransferSoils(damKernelInput.Location.SoilList, macroStabilityInput.StabilityModel.Soils); macroStabilityInput.StabilityModel.ConstructionStages.Add(new ConstructionStage()); // ToDo check whether this is needed. var lastStage = macroStabilityInput.StabilityModel.ConstructionStages.Last(); @@ -71,7 +79,7 @@ var preConstructionLastStage = macroStabilityInput.PreprocessingInput.PreConstructionStages.Last(); preConstructionLastStage.Surfaceline = new SurfaceLine(); TransferSurfaceLine(damKernelInput.Location.SurfaceLine, preConstructionLastStage.Surfaceline); - TransferWaternet(waternet, lastStage.Waternet); + TransferWaternet(waterNet, lastStage.Waternet); TransferUpliftVanCalculationGrid(UpliftVanCalculationGrid, macroStabilityInput.StabilityModel.UpliftVanCalculationGrid, macroStabilityInput.PreprocessingInput.SearchAreaConditions); lastStage.UniformLoads = new List(); // ToDo check whether this is needed. @@ -88,7 +96,7 @@ kernelStabilityInput.Orientation = ConversionHelper.ConvertToGridOrientation(damFailureMechanismParametersMStab.MStabParameters.GridPosition); } - private void TransferSoils(SoilList damSoilList, Data.Geotechnics.SoilProfile2D damSoilProfile2D, IList kernelSoils) + private void TransferSoils(SoilList damSoilList, IList kernelSoils) { // Transfer all soils if (damSoilList != null) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/ConversionHelper.cs =================================================================== diff -u -r2933 -r2944 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/ConversionHelper.cs (.../ConversionHelper.cs) (revision 2933) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/ConversionHelper.cs (.../ConversionHelper.cs) (revision 2944) @@ -24,14 +24,13 @@ using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geotechnics; using Deltares.MacroStability.CSharpWrapper.Input; -using Deltares.MacroStability.CSharpWrapper.Output; using CharacteristicPointType = Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType; using WaterPressureInterpolationModel = Deltares.DamEngine.Data.Geotechnics.WaterpressureInterpolationModel; using CharacteristicPoint = Deltares.MacroStability.CSharpWrapper.Input.CharacteristicPoint; using LogMessageType = Deltares.DamEngine.Data.Standard.Logging.LogMessageType; using ObjectExtensions = Deltares.DamEngine.Data.Standard.ObjectExtensions; using SearchAlgorithm = Deltares.MacroStability.CSharpWrapper.Input.SearchAlgorithm; -using MessageTpe = Deltares.MacroStability.CSharpWrapper.Output.MessageType; +using MessageType = Deltares.MacroStability.CSharpWrapper.Output.MessageType; using ShearStrengthModel = Deltares.DamEngine.Data.Geotechnics.ShearStrengthModel; using Soil = Deltares.MacroStability.CSharpWrapper.Input.Soil; using StabilityModelOptionInput = Deltares.MacroStability.CSharpWrapper.Input.StabilityModelOption; @@ -210,9 +209,8 @@ case DilatancyType.Phi: macroStabilitySoil.Dilatancy = macroStabilitySoil.FrictionAngle; // Phi (FrictionAngle) break; - case DilatancyType.Zero: default: - macroStabilitySoil.Dilatancy = 0.0; // Zero + macroStabilitySoil.Dilatancy = 0.0; // Zero and default break; } return macroStabilitySoil; @@ -328,7 +326,7 @@ /// Converts to dam waterpressure interpolation model. /// The waterpressure interpolation model. /// - public static Data.Geotechnics.WaterpressureInterpolationModel ConvertToDamWaterpressureInterpolationModel(WaterPressureInterpolationModelKernel waterpressureInterpolationModel) + public static WaterpressureInterpolationModel ConvertToDamWaterpressureInterpolationModel(WaterPressureInterpolationModelKernel waterpressureInterpolationModel) { var translationTable = new Dictionary() { @@ -403,12 +401,12 @@ /// /// Type of the message. /// - public static LogMessageType ConvertKernelValidationResultTypeToLogMessageType(MessageTpe messageType) + public static LogMessageType ConvertKernelValidationResultTypeToLogMessageType(MessageType messageType) { var translationTable = new Dictionary() { {MessageType.Info, LogMessageType.Info}, - {MessageTpe.Warning, LogMessageType.Warning}, + {MessageType.Warning, LogMessageType.Warning}, {MessageType.Error, LogMessageType.Error} }; return translationTable[messageType]; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs =================================================================== diff -u -r2942 -r2944 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 2942) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 2944) @@ -37,7 +37,7 @@ /// Fill DamEngine data objects from the kernel data model public class FillEngineFromMacroStabilityWrapperInput { - private Dictionary soilDictionary = new Dictionary(); + private readonly Dictionary soilDictionary = new Dictionary(); /// Gets or sets the SoilList DamEngine object /// The soil list. @@ -67,7 +67,7 @@ /// Creates the dam project data from the kernel model. /// The kernel model. /// The DamProjectData object filled with Wti data - public void FillDamProjectDataFromKernelModel(Deltares.MacroStability.CSharpWrapper.Input.MacroStabilityInput macroStabilityInput) + public void FillDamProjectDataFromKernelModel(MacroStabilityInput macroStabilityInput) { soilDictionary.Clear(); Location = null; @@ -82,7 +82,7 @@ TransferTrafficLoad(macroStabilityInput.StabilityModel.ConstructionStages.Last().UniformLoads); } - private void TransferTrafficLoad(IList kernelUniformLoads) + private void TransferTrafficLoad(IList kernelUniformLoads) { TrafficLoad = null; if ((kernelUniformLoads != null) && (kernelUniformLoads.Count > 0)) @@ -104,7 +104,7 @@ } private void TransferUpliftVanCalculationGrid(KernelUpliftVanCalculationGrid kernelSlipPlaneUpliftVan, - Deltares.MacroStability.CSharpWrapper.Input.SearchAreaConditions kernelSearchAreaConditions) + SearchAreaConditions kernelSearchAreaConditions) { // UpliftVanCalculationGrid.IsAuto = kernelSearchAreaConditions.AutoSearchArea; UpliftVanCalculationGrid = new UpliftVanCalculationGrid @@ -130,7 +130,7 @@ UpliftVanCalculationGrid.TangentLineCount = tangentLines.Count() - 1; // -1 as the ZTop coordinate is inclusive } - private void TransferWaternet(Deltares.MacroStability.CSharpWrapper.Input.Waternet kernelWaternet) + private void TransferWaternet(MacroStability.CSharpWrapper.Input.Waternet kernelWaternet) { // Waternet = new Data.Geometry.Waternet(); // // Properties @@ -181,7 +181,7 @@ // } } - private void TransferSurfaceLine(MacroStability.CSharpWrapper.Input.SurfaceLine kernelSurfaceLine) + private void TransferSurfaceLine(SurfaceLine kernelSurfaceLine) { SurfaceLine2 = new SurfaceLine2(); foreach (var kernelCharPoint in kernelSurfaceLine.CharacteristicPoints) @@ -211,7 +211,7 @@ } } - private void TransferStabilityModel(Deltares.MacroStability.CSharpWrapper.Input.StabilityInput kernelModelStabilityModel) + private void TransferStabilityModel(StabilityInput kernelModelStabilityModel) { FailureMechanismParametersMStab = new FailureMechanismParametersMStab(); //kernelModelStabilityModel.MoveGrid is not in DamEngine datamodel @@ -224,21 +224,21 @@ ConversionHelper.ConvertToMStabGridPosition(kernelModelStabilityModel.Orientation); } - private void TransferSoilProfile2D(MacroStability.CSharpWrapper.Input.SoilProfile kernelSoilProfile2D, IList preconsolidationStresses) + private void TransferSoilProfile2D(MacroStability.CSharpWrapper.Input.SoilProfile kernelSoilProfile2D, IList preconsolidationStresses) { SoilProfile2D = new SoilProfile2D(); // Add points var pointsDictionary = new Dictionary(); foreach (var kernelPoint in kernelSoilProfile2D.Geometry.Points) { - var damPoint = new Data.Geometry.Point2D() { X = kernelPoint.X, Z = kernelPoint.Z }; + var damPoint = new Point2D() { X = kernelPoint.X, Z = kernelPoint.Z }; pointsDictionary.Add(kernelPoint, damPoint); SoilProfile2D.Geometry.Points.Add(damPoint); } // Add curves - var curvesDictionary = new Dictionary(); + var curvesDictionary = new Dictionary(); foreach (var kernelCurve in kernelSoilProfile2D.Geometry.Curves) { var damHeadPoint = pointsDictionary[kernelCurve.HeadPoint]; @@ -252,7 +252,7 @@ var loopsDictionary = new Dictionary(); foreach (var kernelLoop in kernelSoilProfile2D.Geometry.Loops) { - var damLoop = new Data.Geometry.GeometryLoop(); + var damLoop = new GeometryLoop(); foreach (var damCurve in kernelLoop.Curves) { damLoop.CurveList.Add(curvesDictionary[damCurve]); @@ -265,7 +265,7 @@ var geometrySurfacesDictionary = new Dictionary(); foreach (var kernelSurface in kernelSoilProfile2D.Geometry.GeometrySurfaces) { - var damSurface = new Data.Geometry.GeometrySurface(); + var damSurface = new GeometrySurface(); damSurface.OuterLoop = loopsDictionary[kernelSurface.OuterLoop]; foreach (var damInnerLoop in kernelSurface.InnerLoops) {