Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/DistributionHelper.cs
===================================================================
diff -u -r7b4aa1ece31359b16a450b043a66a767265615d5 -r8edf96cdf0db44770c331cff467de51de992941b
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/DistributionHelper.cs (.../DistributionHelper.cs) (revision 7b4aa1ece31359b16a450b043a66a767265615d5)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/DistributionHelper.cs (.../DistributionHelper.cs) (revision 8edf96cdf0db44770c331cff467de51de992941b)
@@ -41,7 +41,7 @@
/// The name of the parameter to be validated.
/// Thrown when
/// is null.
- /// Thrown when the parameter is not a
+ /// Thrown when the parameter is not a
/// log normal distribution with a zero shift.
public static void ValidateLogNormalDistribution(long? distributionType, double shift, string parameterName)
{
@@ -53,15 +53,15 @@
if (distributionType.HasValue)
{
if (distributionType.Value != SoilLayerConstants.LogNormalDistributionValue)
- throw new ImportedDataTransformException(string.Format(
- Resources.Stochastic_parameter_0_must_be_a_lognormal_distribution,
- parameterName));
+ throw new InvalidDistributionSettingsException(string.Format(
+ Resources.Stochastic_parameter_0_must_be_a_lognormal_distribution,
+ parameterName));
if (Math.Abs(shift) > tolerance)
{
- throw new ImportedDataTransformException(string.Format(
- Resources.Stochastic_parameter_0_must_be_a_lognormal_distribution_with_zero_shift,
- parameterName));
+ throw new InvalidDistributionSettingsException(string.Format(
+ Resources.Stochastic_parameter_0_must_be_a_lognormal_distribution_with_zero_shift,
+ parameterName));
}
}
}
@@ -73,7 +73,7 @@
/// The name of the parameter to be validated.
/// Thrown when
/// is null.
- /// Thrown when the parameter is not a
+ /// Thrown when the parameter is not a
/// log normal distribution.
public static void ValidateShiftedLogNormalDistribution(long? distributionType, string parameterName)
{
@@ -84,9 +84,9 @@
if (distributionType.HasValue && distributionType != SoilLayerConstants.LogNormalDistributionValue)
{
- throw new ImportedDataTransformException(string.Format(
- Resources.Stochastic_parameter_0_has_no_shifted_lognormal_distribution,
- parameterName));
+ throw new InvalidDistributionSettingsException(string.Format(
+ Resources.Stochastic_parameter_0_has_no_shifted_lognormal_distribution,
+ parameterName));
}
}
}
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/DistributionHelperTest.cs
===================================================================
diff -u -r9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab -r8edf96cdf0db44770c331cff467de51de992941b
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/DistributionHelperTest.cs (.../DistributionHelperTest.cs) (revision 9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/DistributionHelperTest.cs (.../DistributionHelperTest.cs) (revision 8edf96cdf0db44770c331cff467de51de992941b)
@@ -48,7 +48,7 @@
}
[Test]
- public void ValidateLogNormalDistribution_InvalidDistributionType_ThrowsImportedDataException()
+ public void ValidateLogNormalDistribution_InvalidDistributionType_ThrowsInvalidDistributionSettingException()
{
// Setup
const long distributionType = -1;
@@ -63,12 +63,12 @@
parameterName);
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(call);
Assert.AreEqual($"Parameter '{parameterName}' moet lognormaal verdeeld zijn.", exception.Message);
}
[Test]
- public void ValidateLogNormalDistribution_ShiftNonZero_ThrowsImportedDataTransformException()
+ public void ValidateLogNormalDistribution_ShiftNonZero_ThrowsInvalidDistributionSettingException()
{
// Setup
const long distributionType = SoilLayerConstants.LogNormalDistributionValue;
@@ -83,7 +83,7 @@
parameterName);
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(call);
Assert.AreEqual($"Parameter '{parameterName}' moet lognormaal verdeeld zijn met een verschuiving gelijk aan 0.", exception.Message);
}
@@ -137,7 +137,7 @@
}
[Test]
- public void ValidateShiftedLogNormalDistribution_InvalidDistributionType_ThrowsImportedDataException()
+ public void ValidateShiftedLogNormalDistribution_InvalidDistributionType_ThrowsInvalidDistributionSettingException()
{
// Setup
const long invalidDistributionType = -1;
@@ -148,7 +148,7 @@
parameterName);
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(call);
Assert.AreEqual($"Parameter '{parameterName}' moet verschoven lognormaal verdeeld zijn.", exception.Message);
}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs
===================================================================
diff -u -r9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab -r8edf96cdf0db44770c331cff467de51de992941b
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (.../MacroStabilityInwardsPreconsolidationStressTransformer.cs) (revision 9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (.../MacroStabilityInwardsPreconsolidationStressTransformer.cs) (revision 8edf96cdf0db44770c331cff467de51de992941b)
@@ -59,10 +59,10 @@
var location = new Point2D(preconsolidationStress.XCoordinate,
preconsolidationStress.ZCoordinate);
- ValidateDistribution(preconsolidationStress, location);
-
try
{
+ ValidateDistribution(preconsolidationStress);
+
var distribution = new VariationCoefficientLogNormalDistribution
{
Mean = (RoundedDouble) preconsolidationStress.StressMean,
@@ -71,6 +71,11 @@
return new MacroStabilityInwardsPreconsolidationStress(location, distribution);
}
+ catch (InvalidDistributionSettingsException e)
+ {
+ string errorMessage = CreateErrorMessage(location, e.Message);
+ throw new ImportedDataTransformException(errorMessage, e);
+ }
catch (ArgumentOutOfRangeException e)
{
string errorMessage = CreateErrorMessage(location, e.Message);
@@ -91,25 +96,16 @@
///
/// Validates whether the values of the
- /// are correct for creating the log normal distribution of a reconsolidation stress.
+ /// are correct for creating the log normal distribution of a preconsolidation stress.
///
/// The to validate.
- /// The location of the
- /// Thrown when the stochastic parameters
+ /// Thrown when the stochastic parameters
/// are not defined as a log normal distribution.
- private static void ValidateDistribution(PreconsolidationStress preconsolidationStress, Point2D location)
+ private static void ValidateDistribution(PreconsolidationStress preconsolidationStress)
{
- try
- {
- DistributionHelper.ValidateLogNormalDistribution(preconsolidationStress.StressDistributionType,
- preconsolidationStress.StressShift,
- Resources.PreconsolidationStress_DisplayName);
- }
- catch (ImportedDataTransformException e)
- {
- string errorMessage = CreateErrorMessage(location, e.Message);
- throw new ImportedDataTransformException(errorMessage, e);
- }
+ DistributionHelper.ValidateLogNormalDistribution(preconsolidationStress.StressDistributionType,
+ preconsolidationStress.StressShift,
+ Resources.PreconsolidationStress_DisplayName);
}
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs
===================================================================
diff -u -r9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab -r8edf96cdf0db44770c331cff467de51de992941b
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision 9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision 8edf96cdf0db44770c331cff467de51de992941b)
@@ -273,7 +273,6 @@
private static MacroStabilityInwardsShearStrengthModel TransformShearStrengthModel(double? shearStrengthModel,
string soilLayerName)
{
- string exceptionMessage;
if (!shearStrengthModel.HasValue)
{
return MacroStabilityInwardsShearStrengthModel.CPhi;
@@ -286,16 +285,20 @@
{
return MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated;
}
+
+ string exceptionMessage;
if (Math.Abs(shearStrengthModel.Value - 1) < tolerance)
{
exceptionMessage = CreateErrorMessage(soilLayerName,
Resources.MacroStabilityInwardsSoilLayerTransformer_TransformShearStrengthModel_No_MacroStabilityInwardsShearStrengthModel);
- throw new ImportedDataTransformException(exceptionMessage);
}
+ else
+ {
+ exceptionMessage = CreateErrorMessage(soilLayerName,
+ string.Format(RingtoetsCommonIOResources.Transform_Invalid_value_ParameterName_0,
+ Resources.SoilLayerData_ShearStrengthModel_Description));
+ }
- exceptionMessage = CreateErrorMessage(soilLayerName,
- string.Format(RingtoetsCommonIOResources.Transform_Invalid_value_ParameterName_0,
- Resources.SoilLayerData_ShearStrengthModel_Description));
throw new ImportedDataTransformException(exceptionMessage);
}
@@ -364,10 +367,10 @@
soilLayer.PopShift,
Resources.SoilLayerData_PopDistribution_DisplayName);
}
- catch (ImportedDataTransformException e)
+ catch (InvalidDistributionSettingsException e)
{
- string errorMessage = CreateErrorMessage(soilLayer.MaterialName, e.Message);
- throw new ImportedDataTransformException(errorMessage, e);
+ string exceptionMessage = CreateErrorMessage(soilLayer.MaterialName, e.Message);
+ throw new ImportedDataTransformException(exceptionMessage, e);
}
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs
===================================================================
diff -u -r9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab -r8edf96cdf0db44770c331cff467de51de992941b
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision 9c8f63537efbe5c5efb2b2bc066bc7e7358d3cab)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision 8edf96cdf0db44770c331cff467de51de992941b)
@@ -172,7 +172,7 @@
soilLayer.PermeabilityShift,
Resources.SoilLayer_PermeabilityDistribution_DisplayName);
}
- catch (ImportedDataTransformException e)
+ catch (InvalidDistributionSettingsException e)
{
string errorMessage = CreateExceptionMessage(soilLayer.MaterialName,
e.Message);