Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs =================================================================== diff -u -r1327 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs (.../DamMacroStabilityOutwardsKernelWrapper.cs) (revision 1327) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs (.../DamMacroStabilityOutwardsKernelWrapper.cs) (revision 1329) @@ -74,63 +74,54 @@ /// public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) { - try + var damMacroStabilityOutput = new DamMacroStabilityOutput() { - var damMacroStabilityOutput = new DamMacroStabilityOutput() - { - StabilityOutputItems = new List(), - CalculationResult = CalculationResult.NoRun - }; - kernelDataOutput = damMacroStabilityOutput; - // Note: as segments and thus SubSoilScenario are generally divided into Piping versus Stability, - // the actual SegmentFailureMechanismType would be set to StabilityInside rather than StabilityOutside - // So check for both types. - if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.StabilityOutside || - damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.StabilityInside) - { - // Make sure the gridposition is Left. - FailureMechanismParametersMStab.MStabParameters.GridPosition = MStabGridPosition.Left; + StabilityOutputItems = new List(), + CalculationResult = CalculationResult.NoRun + }; + kernelDataOutput = damMacroStabilityOutput; + // Note: as segments and thus SubSoilScenario are generally divided into Piping versus Stability, + // the actual SegmentFailureMechanismType would be set to StabilityInside rather than StabilityOutside + // So check for both types. + if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.StabilityOutside || + damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.StabilityInside) + { + // Make sure the gridposition is Left. + FailureMechanismParametersMStab.MStabParameters.GridPosition = MStabGridPosition.Left; - FailureMechanismParametersMStab.ProjectWorkingPath = damKernelInput.CalculationDir; + FailureMechanismParametersMStab.ProjectWorkingPath = damKernelInput.CalculationDir; - if (damKernelInput.SubSoilScenario.SoilProfileType == SoilProfileType.ProfileTypeStiFile) - { - damKernelInput.SubSoilScenario.FullStiFileName = Path.Combine(damKernelInput.ProjectDir, - Path.Combine(damKernelInput.Location.StabilityOptions.SoilGeometries2DPath, - damKernelInput.SubSoilScenario.StiFileName)); - } + if (damKernelInput.SubSoilScenario.SoilProfileType == SoilProfileType.ProfileTypeStiFile) + { + damKernelInput.SubSoilScenario.FullStiFileName = Path.Combine(damKernelInput.ProjectDir, + Path.Combine(damKernelInput.Location.StabilityOptions.SoilGeometries2DPath, + damKernelInput.SubSoilScenario.StiFileName)); + } - // Determine whether there is uplift - var upliftSituation = UpliftHelper.DetermineStabilityUplift(damKernelInput, true); - damMacroStabilityOutput.UpliftSituation = upliftSituation; - kernelDataOutput = damMacroStabilityOutput; + // Determine whether there is uplift + var upliftSituation = UpliftHelper.DetermineStabilityUplift(damKernelInput, true); + damMacroStabilityOutput.UpliftSituation = upliftSituation; + kernelDataOutput = damMacroStabilityOutput; - var damMacroStabilityInput = new DamMacroStabilityInput() - { - DGeoStabilityExePath = FailureMechanismParametersMStab.DGeoStabilityExePath, - DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, - FailureMechanismParametersMStab.MStabParameters.Model, FailureMechanismParametersMStab.ProjectWorkingPath), - FailureMechanismParametersMStab = FailureMechanismParametersMStab - }; - kernelDataInput = damMacroStabilityInput; + var damMacroStabilityInput = new DamMacroStabilityInput() + { + DGeoStabilityExePath = FailureMechanismParametersMStab.DGeoStabilityExePath, + DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, + FailureMechanismParametersMStab.MStabParameters.Model, FailureMechanismParametersMStab.ProjectWorkingPath), + FailureMechanismParametersMStab = FailureMechanismParametersMStab + }; + kernelDataInput = damMacroStabilityInput; + + // Write xml file + XDocument xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); - // Write xml file - XDocument xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); + // Use xml file to create sti file + CreateStiFile(xmlDocument); - // Use xml file to create sti file - CreateStiFile(xmlDocument); - - return PrepareResult.Successful; - } - kernelDataInput = null; - return PrepareResult.NotRelevant; + return PrepareResult.Successful; } - catch (Exception) - { - kernelDataInput = null; - kernelDataOutput = null; - return PrepareResult.Failed; - } + kernelDataInput = null; + return PrepareResult.NotRelevant; } /// Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityHorizontalBalance/DamMacroStabilityHorizontalBalanceKernelWrapper.cs =================================================================== diff -u -r1327 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityHorizontalBalance/DamMacroStabilityHorizontalBalanceKernelWrapper.cs (.../DamMacroStabilityHorizontalBalanceKernelWrapper.cs) (revision 1327) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityHorizontalBalance/DamMacroStabilityHorizontalBalanceKernelWrapper.cs (.../DamMacroStabilityHorizontalBalanceKernelWrapper.cs) (revision 1329) @@ -43,7 +43,7 @@ /// Class for the wrapper around the Stability Horizontal Balance calculator /// /// - public class DamMacroStabilityHorizontalBalanceKernelWrapper : IKernelWrapper + public class DamMacroStabilityHorizontalBalanceKernelWrapper: IKernelWrapper { /// @@ -66,47 +66,38 @@ /// public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) { - try + var damMacroStabilityOutput = new DamMacroStabilityOutput() { - var damMacroStabilityOutput = new DamMacroStabilityOutput() - { - StabilityOutputItems = new List(), - CalculationResult = CalculationResult.NoRun - }; + StabilityOutputItems = new List(), + CalculationResult = CalculationResult.NoRun + }; + kernelDataOutput = damMacroStabilityOutput; + if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.HorizontalBalance) + { + FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.HorizontalBalance; + FailureMechanismParametersMStab.ProjectWorkingPath = damKernelInput.CalculationDir; + kernelDataOutput = damMacroStabilityOutput; - if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.HorizontalBalance) + + var damMacroStabilityInput = new DamMacroStabilityInput() { - FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.HorizontalBalance; - FailureMechanismParametersMStab.ProjectWorkingPath = damKernelInput.CalculationDir; + DGeoStabilityExePath = FailureMechanismParametersMStab.DGeoStabilityExePath, + DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, + FailureMechanismParametersMStab.MStabParameters.Model, FailureMechanismParametersMStab.ProjectWorkingPath), + FailureMechanismParametersMStab = FailureMechanismParametersMStab + }; + kernelDataInput = damMacroStabilityInput; - kernelDataOutput = damMacroStabilityOutput; + // Write xml file + XDocument xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); - var damMacroStabilityInput = new DamMacroStabilityInput() - { - DGeoStabilityExePath = FailureMechanismParametersMStab.DGeoStabilityExePath, - DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, - FailureMechanismParametersMStab.MStabParameters.Model, FailureMechanismParametersMStab.ProjectWorkingPath), - FailureMechanismParametersMStab = FailureMechanismParametersMStab - }; - kernelDataInput = damMacroStabilityInput; + // Use xml file to create sti file + CreateStiFile(xmlDocument); - // Write xml file - XDocument xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); - - // Use xml file to create sti file - CreateStiFile(xmlDocument); - - return PrepareResult.Successful; - } - kernelDataInput = null; - return PrepareResult.NotRelevant; + return PrepareResult.Successful; } - catch (Exception) - { - kernelDataInput = null; - kernelDataOutput = null; - return PrepareResult.Failed; - } + kernelDataInput = null; + return PrepareResult.NotRelevant; } /// Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs =================================================================== diff -u -r1327 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 1327) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 1329) @@ -60,37 +60,28 @@ /// public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) { - try + var damPipingBlighOutput = new DamPipingBlighOutput() { - var damPipingBlighOutput = new DamPipingBlighOutput() - { - CalculationResult = CalculationResult.NoRun, - FoSp = defaultMaxReturnValue - }; - kernelDataOutput = damPipingBlighOutput; - if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.Piping) - { - var damPipingBlighInput = new DamPipingBlighInput(); + CalculationResult = CalculationResult.NoRun, + FoSp = defaultMaxReturnValue + }; + kernelDataOutput = damPipingBlighOutput; + if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.Piping) + { + var damPipingBlighInput = new DamPipingBlighInput(); - var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; - var location = damKernelInput.Location; - double waterLevel = damKernelInput.RiverLevelHigh; - UpliftSituation upliftSituation; - PlLines plLines = PlLinesHelper.CreatePlLinesForPiping(location, soilProfile1D, waterLevel, - damKernelInput.DamFailureMechanismeCalculationSpecification.AssessmentScenarioJobSettings.HydraulicShortcutType, - out upliftSituation); - EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, damPipingBlighInput, waterLevel, damPipingBlighOutput); - return PrepareResult.Successful; - } - kernelDataInput = null; - return PrepareResult.NotRelevant; + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var location = damKernelInput.Location; + double waterLevel = damKernelInput.RiverLevelHigh; + UpliftSituation upliftSituation; + PlLines plLines = PlLinesHelper.CreatePlLinesForPiping(location, soilProfile1D, waterLevel, + damKernelInput.DamFailureMechanismeCalculationSpecification.AssessmentScenarioJobSettings.HydraulicShortcutType, + out upliftSituation); + EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, damPipingBlighInput, waterLevel, damPipingBlighOutput); + return PrepareResult.Successful; } - catch (Exception) - { - kernelDataInput = null; - kernelDataOutput = null; - return PrepareResult.Failed; - } + kernelDataInput = null; + return PrepareResult.NotRelevant; } private static void EvaluateUpliftSituation(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput, PlLines plLines, DamPipingBlighInput damPipingBlighInput, double waterLevel, DamPipingBlighOutput damPipingBlighOutput) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs =================================================================== diff -u -r1218 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1218) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1329) @@ -55,72 +55,84 @@ var soiProfileProbability = location.Segment.SoilProfileProbabilities[subSoilScenarioIndex]; for (int designScenarioIndex = 0; designScenarioIndex < location.Scenarios.Count; designScenarioIndex++) { - // Prepare input DesignScenario designScenario = location.Scenarios[designScenarioIndex]; - var damKernelInput = new DamKernelInput(); - var projectPath = damProjectData.ProjectPath != "" ? damProjectData.ProjectPath : Directory.GetCurrentDirectory(); - damKernelInput.ProjectDir = projectPath; - damKernelInput.CalculationDir = Path.Combine(projectPath, damProjectData.CalculationMap); - damKernelInput.Location = location; - damKernelInput.SubSoilScenario = soiProfileProbability; - damKernelInput.DamFailureMechanismeCalculationSpecification = damProjectData.DamProjectCalculationSpecification.CurrentSpecification; - damKernelInput.RiverLevelHigh = designScenario.RiverLevel; - damKernelInput.RiverLevelLow = designScenario.RiverLevelLow; - damKernelInput.FilenamePrefix = String.Format("Loc({0})_Sce({1})", designScenario.Location.Name, designScenario.LocationScenarioID); - AnalysisType analysisType = DamProjectCalculationSpecification.SelectedAnalysisType; - SynchronizeScenarioDataWithLocationData(designScenario, location); - IKernelDataInput kernelDataInput; - IKernelDataOutput kernelDataOutput; - - // Create kernelwrapper - IKernelWrapper kernelWrapper = KernelWrapperHelper.CreateKernelWrapper(damProjectData.DamProjectCalculationSpecification.CurrentSpecification); - if (kernelWrapper == null) + try { - throw new NotImplementedException(Resources.DesignCalculatorKernelNotImplemented); - } + // Prepare input + var damKernelInput = new DamKernelInput(); + var projectPath = damProjectData.ProjectPath != "" ? damProjectData.ProjectPath : Directory.GetCurrentDirectory(); + damKernelInput.ProjectDir = projectPath; + damKernelInput.CalculationDir = Path.Combine(projectPath, damProjectData.CalculationMap); + damKernelInput.Location = location; + damKernelInput.SubSoilScenario = soiProfileProbability; + damKernelInput.DamFailureMechanismeCalculationSpecification = damProjectData.DamProjectCalculationSpecification.CurrentSpecification; + damKernelInput.RiverLevelHigh = designScenario.RiverLevel; + damKernelInput.RiverLevelLow = designScenario.RiverLevelLow; + damKernelInput.FilenamePrefix = String.Format("Loc({0})_Sce({1})", designScenario.Location.Name, designScenario.LocationScenarioID); + AnalysisType analysisType = DamProjectCalculationSpecification.SelectedAnalysisType; + SynchronizeScenarioDataWithLocationData(designScenario, location); + IKernelDataInput kernelDataInput; + IKernelDataOutput kernelDataOutput; - PrepareResult prepareResult = kernelWrapper.Prepare(damKernelInput, 0, out kernelDataInput, out kernelDataOutput); + // Create kernelwrapper + IKernelWrapper kernelWrapper = KernelWrapperHelper.CreateKernelWrapper(damProjectData.DamProjectCalculationSpecification.CurrentSpecification); + if (kernelWrapper == null) + { + throw new NotImplementedException(Resources.DesignCalculatorKernelNotImplemented); + } - // Sometimes the kernelDataInput is not created (p.e when soilprofileprobablility is meant for - // stability where Piping calc is wanted). In that case, do nothing but just skip. - if (prepareResult == PrepareResult.Successful) - { - switch (analysisType) + PrepareResult prepareResult = kernelWrapper.Prepare(damKernelInput, 0, out kernelDataInput, out kernelDataOutput); + + // Sometimes the kernelDataInput is not created (p.e when soilprofileprobablility is meant for + // stability where Piping calc is wanted). In that case, do nothing but just skip. + if (prepareResult == PrepareResult.Successful) { - case AnalysisType.AdaptGeometry: - PerformDesignCalculation( - kernelWrapper, kernelDataInput, kernelDataOutput, - damKernelInput, designScenario, calculationMessages, - damProjectData.DesignCalculations); - break; - case AnalysisType.NoAdaption: - DesignCalculatorSingle.PerformSingleCalculation( - kernelWrapper, kernelDataInput, kernelDataOutput, - damKernelInput, designScenario, calculationMessages, - damProjectData.DesignCalculations); - break; + switch (analysisType) + { + case AnalysisType.AdaptGeometry: + PerformDesignCalculation( + kernelWrapper, kernelDataInput, kernelDataOutput, + damKernelInput, designScenario, calculationMessages, + damProjectData.DesignCalculations); + break; + case AnalysisType.NoAdaption: + DesignCalculatorSingle.PerformSingleCalculation( + kernelWrapper, kernelDataInput, kernelDataOutput, + damKernelInput, designScenario, calculationMessages, + damProjectData.DesignCalculations); + break; + } } - } - else - { - if (prepareResult == PrepareResult.NotRelevant) + else { - calculationMessages.Add(new LogMessage(LogMessageType.Info, null, - string.Format(Resources.DesignCalculatorIrrelevant, - location.Name, - soiProfileProbability.ToString(), - designScenario.LocationScenarioID))); + if (prepareResult == PrepareResult.NotRelevant) + { + calculationMessages.Add(new LogMessage(LogMessageType.Info, null, + string.Format(Resources.DesignCalculatorIrrelevant, + location.Name, + soiProfileProbability.ToString(), + designScenario.LocationScenarioID))); + } + if (prepareResult == PrepareResult.Failed) + { + calculationMessages.Add(new LogMessage(LogMessageType.Error, null, + string.Format(Resources.DesignCalculatorPrepareError, + location.Name, + soiProfileProbability.ToString(), + designScenario.LocationScenarioID))); + } } - if (prepareResult == PrepareResult.Failed) - { - calculationMessages.Add(new LogMessage(LogMessageType.Error, null, - string.Format(Resources.DesignCalculatorPrepareError, - location.Name, - soiProfileProbability.ToString(), - designScenario.LocationScenarioID))); - } } + catch (Exception e) + { + calculationMessages.Add(new LogMessage(LogMessageType.Info, null, + string.Format(Resources.DesignCalculatorGeneralException, + location.Name, + soiProfileProbability.ToString(), + designScenario.LocationScenarioID, + e.Message))); + } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r1237 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1237) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1329) @@ -218,6 +218,15 @@ } /// + /// Looks up a localized string similar to Location {0}, subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}'. + /// + internal static string DesignCalculatorGeneralException { + get { + return ResourceManager.GetString("DesignCalculatorGeneralException", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Location {0}, subsoil scenario '{1}', design scenario '{2}': This calculation in not relevant and thus skipped.. /// internal static string DesignCalculatorIrrelevant { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r1327 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1327) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1329) @@ -64,128 +64,119 @@ /// public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) { - try + var damMacroStabilityOutput = new DamMacroStabilityOutput() { - var damMacroStabilityOutput = new DamMacroStabilityOutput() + StabilityOutputItems = new List(), + CalculationResult = CalculationResult.NoRun + }; + kernelDataOutput = damMacroStabilityOutput; + if (damKernelInput.DamFailureMechanismeCalculationSpecification == null) + { + damKernelInput.DamFailureMechanismeCalculationSpecification = new DamFailureMechanismeCalculationSpecification(); + } + + // Make sure the gridposition is Right. + FailureMechanismParametersMStab.MStabParameters.GridPosition = MStabGridPosition.Right; + // Make sure no riverlevellow is defined, because this will trigger Outside stability code elsewhere + damKernelInput.RiverLevelLow = null; + + if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.StabilityInside) + { + var bishopUpliftVan = FailureMechanismParametersMStab.MStabParameters.Model == + MStabModelType.BishopUpliftVan; + var model = FailureMechanismParametersMStab.MStabParameters.Model; + if (bishopUpliftVan) { - StabilityOutputItems = new List(), - CalculationResult = CalculationResult.NoRun + // if current model is BishopUpliftVan then set to Bishop for proper name/path for inputfile + model = MStabModelType.Bishop; + } + + FailureMechanismParametersMStab.ProjectWorkingPath = damKernelInput.CalculationDir; + if (damKernelInput.SubSoilScenario.SoilProfileType == SoilProfileType.ProfileTypeStiFile) + { + damKernelInput.SubSoilScenario.FullStiFileName = Path.Combine(damKernelInput.ProjectDir, + Path.Combine(damKernelInput.Location.StabilityOptions.SoilGeometries2DPath, + damKernelInput.SubSoilScenario.StiFileName)); + } + var damMacroStabilityInput = new DamMacroStabilityInput() + { + DGeoStabilityExePath = FailureMechanismParametersMStab.DGeoStabilityExePath, + DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName( + damKernelInput, iterationIndex, model, FailureMechanismParametersMStab.ProjectWorkingPath), + FailureMechanismParametersMStab = FailureMechanismParametersMStab }; + + // Determine whether there is uplift + var upliftSituation = UpliftHelper.DetermineStabilityUplift(damKernelInput, false); + damMacroStabilityOutput.UpliftSituation = upliftSituation; kernelDataOutput = damMacroStabilityOutput; - if (damKernelInput.DamFailureMechanismeCalculationSpecification == null) + + // Check the model to see what is to be calculated and how many calculations are required + if (bishopUpliftVan) { - damKernelInput.DamFailureMechanismeCalculationSpecification = new DamFailureMechanismeCalculationSpecification(); + // see if uplift is required + // if so, both upliftvan and bishop are to be prepared, calculated and worst case is to be determined + model = MStabModelType.UpliftVan; + damMacroStabilityInput.DGeoStabilityInputFileNameSecondModel = + DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, + model, FailureMechanismParametersMStab.ProjectWorkingPath); + // if not, only Bishop calculation so leave SecondModel empty. } - // Make sure the gridposition is Right. - FailureMechanismParametersMStab.MStabParameters.GridPosition = MStabGridPosition.Right; - // Make sure no riverlevellow is defined, because this will trigger Outside stability code elsewhere - damKernelInput.RiverLevelLow = null; + kernelDataInput = damMacroStabilityInput; - if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.StabilityInside) + // When BishopUpliftVan is performed, make sure the first one is Bishop + if (bishopUpliftVan) { - var bishopUpliftVan = FailureMechanismParametersMStab.MStabParameters.Model == - MStabModelType.BishopUpliftVan; - var model = FailureMechanismParametersMStab.MStabParameters.Model; - if (bishopUpliftVan) - { - // if current model is BishopUpliftVan then set to Bishop for proper name/path for inputfile - model = MStabModelType.Bishop; - } + damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.Bishop; + } + try + { + // start prepare for (first) calculation + // Write xml file + XDocument xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); + // Use xml file to create sti file + CreateStiFile(xmlDocument); - FailureMechanismParametersMStab.ProjectWorkingPath = damKernelInput.CalculationDir; - if (damKernelInput.SubSoilScenario.SoilProfileType == SoilProfileType.ProfileTypeStiFile) - { - damKernelInput.SubSoilScenario.FullStiFileName = Path.Combine(damKernelInput.ProjectDir, - Path.Combine(damKernelInput.Location.StabilityOptions.SoilGeometries2DPath, - damKernelInput.SubSoilScenario.StiFileName)); - } - var damMacroStabilityInput = new DamMacroStabilityInput() - { - DGeoStabilityExePath = FailureMechanismParametersMStab.DGeoStabilityExePath, - DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName( - damKernelInput, iterationIndex, model, FailureMechanismParametersMStab.ProjectWorkingPath), - FailureMechanismParametersMStab = FailureMechanismParametersMStab - }; - - // Determine whether there is uplift - var upliftSituation = UpliftHelper.DetermineStabilityUplift(damKernelInput, false); - damMacroStabilityOutput.UpliftSituation = upliftSituation; - kernelDataOutput = damMacroStabilityOutput; - - // Check the model to see what is to be calculated and how many calculations are required + // now check if second calculation for BishopUpliftVan is needed, if so perform prepare. if (bishopUpliftVan) { - // see if uplift is required - // if so, both upliftvan and bishop are to be prepared, calculated and worst case is to be determined - model = MStabModelType.UpliftVan; - damMacroStabilityInput.DGeoStabilityInputFileNameSecondModel = - DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, - model, FailureMechanismParametersMStab.ProjectWorkingPath); - // if not, only Bishop calculation so leave SecondModel empty. - } - - kernelDataInput = damMacroStabilityInput; - - // When BishopUpliftVan is performed, make sure the first one is Bishop - if (bishopUpliftVan) - { - damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.Bishop; - } - try - { - // start prepare for (first) calculation - // Write xml file - XDocument xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); - // Use xml file to create sti file - CreateStiFile(xmlDocument); - - // now check if second calculation for BishopUpliftVan is needed, if so perform prepare. - if (bishopUpliftVan) + // reset model + damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.BishopUpliftVan; + if (upliftSituation.IsUplift) { - // reset model - damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.BishopUpliftVan; - if (upliftSituation.IsUplift) + var inputFileName = damMacroStabilityInput.DGeoStabilityInputFileName; + // set proper name and model + damMacroStabilityInput.DGeoStabilityInputFileName = damMacroStabilityInput.DGeoStabilityInputFileNameSecondModel; + damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.UpliftVan; + try { - var inputFileName = damMacroStabilityInput.DGeoStabilityInputFileName; - // set proper name and model - damMacroStabilityInput.DGeoStabilityInputFileName = damMacroStabilityInput.DGeoStabilityInputFileNameSecondModel; - damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.UpliftVan; - try - { - // Write xml file - xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); - // Use xml file to create sti file - CreateStiFile(xmlDocument); - } - finally - { - // reset name - damMacroStabilityInput.DGeoStabilityInputFileName = inputFileName; - } + // Write xml file + xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damMacroStabilityInput); + // Use xml file to create sti file + CreateStiFile(xmlDocument); } + finally + { + // reset name + damMacroStabilityInput.DGeoStabilityInputFileName = inputFileName; + } } } - finally + } + finally + { + if (bishopUpliftVan) { - if (bishopUpliftVan) - { - // reset model - damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.BishopUpliftVan; - } + // reset model + damMacroStabilityInput.FailureMechanismParametersMStab.MStabParameters.Model = MStabModelType.BishopUpliftVan; } - - return PrepareResult.Successful; } - kernelDataInput = null; - return PrepareResult.NotRelevant; + + return PrepareResult.Successful; } - catch (Exception) - { - kernelDataInput = null; - kernelDataOutput = null; - return PrepareResult.Failed; - } + kernelDataInput = null; + return PrepareResult.NotRelevant; } /// Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r1237 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1237) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1329) @@ -168,6 +168,9 @@ Geen uitvoer object gedefinieerd voor Sellmeijer VNK + + Locatie '{0}', ondergrond scenario '{1}', ontwerp scenario '{2}': De berekening is gefaald met de volgende foutmedling '{3}'. + Locatie '{0}', ondergrond scenario '{1}', ontwerp scenario '{2}': Deze berekening is niet relevant en dus overgeslagen. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs =================================================================== diff -u -r1327 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 1327) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 1329) @@ -58,34 +58,25 @@ public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) { - try + var damPipingOutput = new DamPipingSellmeijer4ForcesOutput() { - var damPipingOutput = new DamPipingSellmeijer4ForcesOutput() - { - FoSp = defaultMaxReturnValue - }; - kernelDataOutput = damPipingOutput; - if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.Piping) - { - var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; - var location = damKernelInput.Location; - double waterLevel = damKernelInput.RiverLevelHigh; - UpliftSituation upliftSituation; - var plLines = PlLinesHelper.CreatePlLinesForPiping(location, soilProfile1D, waterLevel, - damKernelInput.DamFailureMechanismeCalculationSpecification.AssessmentScenarioJobSettings.HydraulicShortcutType, - out upliftSituation); - EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, waterLevel, damPipingOutput); - return PrepareResult.Successful; - } - kernelDataInput = null; - return PrepareResult.NotRelevant; - } - catch (Exception) + FoSp = defaultMaxReturnValue + }; + kernelDataOutput = damPipingOutput; + if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.Piping) { - kernelDataInput = null; - kernelDataOutput = null; - return PrepareResult.Failed; + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var location = damKernelInput.Location; + double waterLevel = damKernelInput.RiverLevelHigh; + UpliftSituation upliftSituation; + var plLines = PlLinesHelper.CreatePlLinesForPiping(location, soilProfile1D, waterLevel, + damKernelInput.DamFailureMechanismeCalculationSpecification.AssessmentScenarioJobSettings.HydraulicShortcutType, + out upliftSituation); + EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, waterLevel, damPipingOutput); + return PrepareResult.Successful; } + kernelDataInput = null; + return PrepareResult.NotRelevant; } private static void EvaluateUpliftSituation(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput, Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijerVnk/DamPipingSellmeijerVnkKernelWrapper.cs =================================================================== diff -u -r1327 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijerVnk/DamPipingSellmeijerVnkKernelWrapper.cs (.../DamPipingSellmeijerVnkKernelWrapper.cs) (revision 1327) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijerVnk/DamPipingSellmeijerVnkKernelWrapper.cs (.../DamPipingSellmeijerVnkKernelWrapper.cs) (revision 1329) @@ -56,34 +56,25 @@ /// public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) { - try + var damPipingOutput = new DamPipingSellmeijerVnkOutput() { - var damPipingOutput = new DamPipingSellmeijerVnkOutput() - { - FoSp = defaultMaxReturnValue - }; - kernelDataOutput = damPipingOutput; - if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.Piping) - { - var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; - var location = damKernelInput.Location; - double waterLevel = damKernelInput.RiverLevelHigh; - UpliftSituation upliftSituation; - var plLines = PlLinesHelper.CreatePlLinesForPiping(location, soilProfile1D, waterLevel, - damKernelInput.DamFailureMechanismeCalculationSpecification.AssessmentScenarioJobSettings.HydraulicShortcutType, - out upliftSituation); - EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, waterLevel, damPipingOutput); - return PrepareResult.Successful; - } - kernelDataInput = null; - return PrepareResult.NotRelevant; - } - catch (Exception) + FoSp = defaultMaxReturnValue + }; + kernelDataOutput = damPipingOutput; + if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.Piping) { - kernelDataInput = null; - kernelDataOutput = null; - return PrepareResult.Failed; + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var location = damKernelInput.Location; + double waterLevel = damKernelInput.RiverLevelHigh; + UpliftSituation upliftSituation; + var plLines = PlLinesHelper.CreatePlLinesForPiping(location, soilProfile1D, waterLevel, + damKernelInput.DamFailureMechanismeCalculationSpecification.AssessmentScenarioJobSettings.HydraulicShortcutType, + out upliftSituation); + EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, waterLevel, damPipingOutput); + return PrepareResult.Successful; } + kernelDataInput = null; + return PrepareResult.NotRelevant; } private static void EvaluateUpliftSituation(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput, Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r1237 -r1329 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1237) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1329) @@ -267,4 +267,7 @@ Required safety factor must be specified. + + Location {0}, subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}' + \ No newline at end of file