Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Location.cs =================================================================== diff -u -r2166 -r2171 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Location.cs (.../Location.cs) (revision 2166) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Location.cs (.../Location.cs) (revision 2171) @@ -63,6 +63,17 @@ } /// + /// Types of Failure mechanisms for soil segments + /// + public enum SegmentFailureMechanismType + { + All, + Stability, + Piping, + Liquefaction + } + + /// /// Types of soil profiles for DAM /// public enum SoilProfileType Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Deltares.DamEngine.Data.Tests.csproj =================================================================== diff -u -r1691 -r2171 --- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Deltares.DamEngine.Data.Tests.csproj (.../Deltares.DamEngine.Data.Tests.csproj) (revision 1691) +++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Deltares.DamEngine.Data.Tests.csproj (.../Deltares.DamEngine.Data.Tests.csproj) (revision 2171) @@ -50,6 +50,7 @@ + Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj =================================================================== diff -u -r2127 -r2171 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 2127) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 2171) @@ -40,6 +40,7 @@ + Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/ConversionHelper.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/ConversionHelper.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/ConversionHelper.cs (revision 2171) @@ -0,0 +1,43 @@ +// Copyright (C) Stichting Deltares 2019. 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.Collections.Generic; + +namespace Deltares.DamEngine.Data.General +{ + /// Helper class for conversions + public class ConversionHelper + { + /// Convert from FailureMechanismSystemType to SegmentFailureMechanismType + /// + public static SegmentFailureMechanismType ConvertToSegmentFailureMechanismType(FailureMechanismSystemType failureMechanismSystemType) + { + var translationTable = new Dictionary() + { + {FailureMechanismSystemType.StabilityInside, SegmentFailureMechanismType.Stability}, + {FailureMechanismSystemType.StabilityOutside, SegmentFailureMechanismType.Stability}, + {FailureMechanismSystemType.HorizontalBalance, SegmentFailureMechanismType.Stability}, + {FailureMechanismSystemType.Piping, SegmentFailureMechanismType.Piping} + }; + return translationTable[failureMechanismSystemType]; + } + } +} Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/General/ConversionHelperTests.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/General/ConversionHelperTests.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/General/ConversionHelperTests.cs (revision 2171) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2019. 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 NUnit.Framework; +using Deltares.DamEngine.Data.General; + +namespace Deltares.DamEngine.Data.Tests.General +{ + [TestFixture] + public class ConversionHelperTests + { + [Test] + [TestCase(FailureMechanismSystemType.StabilityInside, SegmentFailureMechanismType.Stability)] + [TestCase(FailureMechanismSystemType.StabilityOutside, SegmentFailureMechanismType.Stability)] + [TestCase(FailureMechanismSystemType.HorizontalBalance, SegmentFailureMechanismType.Stability)] + [TestCase(FailureMechanismSystemType.Piping, SegmentFailureMechanismType.Piping)] + public void GivenFailureMechanismSystemTypeWhenConvertingThenReturnsCorrectSegmentFailureMechanismType( + FailureMechanismSystemType failureMechanismSystemType, SegmentFailureMechanismType segmentFailureMechanismType) + { + Assert.AreEqual(segmentFailureMechanismType, ConversionHelper.ConvertToSegmentFailureMechanismType(failureMechanismSystemType)); + } + } +}