Exemple #1
0
        /// <summary>
        /// Creates a <see cref="SlipPlaneConstraints"/> based on the given <paramref name="input"/>
        /// which can be used by <see cref="IUpliftVanKernel"/>.
        /// </summary>
        /// <param name="input">The <see cref="UpliftVanSlipPlaneConstraints"/> to get the information from.</param>
        /// <returns>A new <see cref="SlipPlaneConstraints"/> with the given information from <paramref name="input"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/> is <c>null</c>.</exception>
        public static SlipPlaneConstraints Create(UpliftVanSlipPlaneConstraints input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            return(new SlipPlaneConstraints
            {
                SlipPlaneMinDepth = input.SlipPlaneMinimumDepth,
                SlipPlaneMinLength = input.SlipPlaneMinimumLength,
                XEntryMin = input.ZoneBoundaryLeft,
                XEntryMax = input.ZoneBoundaryRight
            });
        }
        public void Constructor_EmptyConstructionProperties_ExpectedValues()
        {
            // Setup
            var surfaceLine          = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var soilProfile          = new TestSoilProfile();
            var drainageConstruction = new DrainageConstruction();
            var phreaticLineOffsets  = new PhreaticLineOffsets();
            var slipPlane            = new UpliftVanSlipPlane();
            var slipPlaneConstraints = new UpliftVanSlipPlaneConstraints(double.NaN, double.NaN);

            // Call
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine                = surfaceLine,
                SoilProfile                = soilProfile,
                DrainageConstruction       = drainageConstruction,
                PhreaticLineOffsetsExtreme = phreaticLineOffsets,
                PhreaticLineOffsetsDaily   = phreaticLineOffsets,
                SlipPlane            = slipPlane,
                SlipPlaneConstraints = slipPlaneConstraints
            });

            // Assert
            Assert.IsNaN(input.AssessmentLevel);
            Assert.IsNaN(input.WaterLevelRiverAverage);
            Assert.IsNaN(input.WaterLevelPolderExtreme);
            Assert.IsNaN(input.WaterLevelPolderDaily);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine4);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine4);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Outwards);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Inwards);
            Assert.IsNaN(input.PenetrationLengthDaily);
            Assert.IsNaN(input.PenetrationLengthExtreme);
            Assert.IsNaN(input.MaximumSliceWidth);
            Assert.IsNaN(input.WaterVolumetricWeight);

            Assert.IsFalse(input.AdjustPhreaticLine3And4ForUplift);
            Assert.IsFalse(input.MoveGrid);

            Assert.AreEqual(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay, input.DikeSoilScenario);
        }
        public void Constructor_WithMinimumLengthDepthAndCreateZones_ExpectedValues()
        {
            // Setup
            var    random = new Random(39);
            double slipPlaneMinimumLength = random.NextDouble();
            double slipPlaneMinimumDepth  = random.NextDouble();

            // Call
            var slipPlaneConstraints = new UpliftVanSlipPlaneConstraints(slipPlaneMinimumDepth, slipPlaneMinimumLength);

            // Assert
            Assert.IsTrue(slipPlaneConstraints.AutomaticForbiddenZones);
            Assert.AreEqual(slipPlaneMinimumLength, slipPlaneConstraints.SlipPlaneMinimumLength);
            Assert.AreEqual(slipPlaneMinimumDepth, slipPlaneConstraints.SlipPlaneMinimumDepth);
            Assert.IsNaN(slipPlaneConstraints.ZoneBoundaryLeft);
            Assert.IsNaN(slipPlaneConstraints.ZoneBoundaryRight);
        }
        public void Create_WithUpliftVanSlipPlaneConstraints_ReturnsExpectedSlipPlaneConstraints()
        {
            // Setup
            var random = new Random(39);
            var upliftVanSlipPlaneConstraints = new UpliftVanSlipPlaneConstraints(random.NextDouble(), random.NextDouble(),
                                                                                  random.NextDouble(), random.NextDouble());

            // Call
            SlipPlaneConstraints slipPlaneConstraints = SlipPlaneConstraintsCreator.Create(upliftVanSlipPlaneConstraints);

            // Assert
            Assert.AreEqual(upliftVanSlipPlaneConstraints.SlipPlaneMinimumDepth, slipPlaneConstraints.SlipPlaneMinDepth);
            Assert.AreEqual(upliftVanSlipPlaneConstraints.SlipPlaneMinimumLength, slipPlaneConstraints.SlipPlaneMinLength);
            Assert.AreEqual(upliftVanSlipPlaneConstraints.ZoneBoundaryLeft, slipPlaneConstraints.XEntryMin);
            Assert.AreEqual(upliftVanSlipPlaneConstraints.ZoneBoundaryRight, slipPlaneConstraints.XEntryMax);
            Assert.IsNaN(slipPlaneConstraints.XExitMin); // Irrelevant
            Assert.IsNaN(slipPlaneConstraints.XExitMax); // Irrelevant
        }
        public void Convert_CreateZonesTrueAndZoningDeterminationTypeManual_ReturnsExpectedUpliftVanSlipPlaneConstraints()
        {
            // Setup
            var random = new Random(39);
            var input  = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties())
            {
                CreateZones = true,
                ZoningBoundariesDeterminationType = MacroStabilityInwardsZoningBoundariesDeterminationType.Manual,
                SlipPlaneMinimumDepth             = random.NextRoundedDouble(),
                SlipPlaneMinimumLength            = random.NextRoundedDouble(),
                ZoneBoundaryLeft  = random.NextRoundedDouble(),
                ZoneBoundaryRight = random.NextRoundedDouble()
            };

            // Call
            UpliftVanSlipPlaneConstraints constraints = UpliftVanSlipPlaneConstraintsConverter.Convert(input);

            // Assert
            Assert.IsFalse(constraints.AutomaticForbiddenZones);
            Assert.AreEqual(input.SlipPlaneMinimumDepth, constraints.SlipPlaneMinimumDepth, input.SlipPlaneMinimumDepth.GetAccuracy());
            Assert.AreEqual(input.SlipPlaneMinimumLength, constraints.SlipPlaneMinimumLength, input.SlipPlaneMinimumLength.GetAccuracy());
            Assert.AreEqual(input.ZoneBoundaryLeft, constraints.ZoneBoundaryLeft, input.ZoneBoundaryLeft.GetAccuracy());
            Assert.AreEqual(input.ZoneBoundaryRight, constraints.ZoneBoundaryRight, input.ZoneBoundaryRight.GetAccuracy());
        }
        public void Constructor_WithConstructionProperties_PropertiesAreSet()
        {
            // Setup
            var random = new Random(11);

            double hRiverValue             = random.NextDouble();
            var    surfaceLine             = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var    soilProfile             = new TestSoilProfile();
            var    drainageConstruction    = new DrainageConstruction();
            var    phreaticLineOffsets     = new PhreaticLineOffsets();
            var    slipPlane               = new UpliftVanSlipPlane();
            var    slipPlaneConstraints    = new UpliftVanSlipPlaneConstraints(random.NextDouble(), random.NextDouble());
            double waterLevelRiverAverage  = random.NextDouble();
            double waterLevelPolderExtreme = random.NextDouble();
            double waterLevelPolderDaily   = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine3      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine3       = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine4      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine4       = random.NextDouble();
            double piezometricHeadPhreaticLine2Outwards    = random.NextDouble();
            double piezometricHeadPhreaticLine2Inwards     = random.NextDouble();
            double penetrationLengthExtreme         = random.NextDouble();
            double penetrationLengthDaily           = random.NextDouble();
            bool   adjustPhreaticLine3And4ForUplift = random.NextBoolean();
            var    dikeSoilScenario      = random.NextEnumValue <MacroStabilityInwardsDikeSoilScenario>();
            bool   moveGrid              = random.NextBoolean();
            double maximumSliceWidth     = random.NextDouble();
            double waterVolumetricWeight = random.NextDouble();

            // Call
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                AssessmentLevel            = hRiverValue,
                SurfaceLine                = surfaceLine,
                SoilProfile                = soilProfile,
                DrainageConstruction       = drainageConstruction,
                PhreaticLineOffsetsExtreme = phreaticLineOffsets,
                PhreaticLineOffsetsDaily   = phreaticLineOffsets,
                SlipPlane               = slipPlane,
                SlipPlaneConstraints    = slipPlaneConstraints,
                WaterLevelRiverAverage  = waterLevelRiverAverage,
                WaterLevelPolderExtreme = waterLevelPolderExtreme,
                WaterLevelPolderDaily   = waterLevelPolderDaily,
                MinimumLevelPhreaticLineAtDikeTopRiver  = minimumLevelPhreaticLineAtDikeTopRiver,
                MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder,
                LeakageLengthOutwardsPhreaticLine3      = leakageLengthOutwardsPhreaticLine3,
                LeakageLengthInwardsPhreaticLine3       = leakageLengthInwardsPhreaticLine3,
                LeakageLengthOutwardsPhreaticLine4      = leakageLengthOutwardsPhreaticLine4,
                LeakageLengthInwardsPhreaticLine4       = leakageLengthInwardsPhreaticLine4,
                PiezometricHeadPhreaticLine2Outwards    = piezometricHeadPhreaticLine2Outwards,
                PiezometricHeadPhreaticLine2Inwards     = piezometricHeadPhreaticLine2Inwards,
                PenetrationLengthExtreme         = penetrationLengthExtreme,
                PenetrationLengthDaily           = penetrationLengthDaily,
                AdjustPhreaticLine3And4ForUplift = adjustPhreaticLine3And4ForUplift,
                DikeSoilScenario      = dikeSoilScenario,
                MoveGrid              = moveGrid,
                MaximumSliceWidth     = maximumSliceWidth,
                WaterVolumetricWeight = waterVolumetricWeight
            });

            // Assert
            Assert.AreEqual(hRiverValue, input.AssessmentLevel);
            Assert.AreSame(surfaceLine, input.SurfaceLine);
            Assert.AreSame(soilProfile, input.SoilProfile);
            Assert.AreSame(drainageConstruction, input.DrainageConstruction);
            Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsDaily);
            Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsExtreme);
            Assert.AreSame(slipPlane, input.SlipPlane);
            Assert.AreSame(slipPlaneConstraints, input.SlipPlaneConstraints);

            Assert.AreEqual(waterLevelRiverAverage, input.WaterLevelRiverAverage);
            Assert.AreEqual(waterLevelPolderExtreme, input.WaterLevelPolderExtreme);
            Assert.AreEqual(waterLevelPolderDaily, input.WaterLevelPolderDaily);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, input.LeakageLengthOutwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine3, input.LeakageLengthInwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine4, input.LeakageLengthOutwardsPhreaticLine4);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine4, input.LeakageLengthInwardsPhreaticLine4);
            Assert.AreEqual(piezometricHeadPhreaticLine2Outwards, input.PiezometricHeadPhreaticLine2Outwards);
            Assert.AreEqual(piezometricHeadPhreaticLine2Inwards, input.PiezometricHeadPhreaticLine2Inwards);
            Assert.AreEqual(penetrationLengthExtreme, input.PenetrationLengthExtreme);
            Assert.AreEqual(penetrationLengthDaily, input.PenetrationLengthDaily);
            Assert.AreEqual(adjustPhreaticLine3And4ForUplift, input.AdjustPhreaticLine3And4ForUplift);

            Assert.AreEqual(dikeSoilScenario, input.DikeSoilScenario);
            Assert.AreEqual(moveGrid, input.MoveGrid);
            Assert.AreEqual(maximumSliceWidth, input.MaximumSliceWidth);
            Assert.AreEqual(waterVolumetricWeight, input.WaterVolumetricWeight);
        }