// Copyright (C) Stichting Deltares 2023. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Collections.Generic; using Deltares.DamEngine.Io.XmlInput; using Deltares.DamEngine.Io.XmlOutput; using Deltares.Geotechnics; using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; using Deltares.Standard; using Deltares.Standard.Extensions; using Deltares.Standard.Logging; namespace Deltares.Dam.Data.DamEngineIo; /// /// Converts types from Dam Engine class to Input serializer class and vice versa /// public static class ConversionHelper { public const int CpNone = 0; // public const int CpSurfaceLevelOutside = 1; // Maaiveld buitenwaarts public const int CpDikeToeAtRiver = 5; // Teen dijk buitenwaarts public const int CpShoulderTopOutside = 6; // Kruin buitenberm public const int CpShoulderBaseOutside = 7; // Insteek buitenberm public const int CpDikeTopAtRiver = 8; // Kruin buitentalud public const int CpDikeLine = 9; // referentielijn public const int CpTrafficLoadOutside = 10; // Verkeersbelasting kant buitenwaarts public const int CpTrafficLoadInside = 11; // Verkeersbelasting kant binnenwaarts public const int CpDikeTopAtPolder = 12; // Kruin binnentalud public const int CpShoulderBaseInside = 13; // Insteek binnenberm public const int CpShoulderTopInside = 14; // Kruin binnenberm public const int CpDikeToeAtPolder = 15; // Teen dijk binnenwaarts public const int CpDitchDikeSide = 16; // Insteek sloot dijkzijde public const int CpBottomDitchDikeSide = 17; // Slootbodem dijkzijde public const int CpBottomDitchPolderSide = 18; // Slootbodem polderzijde public const int CpDitchPolderSide = 19; // Insteek sloot polderzijde public const int CpSurfaceLevelInside = 25; // Maaiveld binnenwaarts /// The enumerated constants for input failure mechanism stability inside public const int InputFailureMechanismStabilityInside = 0; public const int InputFailureMechanismStabilityOutside = 1; public const int InputFailureMechanismPiping = 2; /// The enumerated constants for input segment failure mechanism stability inside public const int InputSegmentFailureMechanismAll = 0; public const int InputSegmentFailureMechanismStability = 1; public const int InputSegmentFailureMechanismPiping = 2; /// /// The input zone type no zones /// public const int InputZoneTypeNoZones = 0; /// /// The input zone types forbidden zones /// public const int InputZoneTypesForbiddenZones = 2; /// /// The input search method grid /// public const int InputSearchMethodGrid = 0; /// /// The input search method genetic /// public const int InputSearchMethodGenetic = 1; /// /// The input search method bee swarm /// public const int InputSearchMethodBeeSwarm = 2; /// /// The input grid type automatic /// public const int InputGridTypeAutomatic = 0; /// /// The input grid type specified /// public const int InputGridTypeSpecified = 1; /// /// The input tangent lines on boundaty lines /// public const int InputTangentLinesOnBoundatyLines = 0; /// /// The input tangent lines specified /// public const int InputTangentLinesSpecified = 1; /// /// The load situation dry /// public const int LoadSituationDry = 0; /// /// The load situation wet /// public const int LoadSituationWet = 1; /// /// The dike dry sensitivity none /// public const int DikeDrySensitivityNone = 0; /// /// The dike dry sensitivity dry /// public const int DikeDrySensitivityDry = 1; /// /// The hydraulic shortcut type hydraulic shortcut /// public const int HydraulicShortcutTypeHydraulicShortcut = 0; /// /// The hydraulic shortcut type no hydraulic shortcut /// public const int HydraulicShortcutTypeNoHydraulicShortcut = 1; /// /// The uplift type uplift /// public const int UpliftTypeUplift = 0; /// /// The uplift type no uplift /// public const int UpliftTypeNoUplift = 1; /// /// The m stab model type bishop /// public const int MStabModelTypeBishop = 0; /// /// The m stab model type spencer /// public const int MStabModelTypeSpencer = 1; /// /// The m stab model type fellenius /// public const int MStabModelTypeFellenius = 2; /// /// The m stab model type uplift van /// public const int MStabModelTypeUpliftVan = 3; /// /// The m stab model type uplift spencer /// public const int MStabModelTypeUpliftSpencer = 4; /// /// The m stab model type bishop random field /// public const int MStabModelTypeBishopRandomField = 5; /// /// The m stab model type bishop uplift van /// public const int MStabModelTypeBishopUpliftVan = 7; /// /// The scenario type scenario01 /// public const int ScenarioTypeScenario01 = 0; /// /// The scenario type scenario02 /// public const int ScenarioTypeScenario02 = 1; /// /// The scenario type scenario03 /// public const int ScenarioTypeScenario03 = 2; /// /// The scenario type scenario04 /// public const int ScenarioTypeScenario04 = 3; /// /// The scenario type scenario05 /// public const int ScenarioTypeScenario05 = 4; /// /// The scenario type scenario06 /// public const int ScenarioTypeScenario06 = 5; /// /// The scenario type scenario07 /// public const int ScenarioTypeScenario07 = 6; /// /// The scenario type scenario08 /// public const int ScenarioTypeScenario08 = 7; /// /// The scenario type scenario09 /// public const int ScenarioTypeScenario09 = 8; /// /// The scenario type scenario10 /// public const int ScenarioTypeScenario10 = 9; /// /// The scenario type scenario11 /// public const int ScenarioTypeScenario11 = 10; /// /// The piping model type bligh /// public const int PipingModelTypeBligh = 0; /// /// The piping model type sellmeijer /// public const int PipingModelTypeSellmeijer = 1; /// /// The piping model type sellmeijer4 forces /// public const int PipingModelTypeSellmeijer4Forces = 2; /// /// The piping model type wti2017 /// public const int PipingModelTypeWti2017 = 3; /// /// Constants for translating to Enums TimeStepUnit /// public const uint TimeStepUnitSecond = 0; public const uint TimeStepUnitMinute = 1; public const uint TimeStepUnitHour = 2; public const uint TimeStepUnitDay = 3; public const uint TimeStepUnitMonth = 4; public const uint TimeStepUnitWeek = 5; public const uint TimeStepUnitYear = 6; public const uint TimeStepUnitNonequidistant = 7; /// /// Constants for translating to Enums PlLineType /// public const uint PlLineTypePl1 = 1; public const uint PlLineTypePl2 = 2; public const uint PlLineTypePl3 = 3; public const uint PlLineTypePl4 = 4; /// /// Constants for translating to Enums SensorType /// public const uint SensorTypePiezometricHead = 0; public const uint SensorTypeWaterLevel = 1; public const uint SensorTypePolderLevel = 2; /// /// Constants for translating to Enums DataSourceTypeSensors /// public const uint DataSourceTypeSensorsIgnore = 0; public const uint DataSourceTypeSensorsLocationData = 1; public const uint DataSourceTypeSensorsSensor = 2; /// /// Converts the type DamProjectType from input object type to Dam Engine type. /// /// Type of the input object. /// Dam Engine type public static DamProjectType ConvertToDamProjectType(InputDamProjectType inputDamProjectType) { var translationTable = new Dictionary { { InputDamProjectType.Design, DamProjectType.Design }, { InputDamProjectType.Operational, DamProjectType.Calamity } }; return translationTable[inputDamProjectType]; } /// /// Converts the type DamProjectType from Dam Engine type to input object type. /// /// Type of the dam project. /// Type of the input object. public static InputDamProjectType ConvertToInputDamProjectType(DamProjectType damProjectType) { if (damProjectType == DamProjectType.DamLiveConfiguration) { damProjectType = DamProjectType.Calamity; } var translationTable = new Dictionary { { DamProjectType.Design, InputDamProjectType.Design }, { DamProjectType.Calamity, InputDamProjectType.Operational } }; return translationTable[damProjectType]; } /// /// Converts the type PLLineCreationMethod from Dam Engine type to input object type. /// /// Type of the dam project. /// /// Type of the input object. /// public static LocationWaternetOptionsPhreaticLineCreationMethod ConvertToInputPhreaticLineCreationMethod(PLLineCreationMethod plLineCreationMethod) { var translationTable = new Dictionary { { PLLineCreationMethod.ExpertKnowledgeLinearInDike, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike }, { PLLineCreationMethod.ExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD }, { PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD }, { PLLineCreationMethod.Sensors, LocationWaternetOptionsPhreaticLineCreationMethod.Sensors }, { PLLineCreationMethod.None, LocationWaternetOptionsPhreaticLineCreationMethod.None } }; return translationTable[plLineCreationMethod]; } /// /// Converts the type PLLineCreationMethod from input object type to Dam Engine type. /// /// Type of the input object. /// /// Type of the dam object. /// public static PLLineCreationMethod ConvertToPhreaticLineCreationMethod(LocationWaternetOptionsPhreaticLineCreationMethod inputPhreaticLineCreationMethod) { var translationTable = new Dictionary { { LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike, PLLineCreationMethod.ExpertKnowledgeLinearInDike }, { LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD, PLLineCreationMethod.ExpertKnowledgeRRD }, { LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD }, { LocationWaternetOptionsPhreaticLineCreationMethod.Sensors, PLLineCreationMethod.Sensors }, { LocationWaternetOptionsPhreaticLineCreationMethod.None, PLLineCreationMethod.None } }; return translationTable[inputPhreaticLineCreationMethod]; } /// /// Converts the type IntrusionVerticalWaterPressureType from Dam Engine type to input object type. /// /// Type of the dam project. /// /// Type of the input object. /// public static LocationWaternetOptionsIntrusionVerticalWaterPressure ConvertToInputIntrusionVerticalWaterPressure(IntrusionVerticalWaterPressureType intrusionVerticalWaterPressureType) { var translationTable = new Dictionary { { IntrusionVerticalWaterPressureType.FullHydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic }, { IntrusionVerticalWaterPressureType.HydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic }, { IntrusionVerticalWaterPressureType.Linear, LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear }, { IntrusionVerticalWaterPressureType.SemiTimeDependent, LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent }, { IntrusionVerticalWaterPressureType.Standard, LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard } }; return translationTable[intrusionVerticalWaterPressureType]; } /// /// Converts the type IntrusionVerticalWaterPressureType from input object type to Dam Engine type. /// /// Type of the input object. /// /// Type of the dam object. /// public static IntrusionVerticalWaterPressureType ConvertToIntrusionVerticalWaterPressure(LocationWaternetOptionsIntrusionVerticalWaterPressure inputIntrusionVerticalWaterPressure) { var translationTable = new Dictionary { { LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic, IntrusionVerticalWaterPressureType.FullHydroStatic }, { LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic, IntrusionVerticalWaterPressureType.HydroStatic }, { LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear, IntrusionVerticalWaterPressureType.Linear }, { LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent, IntrusionVerticalWaterPressureType.SemiTimeDependent }, { LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard, IntrusionVerticalWaterPressureType.Standard } }; return translationTable[inputIntrusionVerticalWaterPressure]; } /// /// Converts the type of to dam point. /// /// Type of the input point. /// public static CharacteristicPointType ConvertToDamPointType(int inputPointType) { var translationTable = new Dictionary { { CpNone, CharacteristicPointType.None }, { CpSurfaceLevelOutside, CharacteristicPointType.SurfaceLevelOutside }, { CpDikeToeAtRiver, CharacteristicPointType.DikeToeAtRiver }, { CpShoulderTopOutside, CharacteristicPointType.ShoulderTopOutside }, { CpShoulderBaseOutside, CharacteristicPointType.ShoulderBaseOutside }, { CpDikeTopAtRiver, CharacteristicPointType.DikeTopAtRiver }, { CpDikeLine, CharacteristicPointType.DikeLine }, { CpTrafficLoadOutside, CharacteristicPointType.TrafficLoadOutside }, { CpTrafficLoadInside, CharacteristicPointType.TrafficLoadInside }, { CpDikeTopAtPolder, CharacteristicPointType.DikeTopAtPolder }, { CpShoulderBaseInside, CharacteristicPointType.ShoulderBaseInside }, { CpShoulderTopInside, CharacteristicPointType.ShoulderTopInside }, { CpDikeToeAtPolder, CharacteristicPointType.DikeToeAtPolder }, { CpDitchDikeSide, CharacteristicPointType.DitchDikeSide }, { CpBottomDitchDikeSide, CharacteristicPointType.BottomDitchDikeSide }, { CpBottomDitchPolderSide, CharacteristicPointType.BottomDitchPolderSide }, { CpDitchPolderSide, CharacteristicPointType.DitchPolderSide }, { CpSurfaceLevelInside, CharacteristicPointType.SurfaceLevelInside } }; return translationTable[inputPointType]; } /// /// Converts the type of to input point. /// /// Type of the characteristic point. /// public static int ConvertToInputPointType(CharacteristicPointType characteristicPointType) { var translationTable = new Dictionary { // The following types do not have a meaning in DAM, so should be mapped to CpNone { CharacteristicPointType.BottomRiverChannel, CpNone }, { CharacteristicPointType.InsertRiverChannel, CpNone }, { CharacteristicPointType.ForelandStart, CpNone }, { CharacteristicPointType.DunesBoundaryProfile, CpNone }, { CharacteristicPointType.DunesTransectLocation, CpNone }, // The following types are DAM related, so should be translated { CharacteristicPointType.None, CpNone }, { CharacteristicPointType.SurfaceLevelOutside, CpSurfaceLevelOutside }, { CharacteristicPointType.DikeToeAtRiver, CpDikeToeAtRiver }, { CharacteristicPointType.ShoulderTopOutside, CpShoulderTopOutside }, { CharacteristicPointType.ShoulderBaseOutside, CpShoulderBaseOutside }, { CharacteristicPointType.DikeTopAtRiver, CpDikeTopAtRiver }, { CharacteristicPointType.DikeLine, CpDikeLine }, { CharacteristicPointType.TrafficLoadOutside, CpTrafficLoadOutside }, { CharacteristicPointType.TrafficLoadInside, CpTrafficLoadInside }, { CharacteristicPointType.DikeTopAtPolder, CpDikeTopAtPolder }, { CharacteristicPointType.ShoulderBaseInside, CpShoulderBaseInside }, { CharacteristicPointType.ShoulderTopInside, CpShoulderTopInside }, { CharacteristicPointType.DikeToeAtPolder, CpDikeToeAtPolder }, { CharacteristicPointType.DitchDikeSide, CpDitchDikeSide }, { CharacteristicPointType.BottomDitchDikeSide, CpBottomDitchDikeSide }, { CharacteristicPointType.BottomDitchPolderSide, CpBottomDitchPolderSide }, { CharacteristicPointType.DitchPolderSide, CpDitchPolderSide }, { CharacteristicPointType.SurfaceLevelInside, CpSurfaceLevelInside } }; return translationTable[characteristicPointType]; } /// /// Converts to calculation result. /// /// The calculation result. /// public static CalculationResult ConvertToCalculationResult(int calculationResult) { var translationTable = new Dictionary { { 0, CalculationResult.NoRun }, { 1, CalculationResult.Succeeded }, { 2, CalculationResult.NoInput }, { 3, CalculationResult.NoLicense }, { 4, CalculationResult.UserAbort }, { 5, CalculationResult.InvalidInputStructure }, { 6, CalculationResult.InvalidInputData }, { 7, CalculationResult.RunFailed }, { 8, CalculationResult.UnexpectedError } }; return translationTable[calculationResult]; } /// /// Converts to output calculation result. /// /// Type of the dam project. /// public static int ConvertToOutputCalculationResult(CalculationResult calculationResult) { var translationTable = new Dictionary { { CalculationResult.NoRun, 0 }, { CalculationResult.Succeeded, 1 }, { CalculationResult.NoInput, 2 }, { CalculationResult.NoLicense, 3 }, { CalculationResult.UserAbort, 4 }, { CalculationResult.InvalidInputStructure, 5 }, { CalculationResult.InvalidInputData, 6 }, { CalculationResult.RunFailed, 7 }, { CalculationResult.UnexpectedError, 8 } }; return translationTable[calculationResult]; } /// /// Converts to waterpressure interpolation model. /// /// The input waterpressure interpolation model. /// public static WaterpressureInterpolationModel ConvertToWaterpressureInterpolationModel(int inputWaterpressureInterpolationModel) { var translationTable = new Dictionary { { 0, WaterpressureInterpolationModel.Automatic }, { 1, WaterpressureInterpolationModel.Hydrostatic } }; return translationTable[inputWaterpressureInterpolationModel]; } /// /// Converts to input waterpressure interpolation model. /// /// The waterpressure interpolation model. /// public static int ConvertToInputWaterpressureInterpolationModel(WaterpressureInterpolationModel waterpressureInterpolationModel) { var translationTable = new Dictionary { { WaterpressureInterpolationModel.Automatic, 0 }, { WaterpressureInterpolationModel.Hydrostatic, 1 } }; return translationTable[waterpressureInterpolationModel]; } /// /// Converts the Dam profile type to the input profile type /// /// Type of the soil geometry. /// public static int ConvertToInputSoilProfileType(SoilProfileType soilProfileType) { var translationTable = new Dictionary { { SoilProfileType.SoilProfile1D, 0 }, { SoilProfileType.SoilProfile2D, 1 }, { SoilProfileType.SoilGeometryStiFile, 2 } }; return translationTable[soilProfileType]; } /// /// Converts the input profile type to the Dam profile type /// /// Type of the soil geometry. /// public static SoilProfileType ConvertToSoilProfileType(int soilProfileType) { var translationTable = new Dictionary { { 0, SoilProfileType.SoilProfile1D }, { 1, SoilProfileType.SoilProfile2D }, { 2, SoilProfileType.SoilGeometryStiFile } }; return translationTable[soilProfileType]; } /// /// Converts the Dam failure mechanism type to the input failure mechanism type . /// /// Type of the segment failure mechanism. /// public static int ConvertToInputFailureMechanismSystemType(FailureMechanismSystemType segmentFailureMechanismType) { var translationTable = new Dictionary { { FailureMechanismSystemType.StabilityInside, InputFailureMechanismStabilityInside }, { FailureMechanismSystemType.StabilityOutside, InputFailureMechanismStabilityOutside }, { FailureMechanismSystemType.Piping, InputFailureMechanismPiping } }; return translationTable[segmentFailureMechanismType]; } /// /// Converts the input failure mechanism type to the Dam failure mechanism type . /// /// Type of the failure mechanism system. /// public static FailureMechanismSystemType ConvertToFailureMechanismSystemType(int failureMechanismSystemType) { var translationTable = new Dictionary { { InputFailureMechanismStabilityInside, FailureMechanismSystemType.StabilityInside }, { InputFailureMechanismStabilityOutside, FailureMechanismSystemType.StabilityOutside }, { InputFailureMechanismPiping, FailureMechanismSystemType.Piping } }; return translationTable[failureMechanismSystemType]; } /// /// Converts the Dam segment failure mechanism type to the input segment failure mechanism type . /// /// Type of the segment failure mechanism. /// public static int ConvertToInputSegmentFailureMechanismType(FailureMechanismSystemType segmentFailureMechanismType) { var translationTable = new Dictionary { { FailureMechanismSystemType.StabilityInside, InputSegmentFailureMechanismStability }, { FailureMechanismSystemType.StabilityOutside, InputSegmentFailureMechanismStability }, { FailureMechanismSystemType.Piping, InputSegmentFailureMechanismPiping } }; return translationTable[segmentFailureMechanismType]; } /// /// Converts the input segment failure mechanism type to the Dam segment failure mechanism type . /// /// Type of the failure mechanism system. /// public static FailureMechanismSystemType ConvertToSegmentFailureMechanismType(int failureMechanismSystemType) { if (failureMechanismSystemType == InputSegmentFailureMechanismAll) { throw new ConversionException(typeof(FailureMechanismSystemType), failureMechanismSystemType); } var translationTable = new Dictionary { { InputSegmentFailureMechanismStability, FailureMechanismSystemType.StabilityInside }, { InputSegmentFailureMechanismPiping, FailureMechanismSystemType.Piping } }; return translationTable[failureMechanismSystemType]; } /// /// Converts the Dam piping model to the input piping model. /// /// Type of the piping model. /// public static InputPipingModelType ConvertToInputPipingModelType(PipingModelType pipingModelType) { var translationTable = new Dictionary { { PipingModelType.Bligh, InputPipingModelType.Bligh }, { PipingModelType.Sellmeijer, InputPipingModelType.SellmeijerVnk }, { PipingModelType.Sellmeijer4Forces, InputPipingModelType.Sellmeijer4Forces }, { PipingModelType.Wti2017, InputPipingModelType.WtiSellmeijerRevised } }; return translationTable[pipingModelType]; } /// /// Converts the input piping model to the Dam piping model. /// /// Type of the input piping model. /// public static PipingModelType ConvertToPipingModelType(InputPipingModelType inputPipingModelType) { var translationTable = new Dictionary { { InputPipingModelType.Bligh, PipingModelType.Bligh }, { InputPipingModelType.SellmeijerVnk, PipingModelType.Sellmeijer }, { InputPipingModelType.Sellmeijer4Forces, PipingModelType.Sellmeijer4Forces }, { InputPipingModelType.WtiSellmeijerRevised, PipingModelType.Wti2017 } }; return translationTable[inputPipingModelType]; } /// /// Converts the Dam stability model to the input stability model. /// /// Type of the stability model. /// public static InputStabilityModelType ConvertToInputStabilityModelType(MStabModelType stabilityModelType) { var translationTable = new Dictionary { { MStabModelType.Bishop, InputStabilityModelType.Bishop }, { MStabModelType.UpliftVan, InputStabilityModelType.UpliftVan }, { MStabModelType.BishopUpliftVan, InputStabilityModelType.BishopUpliftVan } }; return translationTable[stabilityModelType]; } /// /// Converts the input stability model to the Dam stability model. /// /// Type of the input stability model. /// public static MStabModelType ConvertToStabilityModelType(InputStabilityModelType inputStabilityModelType) { var translationTable = new Dictionary { { InputStabilityModelType.Bishop, MStabModelType.Bishop }, { InputStabilityModelType.UpliftVan, MStabModelType.UpliftVan }, { InputStabilityModelType.BishopUpliftVan, MStabModelType.BishopUpliftVan } }; return translationTable[inputStabilityModelType]; } /// /// Converts the Dam stability model to the output stability model. /// /// Type of the stability model. /// public static DesignResultStabilityDesignResultsStabilityModelType ConvertToOutputStabilityModelType(MStabModelType stabilityModelType) { var translationTable = new Dictionary { { MStabModelType.Bishop, DesignResultStabilityDesignResultsStabilityModelType.Bishop }, { MStabModelType.UpliftVan, DesignResultStabilityDesignResultsStabilityModelType.UpliftVan }, { MStabModelType.BishopUpliftVan, DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan } }; return translationTable[stabilityModelType]; } /// /// Converts the output stability model to the Dam stability model. /// /// Type of the output stability model. /// public static MStabModelType ConvertToStabilityModelType(DesignResultStabilityDesignResultsStabilityModelType outputStabilityModelType) { var translationTable = new Dictionary { { DesignResultStabilityDesignResultsStabilityModelType.Bishop, MStabModelType.Bishop }, { DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, MStabModelType.UpliftVan }, { DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, MStabModelType.BishopUpliftVan } }; return translationTable[outputStabilityModelType]; } /// /// Converts the Dam analysis type to the input analysis type. /// /// Type of the analysis. /// public static InputAnalysisType ConvertToInputAnalysisType(AnalysisType analysisType) { var translationTable = new Dictionary { { AnalysisType.NoAdaption, InputAnalysisType.NoAdaption }, { AnalysisType.AdaptGeometry, InputAnalysisType.AdaptGeometry } }; return translationTable[analysisType]; } /// /// Converts the input analysis type to the Dam analysis type. /// /// Type of the input analysis. /// public static AnalysisType ConvertToAnalysisType(InputAnalysisType inputAnalysisType) { var translationTable = new Dictionary { { InputAnalysisType.NoAdaption, AnalysisType.NoAdaption }, { InputAnalysisType.AdaptGeometry, AnalysisType.AdaptGeometry } }; return translationTable[inputAnalysisType]; } /// /// Converts the type of to input zone. /// /// Type of the zone. /// public static int ConvertToInputZoneType(MStabZonesType zoneType) { var translationTable = new Dictionary { { MStabZonesType.NoZones, InputZoneTypeNoZones }, { MStabZonesType.ForbiddenZone, InputZoneTypesForbiddenZones } }; if ((zoneType != MStabZonesType.NoZones) && (zoneType != MStabZonesType.ForbiddenZone)) { zoneType = MStabZonesType.NoZones; } return translationTable[zoneType]; } /// /// Converts the type of to zone. /// /// Type of the input zone. /// public static MStabZonesType ConvertToZoneType(int inputZoneType) { var translationTable = new Dictionary { { InputZoneTypeNoZones, MStabZonesType.NoZones }, { InputZoneTypesForbiddenZones, MStabZonesType.ForbiddenZone } }; return translationTable[inputZoneType]; } /// /// Converts the Dam message type to the input message type. /// /// Type of the message. /// public static MessageMessageType ConvertToInputMessageType(LogMessageType messageType) { var translationTable = new Dictionary { { LogMessageType.Warning, MessageMessageType.Warning }, { LogMessageType.Debug, MessageMessageType.Info }, { LogMessageType.Error, MessageMessageType.Error }, { LogMessageType.FatalError, MessageMessageType.Error }, { LogMessageType.Info, MessageMessageType.Info }, { LogMessageType.Trace, MessageMessageType.Info } }; return translationTable[messageType]; } /// /// Converts the input message type to the Dam message type. /// /// Type of the validation result message. /// public static LogMessageType ConvertToMessageType(MessageMessageType validationResultMessageType) { var translationTable = new Dictionary { { MessageMessageType.Warning, LogMessageType.Warning }, { MessageMessageType.Error, LogMessageType.Error }, { MessageMessageType.Info, LogMessageType.Info } }; return translationTable[validationResultMessageType]; } /// /// Converts to input search method. /// /// The search method. /// public static int ConvertToInputSearchMethod(MStabSearchMethod searchMethod) { var translationTable = new Dictionary { { MStabSearchMethod.Grid, InputSearchMethodGrid }, { MStabSearchMethod.GeneticAlgorithm, InputSearchMethodGenetic }, { MStabSearchMethod.BeeSwarm, InputSearchMethodBeeSwarm } }; return translationTable[searchMethod]; } /// /// Converts to search method. /// /// The search method. /// public static MStabSearchMethod ConvertToSearchMethod(int searchMethod) { var translationTable = new Dictionary { { InputSearchMethodGrid, MStabSearchMethod.Grid }, { InputSearchMethodGenetic, MStabSearchMethod.GeneticAlgorithm }, { InputSearchMethodBeeSwarm, MStabSearchMethod.BeeSwarm } }; return translationTable[searchMethod]; } /// /// Converts to input grid determination. /// /// Type of the grid. /// public static int ConvertToInputGridDetermination(GridSizeDetermination gridType) { var translationTable = new Dictionary { { GridSizeDetermination.Automatic, InputGridTypeAutomatic }, { GridSizeDetermination.Specified, InputGridTypeSpecified } }; return translationTable[gridType]; } /// /// Converts to grid determination. /// /// Type of the grid. /// public static GridSizeDetermination ConvertToGridDetermination(int gridType) { var translationTable = new Dictionary { { InputGridTypeAutomatic, GridSizeDetermination.Automatic }, { InputGridTypeSpecified, GridSizeDetermination.Specified } }; return translationTable[gridType]; } /// /// Converts to input tangent lines definition. /// /// Type of the tangent line. /// public static int ConvertToInputTangentLinesDefinition(TangentLinesDefinition tangentLineType) { var translationTable = new Dictionary { { TangentLinesDefinition.OnBoundaryLines, InputGridTypeAutomatic }, { TangentLinesDefinition.Specified, InputGridTypeSpecified } }; return translationTable[tangentLineType]; } /// /// Converts to tangent lines definition. /// /// Type of the tangent line. /// public static TangentLinesDefinition ConvertToTangentLinesDefinition(int tangentLineType) { var translationTable = new Dictionary { { InputGridTypeAutomatic, TangentLinesDefinition.OnBoundaryLines }, { InputGridTypeSpecified, TangentLinesDefinition.Specified } }; return translationTable[tangentLineType]; } /// /// Converts the shear strength model to soil shear strength model. /// /// The shear strength model. /// public static SoilShearStrengthModel ConvertToSoilShearStrengthModel(ShearStrengthModel shearStrengthModel) { var translationTable = new Dictionary { { ShearStrengthModel.None, SoilShearStrengthModel.None }, { ShearStrengthModel.CPhi, SoilShearStrengthModel.CPhi }, { ShearStrengthModel.StressTable, SoilShearStrengthModel.StressTable }, { ShearStrengthModel.PseudoValues, SoilShearStrengthModel.PseudoValues }, { ShearStrengthModel.CuMeasured, SoilShearStrengthModel.SuMeasured }, { ShearStrengthModel.CuCalculated, SoilShearStrengthModel.SuCalculated }, { ShearStrengthModel.CuGradient, SoilShearStrengthModel.SuGradient }, { ShearStrengthModel.CuCalculatedYield, SoilShearStrengthModel.SuCalculatedWithYield }, { ShearStrengthModel.CPhiOrCuCalculated, SoilShearStrengthModel.CPhiOrSuCalculated } }; return translationTable[shearStrengthModel]; } /// /// Converts the soil shear strength model to shear strength model. /// /// The soil shear strength model. /// public static ShearStrengthModel ConvertToShearStrengthModel(SoilShearStrengthModel soilShearStrengthModel) { var translationTable = new Dictionary { { SoilShearStrengthModel.None, ShearStrengthModel.None }, { SoilShearStrengthModel.CPhi, ShearStrengthModel.CPhi }, { SoilShearStrengthModel.StressTable, ShearStrengthModel.StressTable }, { SoilShearStrengthModel.PseudoValues, ShearStrengthModel.PseudoValues }, { SoilShearStrengthModel.SuMeasured, ShearStrengthModel.CuMeasured }, { SoilShearStrengthModel.SuCalculated, ShearStrengthModel.CuCalculated }, { SoilShearStrengthModel.SuGradient, ShearStrengthModel.CuGradient }, { SoilShearStrengthModel.SuCalculatedWithYield, ShearStrengthModel.CuCalculatedYield }, { SoilShearStrengthModel.CPhiOrSuCalculated, ShearStrengthModel.CPhiOrCuCalculated } }; return translationTable[soilShearStrengthModel]; } /// /// Converts the shear strength model. /// /// Type of the soil. /// public static ShearStrengthModel ConvertToShearStrengthModel(string shearStrengthModel) { var translationTable = new Dictionary { { "None", ShearStrengthModel.None }, { "C phi", ShearStrengthModel.CPhi }, { "Stress table", ShearStrengthModel.StressTable }, { "Pseudo values", ShearStrengthModel.PseudoValues }, { "Su measured", ShearStrengthModel.CuMeasured }, { "Su calculated", ShearStrengthModel.CuCalculated }, { "Su gradient", ShearStrengthModel.CuGradient }, { "Su calculated with yield", ShearStrengthModel.CuCalculatedYield }, { "C phi or Su calculated", ShearStrengthModel.CPhiOrCuCalculated } }; return translationTable[shearStrengthModel]; } /// /// Converts the dilatancy type to soil dilatancy dilatancy. /// /// Type of the dilatancy. /// public static SoilDilatancyType ConvertToSoilDilatancyType(DilatancyType dilatancyType) { var translationTable = new Dictionary { { DilatancyType.Zero, SoilDilatancyType.Zero }, { DilatancyType.Phi, SoilDilatancyType.Phi }, { DilatancyType.MinusPhi, SoilDilatancyType.MinusPhi } }; return translationTable[dilatancyType]; } /// /// Converts the soil dilatancy type to dilatancy type. /// /// Type of the soil dilatancy. /// public static DilatancyType ConvertToDilatancyType(SoilDilatancyType soilDilatancyType) { var translationTable = new Dictionary { { SoilDilatancyType.Zero, DilatancyType.Zero }, { SoilDilatancyType.Phi, DilatancyType.Phi }, { SoilDilatancyType.MinusPhi, DilatancyType.MinusPhi } }; return translationTable[soilDilatancyType]; } /// /// Converts the input StabilityDesignMethod to the Dam StabilityDesignMethod. /// /// The stability design method. /// public static StabilityDesignMethod ConvertToDamStabilityDesignMethod(LocationDesignOptionsStabilityDesignMethod stabilityDesignMethod) { var translationTable = new Dictionary { { LocationDesignOptionsStabilityDesignMethod.OptimizedSlopeAndShoulderAdaption, StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption }, { LocationDesignOptionsStabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption, StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption } }; return translationTable[stabilityDesignMethod]; } /// /// Converts the Dam StabilityDesignMethod to the input StabilityDesignMethod. /// /// The stability design method. /// public static LocationDesignOptionsStabilityDesignMethod ConvertToInputStabilityDesignMethod(StabilityDesignMethod stabilityDesignMethod) { var translationTable = new Dictionary { { StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption, LocationDesignOptionsStabilityDesignMethod.OptimizedSlopeAndShoulderAdaption }, { StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption, LocationDesignOptionsStabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption } }; return translationTable[stabilityDesignMethod]; } /// /// Converts to Load Situation. /// /// The input Load Situation. /// public static LoadSituation ConvertToLoadSituation(int inputLoadSituation) { var translationTable = new Dictionary { { LoadSituationDry, LoadSituation.Dry }, { LoadSituationWet, LoadSituation.Wet } }; return translationTable[inputLoadSituation]; } /// /// Converts to output LoadSituation. /// /// The Load Situation. /// public static int ConvertToOutputLoadSituation(LoadSituation loadSituation) { var translationTable = new Dictionary { { LoadSituation.Dry, LoadSituationDry }, { LoadSituation.Wet, LoadSituationWet } }; return translationTable[loadSituation]; } /// /// Converts to Uplift Type. /// /// The input UpliftType. /// public static UpliftType ConvertToUpliftType(int inputUpliftType) { var translationTable = new Dictionary { { UpliftTypeUplift, UpliftType.Uplift }, { UpliftTypeNoUplift, UpliftType.NoUplift } }; return translationTable[inputUpliftType]; } /// /// Converts to output Uplift Type. /// /// The UpliftType. /// public static int ConvertToOutputUpliftType(UpliftType upliftType) { var translationTable = new Dictionary { { UpliftType.Uplift, UpliftTypeUplift }, { UpliftType.NoUplift, UpliftTypeNoUplift } }; return translationTable[upliftType]; } /// /// Converts to MStab Model Type. /// /// The input MStabModelType. /// public static MStabModelType ConvertToMStabModelType(int inputMStabModelType) { var translationTable = new Dictionary { { MStabModelTypeBishop, MStabModelType.Bishop }, { MStabModelTypeSpencer, MStabModelType.Spencer }, { MStabModelTypeFellenius, MStabModelType.Fellenius }, { MStabModelTypeUpliftVan, MStabModelType.UpliftVan }, { MStabModelTypeUpliftSpencer, MStabModelType.UpliftSpencer }, { MStabModelTypeBishopRandomField, MStabModelType.BishopRandomField }, { MStabModelTypeBishopUpliftVan, MStabModelType.BishopUpliftVan } }; return translationTable[inputMStabModelType]; } /// /// Converts to output MStabModelType. /// /// The UpliftType. /// public static int ConvertToOutputMStabModelType(MStabModelType mStabModelType) { var translationTable = new Dictionary { { MStabModelType.Bishop, MStabModelTypeBishop }, { MStabModelType.Spencer, MStabModelTypeSpencer }, { MStabModelType.Fellenius, MStabModelTypeFellenius }, { MStabModelType.UpliftVan, MStabModelTypeUpliftVan }, { MStabModelType.UpliftSpencer, MStabModelTypeUpliftSpencer }, { MStabModelType.BishopRandomField, MStabModelTypeBishopRandomField }, { MStabModelType.BishopUpliftVan, MStabModelTypeBishopUpliftVan } }; return translationTable[mStabModelType]; } /// /// Converts to Piping Model Type. /// /// The input PipingModelType. /// public static PipingModelType ConvertToPipingModelType(int inputPipingModelType) { var translationTable = new Dictionary { { PipingModelTypeBligh, PipingModelType.Bligh }, { PipingModelTypeSellmeijer, PipingModelType.Sellmeijer }, { PipingModelTypeSellmeijer4Forces, PipingModelType.Sellmeijer4Forces }, { PipingModelTypeWti2017, PipingModelType.Wti2017 } }; return translationTable[inputPipingModelType]; } /// /// Converts to output PipingModelType. /// /// The UpliftType. /// public static int ConvertToOutputPipingModelType(PipingModelType pipingModelType) { var translationTable = new Dictionary { { PipingModelType.Bligh, PipingModelTypeBligh }, { PipingModelType.Sellmeijer, PipingModelTypeSellmeijer }, { PipingModelType.Sellmeijer4Forces, PipingModelTypeSellmeijer4Forces }, { PipingModelType.Wti2017, PipingModelTypeWti2017 } }; return translationTable[pipingModelType]; } /// /// Converts the input TimeStepUnit to the TimeStepUnit. /// /// The time step unit. /// public static TimeStepUnit ConvertToTimeStepUnit(uint timeStepUnit) { var translationTable = new Dictionary { { TimeStepUnitSecond, TimeStepUnit.Second }, { TimeStepUnitMinute, TimeStepUnit.Minute }, { TimeStepUnitHour, TimeStepUnit.Hour }, { TimeStepUnitDay, TimeStepUnit.Day }, { TimeStepUnitMonth, TimeStepUnit.Month }, { TimeStepUnitWeek, TimeStepUnit.Week }, { TimeStepUnitYear, TimeStepUnit.Year }, { TimeStepUnitNonequidistant, TimeStepUnit.Nonequidistant } }; return translationTable[timeStepUnit]; } /// /// Converts the TimeStepUnit to the input TimeStepUnit. /// /// The time step unit. /// public static uint ConvertToInputTimeStepUnit(TimeStepUnit timeStepUnit) { var translationTable = new Dictionary { { TimeStepUnit.Second, TimeStepUnitSecond }, { TimeStepUnit.Minute, TimeStepUnitMinute }, { TimeStepUnit.Hour, TimeStepUnitHour }, { TimeStepUnit.Day, TimeStepUnitDay }, { TimeStepUnit.Month, TimeStepUnitMonth }, { TimeStepUnit.Week, TimeStepUnitWeek }, { TimeStepUnit.Year, TimeStepUnitYear }, { TimeStepUnit.Nonequidistant, TimeStepUnitNonequidistant } }; return translationTable[timeStepUnit]; } /// /// Converts the input plLineType to Dam plLineType. /// /// Type of the pl line. /// plLineType public static PLLineType ConvertToPlLineType(uint plLineType) { var translationTable = new Dictionary { { PlLineTypePl1, PLLineType.PL1 }, { PlLineTypePl2, PLLineType.PL2 }, { PlLineTypePl3, PLLineType.PL3 }, { PlLineTypePl4, PLLineType.PL4 } }; return translationTable[plLineType]; } /// /// Converts the Dam plLineType to input plLineType. /// /// Type of the pl line. /// plLineType as integer public static uint ConvertToInputPlLineType(PLLineType plLineType) { var translationTable = new Dictionary { { PLLineType.PL1, PlLineTypePl1 }, { PLLineType.PL2, PlLineTypePl2 }, { PLLineType.PL3, PlLineTypePl3 }, { PLLineType.PL4, PlLineTypePl4 } }; return translationTable[plLineType]; } /// /// Converts the Dam sensorType to input sensorType. /// /// Type of the sensor. /// sensorType public static SensorType ConvertToSensorType(uint sensorType) { var translationTable = new Dictionary { { SensorTypePiezometricHead, SensorType.PiezometricHead }, { SensorTypePolderLevel, SensorType.PolderLevel }, { SensorTypeWaterLevel, SensorType.WaterLevel } }; return translationTable[sensorType]; } /// /// Converts the Dam sensorType to input sensorType. /// /// Type of the sensor. /// sensorType as integer public static uint ConvertToInputSensorType(SensorType sensorType) { var translationTable = new Dictionary { { SensorType.PiezometricHead, SensorTypePiezometricHead }, { SensorType.PolderLevel, SensorTypePolderLevel }, { SensorType.WaterLevel, SensorTypeWaterLevel } }; return translationTable[sensorType]; } /// /// Converts the Dam DataSourceTypeSensors to input DataSourceTypeSensors. /// /// The data source type sensors. /// /// DataSourceTypeSensors /// public static DataSourceTypeSensors ConvertToDataSourceTypeSensors(uint dataSourceTypeSensors) { var translationTable = new Dictionary { { DataSourceTypeSensorsIgnore, DataSourceTypeSensors.Ignore }, { DataSourceTypeSensorsLocationData, DataSourceTypeSensors.LocationData }, { DataSourceTypeSensorsSensor, DataSourceTypeSensors.Sensor } }; return translationTable[dataSourceTypeSensors]; } /// /// Converts the Dam DataSourceType to input DataSourceType. /// /// The data source type sensors. /// /// DataSourceType as integer /// public static uint ConvertToInputDataSourceTypeSensors(DataSourceTypeSensors dataSourceTypeSensors) { var translationTable = new Dictionary { { DataSourceTypeSensors.Ignore, DataSourceTypeSensorsIgnore }, { DataSourceTypeSensors.LocationData, DataSourceTypeSensorsLocationData }, { DataSourceTypeSensors.Sensor, DataSourceTypeSensorsSensor } }; return translationTable[dataSourceTypeSensors]; } /// /// Converts the soil type. /// /// Type of the soil. /// public static SoilType ConvertToSoilType(string soilType) { var translationTable = new Dictionary { { "Sand", SoilType.Sand }, { "Peat", SoilType.Peat }, { "Loam", SoilType.Loam }, { "Clay", SoilType.Clay }, { "Gravel", SoilType.Gravel } }; return translationTable[soilType]; } }