Index: DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.tex =================================================================== diff -u -r945 -r979 --- DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.tex (.../DAM Engine - Technical Design.tex) (revision 945) +++ DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.tex (.../DAM Engine - Technical Design.tex) (revision 979) @@ -596,7 +596,7 @@ \item \texttt{IKernelDataDesignInput kernelDataInput}: design input. \item \texttt{IKernelDataOutput kernelDataOutput}: kernel output data. \item \texttt{IKernelDataDesignOutput kernelDataOutput}: design output; it contains the adapted input data (a.g. a new designed surfaceline) and other design results (e.g. number of iterations needed, success or failure etc.). - \item \texttt{List messages}: a list of messages produced by the desig. + \item \texttt{List messages}: a list of messages produced by the design. \end{itemize} Based on the given criteria a new design is determined, which will meet the required criteria. If such a design is not possible, that will be reported back. Index: DamEngine/trunk/doc/Dam Engine - Technical Design/DAM Engine - Technical Design.pdf =================================================================== diff -u -r945 -r979 Binary files differ Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs =================================================================== diff -u -r971 -r979 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 971) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 979) @@ -77,39 +77,8 @@ // stability where Piping calc is wanted). In that case, do nothing but just skip. if (prepareResult == PrepareResult.Successful) { - // Perform validation - List locationCalculationMessages = new List(); - List validationMessages; - int errorCount = kernelWrapper.Validate(kernelDataInput, kernelDataOutput, out validationMessages); - if (errorCount > 0) - { - locationCalculationMessages.Add(new LogMessage(LogMessageType.Error, null, - string.Format(Resources.DesignCalculatorValidationFailed, - location.Name, - soiProfileProbability.ToString(), - damKernelInput.DesignScenario.LocationScenarioID))); - locationCalculationMessages.AddRange(validationMessages); - } - else - { - // Perform calculation - kernelWrapper.Execute(kernelDataInput, kernelDataOutput, out locationCalculationMessages); - } - // Process output - calculationMessages.AddRange(locationCalculationMessages); - List designResults; - StringBuilder sb = new StringBuilder(); - foreach (var message in locationCalculationMessages) - { - sb.Append(message.Message + Environment.NewLine); - } - string resultMessage = sb.ToString(); - - kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, resultMessage, out designResults); - foreach (var designResult in designResults) - { - damProjectData.DesignCalculations.Add(designResult); - } + PerformSingleCalculation(kernelWrapper, kernelDataInput, kernelDataOutput, + damKernelInput, calculationMessages, damProjectData.DesignCalculations); } else { @@ -136,5 +105,44 @@ } return calculationMessages; } + + private static void PerformSingleCalculation(IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, + List calculationMessages, List designCalculations) + { + // Perform validation + List locationCalculationMessages = new List(); + List validationMessages; + int errorCount = kernelWrapper.Validate(kernelDataInput, kernelDataOutput, out validationMessages); + if (errorCount > 0) + { + locationCalculationMessages.Add(new LogMessage(LogMessageType.Error, null, + string.Format(Resources.DesignCalculatorValidationFailed, + damKernelInput.Location.Name, + damKernelInput.SubSoilScenario.ToString(), + damKernelInput.DesignScenario.LocationScenarioID))); + locationCalculationMessages.AddRange(validationMessages); + } + else + { + // Perform calculation + kernelWrapper.Execute(kernelDataInput, kernelDataOutput, out locationCalculationMessages); + } + // Process output + calculationMessages.AddRange(locationCalculationMessages); + List designResults; + StringBuilder sb = new StringBuilder(); + foreach (var message in locationCalculationMessages) + { + sb.Append(message.Message + Environment.NewLine); + } + string resultMessage = sb.ToString(); + + kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, resultMessage, out designResults); + foreach (var designResult in designResults) + { + designCalculations.Add(designResult); + } + } } } + \ No newline at end of file