private static void SetInputValues(GrassCoverErosionInwardsCalculationEntity entity, GrassCoverErosionInwardsInput input, PersistenceRegistry registry) { if (input.DikeProfile != null) { entity.DikeProfileEntity = registry.Get(input.DikeProfile); } if (input.HydraulicBoundaryLocation != null) { entity.HydraulicLocationEntity = registry.Get(input.HydraulicBoundaryLocation); } entity.Orientation = input.Orientation.ToNaNAsNull(); entity.DikeHeight = input.DikeHeight.ToNaNAsNull(); entity.UseForeshore = Convert.ToByte(input.UseForeshore); entity.UseBreakWater = Convert.ToByte(input.UseBreakWater); entity.BreakWaterType = Convert.ToByte(input.BreakWater.Type); entity.BreakWaterHeight = input.BreakWater.Height.ToNaNAsNull(); entity.CriticalFlowRateMean = input.CriticalFlowRate.Mean.ToNaNAsNull(); entity.CriticalFlowRateStandardDeviation = input.CriticalFlowRate.StandardDeviation.ToNaNAsNull(); entity.ShouldOvertoppingOutputIllustrationPointsBeCalculated = Convert.ToByte(input.ShouldOvertoppingOutputIllustrationPointsBeCalculated); entity.ShouldDikeHeightBeCalculated = Convert.ToByte(input.ShouldDikeHeightBeCalculated); entity.DikeHeightTargetProbability = input.DikeHeightTargetProbability; entity.ShouldDikeHeightIllustrationPointsBeCalculated = Convert.ToByte(input.ShouldDikeHeightIllustrationPointsBeCalculated); entity.ShouldOvertoppingRateBeCalculated = Convert.ToByte(input.ShouldOvertoppingRateBeCalculated); entity.OvertoppingRateTargetProbability = input.OvertoppingRateTargetProbability; entity.ShouldOvertoppingRateIllustrationPointsBeCalculated = Convert.ToByte(input.ShouldOvertoppingRateIllustrationPointsBeCalculated); }
private static void SetInputParametersToEntity(ProbabilisticPipingCalculationEntity entity, ProbabilisticPipingInput inputParameters, PersistenceRegistry registry) { if (inputParameters.SurfaceLine != null) { entity.SurfaceLineEntity = registry.Get(inputParameters.SurfaceLine); } if (inputParameters.HydraulicBoundaryLocation != null) { entity.HydraulicLocationEntity = registry.Get(inputParameters.HydraulicBoundaryLocation); } if (inputParameters.StochasticSoilProfile != null) { entity.PipingStochasticSoilProfileEntity = registry.Get(inputParameters.StochasticSoilProfile); } entity.ExitPointL = inputParameters.ExitPointL.Value.ToNaNAsNull(); entity.EntryPointL = inputParameters.EntryPointL.Value.ToNaNAsNull(); entity.PhreaticLevelExitMean = inputParameters.PhreaticLevelExit.Mean.ToNaNAsNull(); entity.PhreaticLevelExitStandardDeviation = inputParameters.PhreaticLevelExit.StandardDeviation.ToNaNAsNull(); entity.DampingFactorExitMean = inputParameters.DampingFactorExit.Mean.ToNaNAsNull(); entity.DampingFactorExitStandardDeviation = inputParameters.DampingFactorExit.StandardDeviation.ToNaNAsNull(); entity.ShouldProfileSpecificIllustrationPointsBeCalculated = Convert.ToByte(inputParameters.ShouldProfileSpecificIllustrationPointsBeCalculated); entity.ShouldSectionSpecificIllustrationPointsBeCalculated = Convert.ToByte(inputParameters.ShouldSectionSpecificIllustrationPointsBeCalculated); }
private static void SetInputParametersToEntity(SemiProbabilisticPipingCalculationEntity entity, SemiProbabilisticPipingInput inputParameters, PersistenceRegistry registry) { if (inputParameters.SurfaceLine != null) { entity.SurfaceLineEntity = registry.Get(inputParameters.SurfaceLine); } SetHydraulicBoundaryLocationInputToEntity(entity, inputParameters, registry); if (inputParameters.StochasticSoilProfile != null) { entity.PipingStochasticSoilProfileEntity = registry.Get(inputParameters.StochasticSoilProfile); } entity.ExitPointL = inputParameters.ExitPointL.Value.ToNaNAsNull(); entity.EntryPointL = inputParameters.EntryPointL.Value.ToNaNAsNull(); entity.PhreaticLevelExitMean = inputParameters.PhreaticLevelExit.Mean.ToNaNAsNull(); entity.PhreaticLevelExitStandardDeviation = inputParameters.PhreaticLevelExit.StandardDeviation.ToNaNAsNull(); entity.DampingFactorExitMean = inputParameters.DampingFactorExit.Mean.ToNaNAsNull(); entity.DampingFactorExitStandardDeviation = inputParameters.DampingFactorExit.StandardDeviation.ToNaNAsNull(); }
private static void SetInputParametersToEntity(MacroStabilityInwardsCalculationEntity entity, MacroStabilityInwardsInput inputParameters, PersistenceRegistry registry) { if (inputParameters.SurfaceLine != null) { entity.SurfaceLineEntity = registry.Get(inputParameters.SurfaceLine); } if (inputParameters.StochasticSoilProfile != null) { entity.MacroStabilityInwardsStochasticSoilProfileEntity = registry.Get(inputParameters.StochasticSoilProfile); } SetHydraulicBoundaryLocationInputToEntity(entity, inputParameters, registry); entity.SlipPlaneMinimumDepth = inputParameters.SlipPlaneMinimumDepth.ToNaNAsNull(); entity.SlipPlaneMinimumLength = inputParameters.SlipPlaneMinimumLength.ToNaNAsNull(); entity.MaximumSliceWidth = inputParameters.MaximumSliceWidth.ToNaNAsNull(); entity.MoveGrid = Convert.ToByte(inputParameters.MoveGrid); entity.DikeSoilScenario = Convert.ToByte(inputParameters.DikeSoilScenario); entity.WaterLevelRiverAverage = inputParameters.WaterLevelRiverAverage.ToNaNAsNull(); entity.DrainageConstructionPresent = Convert.ToByte(inputParameters.DrainageConstructionPresent); entity.DrainageConstructionCoordinateX = inputParameters.XCoordinateDrainageConstruction.ToNaNAsNull(); entity.DrainageConstructionCoordinateZ = inputParameters.ZCoordinateDrainageConstruction.ToNaNAsNull(); entity.MinimumLevelPhreaticLineAtDikeTopRiver = inputParameters.MinimumLevelPhreaticLineAtDikeTopRiver.ToNaNAsNull(); entity.MinimumLevelPhreaticLineAtDikeTopPolder = inputParameters.MinimumLevelPhreaticLineAtDikeTopPolder.ToNaNAsNull(); SetLocationInputExtremeParametersToEntity(entity, inputParameters.LocationInputExtreme); SetLocationInputDailyParametersToEntity(entity, inputParameters.LocationInputDaily); entity.AdjustPhreaticLine3And4ForUplift = Convert.ToByte(inputParameters.AdjustPhreaticLine3And4ForUplift); entity.LeakageLengthOutwardsPhreaticLine4 = inputParameters.LeakageLengthOutwardsPhreaticLine4.ToNaNAsNull(); entity.LeakageLengthInwardsPhreaticLine4 = inputParameters.LeakageLengthInwardsPhreaticLine4.ToNaNAsNull(); entity.LeakageLengthOutwardsPhreaticLine3 = inputParameters.LeakageLengthOutwardsPhreaticLine3.ToNaNAsNull(); entity.LeakageLengthInwardsPhreaticLine3 = inputParameters.LeakageLengthInwardsPhreaticLine3.ToNaNAsNull(); entity.PiezometricHeadPhreaticLine2Outwards = inputParameters.PiezometricHeadPhreaticLine2Outwards.ToNaNAsNull(); entity.PiezometricHeadPhreaticLine2Inwards = inputParameters.PiezometricHeadPhreaticLine2Inwards.ToNaNAsNull(); entity.GridDeterminationType = Convert.ToByte(inputParameters.GridDeterminationType); entity.TangentLineDeterminationType = Convert.ToByte(inputParameters.TangentLineDeterminationType); entity.TangentLineZTop = inputParameters.TangentLineZTop.ToNaNAsNull(); entity.TangentLineZBottom = inputParameters.TangentLineZBottom.ToNaNAsNull(); entity.TangentLineNumber = inputParameters.TangentLineNumber; SetGridParametersToEntity(entity, inputParameters.LeftGrid, inputParameters.RightGrid); entity.CreateZones = Convert.ToByte(inputParameters.CreateZones); entity.ZoningBoundariesDeterminationType = Convert.ToByte(inputParameters.ZoningBoundariesDeterminationType); entity.ZoneBoundaryLeft = inputParameters.ZoneBoundaryLeft.ToNaNAsNull(); entity.ZoneBoundaryRight = inputParameters.ZoneBoundaryRight.ToNaNAsNull(); }
/// <summary> /// Creates a <see cref="DuneLocationEntity"/> based on the information of the <see cref="DuneLocation"/>. /// </summary> /// <param name="location">The location to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <returns>A new <see cref="DuneLocationEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> internal static DuneLocationEntity Create(this DuneLocation location, PersistenceRegistry registry, int order) { if (location == null) { throw new ArgumentNullException(nameof(location)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(location)) { return(registry.Get(location)); } var entity = new DuneLocationEntity { LocationId = location.Id, Name = location.Name.DeepClone(), LocationX = location.Location.X.ToNaNAsNull(), LocationY = location.Location.Y.ToNaNAsNull(), CoastalAreaId = location.CoastalAreaId, Offset = location.Offset.ToNaNAsNull(), Orientation = location.Orientation.ToNaNAsNull(), D50 = location.D50.ToNaNAsNull(), Order = order }; registry.Register(entity, location); return(entity); }
private static void SetInputParameters(GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity, GrassCoverErosionOutwardsWaveConditionsInput calculationInput, PersistenceRegistry registry) { HydraulicBoundaryLocation hydraulicBoundaryLocation = calculationInput.HydraulicBoundaryLocation; if (hydraulicBoundaryLocation != null) { entity.HydraulicLocationEntity = registry.Get(hydraulicBoundaryLocation); } if (calculationInput.ForeshoreProfile != null) { entity.ForeshoreProfileEntity = calculationInput.ForeshoreProfile.Create(registry, 0); } if (calculationInput.CalculationsTargetProbability != null) { entity.HydraulicLocationCalculationForTargetProbabilityCollectionEntity = calculationInput.CalculationsTargetProbability.Create(HydraulicBoundaryLocationCalculationType.WaterLevel, 0, registry); } entity.Orientation = calculationInput.Orientation.ToNaNAsNull(); entity.UseBreakWater = Convert.ToByte(calculationInput.UseBreakWater); entity.BreakWaterType = Convert.ToByte(calculationInput.BreakWater.Type); entity.BreakWaterHeight = calculationInput.BreakWater.Height.ToNaNAsNull(); entity.UseForeshore = Convert.ToByte(calculationInput.UseForeshore); entity.UpperBoundaryRevetment = calculationInput.UpperBoundaryRevetment.ToNaNAsNull(); entity.LowerBoundaryRevetment = calculationInput.LowerBoundaryRevetment.ToNaNAsNull(); entity.UpperBoundaryWaterLevels = calculationInput.UpperBoundaryWaterLevels.ToNaNAsNull(); entity.LowerBoundaryWaterLevels = calculationInput.LowerBoundaryWaterLevels.ToNaNAsNull(); entity.StepSize = Convert.ToByte(calculationInput.StepSize); entity.CalculationType = Convert.ToByte(calculationInput.CalculationType); entity.WaterLevelType = Convert.ToByte(calculationInput.WaterLevelType); }
/// <summary> /// Creates a <see cref="MacroStabilityInwardsSoilProfileTwoDEntity"/> based on the information /// of the <see cref="MacroStabilityInwardsSoilProfile2D"/>. /// </summary> /// <param name="soilProfile">The soil profile to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <returns>A new <see cref="MacroStabilityInwardsSoilProfileTwoDEntity"/> or one from the /// <paramref name="registry"/> if it was created for the <see cref="soilProfile"/> earlier.</returns> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> public static MacroStabilityInwardsSoilProfileTwoDEntity Create(this MacroStabilityInwardsSoilProfile2D soilProfile, PersistenceRegistry registry) { if (soilProfile == null) { throw new ArgumentNullException(nameof(soilProfile)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(soilProfile)) { return(registry.Get(soilProfile)); } var entity = new MacroStabilityInwardsSoilProfileTwoDEntity { Name = soilProfile.Name.DeepClone() }; AddEntitiesForSoilLayers(soilProfile.Layers, entity); AddEntitiesForPreconsolidationStresses(soilProfile.PreconsolidationStresses, entity); registry.Register(entity, soilProfile); return(entity); }
/// <summary> /// Creates a <see cref="PipingSoilProfileEntity"/> based on the information of the <see cref="PipingSoilProfile"/>. /// </summary> /// <param name="profile">The profile to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <returns>A new <see cref="PipingSoilProfileEntity"/> or one from the <paramref name="registry"/> /// if it was created for the <see cref="profile"/> earlier.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception> internal static PipingSoilProfileEntity Create(this PipingSoilProfile profile, PersistenceRegistry registry) { if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(profile)) { return(registry.Get(profile)); } var entity = new PipingSoilProfileEntity { Name = profile.Name.DeepClone(), Bottom = profile.Bottom.ToNaNAsNull(), SourceType = Convert.ToByte(profile.SoilProfileSourceType) }; AddEntitiesForPipingSoilLayers(profile, entity); registry.Register(entity, profile); return(entity); }
/// <summary> /// Creates a <see cref="DikeProfileEntity"/> based on the information of the <see cref="DikeProfile"/>. /// </summary> /// <param name="dikeProfile">The dike profile to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <returns>A new <see cref="DikeProfileEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception> internal static DikeProfileEntity Create(this DikeProfile dikeProfile, PersistenceRegistry registry, int order) { if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(dikeProfile)) { return(registry.Get(dikeProfile)); } var sectionResultEntity = new DikeProfileEntity { X = dikeProfile.WorldReferencePoint.X, Y = dikeProfile.WorldReferencePoint.Y, X0 = dikeProfile.X0, DikeGeometryXml = new RoughnessPointCollectionXmlSerializer().ToXml(dikeProfile.DikeGeometry), ForeshoreXml = new Point2DCollectionXmlSerializer().ToXml(dikeProfile.ForeshoreGeometry), Orientation = dikeProfile.Orientation, DikeHeight = dikeProfile.DikeHeight, Id = dikeProfile.Id.DeepClone(), Name = dikeProfile.Name.DeepClone(), Order = order }; if (dikeProfile.HasBreakWater) { sectionResultEntity.BreakWaterHeight = dikeProfile.BreakWater.Height; sectionResultEntity.BreakWaterType = Convert.ToByte(dikeProfile.BreakWater.Type); } registry.Register(sectionResultEntity, dikeProfile); return(sectionResultEntity); }
/// <summary> /// Creates a <see cref="MacroStabilityInwardsStochasticSoilProfileEntity"/> based on /// the information of the <see cref="MacroStabilityInwardsStochasticSoilProfile"/>. /// </summary> /// <param name="stochasticSoilProfile">The stochastic soil profile to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <returns>A new <see cref="MacroStabilityInwardsStochasticSoilProfileEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> /// <exception cref="NotSupportedException">Thrown when <see cref="MacroStabilityInwardsStochasticSoilProfile.SoilProfile"/> is /// not of type <see cref="MacroStabilityInwardsSoilProfile1D"/> or <see cref="MacroStabilityInwardsSoilProfile2D"/>.</exception> public static MacroStabilityInwardsStochasticSoilProfileEntity Create(this MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile, PersistenceRegistry registry, int order) { if (stochasticSoilProfile == null) { throw new ArgumentNullException(nameof(stochasticSoilProfile)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(stochasticSoilProfile)) { return(registry.Get(stochasticSoilProfile)); } var entity = new MacroStabilityInwardsStochasticSoilProfileEntity { Probability = stochasticSoilProfile.Probability, Order = order }; AddEntityForProfile(stochasticSoilProfile.SoilProfile, entity, registry); registry.Register(entity, stochasticSoilProfile); return(entity); }
/// <summary> /// Creates a <see cref="MacroStabilityInwardsSoilProfileOneDEntity"/> based on the information /// of the <see cref="MacroStabilityInwardsSoilProfile1D"/>. /// </summary> /// <param name="soilProfile">The soil profile to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <returns>A new <see cref="MacroStabilityInwardsSoilProfileOneDEntity"/> or one from the /// <paramref name="registry"/> if it was created for the <see cref="soilProfile"/> earlier.</returns> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> public static MacroStabilityInwardsSoilProfileOneDEntity Create(this MacroStabilityInwardsSoilProfile1D soilProfile, PersistenceRegistry registry) { if (soilProfile == null) { throw new ArgumentNullException(nameof(soilProfile)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(soilProfile)) { return(registry.Get(soilProfile)); } var entity = new MacroStabilityInwardsSoilProfileOneDEntity { Name = soilProfile.Name.DeepClone(), Bottom = soilProfile.Bottom.ToNaNAsNull() }; AddEntitiesForSoilLayers(soilProfile.Layers, entity); registry.Register(entity, soilProfile); return(entity); }
/// <summary> /// Creates a <see cref="SurfaceLineEntity"/> based on the information of the <see cref="MacroStabilityInwardsSurfaceLine"/>. /// </summary> /// <param name="surfaceLine">The surface line to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <returns>A new <see cref="SurfaceLineEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> internal static SurfaceLineEntity Create(this MacroStabilityInwardsSurfaceLine surfaceLine, PersistenceRegistry registry, int order) { if (surfaceLine == null) { throw new ArgumentNullException(nameof(surfaceLine)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(surfaceLine)) { return(registry.Get(surfaceLine)); } var entity = new SurfaceLineEntity { Name = surfaceLine.Name.DeepClone(), ReferenceLineIntersectionX = surfaceLine.ReferenceLineIntersectionWorldPoint?.X.ToNaNAsNull(), ReferenceLineIntersectionY = surfaceLine.ReferenceLineIntersectionWorldPoint?.Y.ToNaNAsNull(), PointsXml = new Point3DCollectionXmlSerializer().ToXml(surfaceLine.Points), Order = order }; CreateCharacteristicPointEntities(surfaceLine, entity); registry.Register(entity, surfaceLine); return(entity); }
/// <summary> /// Creates a <see cref="StochasticSoilModelEntity"/> based on the information of the <see cref="PipingStochasticSoilModel"/>. /// </summary> /// <param name="model">The model to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <returns>A new <see cref="StochasticSoilModelEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> internal static StochasticSoilModelEntity Create(this PipingStochasticSoilModel model, PersistenceRegistry registry, int order) { if (model == null) { throw new ArgumentNullException(nameof(model)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(model)) { return(registry.Get(model)); } var entity = new StochasticSoilModelEntity { Name = model.Name.DeepClone(), StochasticSoilModelSegmentPointXml = new Point2DCollectionXmlSerializer().ToXml(model.Geometry), Order = order }; AddEntitiesForStochasticSoilProfiles(model, registry, entity); registry.Register(entity, model); return(entity); }
private static void AddEntitiesForPipingScenarioConfigurationPerFailureMechanismSection( IEnumerable <PipingScenarioConfigurationPerFailureMechanismSection> scenarioConfigurations, PersistenceRegistry registry) { foreach (PipingScenarioConfigurationPerFailureMechanismSection configuration in scenarioConfigurations) { PipingScenarioConfigurationPerFailureMechanismSectionEntity configurationPerFailureMechanismSectionEntity = configuration.Create(); FailureMechanismSectionEntity section = registry.Get(configuration.Section); section.PipingScenarioConfigurationPerFailureMechanismSectionEntities.Add(configurationPerFailureMechanismSectionEntity); } }
private static void AddEntitiesForSectionResults( IEnumerable <AdoptableWithProfileProbabilityFailureMechanismSectionResult> sectionResults, PersistenceRegistry registry) { foreach (AdoptableWithProfileProbabilityFailureMechanismSectionResult pipingFailureMechanismSectionResult in sectionResults) { AdoptableWithProfileProbabilityFailureMechanismSectionResultEntity sectionResultEntity = pipingFailureMechanismSectionResult.Create(); FailureMechanismSectionEntity section = registry.Get(pipingFailureMechanismSectionResult.Section); section.AdoptableWithProfileProbabilityFailureMechanismSectionResultEntities.Add(sectionResultEntity); } }
private static void AddEntitiesForSectionResults( IEnumerable <NonAdoptableFailureMechanismSectionResult> sectionResults, PersistenceRegistry registry) { foreach (NonAdoptableFailureMechanismSectionResult failureMechanismSectionResult in sectionResults) { NonAdoptableFailureMechanismSectionResultEntity sectionResultEntity = failureMechanismSectionResult.Create(); FailureMechanismSectionEntity section = registry.Get(failureMechanismSectionResult.Section); section.NonAdoptableFailureMechanismSectionResultEntities.Add(sectionResultEntity); } }
private static void SetHydraulicBoundaryLocationInputToEntity(SemiProbabilisticPipingCalculationEntity entity, SemiProbabilisticPipingInput inputParameters, PersistenceRegistry registry) { entity.UseAssessmentLevelManualInput = Convert.ToByte(inputParameters.UseAssessmentLevelManualInput); entity.AssessmentLevel = inputParameters.AssessmentLevel.ToNaNAsNull(); if (inputParameters.HydraulicBoundaryLocation != null) { entity.HydraulicLocationEntity = registry.Get(inputParameters.HydraulicBoundaryLocation); } }
/// <summary> /// Creates a <see cref="ClosingStructureEntity"/> based on the information of the <see cref="ClosingStructure"/>. /// </summary> /// <param name="structure">The structure to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">The index at which <paramref name="structure"/> resides within its parent.</param> /// <returns>A new <see cref="ClosingStructureEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception> internal static ClosingStructureEntity Create(this ClosingStructure structure, PersistenceRegistry registry, int order) { if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(structure)) { return(registry.Get(structure)); } var entity = new ClosingStructureEntity { Name = structure.Name.DeepClone(), Id = structure.Id.DeepClone(), X = structure.Location.X.ToNaNAsNull(), Y = structure.Location.Y.ToNaNAsNull(), StructureNormalOrientation = structure.StructureNormalOrientation.ToNaNAsNull(), StorageStructureAreaMean = structure.StorageStructureArea.Mean.ToNaNAsNull(), StorageStructureAreaCoefficientOfVariation = structure.StorageStructureArea.CoefficientOfVariation.ToNaNAsNull(), AllowedLevelIncreaseStorageMean = structure.AllowedLevelIncreaseStorage.Mean.ToNaNAsNull(), AllowedLevelIncreaseStorageStandardDeviation = structure.AllowedLevelIncreaseStorage.StandardDeviation.ToNaNAsNull(), WidthFlowAperturesMean = structure.WidthFlowApertures.Mean.ToNaNAsNull(), WidthFlowAperturesStandardDeviation = structure.WidthFlowApertures.StandardDeviation.ToNaNAsNull(), LevelCrestStructureNotClosingMean = structure.LevelCrestStructureNotClosing.Mean.ToNaNAsNull(), LevelCrestStructureNotClosingStandardDeviation = structure.LevelCrestStructureNotClosing.StandardDeviation.ToNaNAsNull(), InsideWaterLevelMean = structure.InsideWaterLevel.Mean.ToNaNAsNull(), InsideWaterLevelStandardDeviation = structure.InsideWaterLevel.StandardDeviation.ToNaNAsNull(), ThresholdHeightOpenWeirMean = structure.ThresholdHeightOpenWeir.Mean.ToNaNAsNull(), ThresholdHeightOpenWeirStandardDeviation = structure.ThresholdHeightOpenWeir.StandardDeviation.ToNaNAsNull(), AreaFlowAperturesMean = structure.AreaFlowApertures.Mean.ToNaNAsNull(), AreaFlowAperturesStandardDeviation = structure.AreaFlowApertures.StandardDeviation.ToNaNAsNull(), CriticalOvertoppingDischargeMean = structure.CriticalOvertoppingDischarge.Mean.ToNaNAsNull(), CriticalOvertoppingDischargeCoefficientOfVariation = structure.CriticalOvertoppingDischarge.CoefficientOfVariation.ToNaNAsNull(), FlowWidthAtBottomProtectionMean = structure.FlowWidthAtBottomProtection.Mean.ToNaNAsNull(), FlowWidthAtBottomProtectionStandardDeviation = structure.FlowWidthAtBottomProtection.StandardDeviation.ToNaNAsNull(), ProbabilityOpenStructureBeforeFlooding = structure.ProbabilityOpenStructureBeforeFlooding.ToNaNAsNull(), FailureProbabilityOpenStructure = structure.FailureProbabilityOpenStructure.ToNaNAsNull(), IdenticalApertures = structure.IdenticalApertures, FailureProbabilityReparation = structure.FailureProbabilityReparation.ToNaNAsNull(), InflowModelType = Convert.ToByte(structure.InflowModelType), Order = order }; registry.Register(entity, structure); return(entity); }
/// <summary> /// Creates a <see cref="PipingStochasticSoilProfileEntity"/> based on the information of the /// <see cref="PipingStochasticSoilProfile"/>. /// </summary> /// <param name="profile">The profile to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <returns>A new <see cref="PipingStochasticSoilProfileEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception> internal static PipingStochasticSoilProfileEntity Create(this PipingStochasticSoilProfile profile, PersistenceRegistry registry, int order) { var entity = new PipingStochasticSoilProfileEntity { Probability = profile.Probability, PipingSoilProfileEntity = profile.SoilProfile.Create(registry), Order = order }; if (registry.Contains(profile)) { return(registry.Get(profile)); } registry.Register(entity, profile); return(entity); }
/// <summary> /// Creates a <see cref="DuneLocationCalculationEntity"/> based on the information of the <see cref="DuneLocationCalculation"/>. /// </summary> /// <param name="calculation">The calculation to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <returns>A new <see cref="DuneLocationCalculationEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> internal static DuneLocationCalculationEntity Create(this DuneLocationCalculation calculation, PersistenceRegistry registry) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } var duneLocationCalculationEntity = new DuneLocationCalculationEntity { DuneLocationEntity = registry.Get(calculation.DuneLocation) }; CreateDuneLocationOutput(duneLocationCalculationEntity, calculation.Output); return(duneLocationCalculationEntity); }
/// <summary> /// Creates a <see cref="HeightStructureEntity"/> based on the information of the <see cref="HeightStructure"/>. /// </summary> /// <param name="structure">The structure to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">The index at which <paramref name="structure"/> resides within its parent.</param> /// <returns>A new <see cref="HeightStructureEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception> internal static HeightStructureEntity Create(this HeightStructure structure, PersistenceRegistry registry, int order) { if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(structure)) { return(registry.Get(structure)); } var entity = new HeightStructureEntity { Name = structure.Name.DeepClone(), Id = structure.Id.DeepClone(), X = structure.Location.X.ToNaNAsNull(), Y = structure.Location.Y.ToNaNAsNull(), StructureNormalOrientation = structure.StructureNormalOrientation.ToNaNAsNull(), AllowedLevelIncreaseStorageMean = structure.AllowedLevelIncreaseStorage.Mean.ToNaNAsNull(), AllowedLevelIncreaseStorageStandardDeviation = structure.AllowedLevelIncreaseStorage.StandardDeviation.ToNaNAsNull(), CriticalOvertoppingDischargeMean = structure.CriticalOvertoppingDischarge.Mean.ToNaNAsNull(), CriticalOvertoppingDischargeCoefficientOfVariation = structure.CriticalOvertoppingDischarge.CoefficientOfVariation.ToNaNAsNull(), FailureProbabilityStructureWithErosion = structure.FailureProbabilityStructureWithErosion.ToNaNAsNull(), FlowWidthAtBottomProtectionMean = structure.FlowWidthAtBottomProtection.Mean.ToNaNAsNull(), FlowWidthAtBottomProtectionStandardDeviation = structure.FlowWidthAtBottomProtection.StandardDeviation.ToNaNAsNull(), LevelCrestStructureMean = structure.LevelCrestStructure.Mean.ToNaNAsNull(), LevelCrestStructureStandardDeviation = structure.LevelCrestStructure.StandardDeviation.ToNaNAsNull(), StorageStructureAreaMean = structure.StorageStructureArea.Mean.ToNaNAsNull(), StorageStructureAreaCoefficientOfVariation = structure.StorageStructureArea.CoefficientOfVariation.ToNaNAsNull(), WidthFlowAperturesMean = structure.WidthFlowApertures.Mean.ToNaNAsNull(), WidthFlowAperturesStandardDeviation = structure.WidthFlowApertures.StandardDeviation.ToNaNAsNull(), Order = order }; registry.Register(entity, structure); return(entity); }
/// <summary> /// Creates a <see cref="StabilityPointStructureEntity"/> based on the information /// of the <see cref="StabilityPointStructure"/>. /// </summary> /// <param name="structure">The structure to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">The index at which <paramref name="structure"/> resides within its parent.</param> /// <returns>A new <see cref="StabilityPointStructureEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception> internal static StabilityPointStructureEntity Create(this StabilityPointStructure structure, PersistenceRegistry registry, int order) { if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(structure)) { return(registry.Get(structure)); } var entity = new StabilityPointStructureEntity { Name = structure.Name.DeepClone(), Id = structure.Id.DeepClone(), X = structure.Location.X.ToNaNAsNull(), Y = structure.Location.Y.ToNaNAsNull(), StructureNormalOrientation = structure.StructureNormalOrientation.ToNaNAsNull(), StorageStructureAreaMean = structure.StorageStructureArea.Mean.ToNaNAsNull(), StorageStructureAreaCoefficientOfVariation = structure.StorageStructureArea.CoefficientOfVariation.ToNaNAsNull(), AllowedLevelIncreaseStorageMean = structure.AllowedLevelIncreaseStorage.Mean.ToNaNAsNull(), AllowedLevelIncreaseStorageStandardDeviation = structure.AllowedLevelIncreaseStorage.StandardDeviation.ToNaNAsNull(), WidthFlowAperturesMean = structure.WidthFlowApertures.Mean.ToNaNAsNull(), WidthFlowAperturesStandardDeviation = structure.WidthFlowApertures.StandardDeviation.ToNaNAsNull(), InsideWaterLevelMean = structure.InsideWaterLevel.Mean.ToNaNAsNull(), InsideWaterLevelStandardDeviation = structure.InsideWaterLevel.StandardDeviation.ToNaNAsNull(), ThresholdHeightOpenWeirMean = structure.ThresholdHeightOpenWeir.Mean.ToNaNAsNull(), ThresholdHeightOpenWeirStandardDeviation = structure.ThresholdHeightOpenWeir.StandardDeviation.ToNaNAsNull(), CriticalOvertoppingDischargeMean = structure.CriticalOvertoppingDischarge.Mean.ToNaNAsNull(), CriticalOvertoppingDischargeCoefficientOfVariation = structure.CriticalOvertoppingDischarge.CoefficientOfVariation.ToNaNAsNull(), FlowWidthAtBottomProtectionMean = structure.FlowWidthAtBottomProtection.Mean.ToNaNAsNull(), FlowWidthAtBottomProtectionStandardDeviation = structure.FlowWidthAtBottomProtection.StandardDeviation.ToNaNAsNull(), ConstructiveStrengthLinearLoadModelMean = structure.ConstructiveStrengthLinearLoadModel.Mean.ToNaNAsNull(), ConstructiveStrengthLinearLoadModelCoefficientOfVariation = structure.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation.ToNaNAsNull(), ConstructiveStrengthQuadraticLoadModelMean = structure.ConstructiveStrengthQuadraticLoadModel.Mean.ToNaNAsNull(), ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation = structure.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation.ToNaNAsNull(), BankWidthMean = structure.BankWidth.Mean.ToNaNAsNull(), BankWidthStandardDeviation = structure.BankWidth.StandardDeviation.ToNaNAsNull(), InsideWaterLevelFailureConstructionMean = structure.InsideWaterLevelFailureConstruction.Mean.ToNaNAsNull(), InsideWaterLevelFailureConstructionStandardDeviation = structure.InsideWaterLevelFailureConstruction.StandardDeviation.ToNaNAsNull(), EvaluationLevel = structure.EvaluationLevel.ToNaNAsNull(), LevelCrestStructureMean = structure.LevelCrestStructure.Mean.ToNaNAsNull(), LevelCrestStructureStandardDeviation = structure.LevelCrestStructure.StandardDeviation.ToNaNAsNull(), VerticalDistance = structure.VerticalDistance.ToNaNAsNull(), FailureProbabilityRepairClosure = structure.FailureProbabilityRepairClosure.ToNaNAsNull(), FailureCollisionEnergyMean = structure.FailureCollisionEnergy.Mean.ToNaNAsNull(), FailureCollisionEnergyCoefficientOfVariation = structure.FailureCollisionEnergy.CoefficientOfVariation.ToNaNAsNull(), ShipMassMean = structure.ShipMass.Mean.ToNaNAsNull(), ShipMassCoefficientOfVariation = structure.ShipMass.CoefficientOfVariation.ToNaNAsNull(), ShipVelocityMean = structure.ShipVelocity.Mean.ToNaNAsNull(), ShipVelocityCoefficientOfVariation = structure.ShipVelocity.CoefficientOfVariation.ToNaNAsNull(), LevellingCount = structure.LevellingCount, ProbabilityCollisionSecondaryStructure = structure.ProbabilityCollisionSecondaryStructure.ToNaNAsNull(), FlowVelocityStructureClosableMean = structure.FlowVelocityStructureClosable.Mean.ToNaNAsNull(), StabilityLinearLoadModelMean = structure.StabilityLinearLoadModel.Mean.ToNaNAsNull(), StabilityLinearLoadModelCoefficientOfVariation = structure.StabilityLinearLoadModel.CoefficientOfVariation.ToNaNAsNull(), StabilityQuadraticLoadModelMean = structure.StabilityQuadraticLoadModel.Mean.ToNaNAsNull(), StabilityQuadraticLoadModelCoefficientOfVariation = structure.StabilityQuadraticLoadModel.CoefficientOfVariation.ToNaNAsNull(), AreaFlowAperturesMean = structure.AreaFlowApertures.Mean.ToNaNAsNull(), AreaFlowAperturesStandardDeviation = structure.AreaFlowApertures.StandardDeviation.ToNaNAsNull(), InflowModelType = Convert.ToByte(structure.InflowModelType), Order = order }; registry.Register(entity, structure); return(entity); }
public void Create_CalculationWithAlreadyRegisteredStochasticSoilProfile_ReturnsEntityWithStochasticSoilModelEntity() { // Setup var random = new Random(21); var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()); var scenario = new MacroStabilityInwardsCalculationScenario { InputParameters = { StochasticSoilProfile = stochasticSoilProfile } }; var registry = new PersistenceRegistry(); var stochasticSoilProfileEntity = new MacroStabilityInwardsStochasticSoilProfileEntity(); registry.Register(stochasticSoilProfileEntity, stochasticSoilProfile); // Call MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0); // Assert Assert.IsNotNull(entity); MacroStabilityInwardsStochasticSoilProfileEntity expectedStochasticSoilProfileEntity = registry.Get(stochasticSoilProfile); Assert.AreSame(expectedStochasticSoilProfileEntity, entity.MacroStabilityInwardsStochasticSoilProfileEntity); }