public void GetProperties_WithData_ReturnExpectedValues() { // Setup var layerOne = new PipingSoilLayer(4); var layerTwo = new PipingSoilLayer(2); IEnumerable <PipingSoilLayer> layers = new[] { layerOne, layerTwo }; var random = new Random(21); double bottom = random.NextDouble(); double probability = random.NextDouble(); var soilProfileType = random.NextEnumValue <SoilProfileType>(); var soilProfile = new PipingSoilProfile("<some name>", bottom, layers, soilProfileType); var stochasticSoilProfile = new PipingStochasticSoilProfile(probability, soilProfile); // Call var properties = new PipingStochasticSoilProfileProperties(stochasticSoilProfile); // Assert Assert.AreEqual(soilProfile.Name, properties.Name); Assert.AreEqual(soilProfile.Name, properties.ToString()); Assert.AreEqual(2, properties.Layers.Length); Assert.AreSame(layerOne, properties.Layers[0].Data); Assert.AreSame(layerTwo, properties.Layers[1].Data); Assert.AreEqual(2, properties.Bottom.NumberOfDecimalPlaces); Assert.AreEqual(bottom, properties.Bottom, properties.Bottom.GetAccuracy()); Assert.AreEqual(2, properties.Probability.NumberOfDecimalPlaces); Assert.AreEqual(probability * 100, properties.Probability, properties.Probability.GetAccuracy()); Assert.AreEqual(soilProfileType, properties.Type); }
private static IEnumerable <string> ValidateAquiferLayers(PipingInput input) { double surfaceLevel = input.SurfaceLine.GetZAtL(input.ExitPointL); PipingSoilProfile pipingSoilProfile = input.StochasticSoilProfile.SoilProfile; if (!pipingSoilProfile.GetConsecutiveAquiferLayersBelowLevel(surfaceLevel).Any()) { yield return(Resources.PipingCalculationService_ValidateInput_No_aquifer_layer_at_ExitPointL_under_SurfaceLine); } else { VariationCoefficientLogNormalDistribution darcyPermeability = DerivedPipingInput.GetDarcyPermeability(input); if (IsInvalidDistributionValue(darcyPermeability.Mean) || IsInvalidDistributionValue(darcyPermeability.CoefficientOfVariation)) { yield return(Resources.PipingCalculationService_ValidateInput_Cannot_derive_DarcyPermeability); } VariationCoefficientLogNormalDistribution diameter70 = DerivedPipingInput.GetDiameterD70(input); if (IsInvalidDistributionValue(diameter70.Mean) || IsInvalidDistributionValue(diameter70.CoefficientOfVariation)) { yield return(Resources.PipingCalculationService_ValidateInput_Cannot_derive_Diameter70); } } }
/// <summary> /// Retrieves the collection of aquifer layers below a certain <paramref name="level"/>. /// </summary> /// <param name="soilProfile">The soil profile containing <see cref="PipingSoilLayer"/> to consider.</param> /// <param name="level">The level under which the aquifer layers are sought.</param> /// <returns>The collection of consecutive aquifer layer(s) (partly) under the <paramref name="level"/>.</returns> public static IEnumerable <PipingSoilLayer> GetConsecutiveAquiferLayersBelowLevel(this PipingSoilProfile soilProfile, double level) { return(GetConsecutiveLayers(soilProfile, level, true)); }
private static bool IsSoilLayerPartlyBelowLevel(PipingSoilProfile soilProfile, PipingSoilLayer pipingSoilLayer, double level) { return(pipingSoilLayer.Top < level || pipingSoilLayer.Top - soilProfile.GetLayerThickness(pipingSoilLayer) < level); }
/// <summary> /// Updates the name of <paramref name="chartData"/> based on <paramref name="soilProfile"/>. /// </summary> /// <param name="chartData">The <see cref="ChartDataCollection"/> to update the name for.</param> /// <param name="soilProfile">The <see cref="PipingSoilProfile"/> used for obtaining the name.</param> /// <remarks>A default name is set when <paramref name="soilProfile"/> is <c>null</c>.</remarks> public static void UpdateSoilProfileChartDataName(ChartDataCollection chartData, PipingSoilProfile soilProfile) { chartData.Name = soilProfile != null ? soilProfile.Name : RiskeerCommonFormsResources.StochasticSoilProfileProperties_DisplayName; }
/// <summary> /// Transforms the generic <paramref name="stochasticSoilProfile"/> into <see cref="PipingStochasticSoilProfile"/>. /// </summary> /// <param name="stochasticSoilProfile">The stochastic soil profile to use in the transformation.</param> /// <param name="soilProfile">The transformed piping soil profile.</param> /// <returns>A new <paramref name="soilProfile"/> based on the given data.</returns> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> /// <exception cref="ImportedDataTransformException">Thrown when <see cref="StochasticSoilProfile"/> /// could not be transformed.</exception> public static PipingStochasticSoilProfile Transform(StochasticSoilProfile stochasticSoilProfile, PipingSoilProfile soilProfile) { if (stochasticSoilProfile == null) { throw new ArgumentNullException(nameof(stochasticSoilProfile)); } if (soilProfile == null) { throw new ArgumentNullException(nameof(soilProfile)); } try { return(new PipingStochasticSoilProfile(stochasticSoilProfile.Probability, soilProfile)); } catch (ArgumentOutOfRangeException e) { throw new ImportedDataTransformException(e.Message, e); } }
/// <summary> /// Calculates the thickness of the coverage layer based on the values of partial piping input. /// </summary> /// <param name="waterVolumetricWeight">The volumetric weight of water.</param> /// <param name="phreaticLevelExit">The design value of the phreatic level at the exit point.</param> /// <param name="exitPointL">The l-coordinate of the exit point.</param> /// <param name="surfaceLine">A surface line.</param> /// <param name="soilProfile">A soil profile.</param> /// <returns>The thickness of the coverage layer, or <see cref="double.NaN"/> if the thickness could not be calculated.</returns> public static double CalculateEffectiveThicknessCoverageLayer(double waterVolumetricWeight, RoundedDouble phreaticLevelExit, RoundedDouble exitPointL, PipingSurfaceLine surfaceLine, PipingSoilProfile soilProfile) { try { var calculatorInput = new PipingCalculatorInput( new PipingCalculatorInput.ConstructionProperties { WaterVolumetricWeight = waterVolumetricWeight, PhreaticLevelExit = phreaticLevelExit, ExitPointXCoordinate = exitPointL, SurfaceLine = surfaceLine, SoilProfile = soilProfile }); return(new PipingCalculator(calculatorInput, PipingSubCalculatorFactory.Instance).CalculateEffectiveThicknessCoverageLayer()); } catch (PipingCalculatorException) { return(double.NaN); } }
/// <summary> /// Obtains the <see cref="PipingSoilProfileEntity"/> which was registered for the given /// <paramref name="model"/>. /// </summary> /// <param name="model">The <see cref="PipingSoilProfileEntity"/> for which a create /// operation has been registered.</param> /// <returns>The constructed <see cref="PipingSoilProfile"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="model"/> is <c>null</c>.</exception> /// <exception cref="InvalidOperationException">Thrown when no create operation /// has been registered for <paramref name="model"/>.</exception> /// <remarks>Use <see cref="Contains(PipingSoilProfile)"/> to find out whether a /// create operation has been registered for <paramref name="model"/>.</remarks> internal PipingSoilProfileEntity Get(PipingSoilProfile model) { return(Get(pipingSoilProfiles, model)); }
/// <summary> /// Registers a create operation for <paramref name="model"/> and the <paramref name="entity"/> /// that was constructed with the information. /// </summary> /// <param name="entity">The <see cref="PipingSoilProfileEntity"/> to be registered.</param> /// <param name="model">The <see cref="PipingSoilProfile"/> to be registered.</param> /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception> internal void Register(PipingSoilProfileEntity entity, PipingSoilProfile model) { Register(pipingSoilProfiles, entity, model); }
private static bool IsSame(PipingSoilProfile pipingSoilProfile, PipingSoilProfile otherPipingSoilProfile) { return(pipingSoilProfile.Name.Equals(otherPipingSoilProfile.Name) && pipingSoilProfile.SoilProfileSourceType.Equals(otherPipingSoilProfile.SoilProfileSourceType)); }
private static Point2D[] CreateSurfaceLineWideSoilLayer(Point2D[] surfaceLineLocalGeometry, PipingSoilLayer soilLayer, PipingSoilProfile soilProfile) { Point2D firstSurfaceLinePoint = surfaceLineLocalGeometry.First(); Point2D lastSurfaceLinePoint = surfaceLineLocalGeometry.Last(); double startX = firstSurfaceLinePoint.X; double endX = lastSurfaceLinePoint.X; double topLevel = soilLayer.Top; double bottomLevel = topLevel - soilProfile.GetLayerThickness(soilLayer); return(new[] { new Point2D(startX, topLevel), new Point2D(endX, topLevel), new Point2D(endX, bottomLevel), new Point2D(startX, bottomLevel) }); }
private static IEnumerable <Point2D> CreateSurfaceLinePolygonAroundSoilLayer(IEnumerable <Point2D> surfaceLineLocalGeometry, PipingSoilLayer soilLayer, PipingSoilProfile soilProfile) { double topLevel = soilLayer.Top; double bottomLevel = topLevel - soilProfile.GetLayerThickness(soilLayer); double closingSurfaceLineToPolygonBottomLevel = Math.Min(surfaceLineLocalGeometry.Select(p => p.Y).Min(), bottomLevel) - 1; return(AdvancedMath2D.CompleteLineToPolygon(surfaceLineLocalGeometry, closingSurfaceLineToPolygonBottomLevel).ToArray()); }
private static bool IsSurfaceLineBelowSoilLayer(IEnumerable <Point2D> surfaceLineLocalGeometry, PipingSoilLayer soilLayer, PipingSoilProfile soilProfile) { double topLevel = soilLayer.Top; return(surfaceLineLocalGeometry.Select(p => p.Y).Max() <= topLevel - soilProfile.GetLayerThickness(soilLayer)); }
private static IEnumerable <Point2D[]> GetSoilLayerWithSurfaceLineIntersection(Point2D[] surfaceLineLocalGeometry, PipingSoilLayer soilLayer, PipingSoilProfile soilProfile) { IEnumerable <Point2D> surfaceLineAsPolygon = CreateSurfaceLinePolygonAroundSoilLayer(surfaceLineLocalGeometry, soilLayer, soilProfile); Point2D[] soilLayerAsPolygon = CreateSurfaceLineWideSoilLayer(surfaceLineLocalGeometry, soilLayer, soilProfile); return(AdvancedMath2D.PolygonIntersectionWithPolygon(surfaceLineAsPolygon, soilLayerAsPolygon)); }
/// <summary> /// Create a collection of soil layer points (areas) in 2D space based on the provided <paramref name="soilLayer"/> and <paramref name="soilProfile"/>. /// </summary> /// <param name="soilLayer">The <see cref="PipingSoilLayer"/> to create the soil layer points for.</param> /// <param name="soilProfile">The <see cref="PipingSoilProfile"/> that contains <paramref name="soilLayer"/>.</param> /// <param name="surfaceLine">The <see cref="PipingSurfaceLine"/> that may intersect with /// the <paramref name="soilLayer"/> and by doing that restricts the drawn height of it.</param> /// <returns>A collection which contains one or more (in the case of <paramref name="surfaceLine"/> /// splitting the layer in multiple parts) arrays of points in 2D space or an empty array when: /// <list type="bullet"> /// <item><paramref name="soilLayer"/> is <c>null</c>;</item> /// <item><paramref name="soilProfile"/> is <c>null</c>;</item> /// <item><paramref name="surfaceLine"/> is <c>null</c>;</item> /// <item>the <paramref name="surfaceLine"/> is below the <paramref name="soilLayer"/>.</item> /// </list> /// </returns> public static IEnumerable <Point2D[]> CreateSoilLayerAreas(PipingSoilLayer soilLayer, PipingSoilProfile soilProfile, PipingSurfaceLine surfaceLine) { if (soilLayer == null || soilProfile == null || surfaceLine == null) { return(Enumerable.Empty <Point2D[]>()); } Point2D[] surfaceLineLocalGeometry = surfaceLine.LocalGeometry.ToArray(); if (IsSurfaceLineAboveSoilLayer(surfaceLineLocalGeometry, soilLayer)) { return(new List <Point2D[]> { CreateSurfaceLineWideSoilLayer(surfaceLineLocalGeometry, soilLayer, soilProfile) }); } if (IsSurfaceLineBelowSoilLayer(surfaceLineLocalGeometry, soilLayer, soilProfile)) { return(Enumerable.Empty <Point2D[]>()); } return(GetSoilLayerWithSurfaceLineIntersection(surfaceLineLocalGeometry, soilLayer, soilProfile)); }
/// <summary> /// Retrieves the collection of aquitard layers below a certain <paramref name="level"/>. /// </summary> /// <param name="soilProfile">The soil profile containing <see cref="PipingSoilLayer"/> to consider.</param> /// <param name="level">The level under which the aquitard layers are sought.</param> /// <returns>The collection of consecutive aquitard layer(s) (partly) under the <paramref name="level"/>.</returns> public static IEnumerable <PipingSoilLayer> GetConsecutiveCoverageLayersBelowLevel(this PipingSoilProfile soilProfile, double level) { PipingSoilLayer topAquiferLayer = soilProfile.GetConsecutiveAquiferLayersBelowLevel(level).FirstOrDefault(); if (topAquiferLayer != null) { PipingSoilLayer[] aquitardLayers = GetConsecutiveLayers(soilProfile, level, false).ToArray(); if (aquitardLayers.Any() && topAquiferLayer.Top < aquitardLayers.First().Top) { return(aquitardLayers); } } return(Enumerable.Empty <PipingSoilLayer>()); }
public void Transform_SoilProfile2DWithMultipleLayersOnlyOuterLoop_ReturnsProfileWithBottomAndLayers() { // Setup const string profileName = "SomeProfile"; const long pipingSoilProfileId = 1234L; var profile = new SoilProfile2D(pipingSoilProfileId, profileName, new List <SoilLayer2D> { SoilLayer2DTestFactory.CreateSoilLayer2D( new List <Segment2D[]>(), Segment2DLoopCollectionHelper.CreateFromString( string.Join(Environment.NewLine, "10", "...", "...", "...", "...", "...", "...", "...", "1.2", "4.3", "..."))), SoilLayer2DTestFactory.CreateSoilLayer2D( new List <Segment2D[]>(), Segment2DLoopCollectionHelper.CreateFromString( string.Join(Environment.NewLine, "10", "...", "...", "...", "...", "...", "4.3", "...", "1.2", "...", "..."))), SoilLayer2DTestFactory.CreateSoilLayer2D( new List <Segment2D[]>(), Segment2DLoopCollectionHelper.CreateFromString( string.Join(Environment.NewLine, "10", "...", "1.2", "...", "...", "...", "4.3", "...", "...", "...", "..."))) }, Enumerable.Empty <PreconsolidationStress>()) { IntersectionX = 1.0 }; // Call PipingSoilProfile transformed = PipingSoilProfileTransformer.Transform(profile); // Assert Assert.AreEqual(profileName, transformed.Name); Assert.AreEqual(SoilProfileType.SoilProfile2D, transformed.SoilProfileSourceType); Assert.AreEqual(3, transformed.Layers.Count()); CollectionAssert.AreEquivalent(new[] { 2.0, 4.0, 8.0 }, transformed.Layers.Select(rl => rl.Top)); Assert.AreEqual(1.0, transformed.Bottom); }
public void GetValidationWarnings_MultipleCoverageLayers_ReturnsMessage() { // Setup var random = new Random(21); const double belowPhreaticLevelDeviation = 0.5; const int belowPhreaticLevelShift = 10; const double belowPhreaticLevelMeanBase = 15.0; var topCoverageLayer = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false, BelowPhreaticLevel = new LogNormalDistribution { Mean = (RoundedDouble)(belowPhreaticLevelMeanBase + belowPhreaticLevelShift + random.NextDouble()), StandardDeviation = (RoundedDouble)belowPhreaticLevelDeviation, Shift = (RoundedDouble)belowPhreaticLevelShift } }; var middleCoverageLayer = new PipingSoilLayer(8.5) { IsAquifer = false, BelowPhreaticLevel = new LogNormalDistribution { Mean = (RoundedDouble)(belowPhreaticLevelMeanBase + belowPhreaticLevelShift + random.NextDouble()), StandardDeviation = (RoundedDouble)belowPhreaticLevelDeviation, Shift = (RoundedDouble)belowPhreaticLevelShift } }; var bottomAquiferLayer = new PipingSoilLayer(5.0) { IsAquifer = true, Permeability = new VariationCoefficientLogNormalDistribution { Mean = (RoundedDouble)1, CoefficientOfVariation = (RoundedDouble)0.5 }, DiameterD70 = new VariationCoefficientLogNormalDistribution { Mean = (RoundedDouble)1e-4, CoefficientOfVariation = (RoundedDouble)0 } }; var profile = new PipingSoilProfile(string.Empty, 0.0, new[] { topCoverageLayer, middleCoverageLayer, bottomAquiferLayer }, SoilProfileType.SoilProfile1D); calculation.InputParameters.StochasticSoilProfile = new PipingStochasticSoilProfile(0.0, profile); // Call IEnumerable <string> messages = PipingCalculationValidationHelper.GetValidationWarnings(calculation.InputParameters); // Assert Assert.AreEqual(1, messages.Count()); const string expectedMessage = "Meerdere aaneengesloten deklagen gevonden. De grondeigenschappen worden bepaald door het nemen van een gewogen gemiddelde, mits de standaardafwijkingen en verschuivingen voor alle lagen gelijk zijn."; Assert.AreEqual(expectedMessage, messages.ElementAt(0)); }
/// <summary> /// Checks whether a create operations has been registered for the given <paramref name="model"/>. /// </summary> /// <param name="model">The <see cref="PipingSoilProfile"/> to check for.</param> /// <returns><c>true</c> if the <see cref="model"/> was registered before, <c>false</c> otherwise.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="model"/> is <c>null</c>.</exception> internal bool Contains(PipingSoilProfile model) { return(ContainsValue(pipingSoilProfiles, model)); }
public void GenerateCalculationItemsStructure_SoilModelGeometryNotIntersecting_LogWarning() { // Setup var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[] { new PipingSoilLayer(-5.0), new PipingSoilLayer(-2.0), new PipingSoilLayer(1.0) }, SoilProfileType.SoilProfile1D); var soilProfile2 = new PipingSoilProfile("Profile 2", -8.0, new[] { new PipingSoilLayer(-4.0), new PipingSoilLayer(0.0), new PipingSoilLayer(4.0) }, SoilProfileType.SoilProfile1D); var soilModel = new PipingStochasticSoilModel("A", new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) }, new[] { new PipingStochasticSoilProfile(0.3, soilProfile1), new PipingStochasticSoilProfile(0.7, soilProfile2) }); PipingStochasticSoilModel[] availableSoilModels = { soilModel }; const string testName = "testName"; var surfaceLine = new PipingSurfaceLine(testName); surfaceLine.SetGeometry(new[] { new Point3D(0.0, 1.0, 0.0), new Point3D(2.5, 1.0, 1.0), new Point3D(5.0, 1.0, 0.0) }); PipingSurfaceLine[] surfaceLines = { surfaceLine }; IEnumerable <ICalculationBase> result = null; // Call void Call() { result = PipingCalculationConfigurationHelper.GenerateCalculationItemsStructure( surfaceLines, true, true, availableSoilModels).ToArray(); } // Assert var expectedMessage = Tuple.Create( $"Geen ondergrondschematisaties gevonden voor profielschematisatie '{testName}'. De profielschematisatie is overgeslagen.", LogLevelConstant.Warn); TestHelper.AssertLogMessageWithLevelIsGenerated(Call, expectedMessage); CollectionAssert.IsEmpty(result); }
public void Constructor_WithConstructionProperties_PropertiesAreSet() { // Setup var random = new Random(22); double volumetricWeightOfWaterValue = random.NextDouble(); double saturatedVolumicWeightOfCoverageLayer = random.NextDouble(); double modelFactorUpliftValue = random.NextDouble(); double hRiverValue = random.NextDouble(); double phiExit = random.NextDouble(); double rExitValue = random.NextDouble(); double hExitValue = random.NextDouble(); double ichValue = random.NextDouble(); double dTotalValue = random.NextDouble(); double effectiveThicknessCoverageLayerValue = random.NextDouble(); double sellmeijerModelFactorValue = random.NextDouble(); double reductionFactorValue = random.NextDouble(); double seepageLengthValue = random.NextDouble(); double sandParticlesVolumicWeightValue = random.NextDouble(); double whitesDragCoefficientValue = random.NextDouble(); double diameter70Value = random.NextDouble(); double darcyPermeabilityValue = random.NextDouble(); double waterKinematicViscosityValue = random.NextDouble(); double gravityValue = random.NextDouble(); double thicknessAquiferLayerValue = random.NextDouble(); double meanDiameter70Value = random.NextDouble(); double beddingAngleValue = random.NextDouble(); double exitPointXCoordinate = random.NextDouble(); var surfaceLine = new PipingSurfaceLine(string.Empty); var soilProfile = new PipingSoilProfile(string.Empty, random.NextDouble(), new[] { new PipingSoilLayer(random.NextDouble()) { IsAquifer = true } }, SoilProfileType.SoilProfile1D); // Call var input = new PipingCalculatorInput( new PipingCalculatorInput.ConstructionProperties { WaterVolumetricWeight = volumetricWeightOfWaterValue, SaturatedVolumicWeightOfCoverageLayer = saturatedVolumicWeightOfCoverageLayer, UpliftModelFactor = modelFactorUpliftValue, AssessmentLevel = hRiverValue, PiezometricHeadExit = phiExit, DampingFactorExit = rExitValue, PhreaticLevelExit = hExitValue, CriticalHeaveGradient = ichValue, ThicknessCoverageLayer = dTotalValue, EffectiveThicknessCoverageLayer = effectiveThicknessCoverageLayerValue, SellmeijerModelFactor = sellmeijerModelFactorValue, SellmeijerReductionFactor = reductionFactorValue, SeepageLength = seepageLengthValue, SandParticlesVolumicWeight = sandParticlesVolumicWeightValue, WhitesDragCoefficient = whitesDragCoefficientValue, Diameter70 = diameter70Value, DarcyPermeability = darcyPermeabilityValue, WaterKinematicViscosity = waterKinematicViscosityValue, Gravity = gravityValue, ThicknessAquiferLayer = thicknessAquiferLayerValue, MeanDiameter70 = meanDiameter70Value, BeddingAngle = beddingAngleValue, ExitPointXCoordinate = exitPointXCoordinate, SurfaceLine = surfaceLine, SoilProfile = soilProfile }); // Assert Assert.AreEqual(volumetricWeightOfWaterValue, input.WaterVolumetricWeight); Assert.AreEqual(saturatedVolumicWeightOfCoverageLayer, input.SaturatedVolumicWeightOfCoverageLayer); Assert.AreEqual(modelFactorUpliftValue, input.UpliftModelFactor); Assert.AreEqual(hRiverValue, input.AssessmentLevel); Assert.AreEqual(phiExit, input.PiezometricHeadExit); Assert.AreEqual(rExitValue, input.DampingFactorExit); Assert.AreEqual(hExitValue, input.PhreaticLevelExit); Assert.AreEqual(ichValue, input.CriticalHeaveGradient); Assert.AreEqual(dTotalValue, input.ThicknessCoverageLayer); Assert.AreEqual(effectiveThicknessCoverageLayerValue, input.EffectiveThicknessCoverageLayer); Assert.AreEqual(sellmeijerModelFactorValue, input.SellmeijerModelFactor); Assert.AreEqual(reductionFactorValue, input.SellmeijerReductionFactor); Assert.AreEqual(seepageLengthValue, input.SeepageLength); Assert.AreEqual(sandParticlesVolumicWeightValue, input.SandParticlesVolumicWeight); Assert.AreEqual(whitesDragCoefficientValue, input.WhitesDragCoefficient); Assert.AreEqual(diameter70Value, input.Diameter70); Assert.AreEqual(darcyPermeabilityValue, input.DarcyPermeability); Assert.AreEqual(waterKinematicViscosityValue, input.WaterKinematicViscosity); Assert.AreEqual(gravityValue, input.Gravity); Assert.AreEqual(thicknessAquiferLayerValue, input.ThicknessAquiferLayer); Assert.AreEqual(meanDiameter70Value, input.MeanDiameter70); Assert.AreEqual(beddingAngleValue, input.BeddingAngle); Assert.AreEqual(exitPointXCoordinate, input.ExitPointXCoordinate); Assert.AreSame(surfaceLine, input.SurfaceLine); Assert.AreSame(soilProfile, input.SoilProfile); }
public void GenerateCalculationItemsStructure_SoilProfileEqualNames_CalculationScenariosGetUniqueName() { // Setup var soilProfile1 = new PipingSoilProfile("Profile 1", -10.0, new[] { new PipingSoilLayer(-5.0), new PipingSoilLayer(-2.0), new PipingSoilLayer(1.0) }, SoilProfileType.SoilProfile1D); var soilProfile2 = new PipingSoilProfile("Profile 1", -8.0, new[] { new PipingSoilLayer(-4.0), new PipingSoilLayer(0.0), new PipingSoilLayer(4.0) }, SoilProfileType.SoilProfile1D); var soilProfile3 = new PipingSoilProfile("Profile 1", -8.0, new[] { new PipingSoilLayer(-4.0), new PipingSoilLayer(0.0), new PipingSoilLayer(4.0) }, SoilProfileType.SoilProfile1D); var soilModel = new PipingStochasticSoilModel("A", new[] { new Point2D(1.0, 0.0), new Point2D(5.0, 0.0) }, new[] { new PipingStochasticSoilProfile(0.3, soilProfile1), new PipingStochasticSoilProfile(0.2, soilProfile2), new PipingStochasticSoilProfile(0.5, soilProfile3) }); PipingStochasticSoilModel[] availableSoilModels = { soilModel }; var surfaceLine = new PipingSurfaceLine("Surface Line"); surfaceLine.SetGeometry(new[] { new Point3D(3.0, 5.0, 0.0), new Point3D(3.0, 0.0, 1.0), new Point3D(3.0, -5.0, 0.0) }); PipingSurfaceLine[] surfaceLines = { surfaceLine }; // Call IEnumerable <ICalculationBase> result = PipingCalculationConfigurationHelper.GenerateCalculationItemsStructure( surfaceLines, true, true, availableSoilModels).ToArray(); // Assert var group = (CalculationGroup)result.First(sl => sl.Name == surfaceLine.Name); var semiProbabilisticPipingCalculationScenario1 = (SemiProbabilisticPipingCalculationScenario)group.Children[0]; var probabilisticPipingCalculationScenario1 = (ProbabilisticPipingCalculationScenario)group.Children[1]; var semiProbabilisticPipingCalculationScenario2 = (SemiProbabilisticPipingCalculationScenario)group.Children[2]; var probabilisticPipingCalculationScenario2 = (ProbabilisticPipingCalculationScenario)group.Children[3]; var semiProbabilisticPipingCalculationScenario3 = (SemiProbabilisticPipingCalculationScenario)group.Children[4]; var probabilisticPipingCalculationScenario3 = (ProbabilisticPipingCalculationScenario)group.Children[5]; Assert.AreEqual($"{surfaceLine.Name} {soilProfile1.Name}", semiProbabilisticPipingCalculationScenario1.Name); Assert.AreEqual($"{surfaceLine.Name} {soilProfile1.Name}", probabilisticPipingCalculationScenario1.Name); Assert.AreEqual($"{surfaceLine.Name} {soilProfile2.Name} (1)", semiProbabilisticPipingCalculationScenario2.Name); Assert.AreEqual($"{surfaceLine.Name} {soilProfile2.Name} (1)", probabilisticPipingCalculationScenario2.Name); Assert.AreEqual($"{surfaceLine.Name} {soilProfile3.Name} (2)", semiProbabilisticPipingCalculationScenario3.Name); Assert.AreEqual($"{surfaceLine.Name} {soilProfile3.Name} (2)", probabilisticPipingCalculationScenario3.Name); }