Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs
===================================================================
diff -u -re4e785f127ce9a2d0d1734c1b51e02d910a31bbe -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision e4e785f127ce9a2d0d1734c1b51e02d910a31bbe)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -159,8 +159,8 @@
return new StructuresClosureVerticalWallCalculationInput(
calculation.InputParameters.HydraulicBoundaryLocation.Id,
new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.StructureNormalOrientation),
- CalculationInputParser.ParseForeshore(calculation.InputParameters),
- CalculationInputParser.ParseBreakWater(calculation.InputParameters),
+ HydraRingInputParser.ParseForeshore(calculation.InputParameters),
+ HydraRingInputParser.ParseBreakWater(calculation.InputParameters),
generalInput.GravitationalAcceleration,
calculation.InputParameters.FactorStormDurationOpenStructure,
calculation.InputParameters.FailureProbabilityOpenStructure,
@@ -190,8 +190,8 @@
return new StructuresClosureLowSillCalculationInput(
calculation.InputParameters.HydraulicBoundaryLocation.Id,
new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.StructureNormalOrientation),
- CalculationInputParser.ParseForeshore(calculation.InputParameters),
- CalculationInputParser.ParseBreakWater(calculation.InputParameters),
+ HydraRingInputParser.ParseForeshore(calculation.InputParameters),
+ HydraRingInputParser.ParseBreakWater(calculation.InputParameters),
generalInput.GravitationalAcceleration,
calculation.InputParameters.FactorStormDurationOpenStructure,
calculation.InputParameters.FailureProbabilityOpenStructure,
@@ -220,8 +220,8 @@
return new StructuresClosureFloodedCulvertCalculationInput(
calculation.InputParameters.HydraulicBoundaryLocation.Id,
new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.StructureNormalOrientation),
- CalculationInputParser.ParseForeshore(calculation.InputParameters),
- CalculationInputParser.ParseBreakWater(calculation.InputParameters),
+ HydraRingInputParser.ParseForeshore(calculation.InputParameters),
+ HydraRingInputParser.ParseBreakWater(calculation.InputParameters),
generalInput.GravitationalAcceleration,
calculation.InputParameters.FactorStormDurationOpenStructure,
calculation.InputParameters.FailureProbabilityOpenStructure,
Fisheye: Tag 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Service/CalculationInputParser.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.Service/HydraRingInputParser.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Service/HydraRingInputParser.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/HydraRingInputParser.cs (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -0,0 +1,57 @@
+// 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 System.Linq;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.HydraRing.Calculation.Data;
+
+namespace Ringtoets.Common.Service
+{
+ ///
+ /// Helper class to parse the breakwater and foreshore properties of a calculation input object into required objects
+ /// for performing calculations with HydrarRing.
+ ///
+ public static class HydraRingInputParser
+ {
+ ///
+ /// Parses the foreshore geometry of a calculation input object into a of
+ /// .
+ ///
+ /// A calculation input object that implements .
+ /// A of .
+ public static IEnumerable ParseForeshore(IUseForeshore input)
+ {
+ return input.UseForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0];
+ }
+
+ ///
+ /// Parses the breakwater properties of a calculation input object into a object.
+ ///
+ /// A calculation input object that implements .
+ /// A object, null if
+ /// is false
+ public static HydraRingBreakWater ParseBreakWater(IUseBreakWater input)
+ {
+ return input.UseBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj
===================================================================
diff -u -r539779c3ab8d787b26f6a2b1ec518eace8d49a02 -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 539779c3ab8d787b26f6a2b1ec518eace8d49a02)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -49,7 +49,7 @@
-
+
Fisheye: Tag 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Service.Test/CalculationInputParserTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraRingInputParserTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraRingInputParserTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraRingInputParserTest.cs (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -0,0 +1,131 @@
+// 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;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HydraRing.Calculation.Data;
+
+namespace Ringtoets.Common.Service.Test
+{
+ [TestFixture]
+ public class HydraRingInputParserTest
+ {
+ [Test]
+ public void ParseForeshore_Use_ReturnCollection()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var foreshoreStub = mockRepository.Stub();
+ foreshoreStub.UseForeshore = true;
+
+ Point2D pointOne = new Point2D(1, 1);
+ Point2D pointTwo = new Point2D(2, 2);
+ foreshoreStub.Stub(call => call.ForeshoreGeometry).Return(new RoundedPoint2DCollection(2, new[]
+ {
+ pointOne,
+ pointTwo
+ }));
+ mockRepository.ReplayAll();
+
+ // Call
+ IEnumerable parsedForeshore = HydraRingInputParser.ParseForeshore(foreshoreStub);
+
+ // Assert
+ HydraRingForelandPoint[] actualForelandPoints = parsedForeshore.ToArray();
+ Assert.AreEqual(pointOne.X, actualForelandPoints[0].X);
+ Assert.AreEqual(pointOne.Y, actualForelandPoints[0].Z);
+ Assert.AreEqual(pointTwo.X, actualForelandPoints[1].X);
+ Assert.AreEqual(pointTwo.Y, actualForelandPoints[1].Z);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void ParseForeshore_DoesNotUse_ReturnEmptyCollection()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var foreshoreStub = mockRepository.Stub();
+ foreshoreStub.UseForeshore = false;
+ mockRepository.ReplayAll();
+
+ // Call
+ IEnumerable parsedForeshore = HydraRingInputParser.ParseForeshore(foreshoreStub);
+
+ // Assert
+ CollectionAssert.IsEmpty(parsedForeshore);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(BreakWaterType.Wall)]
+ [TestCase(BreakWaterType.Caisson)]
+ [TestCase(BreakWaterType.Dam)]
+ public void ParseBreakWater_Use_ReturnHydraRingBreakWater(BreakWaterType breakWaterType)
+ {
+ // Setup
+ var random = new Random(22);
+ var breakWaterHeight = random.NextDouble();
+
+ var mockRepository = new MockRepository();
+ var breakWaterStub = mockRepository.Stub();
+ breakWaterStub.UseBreakWater = true;
+ var expectedBreakWater = new BreakWater(breakWaterType, breakWaterHeight);
+ breakWaterStub.Stub(call => call.BreakWater).Return(expectedBreakWater);
+ mockRepository.ReplayAll();
+
+ // Call
+ HydraRingBreakWater parsedBreakWater = HydraRingInputParser.ParseBreakWater(breakWaterStub);
+
+ // Assert
+ Assert.AreEqual((int) expectedBreakWater.Type, parsedBreakWater.Type);
+ Assert.AreEqual(expectedBreakWater.Height, parsedBreakWater.Height, expectedBreakWater.Height.GetAccuracy());
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(BreakWaterType.Wall)]
+ [TestCase(BreakWaterType.Caisson)]
+ [TestCase(BreakWaterType.Dam)]
+ public void ParseBreakWater_DoesNotUse_ReturnNull(BreakWaterType breakWaterType)
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var breakWaterStub = mockRepository.Stub();
+ breakWaterStub.UseBreakWater = false;
+ mockRepository.ReplayAll();
+
+ // Call
+ HydraRingBreakWater parsedBreakWater = HydraRingInputParser.ParseBreakWater(breakWaterStub);
+
+ // Assert
+ Assert.IsNull(parsedBreakWater);
+ mockRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj
===================================================================
diff -u -r539779c3ab8d787b26f6a2b1ec518eace8d49a02 -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision 539779c3ab8d787b26f6a2b1ec518eace8d49a02)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Ringtoets.Common.Service.Test.csproj (.../Ringtoets.Common.Service.Test.csproj) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -57,7 +57,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs
===================================================================
diff -u -r539779c3ab8d787b26f6a2b1ec518eace8d49a02 -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs (.../GrassCoverErosionInwardsCalculationService.cs) (revision 539779c3ab8d787b26f6a2b1ec518eace8d49a02)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs (.../GrassCoverErosionInwardsCalculationService.cs) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -208,8 +208,8 @@
return new OvertoppingCalculationInput(calculation.InputParameters.HydraulicBoundaryLocation.Id,
new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.Orientation),
ParseProfilePoints(calculation.InputParameters.DikeGeometry),
- CalculationInputParser.ParseForeshore(calculation.InputParameters),
- CalculationInputParser.ParseBreakWater(calculation.InputParameters),
+ HydraRingInputParser.ParseForeshore(calculation.InputParameters),
+ HydraRingInputParser.ParseBreakWater(calculation.InputParameters),
calculation.InputParameters.DikeHeight,
generalInput.CriticalOvertoppingModelFactor,
generalInput.FbFactor.Mean,
@@ -232,8 +232,8 @@
assessmentSection.FailureMechanismContribution.Norm,
new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.Orientation),
ParseProfilePoints(calculation.InputParameters.DikeGeometry),
- CalculationInputParser.ParseForeshore(calculation.InputParameters),
- CalculationInputParser.ParseBreakWater(calculation.InputParameters),
+ HydraRingInputParser.ParseForeshore(calculation.InputParameters),
+ HydraRingInputParser.ParseBreakWater(calculation.InputParameters),
generalInput.CriticalOvertoppingModelFactor,
generalInput.FbFactor.Mean,
generalInput.FbFactor.StandardDeviation,
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs
===================================================================
diff -u -re4e785f127ce9a2d0d1734c1b51e02d910a31bbe -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision e4e785f127ce9a2d0d1734c1b51e02d910a31bbe)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -143,8 +143,8 @@
return new StructuresOvertoppingCalculationInput(
calculation.InputParameters.HydraulicBoundaryLocation.Id,
new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.StructureNormalOrientation),
- CalculationInputParser.ParseForeshore(calculation.InputParameters),
- CalculationInputParser.ParseBreakWater(calculation.InputParameters),
+ HydraRingInputParser.ParseForeshore(calculation.InputParameters),
+ HydraRingInputParser.ParseBreakWater(calculation.InputParameters),
generalInput.GravitationalAcceleration,
generalInput.ModelFactorOvertoppingFlow.Mean, generalInput.ModelFactorOvertoppingFlow.StandardDeviation,
calculation.InputParameters.LevelCrestStructure.Mean, calculation.InputParameters.LevelCrestStructure.StandardDeviation,
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/IStructuresClosureCalculator.cs
===================================================================
diff -u -r7d7217b5823e5008579462c990e259e2bb5b4018 -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/IStructuresClosureCalculator.cs (.../IStructuresClosureCalculator.cs) (revision 7d7217b5823e5008579462c990e259e2bb5b4018)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/IStructuresClosureCalculator.cs (.../IStructuresClosureCalculator.cs) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -24,8 +24,8 @@
namespace Ringtoets.HydraRing.Calculation.Calculator
{
///
- /// Interface for a calculator calculating probability of failure by overtopping or overflow and the
- /// associated wave height. This is used in a closure structures assessment
+ /// Interface for a calculator calculating probability of failure by a non-closing structure.
+ /// This is used in a closure structures assessment.
///
public interface IStructuresClosureCalculator
{
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/StructuresClosureCalculator.cs
===================================================================
diff -u -reb5faa58e3d91d44faf0d7544fa0c33be54c0c4a -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/StructuresClosureCalculator.cs (.../StructuresClosureCalculator.cs) (revision eb5faa58e3d91d44faf0d7544fa0c33be54c0c4a)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/StructuresClosureCalculator.cs (.../StructuresClosureCalculator.cs) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -28,8 +28,8 @@
namespace Ringtoets.HydraRing.Calculation.Calculator
{
///
- /// Calculator for calculating probability of failure by overtopping or overflow and the
- /// associated wave height. This is used in a closure structures assessment.
+ /// Calculator for calculating probability of failure by a non-closing structure.
+ /// This is used in a closure structures assessment.
///
internal class StructuresClosureCalculator : HydraRingCalculatorBase, IStructuresClosureCalculator
{
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs
===================================================================
diff -u -r7c3acc4456b769cc4a0b49b2af8ae3ac5e32c213 -r3023413fe1c0f6dd469e8d16f3a6ebf25adac5da
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision 7c3acc4456b769cc4a0b49b2af8ae3ac5e32c213)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision 3023413fe1c0f6dd469e8d16f3a6ebf25adac5da)
@@ -252,8 +252,8 @@
input.Orientation,
input.HydraulicBoundaryLocation.Id,
norm,
- CalculationInputParser.ParseForeshore(input),
- CalculationInputParser.ParseBreakWater(input),
+ HydraRingInputParser.ParseForeshore(input),
+ HydraRingInputParser.ParseBreakWater(input),
waterLevel,
a,
b,