Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs
===================================================================
diff -u -r578 -r675
--- dam engine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs (.../Segment.cs) (revision 578)
+++ dam engine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs (.../Segment.cs) (revision 675)
@@ -56,6 +56,7 @@
/// The name of the soilgeometry1d.
///
public virtual string SoilProfile2DName { get; set; }
+
///
/// Gets or sets the soilprofile2d.
///
@@ -72,7 +73,7 @@
///
public virtual string StiFileName { get; set; }
-
+
///
/// Gets or sets the type of the segment failure mechanism.
///
@@ -88,7 +89,7 @@
/// The probability.
///
public virtual double Probability { get; set; }
-
+
///
/// Gets the type of the soil geometry.
///
@@ -97,6 +98,24 @@
///
/// No soilprofile assigned
public SoilProfileType SoilProfileType { get; set; }
+
+ ///
+ /// Returns a that represents this instance.
+ ///
+ ///
+ /// A that represents this instance.
+ ///
+ public override string ToString()
+ {
+ if (SoilProfile1D != null)
+ {
+ return SoilProfile1D.Name;
+ }
+ else
+ {
+ return StiFileName;
+ }
+ }
}
///
@@ -119,7 +138,10 @@
///
public virtual List SoilProfileProbabilities
{
- get { return this.soilGeometryProbabilities; }
+ get
+ {
+ return this.soilGeometryProbabilities;
+ }
}
///
@@ -131,8 +153,8 @@
{
IEnumerable spps = from SoilGeometryProbability spp in this.soilGeometryProbabilities
where !spp.SegmentFailureMechanismType.HasValue || !segmentFailureMechanismType.HasValue || spp.SegmentFailureMechanismType == segmentFailureMechanismType
- orderby spp.Probability descending
- select spp;
+ orderby spp.Probability descending
+ select spp;
if (spps.Any())
return spps.First().SoilProfile1D;
else
@@ -184,7 +206,6 @@
}
}
return sb.ToString();
- }
+ }
}
-
-}
\ No newline at end of file
+}
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs
===================================================================
diff -u -r672 -r675
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs (.../DesignCalculator.cs) (revision 672)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs (.../DesignCalculator.cs) (revision 675)
@@ -6,6 +6,7 @@
using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
using Deltares.DamEngine.Data.General;
using Deltares.DamEngine.Data.General.Results;
+using Deltares.DamEngine.Data.Standard.Calculation;
using Deltares.DamEngine.Data.Standard.Logging;
namespace Deltares.DamEngine.Calculators.Dikes_Design
@@ -51,15 +52,30 @@
// stability where Piping calc is wanted). In that case, do nothing but just skip.
if (prepareResult == PrepareResult.Successful)
{
- // Perform calculation
- List locationCalculationMessages;
- IKernelDataOutput kernelDataOutput = kernelWrapper.Execute(kernelDataInput, out locationCalculationMessages);
- calculationMessages.AddRange(locationCalculationMessages);
+ // Perform validation
+ List validationMessages;
+ int errorCount = kernelWrapper.Validate(kernelDataInput, out validationMessages);
+ if (errorCount > 0)
+ {
+ calculationMessages.Add(new LogMessage(LogMessageType.Error, null,
+ string.Format("Validation failed for location '{0}', subsoil scenario '{1}', design scenario '{2}'",
+ location.Name,
+ soiProfileProbability.ToString(),
+ damKernelInput.DesignScenario.LocationScenarioID)));
+ calculationMessages.AddRange(validationMessages);
+ }
+ else
+ {
+ // Perform calculation
+ List locationCalculationMessages;
+ IKernelDataOutput kernelDataOutput = kernelWrapper.Execute(kernelDataInput, out locationCalculationMessages);
+ calculationMessages.AddRange(locationCalculationMessages);
- // Process output
- DesignResult designResult;
- kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, out designResult);
- damProjectData.DesignCalculations.Add(designResult);
+ // Process output
+ DesignResult designResult;
+ kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, out designResult);
+ damProjectData.DesignCalculations.Add(designResult);
+ }
}
}
}
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs
===================================================================
diff -u -r672 -r675
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs (.../IKernelWrapper.cs) (revision 672)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs (.../IKernelWrapper.cs) (revision 675)
@@ -27,21 +27,21 @@
///
/// The dam kernel input.
/// The kernel data input.
- ///
+ /// Result of the prepare
PrepareResult Prepare(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput);
///
/// Validates the kernel data input.
///
/// The kernel data input.
/// The messages.
- ///
+ /// Number of errors that prevent a calculation
int Validate(IKernelDataInput kernelDataInput, out List messages);
///
/// Performs a failure mechanism calcualtion based on the input.
///
/// The kernel data input.
/// The messages.
- ///
+ /// Kernel output object
IKernelDataOutput Execute(IKernelDataInput kernelDataInput, out List messages);
///
/// Fills the dam result based on the kernel output.