Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r34b58146f2ba86fcdf2d1d45604131dd91fef4b9 -rf0b17fbeaae5235e062c016de9adf3c0c209720f --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 34b58146f2ba86fcdf2d1d45604131dd91fef4b9) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision f0b17fbeaae5235e062c016de9adf3c0c209720f) @@ -69,8 +69,13 @@ + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + {c90b77da-e421-43cc-b82e-529651bc21ac} Core.Common.Version Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/HydraRingCalculationService.cs =================================================================== diff -u -r85a052e3663239c7a914d63aff9fb01f72b1db74 -rf0b17fbeaae5235e062c016de9adf3c0c209720f --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/HydraRingCalculationService.cs (.../HydraRingCalculationService.cs) (revision 85a052e3663239c7a914d63aff9fb01f72b1db74) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/HydraRingCalculationService.cs (.../HydraRingCalculationService.cs) (revision f0b17fbeaae5235e062c016de9adf3c0c209720f) @@ -44,11 +44,11 @@ /// The id of the ring to perform the calculation for. /// The to use while executing the calculation. /// The to use while executing the calculation. - /// The input of the calculation to perform. + /// The input of the calculation to perform. /// A or null when something went wrong. - public static TargetProbabilityCalculationOutput PerformCalculation(string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, HydraRingCalculationInput hydraRingCalculationInput) + public static TargetProbabilityCalculationOutput PerformCalculation(string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, TargetProbabilityCalculationInput targetProbabilityCalculationInput) { - return PerformCalculation(hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, hydraRingCalculationInput, (outputFilePath, ouputDatabasePath) => TargetProbabilityCalculationParser.Parse(outputFilePath, hydraRingCalculationInput.DikeSection.SectionId)); + return PerformCalculation(hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, targetProbabilityCalculationInput, (outputFilePath, ouputDatabasePath) => TargetProbabilityCalculationParser.Parse(outputFilePath, targetProbabilityCalculationInput.DikeSection.SectionId)); } private static T PerformCalculation(string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, HydraRingCalculationInput hydraRingCalculationInput, Func parseFunction) @@ -103,7 +103,7 @@ { WorkingDirectory = workingDirectory, UseShellExecute = false, - CreateNoWindow = true + CreateNoWindow = false } }; Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/TargetProbabilityCalculationActivity.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/TargetProbabilityCalculationActivity.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/TargetProbabilityCalculationActivity.cs (revision f0b17fbeaae5235e062c016de9adf3c0c209720f) @@ -0,0 +1,90 @@ +// 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.Service; +using Ringtoets.HydraRing.Calculation.Data; +using Ringtoets.HydraRing.Calculation.Data.Input; +using Ringtoets.HydraRing.Calculation.Data.Output; + +namespace Ringtoets.HydraRing.Calculation.Service +{ + /// + /// for running a type 2 calculation via Hydra-Ring ("iterate towards a target probability, provided as reliability index"). + /// + public class TargetProbabilityCalculationActivity : Activity + { + private readonly string name; + private readonly string hlcdDirectory; + private readonly string ringId; + private readonly HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType; + private readonly HydraRingUncertaintiesType uncertaintiesType; + private readonly TargetProbabilityCalculationInput targetProbabilityCalculationInput; + private TargetProbabilityCalculationOutput targetProbabilityCalculationOutput; + + /// + /// Creates a new instance of the class. + /// + /// The name of the activity. + /// The directory of the HLCD file that should be used for performing the calculation. + /// The id of the ring to perform the calculation for. + /// The to use while executing the calculation. + /// The to use while executing the calculation. + /// The input of the calculation to perform. + public TargetProbabilityCalculationActivity( + string name, + string hlcdDirectory, + string ringId, + HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, + HydraRingUncertaintiesType uncertaintiesType, + TargetProbabilityCalculationInput targetProbabilityCalculationInput) + { + this.name = name; + this.hlcdDirectory = hlcdDirectory; + this.ringId = ringId; + this.timeIntegrationSchemeType = timeIntegrationSchemeType; + this.uncertaintiesType = uncertaintiesType; + this.targetProbabilityCalculationInput = targetProbabilityCalculationInput; + } + + public override string Name + { + get + { + return name; + } + } + + protected override void OnRun() + { + targetProbabilityCalculationOutput = HydraRingCalculationService.PerformCalculation(hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, targetProbabilityCalculationInput); + } + + protected override void OnCancel() + { + // Unable to cancel a running kernel, so nothing can be done. + } + + protected override void OnFinish() + { + // TODO: Implement logic for correctly handling the targetProbabilityCalculationOutput + } + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -rae60c3370d660ae3fb9c7497f90e2b563ec54957 -rf0b17fbeaae5235e062c016de9adf3c0c209720f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ae60c3370d660ae3fb9c7497f90e2b563ec54957) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f0b17fbeaae5235e062c016de9adf3c0c209720f) @@ -249,5 +249,14 @@ return ResourceManager.GetString("ReferenceLineImporter_ProgressText_Removing_hydraulic_boundary_output", resourceCulture); } } + + /// + /// Looks up a localized string similar to Toetspeil berekenen voor locatie '{0}'. + /// + public static string RingtoetsGuiPlugin_Calculate_assessment_level_for_location_0_ { + get { + return ResourceManager.GetString("RingtoetsGuiPlugin_Calculate_assessment_level_for_location_0_", resourceCulture); + } + } } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx =================================================================== diff -u -rae60c3370d660ae3fb9c7497f90e2b563ec54957 -rf0b17fbeaae5235e062c016de9adf3c0c209720f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision ae60c3370d660ae3fb9c7497f90e2b563ec54957) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision f0b17fbeaae5235e062c016de9adf3c0c209720f) @@ -181,4 +181,7 @@ Het bijbehorende HLCD bestand is niet gevonden in dezelfde map als het HRD bestand. + + Toetspeil berekenen voor locatie '{0}' + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r85a052e3663239c7a914d63aff9fb01f72b1db74 -rf0b17fbeaae5235e062c016de9adf3c0c209720f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 85a052e3663239c7a914d63aff9fb01f72b1db74) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision f0b17fbeaae5235e062c016de9adf3c0c209720f) @@ -27,7 +27,6 @@ using System.Linq; using System.Windows.Forms; using Core.Common.Base.Data; -using Core.Common.Base.Service; using Core.Common.Controls.TreeView; using Core.Common.Gui.ContextMenu; using Core.Common.Gui.Forms; @@ -48,6 +47,7 @@ using Ringtoets.Integration.Forms.PropertyClasses; using Ringtoets.Integration.Forms.Views; using Ringtoets.Integration.Plugin.FileImporters; +using Ringtoets.Integration.Plugin.Properties; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; using RingtoetsDataResources = Ringtoets.Integration.Data.Properties.Resources; @@ -56,7 +56,6 @@ using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; using UtilsResources = Core.Common.Utils.Properties.Resources; using BaseResources = Core.Common.Base.Properties.Resources; -using PropertyInfo = Core.Common.Gui.Plugin.PropertyInfo; namespace Ringtoets.Integration.Plugin { @@ -450,7 +449,7 @@ { var beta = -Normal.InvCDF(0.0, 1.0, 1.0 / nodeData.Parent.FailureMechanismContribution.Norm); var hlcdDirectory = Path.GetDirectoryName(nodeData.Parent.HydraulicBoundaryDatabase.FilePath); - var activities = nodeData.Parent.HydraulicBoundaryDatabase.Locations.Select(hbl => new AssessmentLevelActivity(hlcdDirectory, "", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All, (int) hbl.Id, beta)); + var activities = nodeData.Parent.HydraulicBoundaryDatabase.Locations.Select(hbl => new TargetProbabilityCalculationActivity(string.Format(Resources.RingtoetsGuiPlugin_Calculate_assessment_level_for_location_0_, hbl.Id), hlcdDirectory, "", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All, new AssessmentLevelCalculationInput((int) hbl.Id, beta))); ActivityProgressDialogRunner.Run(Gui.MainWindow, activities); } @@ -586,52 +585,5 @@ } #endregion - - # region Nested types - - private class AssessmentLevelActivity : Activity - { - private readonly string hlcdDirectory; - private readonly string ringId; - private readonly HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType; - private readonly HydraRingUncertaintiesType uncertaintiesType; - private readonly int hydraulicBoundaryLocationId; - private readonly double beta; - - public AssessmentLevelActivity(string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, int hydraulicBoundaryLocationId, double beta) - { - this.hlcdDirectory = hlcdDirectory; - this.ringId = ringId; - this.timeIntegrationSchemeType = timeIntegrationSchemeType; - this.uncertaintiesType = uncertaintiesType; - this.hydraulicBoundaryLocationId = hydraulicBoundaryLocationId; - this.beta = beta; - } - - protected override void OnRun() - { - HydraRingCalculationService.PerformCalculation(hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, new AssessmentLevelCalculationInput(hydraulicBoundaryLocationId, beta)); - } - - protected override void OnCancel() - { - // Unable to cancel a running kernel, so nothing can be done. - } - - protected override void OnFinish() - { - - } - - public override string Name - { - get - { - return string.Format("Toetspeil berekenen voor locatie {0}...", hydraulicBoundaryLocationId); - } - } - } - - # endregion } } \ No newline at end of file