Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingCalculation.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingCalculation.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingCalculation.cs (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -0,0 +1,108 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Ringtoets.HydraRing.Calculation.Types; + +namespace Ringtoets.HydraRing.Calculation.Common +{ + /// + /// Container of all data necessary for performing a Hydra-Ring calculation. + /// + public abstract class HydraRingCalculation + { + private readonly int hydraulicBoundaryLocationId; + + /// + /// Creates a new instance of the class. + /// + /// The id of the hydraulic station to use during the calculation. + protected HydraRingCalculation(int hydraulicBoundaryLocationId) + { + this.hydraulicBoundaryLocationId = hydraulicBoundaryLocationId; + } + + /// + /// Gets the . + /// + public abstract HydraRingFailureMechanismType FailureMechanismType { get; } + + /// + /// Gets the id of the hydraulic station to use during the calculation. + /// + public int HydraulicBoundaryLocationId + { + get + { + return hydraulicBoundaryLocationId; + } + } + + /// + /// Gets the dike section to perform the calculation for. + /// + public abstract HydraRingDikeSection DikeSection { get; } + + /// + /// Gets the variables to use during the calculation. + /// + public virtual IEnumerable Variables + { + get + { + yield break; + } + } + + /// + /// Gets the profile points to use during the calculation. + /// + public virtual IEnumerable ProfilePoints + { + get + { + yield break; + } + } + + /// + /// Gets the target reliability index to use during the calculation. + /// + /// Only relevant for type 2 computations. + public virtual double Beta + { + get + { + return double.NaN; + } + } + + /// + /// Gets the sub mechanism model id corresponding to the provided sub mechanism id. + /// + /// The sub mechanim id to get the sub mechanism model id for. + /// The corresponding sub mechanism model id or null otherwise. + public virtual int? GetSubMechanismModelId(int subMechanismId) + { + return null; + } + } +} \ No newline at end of file Fisheye: Tag 6d95a1695a43dacc80bd5dd3a118deb98d99702d refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingCalculationData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingConfiguration.cs =================================================================== diff -u -r8884523252d1c3289b3ece6afd696e58a4959228 -r6d95a1695a43dacc80bd5dd3a118deb98d99702d --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingConfiguration.cs (.../HydraRingConfiguration.cs) (revision 8884523252d1c3289b3ece6afd696e58a4959228) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingConfiguration.cs (.../HydraRingConfiguration.cs) (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -54,7 +54,7 @@ public class HydraRingConfiguration { private readonly string ringId; - private readonly IList hydraRingCalculations; + private readonly IList hydraRingCalculations; private readonly SubMechanismSettingsProvider subMechanismSettingsProvider = new SubMechanismSettingsProvider(); private readonly FailureMechanismSettingsProvider failureMechanismSettingsProvider = new FailureMechanismSettingsProvider(); private readonly FailureMechanismDefaultsProvider failureMechanismDefaultsProvider = new FailureMechanismDefaultsProvider(); @@ -70,7 +70,7 @@ /// The to use while executing the configured Hydra-Ring calculations. public HydraRingConfiguration(string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType) { - hydraRingCalculations = new List(); + hydraRingCalculations = new List(); this.ringId = ringId; this.timeIntegrationSchemeType = timeIntegrationSchemeType; @@ -113,10 +113,10 @@ /// /// Adds a Hydra-Ring calculation to the . /// - /// The container that holds all data for configuring the calculation. - public void AddHydraRingCalculation(HydraRingCalculationData hydraRingCalculationData) + /// The container that holds all data for configuring the calculation. + public void AddHydraRingCalculation(HydraRingCalculation hydraRingCalculation) { - hydraRingCalculations.Add(hydraRingCalculationData); + hydraRingCalculations.Add(hydraRingCalculation); } /// Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/AssessmentLevelCalculation.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/AssessmentLevelCalculation.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/AssessmentLevelCalculation.cs (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -0,0 +1,74 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Ringtoets.HydraRing.Calculation.Common; +using Ringtoets.HydraRing.Calculation.Types; + +namespace Ringtoets.HydraRing.Calculation.Data +{ + /// + /// Container of all data necessary for performing an assessment level calculation via Hydra-Ring. + /// + public class AssessmentLevelCalculation : HydraulicCalculation + { + private readonly HydraRingDikeSection dikeSection; + + /// + /// Creates a new instance of the class. + /// + /// The id of the hydraulic station to use during the calculation. + /// The target reliability index to use during the calculation. + public AssessmentLevelCalculation(int hydraulicBoundaryLocationId, double beta) : base(hydraulicBoundaryLocationId, beta) + { + dikeSection = new HydraRingDikeSection(HydraulicBoundaryLocationId, HydraulicBoundaryLocationId.ToString(), double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + } + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + return HydraRingFailureMechanismType.AssessmentLevel; + } + } + + public override HydraRingDikeSection DikeSection + { + get + { + return dikeSection; + } + } + + public override IEnumerable Variables + { + get + { + yield return new AssessmentLevelVariable(); + } + } + + private class AssessmentLevelVariable : HydraRingVariable + { + public AssessmentLevelVariable() : base(26, HydraRingDistributionType.Deterministic, 0, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN) { } + } + } +} \ No newline at end of file Fisheye: Tag 6d95a1695a43dacc80bd5dd3a118deb98d99702d refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/AssessmentLevelCalculationData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraulicCalculation.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraulicCalculation.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraulicCalculation.cs (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -0,0 +1,30 @@ +using Ringtoets.HydraRing.Calculation.Common; + +namespace Ringtoets.HydraRing.Calculation.Data +{ + /// + /// Container of all data necessary for performing an hydraulic data calculation via Hydra-Ring. + /// + public abstract class HydraulicCalculation : HydraRingCalculation + { + private readonly double beta; + + /// + /// Creates a new instance of the class. + /// + /// The id of the hydraulic station to use during the calculation. + /// The target reliability index to use during the calculation. + protected HydraulicCalculation(int hydraulicBoundaryLocationId, double beta) : base(hydraulicBoundaryLocationId) + { + this.beta = beta; + } + + public override double Beta + { + get + { + return beta; + } + } + } +} \ No newline at end of file Fisheye: Tag 6d95a1695a43dacc80bd5dd3a118deb98d99702d refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraulicCalculationData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -ra86ee48c248b3095d7db43023c64780534dd2e59 -r6d95a1695a43dacc80bd5dd3a118deb98d99702d --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision a86ee48c248b3095d7db43023c64780534dd2e59) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -41,8 +41,8 @@ - - + + @@ -56,7 +56,7 @@ - + Fisheye: Tag 6d95a1695a43dacc80bd5dd3a118deb98d99702d refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingCalculationDataTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingCalculationTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingCalculationTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingCalculationTest.cs (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -0,0 +1,91 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Common; +using Ringtoets.HydraRing.Calculation.Types; + +namespace Ringtoets.HydraRing.Calculation.Test.Common +{ + [TestFixture] + public class HydraRingCalculationTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var hydraRingCalculation = new HydraRingCalculationImplementation(1); + + // Assert + Assert.AreEqual(1, hydraRingCalculation.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.QVariant, hydraRingCalculation.FailureMechanismType); + CollectionAssert.IsEmpty(hydraRingCalculation.Variables); + CollectionAssert.IsEmpty(hydraRingCalculation.ProfilePoints); + Assert.IsNaN(hydraRingCalculation.Beta); + } + + [Test] + public void GetSubMechanismModelId_ReturnsExpectedValues() + { + // Call + var hydraRingCalculation = new HydraRingCalculationImplementation(1); + + // Assert + Assert.AreEqual(10, hydraRingCalculation.GetSubMechanismModelId(1)); + Assert.AreEqual(20, hydraRingCalculation.GetSubMechanismModelId(2)); + Assert.IsNull(hydraRingCalculation.GetSubMechanismModelId(3)); + } + + private class HydraRingCalculationImplementation : HydraRingCalculation + { + public HydraRingCalculationImplementation(int hydraulicBoundaryLocationId) : base(hydraulicBoundaryLocationId) {} + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + return HydraRingFailureMechanismType.QVariant; + } + } + + public override HydraRingDikeSection DikeSection + { + get + { + return new HydraRingDikeSection(1, "Name", 2.2, 3.3, 4.4, 5.5, 6.6, 7.7); + } + } + + public override int? GetSubMechanismModelId(int subMechanismId) + { + switch (subMechanismId) + { + case 1: + return 10; + case 2: + return 20; + default: + return null; + } + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingConfigurationTest.cs =================================================================== diff -u -r5813e3023cea94d7aad8f1fc057b0e85b538f2f5 -r6d95a1695a43dacc80bd5dd3a118deb98d99702d --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingConfigurationTest.cs (.../HydraRingConfigurationTest.cs) (revision 5813e3023cea94d7aad8f1fc057b0e85b538f2f5) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingConfigurationTest.cs (.../HydraRingConfigurationTest.cs) (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -35,19 +35,20 @@ public void Constructor_ExpectedValues() { // Call - var hydraRingConfiguration = new HydraRingConfiguration(HydraRingTimeIntegrationSchemeType.NTI, HydraRingUncertaintiesType.Model); + var hydraRingConfiguration = new HydraRingConfiguration("34-1", HydraRingTimeIntegrationSchemeType.NTI, HydraRingUncertaintiesType.Model); // Assert + Assert.AreEqual("34-1", hydraRingConfiguration.RingId); Assert.AreEqual(HydraRingTimeIntegrationSchemeType.NTI, hydraRingConfiguration.TimeIntegrationSchemeType); Assert.AreEqual(HydraRingUncertaintiesType.Model, hydraRingConfiguration.UncertaintiesType); } [Test] public void GenerateDataBaseCreationScript_NonDefaultHydraRingConfiguration_ReturnsExpectedCreationScript() { - var hydraRingConfiguration = new HydraRingConfiguration(HydraRingTimeIntegrationSchemeType.NTI, HydraRingUncertaintiesType.Model); + var hydraRingConfiguration = new HydraRingConfiguration("34-1", HydraRingTimeIntegrationSchemeType.NTI, HydraRingUncertaintiesType.Model); - hydraRingConfiguration.AddHydraRingCalculation(new HydraulicCalculationDataImplementation(700004, 1.1)); + hydraRingConfiguration.AddHydraRingCalculation(new HydraulicCalculationImplementation(700004, 1.1)); var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + "INSERT INTO [HydraulicModels] VALUES (3, 2, 'WTI 2017');" + Environment.NewLine + @@ -112,9 +113,9 @@ Assert.AreEqual(expectedCreationScript, creationScript); } - private class HydraulicCalculationDataImplementation : HydraulicCalculationData + private class HydraulicCalculationImplementation : HydraulicCalculation { - public HydraulicCalculationDataImplementation(int hydraulicBoundaryLocationId, double beta) : base(hydraulicBoundaryLocationId, beta) + public HydraulicCalculationImplementation(int hydraulicBoundaryLocationId, double beta) : base(hydraulicBoundaryLocationId, beta) { } Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/HydraRingConfigurationIntegrationTest.cs =================================================================== diff -u -r5813e3023cea94d7aad8f1fc057b0e85b538f2f5 -r6d95a1695a43dacc80bd5dd3a118deb98d99702d --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/HydraRingConfigurationIntegrationTest.cs (.../HydraRingConfigurationIntegrationTest.cs) (revision 5813e3023cea94d7aad8f1fc057b0e85b538f2f5) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/HydraRingConfigurationIntegrationTest.cs (.../HydraRingConfigurationIntegrationTest.cs) (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -33,9 +33,9 @@ [Test] public void GenerateDataBaseCreationScript_HydraRingConfigurationWithAssessmentLevelCalculation_ReturnsExpectedCreationScript() { - var hydraRingConfiguration = new HydraRingConfiguration(HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All); + var hydraRingConfiguration = new HydraRingConfiguration("34-1", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All); - hydraRingConfiguration.AddHydraRingCalculation(new AssessmentLevelCalculationData(700004, 3.29053)); + hydraRingConfiguration.AddHydraRingCalculation(new AssessmentLevelCalculation(700004, 3.29053)); var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -ra86ee48c248b3095d7db43023c64780534dd2e59 -r6d95a1695a43dacc80bd5dd3a118deb98d99702d --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision a86ee48c248b3095d7db43023c64780534dd2e59) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 6d95a1695a43dacc80bd5dd3a118deb98d99702d) @@ -48,7 +48,7 @@ - +