/// <summary> /// Configures a <see cref="MacroStabilityInwardsFailureMechanism"/> to a fully configured failure /// mechanism with all possible parent and nested calculation configurations. /// </summary> /// <param name="failureMechanism">The failure mechanism to be updated.</param> /// <param name="hydraulicBoundaryLocation">The hydraulic boundary location used /// by calculations.</param> /// <remarks>This method assumes <paramref name="failureMechanism"/> is a newly /// created instance.</remarks> public static void ConfigureFailureMechanismWithAllCalculationConfigurations(MacroStabilityInwardsFailureMechanism failureMechanism, HydraulicBoundaryLocation hydraulicBoundaryLocation) { var surfaceLine1 = new MacroStabilityInwardsSurfaceLine("Line A") { ReferenceLineIntersectionWorldPoint = new Point2D(0, 5) }; surfaceLine1.SetGeometry(new[] { new Point3D(0, 0, 0), new Point3D(0, 10, 0) }); var surfaceLine2 = new MacroStabilityInwardsSurfaceLine("Line B") { ReferenceLineIntersectionWorldPoint = new Point2D(10, 5) }; surfaceLine2.SetGeometry(new[] { new Point3D(10, 0, 0), new Point3D(10, 10, 0) }); failureMechanism.SurfaceLines.AddRange(new[] { surfaceLine1, surfaceLine2 }, "some/path/to/surfacelines"); var stochasticSoilModel1 = new MacroStabilityInwardsStochasticSoilModel("A", new[] { new Point2D(-5, 5), new Point2D(5, 5) }, new[] { new MacroStabilityInwardsStochasticSoilProfile(1.0, new MacroStabilityInwardsSoilProfile1D("test", 3, new[] { new MacroStabilityInwardsSoilLayer1D(4) })) }); var stochasticSoilModel2 = new MacroStabilityInwardsStochasticSoilModel("C", new[] { new Point2D(5, 5), new Point2D(15, 5) }, new[] { new MacroStabilityInwardsStochasticSoilProfile(1.0, new MacroStabilityInwardsSoilProfile2D("test", new[] { new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(0, 0), new Point2D(1, 0), new Point2D(0, 0) })) }, Enumerable.Empty <MacroStabilityInwardsPreconsolidationStress>())) }); failureMechanism.StochasticSoilModels.AddRange(new[] { stochasticSoilModel1, stochasticSoilModel2 }, "some/path/to/stochasticsoilmodels"); var calculation = new MacroStabilityInwardsCalculationScenario(); var calculationWithOutput = new MacroStabilityInwardsCalculationScenario { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation, SurfaceLine = surfaceLine1, StochasticSoilModel = stochasticSoilModel1 }, Output = MacroStabilityInwardsOutputTestFactory.CreateOutput() }; var calculationWithSurfaceLineAndSoilModel = new MacroStabilityInwardsCalculationScenario { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation, SurfaceLine = surfaceLine1, StochasticSoilModel = stochasticSoilModel1, StochasticSoilProfile = stochasticSoilModel1.StochasticSoilProfiles.ElementAt(0) } }; var calculationWithOutputAndHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation, SurfaceLine = surfaceLine2, StochasticSoilModel = stochasticSoilModel2 }, Output = MacroStabilityInwardsOutputTestFactory.CreateOutput() }; var calculationWithHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; var calculationWithSurfaceLineAndStochasticSoilModel = new MacroStabilityInwardsCalculationScenario { InputParameters = { SurfaceLine = surfaceLine1, StochasticSoilModel = stochasticSoilModel2, StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles.ElementAt(0) } }; var subCalculation = new MacroStabilityInwardsCalculationScenario(); var subCalculationWithOutput = new MacroStabilityInwardsCalculationScenario { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation, SurfaceLine = surfaceLine2, StochasticSoilModel = stochasticSoilModel2, StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles.ElementAt(0) }, Output = MacroStabilityInwardsOutputTestFactory.CreateOutput() }; var subCalculationWithOutputAndHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation, SurfaceLine = surfaceLine1, StochasticSoilModel = stochasticSoilModel1, StochasticSoilProfile = stochasticSoilModel1.StochasticSoilProfiles.ElementAt(0) }, Output = MacroStabilityInwardsOutputTestFactory.CreateOutput() }; var subCalculationWithHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario { InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; var subCalculationWithSurfaceLineAndStochasticSoilModel = new MacroStabilityInwardsCalculationScenario { InputParameters = { SurfaceLine = surfaceLine1, StochasticSoilModel = stochasticSoilModel2, StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles.ElementAt(0) } }; failureMechanism.CalculationsGroup.Children.Add(calculation); failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput); failureMechanism.CalculationsGroup.Children.Add(calculationWithSurfaceLineAndSoilModel); failureMechanism.CalculationsGroup.Children.Add(calculationWithOutputAndHydraulicBoundaryLocation); failureMechanism.CalculationsGroup.Children.Add(calculationWithSurfaceLineAndStochasticSoilModel); failureMechanism.CalculationsGroup.Children.Add(calculationWithHydraulicBoundaryLocation); failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup { Children = { subCalculation, subCalculationWithOutput, subCalculationWithOutputAndHydraulicBoundaryLocation, subCalculationWithHydraulicBoundaryLocation, subCalculationWithSurfaceLineAndStochasticSoilModel } }); var section1 = new FailureMechanismSection("1", new[] { new Point2D(-1, -1), new Point2D(5, 5) }); var section2 = new FailureMechanismSection("2", new[] { new Point2D(5, 5), new Point2D(15, 15) }); failureMechanism.SetSections(new[] { section1, section2 }, "path/to/sections"); }