Index: Core/Common/test/Core.Common.TestUtil/DirectoryDisposeHelper.cs
===================================================================
diff -u -rde4477561032a5d95d5e65e50b719724466648ed -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Core/Common/test/Core.Common.TestUtil/DirectoryDisposeHelper.cs (.../DirectoryDisposeHelper.cs) (revision de4477561032a5d95d5e65e50b719724466648ed)
+++ Core/Common/test/Core.Common.TestUtil/DirectoryDisposeHelper.cs (.../DirectoryDisposeHelper.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -26,14 +26,14 @@
namespace Core.Common.TestUtil
{
///
- /// This class can be used to set temporary files while testing.
- /// Disposing an instance of this class will delete the files.
+ /// This class can be used to create a temporary directory while testing.
+ /// Disposing an instance of this class will delete the directory and its contents.
///
///
/// The following is an example for how to use this class:
///
- /// using(new FileDisposeHelper(new[]{"pathToFile"})) {
- /// // Perform tests with files
+ /// using(new DirectoryDisposeHelper("pathToDirectory")) {
+ /// // Perform tests with directory
/// }
///
///
@@ -45,16 +45,12 @@
/// Creates a new instance of .
///
/// Path of the files that will be used.
- /// Thrown when the is invalid.
public DirectoryDisposeHelper(string directory)
{
this.directory = directory;
Create();
}
- ///
- /// Disposes the instance.
- ///
public void Dispose()
{
if (directory != null)
Index: Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs
===================================================================
diff -u -rde4477561032a5d95d5e65e50b719724466648ed -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs (.../FileDisposeHelper.cs) (revision de4477561032a5d95d5e65e50b719724466648ed)
+++ Core/Common/test/Core.Common.TestUtil/FileDisposeHelper.cs (.../FileDisposeHelper.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using Core.Common.Utils;
namespace Core.Common.TestUtil
{
@@ -44,7 +45,7 @@
///
/// Creates a new instance of .
///
- /// Path of the files that will be used.
+ /// Paths of the files that will be created, if the path is valid.
public FileDisposeHelper(IEnumerable filePaths)
{
files = filePaths;
@@ -54,7 +55,7 @@
///
/// Creates a new instance of .
///
- /// Path of the single file that will be used.
+ /// Path of the single file that will be created, if valid.
public FileDisposeHelper(string filePath) : this(new [] { filePath })
{
}
@@ -70,31 +71,48 @@
}
}
- ///
- /// Disposes the instance.
- ///
public void Dispose()
{
foreach (var file in files)
{
- Dispose(file);
+ DeleteFile(file);
}
}
- private static void CreateFile(string filename)
+ ///
+ /// Creates a file at at the given file path. If the is
+ /// invalid, no file is created.
+ ///
+ /// Path of the new file.
+ private static void CreateFile(string filePath)
{
- if (!string.IsNullOrWhiteSpace(filename))
+ try
{
- using (File.Create(filename)) {}
+ FileUtils.ValidateFilePath(filePath);
}
+ catch (ArgumentException)
+ {
+ return;
+ }
+ using (File.Create(filePath)) {}
}
- private static void Dispose(string filename)
+ ///
+ /// Delets a file at at the given file path. If the is
+ /// invalid, no file is deleted (obviously).
+ ///
+ /// Path of the file to delete.
+ private static void DeleteFile(string filePath)
{
- if (!string.IsNullOrWhiteSpace(filename))
+ try
{
- File.Delete(filename);
+ FileUtils.ValidateFilePath(filePath);
}
+ catch (ArgumentException)
+ {
+ return;
+ }
+ File.Delete(filePath);
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ProbabilityAssessmentOutputPropertiesTest.cs
===================================================================
diff -u -rce94b8228bc7e51779b3754217580f13cb35e475 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ProbabilityAssessmentOutputPropertiesTest.cs (.../ProbabilityAssessmentOutputPropertiesTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ProbabilityAssessmentOutputPropertiesTest.cs (.../ProbabilityAssessmentOutputPropertiesTest.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -24,6 +24,7 @@
using Core.Common.Gui.PropertyBag;
using NUnit.Framework;
using Ringtoets.Common.Data.Probability;
+using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.PropertyClasses;
namespace Ringtoets.Common.Forms.Test.PropertyClasses
@@ -62,10 +63,9 @@
};
// Assert
- var probabilityFormat = "1/{0:n0}";
- Assert.AreEqual(string.Format(probabilityFormat, 1.0/requiredProbability), properties.RequiredProbability);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(requiredProbability), properties.RequiredProbability);
Assert.AreEqual(requiredReliability, properties.RequiredReliability, 1e-3);
- Assert.AreEqual(string.Format(probabilityFormat, 1.0/probability), properties.Probability);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(probability), properties.Probability);
Assert.AreEqual(reliability, properties.Reliability, 1e-3);
Assert.AreEqual(factorOfSafety, properties.FactorOfSafety, 1e-3);
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsOutput.cs
===================================================================
diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsOutput.cs (.../GrassCoverErosionInwardsOutput.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsOutput.cs (.../GrassCoverErosionInwardsOutput.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Core.Common.Base;
using Core.Common.Base.Data;
using Ringtoets.Common.Data.Calculation;
@@ -31,7 +32,7 @@
///
public class GrassCoverErosionInwardsOutput : Observable, ICalculationOutput
{
- private ProbabilityAssessmentOutput probabilityAssessmentOutput;
+ private readonly ProbabilityAssessmentOutput probabilityAssessmentOutput;
///
/// Creates a new instance of .
@@ -47,9 +48,20 @@
this.probabilityAssessmentOutput = probabilityAssessmentOutput;
}
+ ///
+ /// The height of the wave that was calculated in the overtopping sub failure mechanism.
+ ///
public RoundedDouble WaveHeight { get; private set; }
+
+ ///
+ /// Value indicating whether the overtopping sub failure mechanism was dominant over the overflow
+ /// sub failure mechanism.
+ ///
public bool IsOvertoppingDominant { get; private set; }
+ ///
+ /// Gets the factor of safety of the failure mechanism.
+ ///
public RoundedDouble FactorOfSafety
{
get
@@ -58,6 +70,11 @@
}
}
+ ///
+ /// Gets the probability of failure.
+ ///
+ /// When setting a value that falls
+ /// outside the [0.0, 1.0] range or isn't .
public double Probability
{
get
@@ -66,6 +83,9 @@
}
}
+ ///
+ /// Gets the reliability of the failure mechanism.
+ ///
public RoundedDouble Reliability
{
get
@@ -74,6 +94,11 @@
}
}
+ ///
+ /// Gets the required (maximum allowed) probability of failure.
+ ///
+ /// When setting a value that falls
+ /// outside the [0.0, 1.0] range and isn't .
public double RequiredProbability
{
get
@@ -82,6 +107,9 @@
}
}
+ ///
+ /// Get the required (maximum allowed) reliability of the failure mechanism.
+ ///
public RoundedDouble RequiredReliability
{
get
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r8bb257bcf65291ebc7fc3b913d73bb11f40124d4 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8bb257bcf65291ebc7fc3b913d73bb11f40124d4)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -179,6 +179,15 @@
}
///
+ /// Looks up a localized string similar to Indicatieve golfhoogte.
+ ///
+ public static string Categories_Indicative_WaveHeight {
+ get {
+ return ResourceManager.GetString("Categories_Indicative_WaveHeight", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Lengte-effect parameters.
///
public static string Categories_LengthEffect {
@@ -552,7 +561,7 @@
}
///
- /// Looks up a localized string similar to Is het resultaat van de overtopping deelberekening dominant over de overflow deelberekening..
+ /// Looks up a localized string similar to Is het resultaat van de overslag deelberekening dominant over de overloop deelberekening..
///
public static string GrassCoverErosionInwardsOutput_IsOvertoppingDominant_Description {
get {
@@ -561,7 +570,7 @@
}
///
- /// Looks up a localized string similar to Overtopping dominant [-].
+ /// Looks up a localized string similar to Overslag dominant [-].
///
public static string GrassCoverErosionInwardsOutput_IsOvertoppingDominant_Displayname {
get {
@@ -570,7 +579,7 @@
}
///
- /// Looks up a localized string similar to De golfhoogte van de overtopping deelberekening..
+ /// Looks up a localized string similar to De golfhoogte van de overslag deelberekening..
///
public static string GrassCoverErosionInwardsOutput_WaveHeight_Description {
get {
@@ -579,7 +588,7 @@
}
///
- /// Looks up a localized string similar to Golfhoogte (Hs) [-].
+ /// Looks up a localized string similar to Golfhoogte (Hs) [m].
///
public static string GrassCoverErosionInwardsOutput_WaveHeight_Displayname {
get {
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx
===================================================================
diff -u -r8bb257bcf65291ebc7fc3b913d73bb11f40124d4 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 8bb257bcf65291ebc7fc3b913d73bb11f40124d4)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -290,21 +290,24 @@
Berekening
- Is het resultaat van de overtopping deelberekening dominant over de overflow deelberekening.
+ Is het resultaat van de overslag deelberekening dominant over de overloop deelberekening.
- Overtopping dominant [-]
+ Overslag dominant [-]
- De golfhoogte van de overtopping deelberekening.
+ De golfhoogte van de overslag deelberekening.
- Golfhoogte (Hs) [-]
+ Golfhoogte (Hs) [m]
De maatgevende berekening voor dit vak is niet uitgevoerd.
De maatgevende berekening voor dit vak heeft geen geldige uitkomst.
+
+ Indicatieve golfhoogte
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs
===================================================================
diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOutputProperties.cs (.../GrassCoverErosionInwardsOutputProperties.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -1,4 +1,25 @@
-using Core.Common.Base.Data;
+// 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 Core.Common.Base.Data;
using Core.Common.Gui.Attributes;
using Core.Common.Gui.PropertyBag;
using Core.Common.Utils.Attributes;
@@ -9,6 +30,9 @@
namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses
{
+ ///
+ /// ViewModel of for properties panel.
+ ///
public class GrassCoverErosionInwardsOutputProperties : ObjectProperties
{
[PropertyOrder(1)]
@@ -72,7 +96,7 @@
}
[PropertyOrder(6)]
- [ResourcesCategory(typeof(CommonFormsResources), "Categories_Result")]
+ [ResourcesCategory(typeof(GrassCoverErosionInwardsFormsResources), "Categories_Indicative_WaveHeight")]
[ResourcesDisplayName(typeof(GrassCoverErosionInwardsFormsResources), "GrassCoverErosionInwardsOutput_WaveHeight_Displayname")]
[ResourcesDescription(typeof(GrassCoverErosionInwardsFormsResources), "GrassCoverErosionInwardsOutput_WaveHeight_Description")]
public RoundedDouble WaveHeight
@@ -84,7 +108,7 @@
}
[PropertyOrder(7)]
- [ResourcesCategory(typeof(CommonFormsResources), "Categories_Result")]
+ [ResourcesCategory(typeof(GrassCoverErosionInwardsFormsResources), "Categories_Indicative_WaveHeight")]
[ResourcesDisplayName(typeof(GrassCoverErosionInwardsFormsResources), "GrassCoverErosionInwardsOutput_IsOvertoppingDominant_Displayname")]
[ResourcesDescription(typeof(GrassCoverErosionInwardsFormsResources), "GrassCoverErosionInwardsOutput_IsOvertoppingDominant_Description")]
public bool IsOvertoppingDominant
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationServiceOutput.cs
===================================================================
diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationServiceOutput.cs (.../GrassCoverErosionInwardsCalculationServiceOutput.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationServiceOutput.cs (.../GrassCoverErosionInwardsCalculationServiceOutput.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -31,7 +31,7 @@
///
/// The beta result of the calculation.
/// The wave height result of the calculation.
- /// The value indicating wheter overtopping was dominant in the calculation.
+ /// The value indicating whether overtopping was dominant in the calculation.
public GrassCoverErosionInwardsCalculationServiceOutput(double beta, double waveHeight, bool isOvertoppingDominant)
{
Beta = beta;
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/packages.config
===================================================================
diff -u -r3d9b418d483c122040e11a7e074d666c64e9d7b5 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/packages.config (.../packages.config) (revision 3d9b418d483c122040e11a7e074d666c64e9d7b5)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/packages.config (.../packages.config) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -1,4 +1,27 @@
+
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs
===================================================================
diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOutputPropertiesTest.cs (.../GrassCoverErosionInwardsOutputPropertiesTest.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -26,6 +26,7 @@
using Rhino.Mocks;
using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.Helpers;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses;
@@ -84,10 +85,9 @@
Assert.AreEqual(3, properties.FactorOfSafety.NumberOfDecimalPlaces);
Assert.AreEqual(factorOfSafety, properties.FactorOfSafety, properties.FactorOfSafety.GetAccuracy());
- var probabilityFormat = "1/{0:n0}";
- Assert.AreEqual(string.Format(probabilityFormat, 1.0 / requiredProbability), properties.RequiredProbability);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(requiredProbability), properties.RequiredProbability);
Assert.AreEqual(requiredReliability, properties.RequiredReliability, 1e-3);
- Assert.AreEqual(string.Format(probabilityFormat, 1.0 / probability), properties.Probability);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(probability), properties.Probability);
Assert.AreEqual(isOvertoppingDominant, properties.IsOvertoppingDominant);
@@ -147,15 +147,15 @@
PropertyDescriptor waveHeightProperty = dynamicProperties[waveHeightIndex];
Assert.IsTrue(waveHeightProperty.IsReadOnly);
- Assert.AreEqual("Resultaat", waveHeightProperty.Category);
- Assert.AreEqual("Golfhoogte (Hs) [-]", waveHeightProperty.DisplayName);
- Assert.AreEqual("De golfhoogte van de overtopping deelberekening.", waveHeightProperty.Description);
+ Assert.AreEqual("Indicatieve golfhoogte", waveHeightProperty.Category);
+ Assert.AreEqual("Golfhoogte (Hs) [m]", waveHeightProperty.DisplayName);
+ Assert.AreEqual("De golfhoogte van de overslag deelberekening.", waveHeightProperty.Description);
PropertyDescriptor isDominantProperty = dynamicProperties[isDominantIndex];
Assert.IsTrue(isDominantProperty.IsReadOnly);
- Assert.AreEqual("Resultaat", isDominantProperty.Category);
- Assert.AreEqual("Overtopping dominant [-]", isDominantProperty.DisplayName);
- Assert.AreEqual("Is het resultaat van de overtopping deelberekening dominant over de overflow deelberekening.", isDominantProperty.Description);
+ Assert.AreEqual("Indicatieve golfhoogte", isDominantProperty.Category);
+ Assert.AreEqual("Overslag dominant [-]", isDominantProperty.DisplayName);
+ Assert.AreEqual("Is het resultaat van de overslag deelberekening dominant over de overloop deelberekening.", isDominantProperty.Description);
}
private const int requiredProbabilityPropertyIndex = 0;
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs
===================================================================
diff -u -r150366ef474f9522b3af857c29e3eac484910700 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision 150366ef474f9522b3af857c29e3eac484910700)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -150,7 +150,7 @@
var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
ImportHydraulicBoundaryDatabase(assessmentSection);
- assessmentSection.HeightStructures.AddSection(new FailureMechanismSection("/", new[]
+ assessmentSection.HeightStructures.AddSection(new FailureMechanismSection("test section", new[]
{
new Point2D(0, 0),
new Point2D(1, 1)
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IHydraRingFileParser.cs
===================================================================
diff -u -r3d9b418d483c122040e11a7e074d666c64e9d7b5 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IHydraRingFileParser.cs (.../IHydraRingFileParser.cs) (revision 3d9b418d483c122040e11a7e074d666c64e9d7b5)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IHydraRingFileParser.cs (.../IHydraRingFileParser.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -1,5 +1,8 @@
namespace Ringtoets.HydraRing.Calculation.Parsers
{
+ ///
+ /// This interface describes components that obtain results from the output files of a Hydra-Ring calculation.
+ ///
public interface IHydraRingFileParser
{
///
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/WaveHeightCalculationParser.cs
===================================================================
diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/WaveHeightCalculationParser.cs (.../WaveHeightCalculationParser.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/WaveHeightCalculationParser.cs (.../WaveHeightCalculationParser.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -35,9 +35,9 @@
{
private class GeneralResult
{
- public int WindDirection;
- public int ClosingSituation;
- public double Beta;
+ public int WindDirection { get; set; }
+ public int ClosingSituation { get; set; }
+ public double Beta { get; set; }
public GeneralResult()
{
@@ -47,7 +47,7 @@
private class OvertoppingResult : GeneralResult
{
- public double WaveHeight;
+ public double WaveHeight { get; set; }
}
private const string overtoppingStart = "Submechanism = Overtopping RTO";
@@ -79,8 +79,8 @@
public void Parse(string workingDirectory, int sectionId)
{
- var fileName = string.Format("{0}{1}", sectionId, HydraRingFileName.OutputFileSuffix);
- var filePath = Path.Combine(workingDirectory, fileName);
+ string fileName = string.Format("{0}{1}", sectionId, HydraRingFileName.OutputFileSuffix);
+ string filePath = Path.Combine(workingDirectory, fileName);
try
{
@@ -95,12 +95,17 @@
private void SetOutputs()
{
- if (overtoppingResults.Any() && overflowResults.Any())
+ OvertoppingResult relevantOvertoppingResult = null;
+ foreach (OvertoppingResult overtoppingResult in overtoppingResults.Where(o => o.WindDirection == governingWindDirection))
{
- OvertoppingResult[] governingOvertoppingResults = overtoppingResults.Where(o => o.WindDirection == governingWindDirection).ToArray();
- double minBeta = governingOvertoppingResults.Min(o => o.Beta);
+ if (relevantOvertoppingResult == null || overtoppingResult.Beta < relevantOvertoppingResult.Beta)
+ {
+ relevantOvertoppingResult = overtoppingResult;
+ }
+ }
- OvertoppingResult relevantOvertoppingResult = governingOvertoppingResults.First(o => o.Beta.Equals(minBeta));
+ if (relevantOvertoppingResult != null && overflowResults.Any())
+ {
GeneralResult governingOverflowResult = overflowResults
.First(o => o.WindDirection == governingWindDirection && o.ClosingSituation == relevantOvertoppingResult.ClosingSituation);
@@ -118,7 +123,7 @@
{
while (!file.EndOfStream)
{
- var currentLine = file.ReadLine();
+ string currentLine = file.ReadLine();
TryParseOvertoppingSection(currentLine, file);
TryParseOverflowSection(currentLine, file);
TryParseGoverningWindDirection(currentLine, file);
@@ -134,7 +139,7 @@
var overtoppingResult = new OvertoppingResult();
while (!file.EndOfStream && double.IsNaN(overtoppingResult.Beta))
{
- var readLine = file.ReadLine();
+ string readLine = file.ReadLine();
TryParseWaveHeight(readLine, overtoppingResult);
TryParseWindDirection(readLine, overtoppingResult);
TryParseClosingSituation(readLine, overtoppingResult);
@@ -151,7 +156,7 @@
var overflowResult = new GeneralResult();
while (!file.EndOfStream && double.IsNaN(overflowResult.Beta))
{
- var readLine = file.ReadLine();
+ string readLine = file.ReadLine();
TryParseWindDirection(readLine, overflowResult);
TryParseClosingSituation(readLine, overflowResult);
TryParseBeta(readLine, overflowResult);
@@ -164,8 +169,8 @@
{
if (startLine.Contains(combineWindDirectionStart))
{
- var line = file.ReadLine();
- var governingWindDirectionString = line.Split(equalsCharacter)[1].Trim();
+ string line = file.ReadLine();
+ string governingWindDirectionString = line.Split(equalsCharacter)[1].Trim();
governingWindDirection = int.Parse(governingWindDirectionString);
}
}
@@ -174,7 +179,7 @@
{
if (line.Contains(overtoppingWaveHeight))
{
- var resultAsString = line.Split(equalsCharacter)[1].Trim();
+ string resultAsString = line.Split(equalsCharacter)[1].Trim();
overtoppingResult.WaveHeight = double.Parse(resultAsString, CultureInfo.InvariantCulture);
}
}
@@ -183,7 +188,7 @@
{
if (line.Contains(windDirection))
{
- var resultAsString = line.Split(equalsCharacter)[1].Trim();
+ string resultAsString = line.Split(equalsCharacter)[1].Trim();
generalResult.WindDirection = int.Parse(resultAsString, CultureInfo.InvariantCulture);
}
}
@@ -192,7 +197,7 @@
{
if (line.Contains(closingSituation))
{
- var resultAsString = line.Split(equalsCharacter)[1].Trim();
+ string resultAsString = line.Split(equalsCharacter)[1].Trim();
generalResult.ClosingSituation = int.Parse(resultAsString, CultureInfo.InvariantCulture);
}
}
@@ -201,7 +206,7 @@
{
if (line.Contains(beta))
{
- var resultAsString = line.Split(equalsCharacter)[1].Trim();
+ string resultAsString = line.Split(equalsCharacter)[1].Trim();
generalResult.Beta = double.Parse(resultAsString, CultureInfo.InvariantCulture);
}
}
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingCalculationService.cs
===================================================================
diff -u -r3d9b418d483c122040e11a7e074d666c64e9d7b5 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingCalculationService.cs (.../HydraRingCalculationService.cs) (revision 3d9b418d483c122040e11a7e074d666c64e9d7b5)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingCalculationService.cs (.../HydraRingCalculationService.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -58,10 +58,10 @@
var sectionId = targetProbabilityCalculationInput.Section.SectionId;
var workingDirectory = CreateWorkingDirectory();
- var hydraRingInitializationService = new HydraRingInitializationService(targetProbabilityCalculationInput.FailureMechanismType, sectionId, hlcdDirectory, workingDirectory);
var hydraRingConfigurationService = new HydraRingConfigurationService(ringId, timeIntegrationSchemeType, uncertaintiesType);
hydraRingConfigurationService.AddHydraRingCalculationInput(targetProbabilityCalculationInput);
+ var hydraRingInitializationService = new HydraRingInitializationService(targetProbabilityCalculationInput.FailureMechanismType, sectionId, hlcdDirectory, workingDirectory);
hydraRingInitializationService.WriteInitializationScript();
hydraRingConfigurationService.WriteDataBaseCreationScript(hydraRingInitializationService.DatabaseCreationScriptFilePath);
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingFileName.cs
===================================================================
diff -u -r150366ef474f9522b3af857c29e3eac484910700 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingFileName.cs (.../HydraRingFileName.cs) (revision 150366ef474f9522b3af857c29e3eac484910700)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingFileName.cs (.../HydraRingFileName.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -1,13 +1,59 @@
-namespace Ringtoets.HydraRing.Calculation.Services
+// 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.
+
+namespace Ringtoets.HydraRing.Calculation.Services
{
- public static class HydraRingFileName
+ ///
+ /// Class containing (parts of) file names that are generated during a Hydra-Ring calculation.
+ ///
+ internal static class HydraRingFileName
{
+ ///
+ /// The tail and extension of the file containing output generated during a calculation.
+ ///
public const string OutputFileSuffix = "-output.txt";
+
+ ///
+ /// The file name of the file containing the output of a calculation.
+ ///
public const string DesignTablesFileName = "designTable.txt";
+
+ ///
+ /// The file name of the working database which contains input and output.
+ ///
public const string OutputDatabaseFileName = "temp.sqlite";
+ ///
+ /// The file name of the HLCD database.
+ ///
public const string HlcdDatabaseFileName = "HLCD.sqlite";
+
+ ///
+ /// The file name of the executable of Hydra-Ring.
+ ///
public const string HydraRingExecutableFileName = "MechanismComputation.exe";
+
+ ///
+ /// The database which contains configuration paramters.
+ ///
public const string ConfigurationDatabaseFileName = "config.sqlite";
}
}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingInitializationService.cs
===================================================================
diff -u -rfe3c7aa84947f57a508f494e6b671f9c19dce6df -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingInitializationService.cs (.../HydraRingInitializationService.cs) (revision fe3c7aa84947f57a508f494e6b671f9c19dce6df)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingInitializationService.cs (.../HydraRingInitializationService.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -59,13 +59,13 @@
/// The failure mechanism type.
/// The section id.
/// The HLCD directory.
- /// The working directory.
- public HydraRingInitializationService(HydraRingFailureMechanismType failureMechanismType, int sectionId, string hlcdDirectory, string temporaryTemporaryWorkingDirectory)
+ /// The working directory.
+ public HydraRingInitializationService(HydraRingFailureMechanismType failureMechanismType, int sectionId, string hlcdDirectory, string temporaryWorkingDirectory)
{
mechanismId = new FailureMechanismDefaultsProvider().GetFailureMechanismDefaults(failureMechanismType).MechanismId;
this.sectionId = sectionId;
- TemporaryWorkingDirectory = temporaryTemporaryWorkingDirectory;
+ TemporaryWorkingDirectory = temporaryWorkingDirectory;
this.hlcdDirectory = hlcdDirectory;
hydraRingDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), hydraRingBinariesSubDirectory);
@@ -176,10 +176,10 @@
"mechanism = " + mechanismId,
"alternative = 1", // Fixed: no support for piping
"layer = 1", // Fixed: no support for revetments
- "logfile = " + (sectionId + logFileExtension),
+ "logfile = " + sectionId + logFileExtension,
"outputverbosity = basic",
"outputtofile = file",
- "projectdbfilename = " + (sectionId + databaseFileExtension),
+ "projectdbfilename = " + sectionId + databaseFileExtension,
"outputfilename = " + HydraRingFileName.DesignTablesFileName,
"configdbfilename = " + ConfigurationDatabaseFilePath,
"hydraulicdbfilename = " + HlcdFilePath);
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs
===================================================================
diff -u -r8692161b4e1e558746fcca9d3204c33d606fb311 -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (.../HydraRingConfigurationServiceIntegrationTest.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (.../HydraRingConfigurationServiceIntegrationTest.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -46,7 +46,7 @@
hydraRingConfigurationService.AddHydraRingCalculationInput(new AssessmentLevelCalculationInput(1, 700004, 10000));
- var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine +
+ string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine +
"INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine +
Environment.NewLine +
"DELETE FROM [Sections];" + Environment.NewLine +
@@ -98,14 +98,14 @@
Environment.NewLine +
"DELETE FROM [Breakwaters];" + Environment.NewLine;
- var databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db");
+ string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db");
using (new FileDisposeHelper(databaseFilePath))
{
// Call
hydraRingConfigurationService.WriteDataBaseCreationScript(databaseFilePath);
// Assert
- var creationScript = File.ReadAllText(databaseFilePath);
+ string creationScript = File.ReadAllText(databaseFilePath);
Assert.AreEqual(expectedCreationScript, creationScript);
}
}
@@ -148,7 +148,7 @@
hydraRingModelFactorFrunupStandardDeviation, hydraRingExponentModelFactorShallowMean, hydraRingExponentModelFactorShallowStandardDeviation,
profilePoints, forelandPoints, breakWater));
- var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine +
+ string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine +
"INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine +
Environment.NewLine +
"DELETE FROM [Sections];" + Environment.NewLine +
@@ -214,14 +214,14 @@
"DELETE FROM [Breakwaters];" + Environment.NewLine +
"INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine;
- var databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db");
+ string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db");
using (new FileDisposeHelper(databaseFilePath))
{
// Call
hydraRingConfigurationService.WriteDataBaseCreationScript(databaseFilePath);
// Assert
- var creationScript = File.ReadAllText(databaseFilePath);
+ string creationScript = File.ReadAllText(databaseFilePath);
Assert.AreEqual(expectedCreationScript, creationScript);
}
}
@@ -391,7 +391,7 @@
widthOfFlowAperturesMean, widthOfFlowAperturesStandardDeviation,
deviationOfTheWaveDirection,
stormDurationMean, stormDurationStandardDeviation));
- var expectedCreationScript =
+ string expectedCreationScript =
"DELETE FROM [HydraulicModels];" + Environment.NewLine +
"INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine +
Environment.NewLine +
@@ -460,14 +460,14 @@
Environment.NewLine +
"DELETE FROM [Breakwaters];" + Environment.NewLine;
- var databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db");
+ string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db");
using (new FileDisposeHelper(databaseFilePath))
{
// Call
hydraRingConfigurationService.WriteDataBaseCreationScript(databaseFilePath);
// Assert
- var creationScript = File.ReadAllText(databaseFilePath);
+ string creationScript = File.ReadAllText(databaseFilePath);
Assert.AreEqual(expectedCreationScript, creationScript);
}
}
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/WaveHeightCalculationParserTest.cs
===================================================================
diff -u -rfe3c7aa84947f57a508f494e6b671f9c19dce6df -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/WaveHeightCalculationParserTest.cs (.../WaveHeightCalculationParserTest.cs) (revision fe3c7aa84947f57a508f494e6b671f9c19dce6df)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/WaveHeightCalculationParserTest.cs (.../WaveHeightCalculationParserTest.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -138,6 +138,7 @@
// Assert
Assert.IsNull(parser.Output);
}
+
private string GetOutputFileName(int sectionId)
{
return string.Format("{0}{1}", sectionId, HydraRingFileName.OutputFileSuffix);
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.TestUtil.Test/TestTargetProbabilityCalculationInputTest.cs
===================================================================
diff -u -rde4477561032a5d95d5e65e50b719724466648ed -r2c02ce70cceb9e22c740df034c94782e44eded33
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.TestUtil.Test/TestTargetProbabilityCalculationInputTest.cs (.../TestTargetProbabilityCalculationInputTest.cs) (revision de4477561032a5d95d5e65e50b719724466648ed)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.TestUtil.Test/TestTargetProbabilityCalculationInputTest.cs (.../TestTargetProbabilityCalculationInputTest.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
@@ -16,7 +16,7 @@
public void Constructed_UsingDifferentNormAndLocationId_ReturnDifferentBetaAndDefaultValues(int locationId, double norm)
{
// Setup
- var expectedBeta = -Normal.InvCDF(0.0, 1.0, 1.0 / norm);
+ double expectedBeta = -Normal.InvCDF(0.0, 1.0, 1.0 / norm);
// Call
var testInput = new TestTargetProbabilityCalculationInput(locationId, norm);