// Copyright (C) Stichting Deltares 2024. All rights reserved.
//
// This file is part of the Dam Engine.
//
// The Dam Engine is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System;
using System.Collections.Generic;
using Deltares.DamEngine.Data.Design;
using Deltares.DamEngine.Data.General;
using Deltares.DamEngine.Data.General.Sensors;
using Deltares.DamEngine.Data.General.TimeSeries;
using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Geotechnics;
using Deltares.DamEngine.Interface;
namespace Deltares.DamEngine.TestHelpers.Factories;
public class FactoryForDamProjectData
{
public const AnalysisType ExpectedAnalysisType = AnalysisType.AdaptGeometry;
public const AnalysisType NotExpectedAnalysisType = AnalysisType.NoAdaption;
public static DamProjectData CreateExampleDamProjectData()
{
var damProjectData = new DamProjectData();
damProjectData.ProjectPath = @"D:\TestDir";
damProjectData.CalculationMap = @"Sub\Calc";
damProjectData.MaxCalculationCores = 3;
FillAnalysisSpecification(damProjectData);
FillStabilityParameters(damProjectData);
damProjectData.Dike = new Dike();
Dike dike = damProjectData.Dike;
FillSurfaceLines(dike);
FillSoils(dike);
FillSoilProfiles1D(dike);
FillSoilProfiles2D(dike);
FillSegments(damProjectData);
FillTrafficLoadDegreeOfConsolidation(dike);
FillLocations(dike, damProjectData.Segments);
FillInputTimeSeries(dike);
FillSensorData(damProjectData);
return damProjectData;
}
private static void FillSensorData(DamProjectData damProjectData)
{
damProjectData.SensorData = new SensorData(); // SensorLocations, Sensors and SensorGroups are automatically created
SensorData sensorData = damProjectData.SensorData;
var sensor1 = new Sensor
{
ID = 1,
Name = "Sensor 1",
RelativeLocation = 12.2,
SensorType = SensorType.WaterLevel,
PlLineMappings = new[]
{
PlLineType.Pl1
}
};
sensorData.Sensors.Add(sensor1);
var sensor2 = new Sensor
{
ID = 2,
Name = "Sensor 2",
RelativeLocation = 24.2,
SensorType = SensorType.PolderLevel,
PlLineMappings = new[]
{
PlLineType.Pl1
}
};
sensorData.Sensors.Add(sensor2);
var sensorGroup1 = new SensorGroup
{
ID = 1,
SensorArray = new[]
{
sensor1,
sensor2
}
};
sensorData.SensorGroups.Add(sensorGroup1);
var sensorLocation1 = new SensorLocation
{
Location = damProjectData.Dike.Locations[0],
SensorGroup = sensorGroup1,
SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = DataSourceTypeSensors.LocationData,
SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = DataSourceTypeSensors.LocationData,
SourceTypePl1WaterLevelAtPolder = DataSourceTypeSensors.Sensor,
SourceTypePl1WaterLevelAtRiver = DataSourceTypeSensors.Sensor,
SourceTypePl3 = DataSourceTypeSensors.Sensor,
SourceTypePl4 = DataSourceTypeSensors.Sensor,
SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = DataSourceTypeSensors.LocationData,
SourceTypePl1PlLineOffsetBelowShoulderBaseInside = DataSourceTypeSensors.LocationData
};
damProjectData.Dike.Locations[0].SensorLocation = sensorLocation1;
sensorData.SensorLocations.Add(sensorLocation1);
var sensor3 = new Sensor
{
ID = 3,
Name = "Sensor 3",
RelativeLocation = 8.8,
SensorType = SensorType.PiezometricHead,
PlLineMappings = new[]
{
PlLineType.Pl3,
PlLineType.Pl4
}
};
sensorData.Sensors.Add(sensor3);
var sensorGroup2 = new SensorGroup
{
ID = 2,
SensorArray = new[]
{
sensor3
}
};
sensorData.SensorGroups.Add(sensorGroup2);
var sensorLocation2 = new SensorLocation
{
Location = damProjectData.Dike.Locations[0],
SensorGroup = sensorGroup1,
SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = DataSourceTypeSensors.LocationData,
SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = DataSourceTypeSensors.LocationData,
SourceTypePl1WaterLevelAtPolder = DataSourceTypeSensors.Sensor,
SourceTypePl1WaterLevelAtRiver = DataSourceTypeSensors.Sensor,
SourceTypePl3 = DataSourceTypeSensors.Sensor,
SourceTypePl4 = DataSourceTypeSensors.Sensor,
SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = DataSourceTypeSensors.LocationData,
SourceTypePl1PlLineOffsetBelowShoulderBaseInside = DataSourceTypeSensors.LocationData
};
damProjectData.Dike.Locations[2].SensorLocation = sensorLocation2;
sensorData.SensorLocations.Add(sensorLocation2);
}
private static void FillInputTimeSeries(Dike dike)
{
const int timeSeriesCount = 2;
const int timeEntriesCount = 3;
const string idWaterLevel = "WaterLevel";
const string idWaterPressure = "WaterPressure";
dike.InputTimeSerieCollection = new TimeSerieCollection();
for (var i = 0; i < timeSeriesCount; i++)
{
var locationId = $"location{i}";
TimeSerie timeSerie = dike.InputTimeSerieCollection.AddNewSeries(locationId);
timeSerie.ParameterId = (i % 2 == 0) ? idWaterLevel : idWaterPressure;
timeSerie.ForecastDateTime = DateTime.Now;
timeSerie.StartDateTime = new DateTime(2012, 12, 31);
timeSerie.EndDateTime = new DateTime(2012, 12, 31, 1, 0, 0);
timeSerie.MissVal = -9999.0;
timeSerie.Units = "m";
for (var j = 0; j < timeEntriesCount; j++)
{
timeSerie.Entries.Add(new TimeSerieEntry
{
DateTime = new DateTime(2012, 12, 31, 1, j * 10, 0),
Value = j
});
}
}
}
private static void FillTrafficLoadDegreeOfConsolidation(Dike dike)
{
dike.TrafficLoadDegreeOfConsolidations = new List();
for (var i = 0; i < dike.SoilList.Soils.Count; i++)
{
var loadDegreeOfConsolidation = new TrafficLoadDegreeOfConsolidation
{
DegreeOfConsolidation = i * 3,
SoilName = dike.SoilList.Soils[i].Name
};
dike.TrafficLoadDegreeOfConsolidations.Add(loadDegreeOfConsolidation);
}
}
private static void FillAnalysisSpecification(DamProjectData damProjectData)
{
damProjectData.DamProjectType = DamProjectType.Design;
damProjectData.DamProjectCalculationSpecification = new DamProjectCalculationSpecification();
DamProjectCalculationSpecification.SelectedAnalysisType = ExpectedAnalysisType;
var calculationSpecification = new DamFailureMechanismeCalculationSpecification();
calculationSpecification.FailureMechanismSystemType = FailureMechanismSystemType.Piping;
calculationSpecification.CalculationModel = PipingModelType.Bligh;
damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Add(calculationSpecification);
}
private static void FillStabilityParameters(DamProjectData damProjectData)
{
// Note: DamProjectCalculationSpecification created and filled by FillAnalysisSpecification
DamFailureMechanismeCalculationSpecification curspec = damProjectData.DamProjectCalculationSpecification.CurrentSpecification;
curspec.FailureMechanismParametersMStab = new FailureMechanismParametersMStab
{
MStabParameters = new MStabParameters
{
SearchMethod = MStabSearchMethod.Grid,
SlipCircleDefinition = new SlipCircleDefinition
{
UpliftVanGridSizeDetermination = GridSizeDetermination.Specified,
BishopSearchAreaDetermination = GridSizeDetermination.Specified,
BishopGridHorizontalPointCount = 4,
BishopGridHorizontalPointDistance = 1.2,
BishopGridVerticalPointCount = 5,
BishopGridVerticalPointDistance = 1.1,
BishopTangentLinesDistance = 0.25,
UpliftVanLeftGridHorizontalPointCount = 6,
UpliftVanLeftGridHorizontalPointDistance = 0.7,
UpliftVanLeftGridVerticalPointCount = 3,
UpliftVanLeftGridVerticalPointDistance = 1.3,
UpliftVanRightGridHorizontalPointCount = 8,
UpliftVanRightGridHorizontalPointDistance = 1.76,
UpliftVanRightGridVerticalPointCount = 11,
UpliftVanRightGridVerticalPointDistance = 0.14,
UpliftVanTangentLinesDefinition = TangentLinesDefinition.OnBoundaryLines,
UpliftVanTangentLinesDistance = 0.5 // this should be a reasonable value
}
}
};
}
private static void FillSoils(Dike dike)
{
dike.SoilList = new SoilList();
var soil = new Soil
{
Name = "Soil 1",
AbovePhreaticLevel = 7,
BelowPhreaticLevel = 8,
ShearStrengthModel = ShearStrengthModel.CPhi,
Cohesion = 10,
FrictionAngle = 13,
Ocr = 14,
StrengthIncreaseExponent = 17,
RatioCuPc = 18,
PoP = 11,
DiameterD70 = 20,
PermeabKx = 22
};
dike.SoilList.Add(soil);
var dikemat = new Soil
{
Name = "DikeMat",
ShearStrengthModel = ShearStrengthModel.CPhi,
AbovePhreaticLevel = 7,
BelowPhreaticLevel = 8,
DiameterD70 = 19,
PermeabKx = 21
};
dike.SoilList.Add(dikemat);
var sigmaTauCurveSoil = new Soil
{
Name = "sigmaTauCurveSoil",
ShearStrengthModel = ShearStrengthModel.SigmaTauCurve,
AbovePhreaticLevel = 7,
BelowPhreaticLevel = 8,
DiameterD70 = 19,
PermeabKx = 21,
SigmaTauCurve = new SigmaTauCurve()
};
sigmaTauCurveSoil.SigmaTauCurve.Points.Add(new SigmaTauPoint());
sigmaTauCurveSoil.SigmaTauCurve.Points.Add(new SigmaTauPoint(1.0, 1.0));
sigmaTauCurveSoil.SigmaTauCurve.Points.Add(new SigmaTauPoint(4.0, 2.0));
dike.SoilList.Add(sigmaTauCurveSoil);
var suTableSoil = new Soil
{
Name = "suTableSoil",
ShearStrengthModel = ShearStrengthModel.SuTable,
AbovePhreaticLevel = 7,
BelowPhreaticLevel = 8,
DiameterD70 = 19,
PermeabKx = 21,
SuTableCurve = new SuTableCurve()
};
suTableSoil.SuTableCurve.Points.Add(new SigmaSuPoint());
suTableSoil.SuTableCurve.Points.Add(new SigmaSuPoint(1.0, 5.0));
suTableSoil.SuTableCurve.Points.Add(new SigmaSuPoint(4.0, 12.0));
dike.SoilList.Add(suTableSoil);
}
private static void FillSurfaceLines(Dike dike)
{
const int surfaceLineCount = 3;
for (var i = 0; i < surfaceLineCount; i++)
{
var surfaceLine = new SurfaceLine2();
surfaceLine.Name = $"SurfaceLine {i}";
surfaceLine.CharacteristicPoints.Geometry = surfaceLine.Geometry;
AddPointsToSurfaceLines(surfaceLine);
dike.SurfaceLines2.Add(surfaceLine);
}
}
private static void AddPointToSurfaceLine(SurfaceLine2 surfaceLine, double xCoordinate, double zCoordinate, CharacteristicPointType characteristicPointType)
{
var geometryPoint = new Point2D()
{
X = xCoordinate,
Z = zCoordinate
};
surfaceLine.AddCharacteristicPoint(geometryPoint, characteristicPointType);
}
private static void AddPointsToSurfaceLines(SurfaceLine2 surfaceLine)
{
AddPointToSurfaceLine(surfaceLine, 0.0, 0.0, CharacteristicPointType.SurfaceLevelOutside);
AddPointToSurfaceLine(surfaceLine, 2.0, 0.5, CharacteristicPointType.None);
AddPointToSurfaceLine(surfaceLine, 4.0, 0.0, CharacteristicPointType.DikeToeAtRiver);
AddPointToSurfaceLine(surfaceLine, 9.0, 5.0, CharacteristicPointType.DikeTopAtRiver);
AddPointToSurfaceLine(surfaceLine, 10.0, 5.2, CharacteristicPointType.None);
AddPointToSurfaceLine(surfaceLine, 13.0, 5.4, CharacteristicPointType.DikeTopAtPolder);
AddPointToSurfaceLine(surfaceLine, 13.0, 5.4, CharacteristicPointType.TrafficLoadOutside);
AddPointToSurfaceLine(surfaceLine, 14.0, 4.52, CharacteristicPointType.TrafficLoadInside);
AddPointToSurfaceLine(surfaceLine, 18.0, 1.0, CharacteristicPointType.DikeToeAtPolder);
AddPointToSurfaceLine(surfaceLine, 24.0, 1.0, CharacteristicPointType.SurfaceLevelInside);
}
private static void FillLocations(Dike dike, IList segments)
{
const int locationCount = 3;
for (var i = 0; i < locationCount; i++)
{
var location = new Location();
location.Name = "Location " + (i + 1);
location.ModelParametersForPlLines.PlLineCreationMethod = (PlLineCreationMethod) i;
location.IntrusionVerticalWaterPressure = (IntrusionVerticalWaterPressureType) i;
location.DistanceToEntryPoint = 1.2 * i + 0.56;
location.ModelParametersForPlLines.DampingFactorPl4 = 1.0 * i + 0.12;
location.ModelParametersForPlLines.DampingFactorPl3 = 1.0 * i + 0.13;
location.ModelParametersForPlLines.PenetrationLength = 1.0 * i + 0.14;
location.SlopeDampingPiezometricHeightPolderSide = 1.0 * i + 0.19;
location.SurfaceLine = dike.SurfaceLines2[i];
location.Segment = segments[i % 2]; // alternate between the 2 available segments
for (var j = 0; j < 3; j++)
{
DesignScenario designScenario = FillDesignScenario(location, i, j);
location.Scenarios.Add(designScenario);
}
location.CurrentScenario = location.Scenarios[0];
location.DikeEmbankmentMaterial = "DikeMat";
location.StabilityOptions = new StabilityOptions
{
StabilityZoneType = MStabZonesType.ForbiddenZone,
ForbiddenZoneFactor = 10.0 * i + 0.42,
TrafficLoad = 10.0 * i + 0.44,
TrafficLoadDegreeOfConsolidation = 10.0 * i + 0.45,
MinimalCircleDepth = 10.0 * i + 0.46
};
location.RedesignDikeHeight = false;
location.RedesignDikeShoulder = false;
location.ShoulderEmbankmentMaterial = "ShoulderMat" + (i + 1);
location.StabilityShoulderGrowSlope = 10.0 * i + 0.50;
location.StabilityShoulderGrowDeltaX = 10.0 * i + 0.51;
location.StabilitySlopeAdaptionDeltaX = 10.0 * i + 0.52;
location.SlopeAdaptionStartCotangent = 10.0 * i + 0.53;
location.SlopeAdaptionEndCotangent = 10.0 * i + 0.54;
location.SlopeAdaptionStepCotangent = 10.0 * i + 0.55;
location.UseNewDikeTopWidth = true;
location.UseNewDikeSlopeInside = true;
location.UseNewDikeSlopeOutside = true;
location.UseNewShoulderTopSlope = true;
location.UseNewShoulderBaseSlope = true;
location.UseNewMaxHeightShoulderAsFraction = true;
location.UseNewMinDistanceDikeToeStartDitch = true;
location.UseNewDitchDefinition = true;
location.NewDikeTopWidth = 10.0 * i + 0.56;
location.NewDikeSlopeInside = 10.0 * i + 0.57;
location.NewDikeSlopeOutside = 10.0 * i + 0.58;
location.NewShoulderTopSlope = 10.0 * i + 0.59;
location.NewShoulderBaseSlope = 10.0 * i + 0.60;
location.NewMaxHeightShoulderAsFraction = 10.0 * i + 0.61;
location.NewMinDistanceDikeToeStartDitch = 10.0 * i + 0.62;
location.UseNewDitchDefinition = true;
location.NewWidthDitchBottom = 10.0 * i + 0.63;
location.NewSlopeAngleDitch = 10.0 * i + 0.64;
location.NewDepthDitch = 10.0 * i + 0.65;
location.StabilityDesignMethod = StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption;
location.SoilList = dike.SoilList;
location.TrafficLoadDegreeOfConsolidations = dike.TrafficLoadDegreeOfConsolidations;
dike.Locations.Add(location);
}
}
private static void FillSoilProfiles1D(Dike dike)
{
dike.SoilProfiles = new List();
const int profilesCount = 2;
for (var i = 0; i < profilesCount; i++)
{
var profile = new SoilProfile1D();
profile.Name = "Profile1D " + (i + 1);
profile.BottomLevel = -21.12 * (i + 1);
const int layerCount = 3;
for (var j = 0; j < layerCount; j++)
{
var layer = new SoilLayer1D
{
Name = "Layer" + (j + 1),
Soil = dike.SoilList.Soils[j],
TopLevel = 1 * -j
};
if (j < 2)
{
layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic;
layer.IsAquifer = false;
}
else
{
layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic;
layer.IsAquifer = true;
}
profile.Layers.Add(layer);
}
dike.SoilProfiles.Add(profile);
}
}
private static DesignScenario FillDesignScenario(Location location, int locationIndex, int scenarioIndex)
{
// The parameter factor is used to create unique data for the design scenario
int factor = (locationIndex + 1) * (scenarioIndex + 1);
var designScenario = new DesignScenario();
designScenario.LocationScenarioID = scenarioIndex.ToString();
designScenario.RiverLevel = 1.0 * factor + 0.51;
designScenario.RiverLevelLow = 1.0 * factor + 0.52;
designScenario.DikeTableHeight = 1.0 * factor + 0.53;
designScenario.PlLineOffsetBelowDikeTopAtRiver = 1.0 * factor + 0.54;
designScenario.PlLineOffsetBelowDikeTopAtPolder = 1.0 * factor + 0.55;
designScenario.PlLineOffsetBelowShoulderBaseInside = 1.0 * factor + 0.56;
designScenario.PlLineOffsetBelowDikeToeAtPolder = 1.0 * factor + 0.57;
designScenario.PlLineOffsetBelowDikeCrestMiddle = 1.0 * factor + 0.58;
designScenario.UsePlLineOffsetBelowDikeCrestMiddle = true;
designScenario.PlLineOffsetFactorBelowShoulderCrest = 1.0 * factor + 0.59;
designScenario.UsePlLineOffsetFactorBelowShoulderCrest = true;
designScenario.PolderLevel = 1.0 * factor + 1.24;
designScenario.HeadPl2 = 1.0 * factor + 0.28;
designScenario.HeadPl3 = 1.0 * factor + 0.60;
designScenario.HeadPl4 = 1.0 * factor + 0.61;
designScenario.UpliftCriterionStability = 1.0 * factor + 0.62;
designScenario.UpliftCriterionPiping = 1.0 * factor + 0.63;
designScenario.RequiredSafetyFactorStabilityInnerSlope = 1.0 * factor + 0.64;
designScenario.RequiredSafetyFactorStabilityOuterSlope = 1.0 * factor + 0.65;
designScenario.RequiredSafetyFactorPiping = 1.0 * factor + 0.66;
designScenario.LocationName = location.Name;
return designScenario;
}
private static void FillSoilProfiles2D(Dike dike)
{
dike.SoilProfiles2D = new List();
const int profilesCount = 2;
for (var i = 0; i < profilesCount; i++)
{
var profile = new SoilProfile2D
{
Name = "Profile2D " + (i + 1)
};
const int preConCount = 2;
for (var j = 0; j < preConCount; j++)
{
var preCon = new PreConsolidationStress
{
Name = "Precon " + (j + 1),
StressValue = 3.33 * (i + 1) * (j + 1),
X = 12.3 * (i + 1) * (j + 1),
Z = 0.3 * (-i - 1) * (j + 1)
};
profile.PreconsolidationStresses.Add(preCon);
}
const int layerCount = 4;
var point1 = new Point2D(0, 0);
var point2 = new Point2D(0, 10);
var point3 = new Point2D(10, 10);
var point4 = new Point2D(1, 1);
var point5 = new Point2D(1, 9);
var point6 = new Point2D(9, 9);
profile.Geometry.Points.Add(point1);
profile.Geometry.Points.Add(point2);
profile.Geometry.Points.Add(point3);
profile.Geometry.Points.Add(point4);
profile.Geometry.Points.Add(point5);
profile.Geometry.Points.Add(point6);
var curve1 = new GeometryCurve
{
HeadPoint = point1,
EndPoint = point2
};
var curve2 = new GeometryCurve
{
HeadPoint = point2,
EndPoint = point3
};
var curve3 = new GeometryCurve
{
HeadPoint = point3,
EndPoint = point1
};
var curve4 = new GeometryCurve
{
HeadPoint = point4,
EndPoint = point5
};
var curve5 = new GeometryCurve
{
HeadPoint = point5,
EndPoint = point6
};
var curve6 = new GeometryCurve
{
HeadPoint = point6,
EndPoint = point4
};
profile.Geometry.Curves.Add(curve1);
profile.Geometry.Curves.Add(curve2);
profile.Geometry.Curves.Add(curve3);
profile.Geometry.Curves.Add(curve4);
profile.Geometry.Curves.Add(curve5);
profile.Geometry.Curves.Add(curve6);
for (var j = 0; j < layerCount; j++)
{
var layer = new SoilLayer2D
{
Name = "Layer" + (j + 1),
Soil = dike.SoilList.Soils[j]
};
if (j < 2)
{
layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic;
layer.IsAquifer = false;
}
else
{
layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic;
layer.IsAquifer = true;
}
layer.GeometrySurface = new GeometrySurface();
var outerLoop = new GeometryLoop();
outerLoop.Points.Add(point1);
outerLoop.Points.Add(point2);
outerLoop.Points.Add(point3);
outerLoop.CurveList.Add(curve1);
outerLoop.CurveList.Add(curve2);
outerLoop.CurveList.Add(curve3);
layer.GeometrySurface.OuterLoop = outerLoop;
profile.Geometry.Loops.Add(outerLoop);
var innerloop = new GeometryLoop();
innerloop.Points.Add(point4);
innerloop.Points.Add(point5);
innerloop.Points.Add(point6);
innerloop.CurveList.Add(curve4);
innerloop.CurveList.Add(curve5);
innerloop.CurveList.Add(curve6);
layer.GeometrySurface.InnerLoops.Add(innerloop);
profile.Geometry.Loops.Add(innerloop);
profile.Surfaces.Add(layer);
profile.Geometry.Surfaces.Add(layer.GeometrySurface);
}
dike.SoilProfiles2D.Add(profile);
}
}
private static void FillSegments(DamProjectData damProjectData)
{
var segmentCount = 2;
for (var i = 0; i < segmentCount; i++)
{
var segment = new Segment();
segment.Name = "Segment " + i;
var soilProfileProbability = new SoilGeometryProbability();
if (i == 0)
{
soilProfileProbability.SegmentFailureMechanismType = SegmentFailureMechanismType.Stability;
soilProfileProbability.SoilProfile2DName = "Profile2D " + (i + 1);
soilProfileProbability.SoilProfile2D = FillDamFromXmlInput.FindSoilProfile2DByName(damProjectData.Dike.SoilProfiles2D,
soilProfileProbability.SoilProfile2DName);
if (soilProfileProbability.SoilProfile2D != null)
{
soilProfileProbability.SoilProfileType = SoilProfileType.ProfileType2D;
}
}
else
{
soilProfileProbability.SegmentFailureMechanismType = SegmentFailureMechanismType.Piping;
soilProfileProbability.SoilProfile1DName = "Profile1D " + (i + 1);
soilProfileProbability.SoilProfile1D = FillDamFromXmlInput.FindSoilProfile1DByName(damProjectData.Dike.SoilProfiles,
soilProfileProbability.SoilProfile1DName);
soilProfileProbability.SoilProfileType = SoilProfileType.ProfileType1D;
}
soilProfileProbability.Probability = 0.003 * (i + 1);
segment.SoilProfileProbabilities.Add(soilProfileProbability);
damProjectData.Segments.Add(segment);
}
}
}