Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InterfaceConversionHelper.cs
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InterfaceConversionHelper.cs (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InterfaceConversionHelper.cs (revision 6322)
@@ -0,0 +1,176 @@
+// Copyright (C) Stichting Deltares 2024. All rights reserved.
+//
+// This file is part of the Dam Engine.
+//
+// The Dam Engine is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero 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;
+using System.Collections.Generic;
+using Deltares.DamEngine.Data.General;
+using Deltares.DamEngine.Data.Geotechnics;
+using Deltares.MacroStability.Io.XmlInput;
+using CharacteristicPointType = Deltares.MacroStability.Io.XmlInput.CharacteristicPointType;
+
+namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon.MacroStabilityIo;
+
+public class InterfaceConversionHelper
+{
+ /// Converts SearchAlgorithm to MStabSearchMethod.
+ /// The MacroStability search algorithm.
+ ///
+ ///
+ public static StabilitySearchMethod ConvertToDamSearchMethod(SearchAlgorithmType searchAlgorithm)
+ {
+ if (searchAlgorithm != SearchAlgorithmType.Grid && searchAlgorithm != SearchAlgorithmType.Genetic && searchAlgorithm != SearchAlgorithmType.BeeswarmAndLevenbergMarquardt)
+ {
+ throw new ArgumentException($"Unsupported search algorithm: {searchAlgorithm}");
+ }
+
+ var translationTable = new Dictionary
+ {
+ {
+ SearchAlgorithmType.Grid, StabilitySearchMethod.Grid
+ },
+ {
+ SearchAlgorithmType.BeeswarmAndLevenbergMarquardt, StabilitySearchMethod.BeeSwarm
+ }
+ };
+ return translationTable[searchAlgorithm];
+ }
+
+ /// Converts MStabSearchMethod to SearchAlgorithm.
+ /// The Dam search algorithm.
+ ///
+ ///
+ public static SearchAlgorithmType ConvertToMacroStabilitySearchMethod(StabilitySearchMethod stabilitySearchMethod)
+ {
+ var translationTable = new Dictionary
+ {
+ {
+ StabilitySearchMethod.Grid, SearchAlgorithmType.Grid
+ },
+ {
+ StabilitySearchMethod.BeeSwarm, SearchAlgorithmType.BeeswarmAndLevenbergMarquardt
+ }
+ };
+ return translationTable[stabilitySearchMethod];
+ }
+
+ /// Converts to ModelOptions type.
+ /// the MStabModelType.
+ /// the MacroStability ModelOption
+ ///
+ public static StabilityModelOption ConvertToModelOptions(StabilityModelType stabilityModelType)
+ {
+ // For the Macrostability kernel, the only supported options for now are Bishop and UpliftVan.
+ if (stabilityModelType != StabilityModelType.UpliftVan && stabilityModelType != StabilityModelType.Bishop)
+ {
+ throw new ArgumentException($"Unsupported MStabModelType: {stabilityModelType}");
+ }
+
+ var translationTable = new Dictionary
+ {
+ {
+ StabilityModelType.UpliftVan, StabilityModelOption.UpliftVan
+ },
+ {
+ StabilityModelType.Bishop, StabilityModelOption.Bishop
+ }
+ };
+ return translationTable[stabilityModelType];
+ }
+
+ /// Converts to GridOrientation.
+ /// The MStabGridPosition.
+ ///
+ public static OrientationType ConvertToGridOrientation(StabilityGridPosition stabilityGridPosition)
+ {
+ var translationTable = new Dictionary
+ {
+ {
+ StabilityGridPosition.Right, OrientationType.Inwards
+ },
+ {
+ StabilityGridPosition.Left, OrientationType.Outwards
+ }
+ };
+ return translationTable[stabilityGridPosition];
+ }
+
+ /// Converts the type of to macro stability characteristic point.
+ /// Type of the dam characteristic point.
+ ///
+ public static CharacteristicPointType ConvertToMacroStabilityCharacteristicPointType(Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType damCharacteristicPointType)
+ {
+ var translationTable = new Dictionary
+ {
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.BottomDitchPolderSide, CharacteristicPointType.BottomDitchPolderSide
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.BottomDitchDikeSide, CharacteristicPointType.BottomDitchDikeSide
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.DikeToeAtPolder, CharacteristicPointType.DikeToeAtPolder
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.DikeToeAtRiver, CharacteristicPointType.DikeToeAtRiver
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.DikeTopAtPolder, CharacteristicPointType.DikeTopAtPolder
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.DikeTopAtRiver, CharacteristicPointType.DikeTopAtRiver
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.DitchDikeSide, CharacteristicPointType.DitchDikeSide
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.DitchPolderSide, CharacteristicPointType.DitchPolderSide
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.None, CharacteristicPointType.None
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.ShoulderBaseInside, CharacteristicPointType.ShoulderBaseInside
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.ShoulderBaseOutside, CharacteristicPointType.ShoulderBaseOutside
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.ShoulderTopInside, CharacteristicPointType.ShoulderTopInside
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.ShoulderTopOutside, CharacteristicPointType.ShoulderTopOutside
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.SurfaceLevelInside, CharacteristicPointType.SurfaceLevelInside
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.SurfaceLevelOutside, CharacteristicPointType.SurfaceLevelOutside
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.TrafficLoadInside, CharacteristicPointType.TrafficLoadInside
+ },
+ {
+ Deltares.DamEngine.Data.Geotechnics.CharacteristicPointType.TrafficLoadOutside, CharacteristicPointType.TrafficLoadOutside
+ }
+ };
+ return translationTable[damCharacteristicPointType];
+ }
+}
\ No newline at end of file
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityInterfaceInputFromEngine.cs
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityInterfaceInputFromEngine.cs (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityInterfaceInputFromEngine.cs (revision 6322)
@@ -0,0 +1,248 @@
+// Copyright (C) Stichting Deltares 2024. All rights reserved.
+//
+// This file is part of the Dam Engine.
+//
+// The Dam Engine is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero 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;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using Deltares.DamEngine.Data.General;
+using Deltares.DamEngine.Data.Geometry;
+using Deltares.DamEngine.Data.Geotechnics;
+using Deltares.DamEngine.Data.Standard;
+using Deltares.Geo.Common.Geometry;
+using Deltares.DamEngine.Calculators.KernelWrappers.Common;
+using Deltares.MacroStability.Io.XmlInput;
+using Soil = Deltares.Geo.Common.Geometry.Soil;
+using SurfaceLine2 = Deltares.DamEngine.Data.Geotechnics.SurfaceLine2;
+using Waternet = Deltares.DamEngine.Data.Geometry.Waternet;
+
+namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon.MacroStabilityIo;
+
+internal class ObjectRegistry
+{
+ private readonly ConcurrentDictionary