示例#1
0
        /// <summary>
        /// Read the <see cref="ForeshoreProfileEntity"/> and use the information to construct a <see cref="ForeshoreProfile"/>.
        /// </summary>
        /// <param name="entity">The <see cref="ForeshoreProfileEntity"/> to create <see cref="ForeshoreProfile"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="ForeshoreProfile"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="collector"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <see cref="ForeshoreProfileEntity.GeometryXml"/>
        /// of <paramref name="entity"/> is <c>null</c> or empty.</exception>
        internal static ForeshoreProfile Read(this ForeshoreProfileEntity entity, ReadConversionCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            Point2D[] points = new Point2DCollectionXmlSerializer().FromXml(entity.GeometryXml);

            var foreshoreProfile = new ForeshoreProfile(new Point2D(entity.X.ToNullAsNaN(), entity.Y.ToNullAsNaN()),
                                                        points,
                                                        CreateBreakWater(entity.BreakWaterType, entity.BreakWaterHeight),
                                                        new ForeshoreProfile.ConstructionProperties
            {
                Id          = entity.Id.DeepClone(),
                Name        = entity.Name.DeepClone(),
                Orientation = entity.Orientation.ToNullAsNaN(),
                X0          = entity.X0.ToNullAsNaN()
            });

            collector.Read(entity, foreshoreProfile);

            return(foreshoreProfile);
        }
        /// <summary>
        /// Reads the <see cref="PipingStochasticSoilProfileEntity"/> and use the information to
        /// construct a <see cref="PipingStochasticSoilProfile"/>.
        /// </summary>
        /// <param name="entity">The <see cref="PipingStochasticSoilProfileEntity"/> to create
        /// <see cref="PipingStochasticSoilProfile"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="PipingStochasticSoilProfile"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        internal static PipingStochasticSoilProfile Read(this PipingStochasticSoilProfileEntity entity,
                                                         ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            PipingSoilProfile soilProfile = entity.ReadSoilProfile(collector);
            var stochasticSoilProfile     = new PipingStochasticSoilProfile(entity.Probability, soilProfile);

            collector.Read(entity, stochasticSoilProfile);

            return(stochasticSoilProfile);
        }
        /// <summary>
        /// Read the <see cref="DuneLocationEntity"/> and use the information to construct a <see cref="DuneLocation"/>.
        /// </summary>
        /// <param name="entity">The <see cref="DuneLocationEntity"/> to create <see cref="DuneLocation"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="DuneLocation"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        internal static DuneLocation Read(this DuneLocationEntity entity, ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var duneLocation = new DuneLocation(entity.LocationId, entity.Name,
                                                new Point2D(entity.LocationX.ToNullAsNaN(), entity.LocationY.ToNullAsNaN()),
                                                new DuneLocation.ConstructionProperties
            {
                CoastalAreaId = entity.CoastalAreaId,
                Offset        = entity.Offset.ToNullAsNaN(),
                Orientation   = entity.Orientation.ToNullAsNaN(),
                D50           = entity.D50.ToNullAsNaN()
            });

            collector.Read(entity, duneLocation);
            return(duneLocation);
        }
示例#4
0
        /// <summary>
        /// Reads the <see cref="MacroStabilityInwardsSoilProfileTwoDEntity"/> and use the information
        /// to construct a <see cref="MacroStabilityInwardsSoilProfile2D"/>.
        /// </summary>
        /// <param name="entity">The <see cref="MacroStabilityInwardsSoilProfileTwoDEntity"/> to
        /// create <see cref="MacroStabilityInwardsSoilProfile2D"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="MacroStabilityInwardsSoilProfile2D"/> or one from the <paramref name="collector"/>
        /// if the <see cref="MacroStabilityInwardsSoilProfileTwoDEntity"/> has been read before.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        public static MacroStabilityInwardsSoilProfile2D Read(this MacroStabilityInwardsSoilProfileTwoDEntity entity,
                                                              ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            IEnumerable <MacroStabilityInwardsSoilLayer2D> layers = entity.MacroStabilityInwardsSoilLayerTwoDEntities
                                                                    .OrderBy(sl => sl.Order)
                                                                    .Select(sl => sl.Read())
                                                                    .ToArray();
            IEnumerable <MacroStabilityInwardsPreconsolidationStress> preconsolidationStresses = entity.MacroStabilityInwardsPreconsolidationStressEntities
                                                                                                 .OrderBy(stressEntity => stressEntity.Order)
                                                                                                 .Select(stressEntity => stressEntity.Read())
                                                                                                 .ToArray();
            var soilProfile = new MacroStabilityInwardsSoilProfile2D(entity.Name,
                                                                     layers,
                                                                     preconsolidationStresses);

            collector.Read(entity, soilProfile);
            return(soilProfile);
        }
示例#5
0
        /// <summary>
        /// Reads the <see cref="MacroStabilityInwardsSoilProfileOneDEntity"/> and use the information
        /// to construct a <see cref="MacroStabilityInwardsSoilProfile1D"/>.
        /// </summary>
        /// <param name="entity">The <see cref="MacroStabilityInwardsSoilProfileOneDEntity"/> to
        /// create <see cref="MacroStabilityInwardsSoilProfile1D"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="MacroStabilityInwardsSoilProfile1D"/> or one from the <paramref name="collector"/>
        /// if the <see cref="MacroStabilityInwardsSoilProfileOneDEntity"/> has been read before.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        public static MacroStabilityInwardsSoilProfile1D Read(this MacroStabilityInwardsSoilProfileOneDEntity entity,
                                                              ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            IEnumerable <MacroStabilityInwardsSoilLayer1D> layers = entity.MacroStabilityInwardsSoilLayerOneDEntities.OrderBy(sl => sl.Order)
                                                                    .Select(sl => sl.Read())
                                                                    .ToArray();
            var macroStabilityInwardsSoilProfile = new MacroStabilityInwardsSoilProfile1D(entity.Name,
                                                                                          entity.Bottom.ToNullAsNaN(),
                                                                                          layers);

            collector.Read(entity, macroStabilityInwardsSoilProfile);
            return(macroStabilityInwardsSoilProfile);
        }
        /// <summary>
        /// Reads the <see cref="PipingSoilProfileEntity"/> and use the information to construct a <see cref="PipingSoilProfile"/>.
        /// </summary>
        /// <param name="entity">The <see cref="PipingSoilProfileEntity"/> to create <see cref="PipingSoilProfile"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="PipingSoilProfile"/> or one from the <paramref name="collector"/> if the
        /// <see cref="PipingSoilProfileEntity"/> has been read before.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        public static PipingSoilProfile Read(this PipingSoilProfileEntity entity, ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            IEnumerable <PipingSoilLayer> layers = entity.PipingSoilLayerEntities.OrderBy(sl => sl.Order)
                                                   .Select(sl => sl.Read())
                                                   .ToArray();
            var pipingSoilProfile = new PipingSoilProfile(entity.Name,
                                                          entity.Bottom.ToNullAsNaN(),
                                                          layers,
                                                          (SoilProfileType)entity.SourceType);

            collector.Read(entity, pipingSoilProfile);
            return(pipingSoilProfile);
        }
示例#7
0
        public void Read_WithCollectorAndEntitiesWithoutOutput_ReturnsHydraulicBoundaryLocationWithPropertiesSetAndEntityRegistered()
        {
            // Setup
            var          random   = new Random(21);
            long         testId   = random.Next(0, 400);
            const string testName = "testName";
            double       x        = random.NextDouble();
            double       y        = random.NextDouble();

            var entity = new HydraulicLocationEntity
            {
                LocationId = testId,
                Name       = testName,
                LocationX  = x,
                LocationY  = y
            };

            var collector = new ReadConversionCollector();

            // Call
            HydraulicBoundaryLocation location = entity.Read(collector);

            // Assert
            Assert.IsNotNull(location);
            Assert.AreEqual(testId, location.Id);
            Assert.AreEqual(testName, location.Name);
            Assert.AreEqual(x, location.Location.X, 1e-6);
            Assert.AreEqual(y, location.Location.Y, 1e-6);
            Assert.IsTrue(collector.Contains(entity));
        }
示例#8
0
        /// <summary>
        /// Read the <see cref="HydraulicLocationEntity"/> and use the information to construct a <see cref="HydraulicBoundaryLocation"/>.
        /// </summary>
        /// <param name="entity">The <see cref="HydraulicLocationEntity"/> to create <see cref="HydraulicBoundaryLocation"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="HydraulicBoundaryLocation"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        internal static HydraulicBoundaryLocation Read(this HydraulicLocationEntity entity, ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(entity.LocationId,
                                                                          entity.Name,
                                                                          entity.LocationX.ToNullAsNaN(),
                                                                          entity.LocationY.ToNullAsNaN());

            collector.Read(entity, hydraulicBoundaryLocation);

            return(hydraulicBoundaryLocation);
        }
示例#9
0
        /// <summary>
        /// Reads the <see cref="HydraulicLocationCalculationForTargetProbabilityCollectionEntity"/> and uses
        /// the information to create a <see cref="HydraulicBoundaryLocationCalculationsForTargetProbability"/>.
        /// </summary>
        /// <param name="entity">The <see cref="HydraulicLocationCalculationForTargetProbabilityCollectionEntity"/> to create the
        /// <see cref="HydraulicBoundaryLocationCalculationsForTargetProbability"/>.</param>
        /// <param name="collector">The object keeping track of the read operations.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        internal static HydraulicBoundaryLocationCalculationsForTargetProbability Read(
            this HydraulicLocationCalculationForTargetProbabilityCollectionEntity entity,
            ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var calculations = new HydraulicBoundaryLocationCalculationsForTargetProbability(entity.TargetProbability);
            IEnumerable <HydraulicBoundaryLocationCalculation> hydraulicBoundaryLocationCalculations =
                entity.HydraulicLocationCalculationEntities
                .Select(hlce => CreateHydraulicBoundaryLocationCalculation(hlce, collector))
                .ToArray();

            calculations.HydraulicBoundaryLocationCalculations.AddRange(hydraulicBoundaryLocationCalculations);

            collector.Read(entity, calculations);
            return(calculations);
        }
示例#10
0
        public void Read_ValidEntityWithUnreadDikeProfileEntity_ReturnCalculationWithNewDikeProfile()
        {
            // Setup
            var dikeProfileEntity = new DikeProfileEntity
            {
                Id = "a",
                DikeGeometryXml = new RoughnessPointCollectionXmlSerializer().ToXml(new RoughnessPoint[0]),
                ForeshoreXml    = new Point2DCollectionXmlSerializer().ToXml(new Point2D[0])
            };
            var entity = new GrassCoverErosionInwardsCalculationEntity
            {
                DikeProfileEntity                = dikeProfileEntity,
                ScenarioContribution             = 0,
                DikeHeightTargetProbability      = 0.01,
                OvertoppingRateTargetProbability = 0.02
            };

            var collector = new ReadConversionCollector();

            // Call
            GrassCoverErosionInwardsCalculationScenario calculation = entity.Read(collector);

            // Assert
            Assert.IsNotNull(calculation.InputParameters.DikeProfile);
            Assert.IsTrue(collector.Contains(dikeProfileEntity));
        }
示例#11
0
        public void Read_WithCollector_NewPointAndEntityRegistered()
        {
            // Setup
            const string name   = "testName";
            var          points = new[]
            {
                new Point2D(0, 0)
            };
            string pointXml = new Point2DCollectionXmlSerializer().ToXml(points);
            var    entity   = new FailureMechanismSectionEntity
            {
                Name = name,
                FailureMechanismSectionPointXml = pointXml
            };

            var collector = new ReadConversionCollector();

            // Call
            FailureMechanismSection section = entity.Read(collector);

            // Assert
            Assert.IsNotNull(section);
            Assert.AreEqual(name, section.Name);
            Assert.AreEqual(section, collector.Get(entity));

            Assert.IsTrue(collector.Contains(entity));
        }
        /// <summary>
        /// Reads the <see cref="HeightStructureEntity"/> and use the information to update a
        /// <see cref="HeightStructure"/>.
        /// </summary>
        /// <param name="entity">The <see cref="HeightStructureEntity"/> to create <see cref="HeightStructure"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="HeightStructure"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="collector"/> is <c>null</c>.</exception>
        internal static HeightStructure Read(this HeightStructureEntity entity, ReadConversionCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var structure = new HeightStructure(new HeightStructure.ConstructionProperties
            {
                Name     = entity.Name,
                Id       = entity.Id,
                Location = new Point2D(entity.X.ToNullAsNaN(), entity.Y.ToNullAsNaN()),
                StructureNormalOrientation = (RoundedDouble)entity.StructureNormalOrientation.ToNullAsNaN(),
                LevelCrestStructure        =
                {
                    Mean              = (RoundedDouble)entity.LevelCrestStructureMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.LevelCrestStructureStandardDeviation.ToNullAsNaN()
                },
                FlowWidthAtBottomProtection =
                {
                    Mean              = (RoundedDouble)entity.FlowWidthAtBottomProtectionMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.FlowWidthAtBottomProtectionStandardDeviation.ToNullAsNaN()
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = (RoundedDouble)entity.CriticalOvertoppingDischargeMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.CriticalOvertoppingDischargeCoefficientOfVariation.ToNullAsNaN()
                },
                WidthFlowApertures =
                {
                    Mean              = (RoundedDouble)entity.WidthFlowAperturesMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.WidthFlowAperturesStandardDeviation.ToNullAsNaN()
                },
                FailureProbabilityStructureWithErosion = entity.FailureProbabilityStructureWithErosion.ToNullAsNaN(),
                StorageStructureArea =
                {
                    Mean                   = (RoundedDouble)entity.StorageStructureAreaMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.StorageStructureAreaCoefficientOfVariation.ToNullAsNaN()
                },
                AllowedLevelIncreaseStorage =
                {
                    Mean              = (RoundedDouble)entity.AllowedLevelIncreaseStorageMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.AllowedLevelIncreaseStorageStandardDeviation.ToNullAsNaN()
                }
            });

            collector.Read(entity, structure);

            return(structure);
        }
        public void Read_EntityNotReadBefore_EntityRegistered()
        {
            // Setup
            var collector = new ReadConversionCollector();

            var entity = new ForeshoreProfileEntity
            {
                Id          = "id",
                GeometryXml = new Point2DCollectionXmlSerializer().ToXml(new Point2D[0])
            };

            // Precondition
            Assert.IsFalse(collector.Contains(entity));

            // Call
            entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(entity));
        }
        public void Read_EntityNotReadBefore_RegisterEntity()
        {
            // Setup
            var entity = new ClosingStructureEntity
            {
                Name = "name",
                Id   = "id"
            };

            var collector = new ReadConversionCollector();

            // Precondition
            Assert.IsFalse(collector.Contains(entity));

            // Call
            ClosingStructure calculation = entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(entity));
            Assert.AreSame(calculation, collector.Get(entity));
        }
        public void Read_EntityWithStochasticSoilProfileEntityNotYetInCollector_CalculationWithCreatedStochasticSoilProfileAndRegisteredNewEntities()
        {
            // Setup
            var stochasticSoilProfileEntity = new PipingStochasticSoilProfileEntity
            {
                PipingSoilProfileEntity = new PipingSoilProfileEntity
                {
                    Name = "SoilProfile",
                    PipingSoilLayerEntities =
                    {
                        new PipingSoilLayerEntity()
                    }
                }
            };

            var random   = new Random(21);
            var geometry = new[]
            {
                new Point2D(random.NextDouble(), random.NextDouble())
            };
            var stochasticSoilModelEntity = new StochasticSoilModelEntity
            {
                Name = "StochasticSoilModel",
                StochasticSoilModelSegmentPointXml  = new Point2DCollectionXmlSerializer().ToXml(geometry),
                PipingStochasticSoilProfileEntities =
                {
                    stochasticSoilProfileEntity
                }
            };

            stochasticSoilProfileEntity.StochasticSoilModelEntity = stochasticSoilModelEntity;

            var entity = new SemiProbabilisticPipingCalculationEntity
            {
                PipingStochasticSoilProfileEntity = stochasticSoilProfileEntity,
                EntryPointL           = 1,
                ExitPointL            = 2,
                DampingFactorExitMean = 1,
                ScenarioContribution  = 0
            };

            var collector = new ReadConversionCollector();

            // Call
            entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(stochasticSoilProfileEntity));
            Assert.IsTrue(collector.ContainsPipingStochasticSoilModel(stochasticSoilModelEntity));
        }
        public void Read_EntityWithHydraulicBoundaryLocationNotYetInCollector_CalculationWithCreatedHydraulicBoundaryLocationAndRegisteredNewEntities()
        {
            // Setup
            HydraulicLocationEntity hydraulicLocationEntity = HydraulicLocationEntityTestFactory.CreateHydraulicLocationEntity();
            var entity = new WaveImpactAsphaltCoverWaveConditionsCalculationEntity
            {
                HydraulicLocationEntity = hydraulicLocationEntity
            };

            var collector = new ReadConversionCollector();

            // Call
            entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(hydraulicLocationEntity));
        }
示例#17
0
        public void Read_DikeProfileEntityWithBreakWater_ReturnDikeProfileWithBreakWater(BreakWaterType type, double height)
        {
            // Setup
            var foreshorePoints = new Point2D[0];
            var roughnessPoints = new[]
            {
                new RoughnessPoint(new Point2D(1.1, 2.2), 1.0),
                new RoughnessPoint(new Point2D(3.3, 4.4), 0.6),
                new RoughnessPoint(new Point2D(5.5, 6.6), 1.0),
                new RoughnessPoint(new Point2D(7.7, 8.8), 0.5)
            };
            var entity = new DikeProfileEntity
            {
                Id               = "with_breakwater",
                Name             = "I have a Breakwater!",
                Orientation      = 360.0,
                BreakWaterHeight = height,
                BreakWaterType   = Convert.ToByte(type),
                ForeshoreXml     = new Point2DCollectionXmlSerializer().ToXml(foreshorePoints),
                DikeGeometryXml  = new RoughnessPointCollectionXmlSerializer().ToXml(roughnessPoints),
                DikeHeight       = 4.5,
                X  = 93.0,
                Y  = 945.6,
                X0 = 9.34
            };

            var collector = new ReadConversionCollector();

            // Call
            DikeProfile dikeProfile = entity.Read(collector);

            // Assert
            Assert.AreEqual(entity.Id, dikeProfile.Id);
            Assert.AreEqual(entity.Name, dikeProfile.Name);
            Assert.AreEqual(entity.Orientation, dikeProfile.Orientation.Value);
            CollectionAssert.AreEqual(foreshorePoints, dikeProfile.ForeshoreGeometry);
            CollectionAssert.AreEqual(roughnessPoints, dikeProfile.DikeGeometry, new RoughnessPointComparer());
            Assert.AreEqual(entity.X, dikeProfile.WorldReferencePoint.X);
            Assert.AreEqual(entity.Y, dikeProfile.WorldReferencePoint.Y);
            Assert.AreEqual(entity.X0, dikeProfile.X0);

            Assert.AreEqual(height, dikeProfile.BreakWater.Height.Value);
            Assert.AreEqual(type, dikeProfile.BreakWater.Type);

            Assert.IsTrue(collector.Contains(entity));
        }
        public void Read_EntityWithHydraulicBoundaryLocationCalculationsForTargetProbabilityNotYetInCollector_CalculationWithCreatedHydraulicBoundaryLocationCalculationsForTargetProbabilityAndRegisteredNewEntities()
        {
            // Setup
            HydraulicLocationCalculationForTargetProbabilityCollectionEntity calculationForTargetProbabilityCollectionEntity =
                HydraulicLocationCalculationForTargetProbabilityCollectionEntityTestFactory.CreateHydraulicLocationCalculationForTargetProbabilityCollectionEntity();
            var entity = new StabilityStoneCoverWaveConditionsCalculationEntity
            {
                HydraulicLocationCalculationForTargetProbabilityCollectionEntity = calculationForTargetProbabilityCollectionEntity
            };

            var collector = new ReadConversionCollector();

            // Call
            entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(calculationForTargetProbabilityCollectionEntity));
        }
        public void Read_WithValidData_ReturnsDuneLocationWithPropertiesSetAndEntityRegistered()
        {
            // Setup
            const string testName      = "testName";
            var          random        = new Random(21);
            long         locationId    = random.Next(0, 400);
            double       x             = random.NextDouble();
            double       y             = random.NextDouble();
            int          coastalAreaId = random.Next();
            double       offset        = random.NextDouble();
            double       orientation   = random.NextDouble();
            double       d50           = random.NextDouble();
            var          entity        = new DuneLocationEntity
            {
                LocationId    = locationId,
                Name          = testName,
                LocationX     = x,
                LocationY     = y,
                CoastalAreaId = coastalAreaId,
                Offset        = offset,
                Orientation   = orientation,
                D50           = d50
            };

            var collector = new ReadConversionCollector();

            // Call
            DuneLocation location = entity.Read(collector);

            // Assert
            Assert.IsNotNull(location);
            Assert.AreEqual(locationId, location.Id);
            Assert.AreEqual(testName, location.Name);
            Assert.AreEqual(x, location.Location.X, 1e-6);
            Assert.AreEqual(y, location.Location.Y, 1e-6);
            Assert.AreEqual(coastalAreaId, location.CoastalAreaId);
            Assert.AreEqual(offset, location.Offset, location.Offset.GetAccuracy());
            Assert.AreEqual(orientation, location.Orientation, location.Orientation.GetAccuracy());
            Assert.AreEqual(d50, location.D50, location.D50.GetAccuracy());

            Assert.IsTrue(collector.Contains(entity));
        }
        public void Read_EntityWithHydraulicBoundaryLocationNotYetInCollector_CalculationWithCreatedHydraulicBoundaryLocationAndRegisteredNewEntities()
        {
            // Setup
            HydraulicLocationEntity hydraulicLocationEntity = HydraulicLocationEntityTestFactory.CreateHydraulicLocationEntity();
            var entity = new ProbabilisticPipingCalculationEntity
            {
                HydraulicLocationEntity = hydraulicLocationEntity,
                EntryPointL             = 1,
                ExitPointL            = 2,
                DampingFactorExitMean = 1
            };

            var collector = new ReadConversionCollector();

            // Call
            entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(hydraulicLocationEntity));
        }
示例#21
0
        public void Read_ValidEntityWithUnreadHydraulicLocationEntity_ReturnCalculationWithNewHydraulicBoundaryLocation()
        {
            // Setup
            HydraulicLocationEntity hydraulicLocationEntity = HydraulicLocationEntityTestFactory.CreateHydraulicLocationEntity();
            var entity = new GrassCoverErosionInwardsCalculationEntity
            {
                HydraulicLocationEntity          = hydraulicLocationEntity,
                ScenarioContribution             = 0,
                DikeHeightTargetProbability      = 0.01,
                OvertoppingRateTargetProbability = 0.02
            };

            var collector = new ReadConversionCollector();

            // Call
            GrassCoverErosionInwardsCalculationScenario calculation = entity.Read(collector);

            // Assert
            Assert.IsNotNull(calculation.InputParameters.HydraulicBoundaryLocation);
            Assert.IsTrue(collector.Contains(hydraulicLocationEntity));
        }
        public void Read_EntityWithHydraulicBoundaryLocationNotYetInCollector_CalculationWithCreatedHydraulicBoundaryLocationAndRegisteredNewEntities()
        {
            // Setup
            HydraulicLocationEntity hydraulicLocationEntity = HydraulicLocationEntityTestFactory.CreateHydraulicLocationEntity();
            var entity = new SemiProbabilisticPipingCalculationEntity
            {
                HydraulicLocationEntity = hydraulicLocationEntity,
                EntryPointL             = 1,
                ExitPointL                    = 2,
                DampingFactorExitMean         = 1,
                UseAssessmentLevelManualInput = Convert.ToByte(false),
                ScenarioContribution          = 0
            };

            var collector = new ReadConversionCollector();

            // Call
            entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(hydraulicLocationEntity));
        }
        /// <summary>
        /// Reads the <see cref="DikeProfileEntity"/> and use the information to update a
        /// <see cref="DikeProfile"/>.
        /// </summary>
        /// <param name="entity">The <see cref="DikeProfileEntity"/> to create <see cref="DikeProfile"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="DikeProfile"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="collector"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <see cref="DikeProfileEntity.DikeGeometryXml"/>
        /// or <see cref="DikeProfileEntity.ForeshoreXml"/> of <paramref name="entity"/> is <c>null</c> or empty.</exception>
        internal static DikeProfile Read(this DikeProfileEntity entity, ReadConversionCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var dikeProfile = new DikeProfile(new Point2D(entity.X.ToNullAsNaN(), entity.Y.ToNullAsNaN()),
                                              new RoughnessPointCollectionXmlSerializer().FromXml(entity.DikeGeometryXml),
                                              new Point2DCollectionXmlSerializer().FromXml(entity.ForeshoreXml),
                                              CreateBreakWater(entity),
                                              CreateProperties(entity));

            collector.Read(entity, dikeProfile);

            return(dikeProfile);
        }
        public void Read_WithNullData_ReturnsDuneLocationWithNaNPropertiesSet()
        {
            // Setup
            const string testName      = "testName";
            var          random        = new Random(22);
            long         locationId    = random.Next(0, 400);
            int          coastalAreaId = random.Next();
            var          entity        = new DuneLocationEntity
            {
                LocationId    = locationId,
                Name          = testName,
                LocationX     = null,
                LocationY     = null,
                CoastalAreaId = coastalAreaId,
                Offset        = null,
                Orientation   = null,
                D50           = null
            };

            var collector = new ReadConversionCollector();

            // Call
            DuneLocation location = entity.Read(collector);

            // Assert
            Assert.IsNotNull(location);
            Assert.AreEqual(locationId, location.Id);
            Assert.AreEqual(testName, location.Name);
            Assert.IsNaN(location.Location.X);
            Assert.IsNaN(location.Location.Y);
            Assert.AreEqual(coastalAreaId, location.CoastalAreaId);
            Assert.IsNaN(location.Offset);
            Assert.IsNaN(location.Orientation);
            Assert.IsNaN(location.D50);

            Assert.IsTrue(collector.Contains(entity));
        }
        public void Read_EntityWithForeshoreProfileNotYetInCollector_CalculationWithCreatedForeshoreProfileAndRegisteredNewEntities()
        {
            // Setup
            const string id = "profile";
            var          foreshoreProfileEntity = new ForeshoreProfileEntity
            {
                Id          = id,
                GeometryXml = new Point2DCollectionXmlSerializer().ToXml(Enumerable.Empty <Point2D>())
            };

            var entity = new WaveImpactAsphaltCoverWaveConditionsCalculationEntity
            {
                ForeshoreProfileEntity = foreshoreProfileEntity
            };

            var collector = new ReadConversionCollector();

            // Call
            WaveImpactAsphaltCoverWaveConditionsCalculation calculation = entity.Read(collector);

            // Assert
            Assert.IsTrue(collector.Contains(foreshoreProfileEntity));
            CollectionAssert.AreEqual(id, calculation.InputParameters.ForeshoreProfile.Id);
        }
示例#26
0
        /// <summary>
        /// Reads the <see cref="MacroStabilityInwardsStochasticSoilProfileEntity"/> and use the information to
        /// construct a <see cref="MacroStabilityInwardsStochasticSoilProfile"/>.
        /// </summary>
        /// <param name="entity">The <see cref="MacroStabilityInwardsStochasticSoilProfileEntity"/> to create
        /// <see cref="MacroStabilityInwardsStochasticSoilProfile"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="MacroStabilityInwardsStochasticSoilProfile"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        public static MacroStabilityInwardsStochasticSoilProfile Read(this MacroStabilityInwardsStochasticSoilProfileEntity entity,
                                                                      ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(entity.Probability, entity.ReadSoilProfile(collector));

            collector.Read(entity, stochasticSoilProfile);

            return(stochasticSoilProfile);
        }
        /// <summary>
        /// Reads the <see cref="ClosingStructureEntity"/> and use the information to update a
        /// <see cref="ClosingStructure"/>.
        /// </summary>
        /// <param name="entity">The <see cref="ClosingStructureEntity"/> to create <see cref="ClosingStructure"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="ClosingStructure"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="collector"/> is <c>null</c>.</exception>
        internal static ClosingStructure Read(this ClosingStructureEntity entity, ReadConversionCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var structure = new ClosingStructure(new ClosingStructure.ConstructionProperties
            {
                Name     = entity.Name,
                Id       = entity.Id,
                Location = new Point2D(entity.X.ToNullAsNaN(), entity.Y.ToNullAsNaN()),
                StructureNormalOrientation = (RoundedDouble)entity.StructureNormalOrientation.ToNullAsNaN(),
                StorageStructureArea       =
                {
                    Mean                   = (RoundedDouble)entity.StorageStructureAreaMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.StorageStructureAreaCoefficientOfVariation.ToNullAsNaN()
                },
                AllowedLevelIncreaseStorage =
                {
                    Mean              = (RoundedDouble)entity.AllowedLevelIncreaseStorageMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.AllowedLevelIncreaseStorageStandardDeviation.ToNullAsNaN()
                },
                WidthFlowApertures =
                {
                    Mean              = (RoundedDouble)entity.WidthFlowAperturesMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.WidthFlowAperturesStandardDeviation.ToNullAsNaN()
                },
                LevelCrestStructureNotClosing =
                {
                    Mean              = (RoundedDouble)entity.LevelCrestStructureNotClosingMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.LevelCrestStructureNotClosingStandardDeviation.ToNullAsNaN()
                },
                InsideWaterLevel =
                {
                    Mean              = (RoundedDouble)entity.InsideWaterLevelMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.InsideWaterLevelStandardDeviation.ToNullAsNaN()
                },
                ThresholdHeightOpenWeir =
                {
                    Mean              = (RoundedDouble)entity.ThresholdHeightOpenWeirMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.ThresholdHeightOpenWeirStandardDeviation.ToNullAsNaN()
                },
                AreaFlowApertures =
                {
                    Mean              = (RoundedDouble)entity.AreaFlowAperturesMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.AreaFlowAperturesStandardDeviation.ToNullAsNaN()
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = (RoundedDouble)entity.CriticalOvertoppingDischargeMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.CriticalOvertoppingDischargeCoefficientOfVariation.ToNullAsNaN()
                },
                FlowWidthAtBottomProtection =
                {
                    Mean              = (RoundedDouble)entity.FlowWidthAtBottomProtectionMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.FlowWidthAtBottomProtectionStandardDeviation.ToNullAsNaN()
                },
                ProbabilityOpenStructureBeforeFlooding = entity.ProbabilityOpenStructureBeforeFlooding.ToNullAsNaN(),
                FailureProbabilityOpenStructure        = entity.FailureProbabilityOpenStructure.ToNullAsNaN(),
                IdenticalApertures           = entity.IdenticalApertures,
                FailureProbabilityReparation = entity.FailureProbabilityReparation.ToNullAsNaN(),
                InflowModelType = (ClosingStructureInflowModelType)entity.InflowModelType
            });

            collector.Read(entity, structure);

            return(structure);
        }
        public void Read_ValidEntity_ReturnClosingStructure()
        {
            // Setup
            var entity = new ClosingStructureEntity
            {
                Name = "A",
                Id   = "B",
                X    = 1.1,
                Y    = 2.2,
                StructureNormalOrientation = 3.3,
                StorageStructureAreaMean   = 4.4,
                StorageStructureAreaCoefficientOfVariation   = 5.5,
                AllowedLevelIncreaseStorageMean              = 6.6,
                AllowedLevelIncreaseStorageStandardDeviation = 7.7,
                WidthFlowAperturesMean = 8.8,
                WidthFlowAperturesStandardDeviation            = 9.9,
                LevelCrestStructureNotClosingMean              = 10.10,
                LevelCrestStructureNotClosingStandardDeviation = 11.11,
                InsideWaterLevelMean = 12.12,
                InsideWaterLevelStandardDeviation        = 13.13,
                ThresholdHeightOpenWeirMean              = 14.14,
                ThresholdHeightOpenWeirStandardDeviation = 15.15,
                AreaFlowAperturesMean = 16.16,
                AreaFlowAperturesStandardDeviation = 17.17,
                CriticalOvertoppingDischargeMean   = 18.18,
                CriticalOvertoppingDischargeCoefficientOfVariation = 19.19,
                FlowWidthAtBottomProtectionMean = 20.20,
                FlowWidthAtBottomProtectionStandardDeviation = 21.21,
                ProbabilityOpenStructureBeforeFlooding       = 22.22,
                FailureProbabilityOpenStructure = 23.23,
                IdenticalApertures           = 24,
                FailureProbabilityReparation = 25.25,
                InflowModelType = Convert.ToByte(ClosingStructureInflowModelType.FloodedCulvert)
            };

            var collector = new ReadConversionCollector();

            // Call
            ClosingStructure structure = entity.Read(collector);

            // Assert
            Assert.AreEqual(entity.Name, structure.Name);
            Assert.AreEqual(entity.Id, structure.Id);
            Assert.AreEqual(entity.X, structure.Location.X);
            Assert.AreEqual(entity.Y, structure.Location.Y);
            Assert.AreEqual(entity.StructureNormalOrientation, structure.StructureNormalOrientation.Value);
            Assert.AreEqual(entity.StorageStructureAreaMean, structure.StorageStructureArea.Mean.Value);
            Assert.AreEqual(entity.StorageStructureAreaCoefficientOfVariation, structure.StorageStructureArea.CoefficientOfVariation.Value);
            Assert.AreEqual(entity.AllowedLevelIncreaseStorageMean, structure.AllowedLevelIncreaseStorage.Mean.Value);
            Assert.AreEqual(entity.AllowedLevelIncreaseStorageStandardDeviation, structure.AllowedLevelIncreaseStorage.StandardDeviation.Value);
            Assert.AreEqual(entity.WidthFlowAperturesMean, structure.WidthFlowApertures.Mean.Value);
            Assert.AreEqual(entity.WidthFlowAperturesStandardDeviation, structure.WidthFlowApertures.StandardDeviation.Value);
            Assert.AreEqual(entity.LevelCrestStructureNotClosingMean, structure.LevelCrestStructureNotClosing.Mean.Value);
            Assert.AreEqual(entity.LevelCrestStructureNotClosingStandardDeviation, structure.LevelCrestStructureNotClosing.StandardDeviation.Value);
            Assert.AreEqual(entity.InsideWaterLevelMean, structure.InsideWaterLevel.Mean.Value);
            Assert.AreEqual(entity.InsideWaterLevelStandardDeviation, structure.InsideWaterLevel.StandardDeviation.Value);
            Assert.AreEqual(entity.ThresholdHeightOpenWeirMean, structure.ThresholdHeightOpenWeir.Mean.Value);
            Assert.AreEqual(entity.ThresholdHeightOpenWeirStandardDeviation, structure.ThresholdHeightOpenWeir.StandardDeviation.Value);
            Assert.AreEqual(entity.AreaFlowAperturesMean, structure.AreaFlowApertures.Mean.Value);
            Assert.AreEqual(entity.AreaFlowAperturesStandardDeviation, structure.AreaFlowApertures.StandardDeviation.Value);
            Assert.AreEqual(entity.CriticalOvertoppingDischargeMean, structure.CriticalOvertoppingDischarge.Mean.Value);
            Assert.AreEqual(entity.CriticalOvertoppingDischargeCoefficientOfVariation, structure.CriticalOvertoppingDischarge.CoefficientOfVariation.Value);
            Assert.AreEqual(entity.FlowWidthAtBottomProtectionMean, structure.FlowWidthAtBottomProtection.Mean.Value);
            Assert.AreEqual(entity.FlowWidthAtBottomProtectionStandardDeviation, structure.FlowWidthAtBottomProtection.StandardDeviation.Value);
            Assert.AreEqual(entity.ProbabilityOpenStructureBeforeFlooding, structure.ProbabilityOpenStructureBeforeFlooding);
            Assert.AreEqual(entity.FailureProbabilityOpenStructure, structure.FailureProbabilityOpenStructure);
            Assert.AreEqual(entity.IdenticalApertures, structure.IdenticalApertures);
            Assert.AreEqual(entity.FailureProbabilityReparation, structure.FailureProbabilityReparation);
            Assert.AreEqual((ClosingStructureInflowModelType)entity.InflowModelType, structure.InflowModelType);

            Assert.IsTrue(collector.Contains(entity));
        }
示例#29
0
        /// <summary>
        /// Reads the <see cref="StabilityPointStructureEntity"/> and use the information to update a
        /// <see cref="StabilityPointStructure"/>.
        /// </summary>
        /// <param name="entity">The <see cref="StabilityPointStructureEntity"/> to create <see cref="StabilityPointStructure"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="StabilityPointStructure"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="collector"/> is <c>null</c>.</exception>
        internal static StabilityPointStructure Read(this StabilityPointStructureEntity entity, ReadConversionCollector collector)
        {
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            var structure = new StabilityPointStructure(new StabilityPointStructure.ConstructionProperties
            {
                Name     = entity.Name,
                Id       = entity.Id,
                Location = new Point2D(entity.X.ToNullAsNaN(), entity.Y.ToNullAsNaN()),
                StructureNormalOrientation = (RoundedDouble)entity.StructureNormalOrientation.ToNullAsNaN(),
                StorageStructureArea       =
                {
                    Mean                   = (RoundedDouble)entity.StorageStructureAreaMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.StorageStructureAreaCoefficientOfVariation.ToNullAsNaN()
                },
                AllowedLevelIncreaseStorage =
                {
                    Mean              = (RoundedDouble)entity.AllowedLevelIncreaseStorageMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.AllowedLevelIncreaseStorageStandardDeviation.ToNullAsNaN()
                },
                FlowWidthAtBottomProtection =
                {
                    Mean              = (RoundedDouble)entity.FlowWidthAtBottomProtectionMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.FlowWidthAtBottomProtectionStandardDeviation.ToNullAsNaN()
                },
                InsideWaterLevel =
                {
                    Mean              = (RoundedDouble)entity.InsideWaterLevelMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.InsideWaterLevelStandardDeviation.ToNullAsNaN()
                },
                ThresholdHeightOpenWeir =
                {
                    Mean              = (RoundedDouble)entity.ThresholdHeightOpenWeirMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.ThresholdHeightOpenWeirStandardDeviation.ToNullAsNaN()
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = (RoundedDouble)entity.CriticalOvertoppingDischargeMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.CriticalOvertoppingDischargeCoefficientOfVariation.ToNullAsNaN()
                },
                WidthFlowApertures =
                {
                    Mean              = (RoundedDouble)entity.WidthFlowAperturesMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.WidthFlowAperturesStandardDeviation.ToNullAsNaN()
                },
                ConstructiveStrengthLinearLoadModel =
                {
                    Mean                   = (RoundedDouble)entity.ConstructiveStrengthLinearLoadModelMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.ConstructiveStrengthLinearLoadModelCoefficientOfVariation.ToNullAsNaN()
                },
                ConstructiveStrengthQuadraticLoadModel =
                {
                    Mean                   = (RoundedDouble)entity.ConstructiveStrengthQuadraticLoadModelMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation.ToNullAsNaN()
                },
                BankWidth =
                {
                    Mean              = (RoundedDouble)entity.BankWidthMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.BankWidthStandardDeviation.ToNullAsNaN()
                },
                InsideWaterLevelFailureConstruction =
                {
                    Mean              = (RoundedDouble)entity.InsideWaterLevelFailureConstructionMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.InsideWaterLevelFailureConstructionStandardDeviation.ToNullAsNaN()
                },
                EvaluationLevel     = (RoundedDouble)entity.EvaluationLevel.ToNullAsNaN(),
                LevelCrestStructure =
                {
                    Mean              = (RoundedDouble)entity.LevelCrestStructureMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.LevelCrestStructureStandardDeviation.ToNullAsNaN()
                },
                VerticalDistance = (RoundedDouble)entity.VerticalDistance.ToNullAsNaN(),
                FailureProbabilityRepairClosure = entity.FailureProbabilityRepairClosure.ToNullAsNaN(),
                FailureCollisionEnergy          =
                {
                    Mean                   = (RoundedDouble)entity.FailureCollisionEnergyMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.FailureCollisionEnergyCoefficientOfVariation.ToNullAsNaN()
                },
                ShipMass =
                {
                    Mean                   = (RoundedDouble)entity.ShipMassMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.ShipMassCoefficientOfVariation.ToNullAsNaN()
                },
                ShipVelocity =
                {
                    Mean                   = (RoundedDouble)entity.ShipVelocityMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.ShipVelocityCoefficientOfVariation.ToNullAsNaN()
                },
                LevellingCount = entity.LevellingCount,
                ProbabilityCollisionSecondaryStructure = entity.ProbabilityCollisionSecondaryStructure.ToNullAsNaN(),
                FlowVelocityStructureClosable          =
                {
                    Mean = (RoundedDouble)entity.FlowVelocityStructureClosableMean.ToNullAsNaN()
                },
                StabilityLinearLoadModel =
                {
                    Mean                   = (RoundedDouble)entity.StabilityLinearLoadModelMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.StabilityLinearLoadModelCoefficientOfVariation.ToNullAsNaN()
                },
                StabilityQuadraticLoadModel =
                {
                    Mean                   = (RoundedDouble)entity.StabilityQuadraticLoadModelMean.ToNullAsNaN(),
                    CoefficientOfVariation = (RoundedDouble)entity.StabilityQuadraticLoadModelCoefficientOfVariation.ToNullAsNaN()
                },
                AreaFlowApertures =
                {
                    Mean              = (RoundedDouble)entity.AreaFlowAperturesMean.ToNullAsNaN(),
                    StandardDeviation = (RoundedDouble)entity.AreaFlowAperturesStandardDeviation.ToNullAsNaN()
                },
                InflowModelType = (StabilityPointStructureInflowModelType)entity.InflowModelType
            });

            collector.Read(entity, structure);

            return(structure);
        }