Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Parallel.cs =================================================================== diff -u -r877 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Parallel.cs (.../Parallel.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Parallel.cs (.../Parallel.cs) (revision 962) @@ -36,54 +36,22 @@ public class Parallel { private static Queue queue = new Queue(); - private static TaskDelegate task = null; - private static ProgressDelegate progress = null; - private static int total = 0; - private static int executed = 0; + private static TaskDelegate task; + private static ProgressDelegate progress; + private static int total; + private static int executed; private static List threads = new List(); private static List processes = new List(); - private static bool stopPressed = false; - private static bool errorOccured = false; + private static bool stopPressed; + private static bool errorOccured; private static bool limitToAvailableProcessors = true; /// /// Runs a number of tasks in parallel. Returns when all tasks have been executed. /// /// The objects on which the task is to be performed /// The task to be executed - public static void Run(IList list, TaskDelegate parallelTask) - { - Run(list, parallelTask, null, -1); - } - - /// - /// Runs a number of tasks in parallel. Returns when all tasks have been executed. - /// - /// The objects on which the task is to be performed - /// The task to be executed /// The maximum number of processes, will be equal to the number of cores if omitted - public static void Run(IList list, TaskDelegate parallelTask, int maxProcesses) - { - Run(list, parallelTask, null, maxProcesses); - } - - /// - /// Runs a number of tasks in parallel. Returns when all tasks have been executed. - /// - /// The objects on which the task is to be performed - /// The task to be executed - /// Optional delegate indicating the progress of the tasks - public static void Run(IList list, TaskDelegate parallelTask, ProgressDelegate progress) - { - Run(list, parallelTask, progress, -1); - } - - /// - /// Runs a number of tasks in parallel. Returns when all tasks have been executed. - /// - /// The objects on which the task is to be performed - /// The task to be executed - /// The maximum number of processes, will be equal to the number of cores if omitted /// Optional delegate indicating the progress of the tasks public static void Run(IList list, TaskDelegate parallelTask, ProgressDelegate progressDelegate, int maxProcesses) { @@ -208,15 +176,6 @@ processes.Clear(); } - /// - /// Registers a process which should be killed too when the method is called - /// - /// The process - public static void KillOnAbort(Process process) - { - processes.Add(process); - } - private static void RunSequential(IList list, TaskDelegate parallelTask, ProgressDelegate progressDelegate) { for (int i = 0; i < list.Count; i++) @@ -232,7 +191,7 @@ private static void RunTask(object context) { - object argument = null; + object argument; // Set the context of the task thread Context.CurrentContext = context as IContext; @@ -286,21 +245,6 @@ } } } - } - - /// - /// Indicates whether the number of parallel processes is limited to the number of available cores - /// - public static bool LimitToAvailableProcessors - { - get - { - return limitToAvailableProcessors; - } - set - { - limitToAvailableProcessors = value; - } - } + } } } \ No newline at end of file Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/DamProjectCalculatorCsvExportDataBuilder.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculatorException.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/ParameterMissingException.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj =================================================================== diff -u -r956 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 956) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 962) @@ -62,22 +62,14 @@ - - - - - - - - @@ -132,7 +124,6 @@ True Resources.resx - Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/MStabXmlDoc.cs =================================================================== diff -u -r949 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 949) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 962) @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.IO; using System.Xml.Linq; -using Deltares.DamEngine.Calculators.General; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon.Assemblers; using Deltares.DamEngine.Calculators.Properties; @@ -34,6 +33,25 @@ namespace Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon { + /// + /// Class for raising specified exceptions for MStabXmlDoc objects + /// + /// + public class MStabXmlDocException : Exception + { + /// + /// Initializes a new instance of the class. + /// + /// The message that describes the error. + public MStabXmlDocException(string message) + : base(message) + { + } + } + + /// + /// Class for creating the xml-file for stability calculations using DGeoStability Delphi. + /// public static class MStabXmlDoc { /// @@ -58,7 +76,7 @@ var profile1D = subSoilScenario.SoilProfile1D; var soilGeometry2DName = subSoilScenario.StiFileName; - ConsistencyCheck(scenario, profile1D, soilGeometry2DName); + ConsistencyCheck(scenario, profile1D); failureMechanismParametersMStab.Location = scenario.Location; if (profile1D != null) @@ -112,17 +130,16 @@ { if (profile1D == null) { - throw new DamFailureMechanismeCalculatorException( + throw new MStabXmlDocException( "Model horizontal balance does not support 2d-geometries"); } - failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea = new HorizontalBalanceArea(); - failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea.XLeft = - scenario.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; - failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea.XRight = - scenario.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; - failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea.YTop = scenario.RiverLevel; - failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea.YBottom = - profile1D.InBetweenAquiferLayer?.TopLevel ?? profile1D.BottomAquiferLayer.TopLevel; + failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea = new HorizontalBalanceArea + { + XLeft = scenario.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X, + XRight = scenario.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, + YTop = scenario.RiverLevel, + YBottom = profile1D.InBetweenAquiferLayer?.TopLevel ?? profile1D.BottomAquiferLayer.TopLevel + }; int planeCount = (int)(Math.Round((failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea.YTop - failureMechanismParametersMStab.MStabParameters.HorizontalBalanceArea.YBottom) / 0.25)); @@ -139,9 +156,9 @@ failureMechanismParametersMStab.MStabParameters.CalculationOptions.ZonesType.Equals( MStabZonesType.ZoneAreas)) { - double? dikeTableHeight = scenario.DikeTableHeight ?? scenario.Location.SurfaceLine.GetDefaultDikeTableHeight() ?? null; + double? dikeTableHeight = scenario.DikeTableHeight ?? scenario.Location.SurfaceLine.GetDefaultDikeTableHeight(); if (!dikeTableHeight.HasValue) - throw new DamFailureMechanismeCalculatorException("Surface line has no dike table height."); + throw new MStabXmlDocException("Surface line has no dike table height."); failureMechanismParametersMStab.MStabParameters.ZoneAreas = new MStabZoneAreas { DikeTableHeight = dikeTableHeight.Value, @@ -218,8 +235,8 @@ } DamMStabAssembler assembler = new DamMStabAssembler(); - XDocument mstabXML = assembler.CreateDataTransferObject(failureMechanismParametersMStab); - return mstabXML; + XDocument mstabXml = assembler.CreateDataTransferObject(failureMechanismParametersMStab); + return mstabXml; } private static MStabForbiddenZone CreateForbiddenZone(DesignScenario scenario, SurfaceLine2 surfaceLine) @@ -242,14 +259,15 @@ }; } - private static void ConsistencyCheck(DesignScenario scenario, SoilProfile1D soilProfile, string soilGeometry2DName) + private static void ConsistencyCheck(DesignScenario scenario, SoilProfile1D soilProfile) { if (soilProfile != null) { if (soilProfile.BottomAquiferLayer == null) { - throw new DamFailureMechanismeCalculatorException( - String.Format("Soilprofile '{0}' does not contain aquifer layers.", soilProfile.Name)); + throw new MStabXmlDocException(String.Format( + "Scenario {0}: Soilprofile '{1}' does not contain aquifer layers.", + scenario.LocationScenarioID, soilProfile.Name)); } } } Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/RequiredEntityNotExistException.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Geometry2DSectionParameters.cs =================================================================== diff -u -r877 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Geometry2DSectionParameters.cs (.../Geometry2DSectionParameters.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Geometry2DSectionParameters.cs (.../Geometry2DSectionParameters.cs) (revision 962) @@ -57,7 +57,7 @@ /// Assigns the specified geometry2 d section parameters. /// /// The geometry2 d section parameters. - public void Assign(Geometry2DSectionParameters geometry2DSectionParameters) + private void Assign(Geometry2DSectionParameters geometry2DSectionParameters) { SoilGeometry2DName = geometry2DSectionParameters.SoilGeometry2DName; XCoordinateSection = geometry2DSectionParameters.XCoordinateSection; Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/LogHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/DamProjectData.cs =================================================================== diff -u -r929 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/DamProjectData.cs (.../DamProjectData.cs) (revision 929) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/DamProjectData.cs (.../DamProjectData.cs) (revision 962) @@ -24,7 +24,6 @@ using System.Linq; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General.Results; -using Deltares.DamEngine.Data.General.SchematizationFactor; using Deltares.DamEngine.Data.General.Sensors; using Deltares.DamEngine.Data.RWScenarios; using Deltares.DamEngine.Data.Standard.Calculation; @@ -46,7 +45,6 @@ private DamProjectType damProjectType = DamProjectType.Operational; private ProgramType programType = ProgramType.MStab; private List jobs = new List(); - private SchematizationFactorData schematizationFactorData = new SchematizationFactorData(); private List calculations = null; // will be created and initialized in property private List designCalculations = null; private List schematizationFactors = null; @@ -72,26 +70,13 @@ public static string ProjectMap = ""; - public static string OldProjectWorkingPath - { - get; - set; - } - // TODO: FM this is failure mechanism specific code and should be moved to ..\KernelWrappers public static string MStabExePath { get; set; } - // TODO: FM this is failure mechanism specific code and should be moved to ..\KernelWrappers - public static string SlopeWExePath - { - get; - set; - } - public virtual string Name { get { return String.Format(LocalizationManager.GetTranslatedText(this, "WaterBoard")); } @@ -320,15 +305,6 @@ } } - public SchematizationFactorData SchematizationFactorData - { - get { return schematizationFactorData; } - set - { - schematizationFactorData = value; - } - } - public CalculationResult Validate() { try Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/ThrowHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Geometry2DTo1DConverter.cs =================================================================== diff -u -r956 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Geometry2DTo1DConverter.cs (.../Geometry2DTo1DConverter.cs) (revision 956) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/General/Geometry2DTo1DConverter.cs (.../Geometry2DTo1DConverter.cs) (revision 962) @@ -101,15 +101,15 @@ XCoordinateSection = xCoordinate + XOffsetSoilGeometry2DOrigin }; XDocument doc = assembler.CreateDataTransferObject(geometry2DSectionParameters); - String LXMLInput = doc.ToString(); + String lxmlInput = doc.ToString(); // Following file for debugging // SaveXMLInputFile(xCoordinate, doc); - StringBuilder LXMLOutput = null; + StringBuilder lxmlOutput; var stabilityServiceAgent = new StabilityServiceAgent(); - stabilityServiceAgent.ConvertGeometry2DTo1D(LXMLInput, out LXMLOutput); - XDocument docOut = XDocument.Parse(LXMLOutput.ToString()); + stabilityServiceAgent.ConvertGeometry2DTo1D(lxmlInput, out lxmlOutput); + XDocument docOut = XDocument.Parse(lxmlOutput.ToString()); Geometry2DSectionParameters geometry2DSectionParametersOut = assembler.CreateOutputObject(docOut); SoilProfile1D soilProfile = geometry2DSectionParametersOut.SoilProfile; AddDikeMaterialIfSurfaceLineAboveGeometrySurface(ref soilProfile, xCoordinate); @@ -122,7 +122,7 @@ /// /// The x coordinate. /// The document. - private void SaveXMLInputFile(double xCoordinate, XDocument doc) + private void SaveXmlInputFile(double xCoordinate, XDocument doc) { string directoryGeometry2DSectionParameters = "Geometry2DSectionParameters"; string filenameGeometry2DSectionParameters = String.Format("Geometry2DSectionParameters_{0}_{1}.xml", Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/Interfaces/DGSDAMSlopeWInterface.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj =================================================================== diff -u -r941 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 941) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 962) @@ -70,7 +70,6 @@ - @@ -184,6 +183,7 @@ + Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesAssessmentRegional/RWScenariosCalculation.cs =================================================================== diff -u -r949 -r962 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesAssessmentRegional/RWScenariosCalculation.cs (.../RWScenariosCalculation.cs) (revision 949) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesAssessmentRegional/RWScenariosCalculation.cs (.../RWScenariosCalculation.cs) (revision 962) @@ -22,20 +22,17 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; using System.Text.RegularExpressions; -using Deltares.DamEngine.Calculators.SchematizationFactor; +using Deltares.DamEngine.Calculators.Dikes_Assessment_Regional; using Deltares.DamEngine.Data.General; -using Deltares.DamEngine.Data.General.Results; -using Deltares.DamEngine.Data.General.SchematizationFactor; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.RWScenarios; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Language; using Deltares.DamEngine.Data.Standard.Logging; -namespace Deltares.DamEngine.Calculators.Dikes_Assessment_Regional +namespace Deltares.DamEngine.Calculators.DikesAssessmentRegional { /// /// Exception for RWScenariosCalculation class @@ -57,8 +54,7 @@ private Dictionary runningJobs = new Dictionary(); private bool isSkipStabilityCalculation = false; - private SchematizationFactorData schematizationFactorData; - + public PipingModelType PipingModelType { get; set; } public MStabParameters MStabParameters { get; set; } @@ -180,12 +176,6 @@ set { maxCalculationCores = value; } } - public SchematizationFactorData SchematizationFactorData - { - get { return schematizationFactorData; } - set { schematizationFactorData = value; } - } - private List FillQueue() { List tasks = new List(); @@ -338,7 +328,7 @@ // } // //job.SoilGeometryProbability.SoilProfile1D.EnsureUniqueLayerIds(); // var calculationName = GetCalculationNameForPipingCalculator(job); -// calculator.FilenameCalculation = Path.Combine(Path.Combine(DamProjectData.OldProjectWorkingPath, job.FailureMechanismType.ToString()), calculationName); +// calculator.FilenameCalculation = Path.Combine(Path.Combine(DamProjectData.ProjectWorkingPath, job.FailureMechanismType.ToString()), calculationName); // calculator.IsHydraulicShortcut = (job.HydraulicShortcutType == HydraulicShortcutType.HydraulicShortcut); // double? pipingFactor = calculator.CalculatePipingFactor(job.Location, job.Location.LocalXZSurfaceLine2, job.SoilGeometryProbability.SoilProfile1D, waterLevel); // job.BaseFileName = calculator.FilenameCalculation; @@ -438,7 +428,7 @@ // calculator.SaveToFile(damCalculation.FailureMechanismParametersMStab); // string inputFile = damCalculation.FailureMechanismParametersMStab.MStabParameters.ProjectFileName; // - // job.BaseFileName = inputFile.Replace(DamProject.OldProjectWorkingPath, @"").Replace(".sti", ""); + // job.BaseFileName = inputFile.Replace(DamProject.ProjectWorkingPath, @"").Replace(".sti", ""); // calculator.Load(inputFile); // job.CalculationResult = calculator.Run(); @@ -545,11 +535,6 @@ scenariosResult.SafetyFactor = double.NaN; } - if (schematizationFactorData != null) - { - var results = AddSchematizationFactors(location, scenariosResult); - evaluationJob.SchematizationFactorResults.Add(results); - } // scenariosResult are the results of all scenarios for one location. this.evaluationJob.Results.Add(scenariosResult); @@ -567,17 +552,6 @@ } - private RWSchematizationFactorsResult AddSchematizationFactors(Location location, RWScenariosResult scenariosResult) - { - var schematizationFactorCalculation = new SchematizationFactorCalculation(); - schematizationFactorCalculation.ScenariosResult = scenariosResult; - schematizationFactorCalculation.Location = location; - schematizationFactorCalculation.SchematizationFactorData = SchematizationFactorData; - schematizationFactorCalculation.DetrimentFactor = location.DetrimentFactor; - var results = schematizationFactorCalculation.CalculateSchematizationFactorResults(); - return results; - } - private void CombineProfiles(RWScenarioResult scenarioResult) { // combine results of profiles Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Data/General/SchematizationFactor/SchematizationFactorData.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 962 refers to a dead (removed) revision in file `DamEngine/trunk/src/Deltares.DamEngine.Calculators/SchematizationFactor/SchematizationFactorCalculation.cs'. Fisheye: No comparison available. Pass `N' to diff?