// Copyright (C) Stichting Deltares 2018. 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.IO;
using Deltares.DamEngine.Data.Geotechnics;
using Deltares.DamEngine.Data.Standard;
using Deltares.DamEngine.Data.Standard.Validation;
namespace Deltares.DamEngine.Data.General
{
public class FailureMechanismParametersMStab : IAssignable, ICloneable
{
private const string dGeoStabilityExeName = @"DGeoStability.exe";
private readonly string dGeoStabilityExePath;
///
/// Additional specifications/settings of calculation using MStab
///
public FailureMechanismParametersMStab()
{
this.MStabParameters = new MStabParameters();
this.IsStabilityCheckOnUplift = false;
// Make sure that D-Geo Stability path points to the D-Geo Stability version that is located in the application map
dGeoStabilityExePath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), dGeoStabilityExeName);
}
///
/// Gets or sets the project working path.
///
///
/// The project working path.
///
public string ProjectWorkingPath { get; set; }
///
/// Gets the D-GeoStability executable path.
///
///
/// The D-GeoStability path.
///
public string DGeoStabilityExePath
{
get
{
return dGeoStabilityExePath;
}
}
public Location Location { get; set; }
public SurfaceLine2 SurfaceLine { get; set; }
public PlLines.PlLines PlLines { get; set; }
public SoilProfile1D SoilProfile { get; set; }
public string SoilGeometry2DName { get; set; }
public double RiverLevel { get; set; }
public double DikeTableHeight { get; set; }
public double MaxWaterLevel { get; set; }
public double RiverLevelDecimateHeight { get; set; }
public double RequiredProbabilityOfFailure { get; set; }
public double TrafficLoad { get; set; }
///
/// Indicates whether in stability calculation a check on uplift will be performed before performin UpliftVan calculation.
/// Default it is false (set in constructor)
///
public bool IsStabilityCheckOnUplift { get; set; }
public EmbankmentDesignParameters EmbankmentDesignParameters { get; set; }
[Validate]
public MStabParameters MStabParameters { get; set; }
///
/// Checks whether all rerquired data is there.
///
public bool IsComplete
{
get
{
return
!string.IsNullOrEmpty(this.MStabParameters.SoilDatabaseName) &&
this.PlLines != null &&
(this.SoilProfile != null || this.MStabParameters.GeometryCreationOptions.SoilGeometry2DFilename != "") &&
this.Location != null &&
this.SurfaceLine != null &&
!string.IsNullOrEmpty(this.MStabParameters.ProjectFileName);
}
}
///
/// Performs the Assignment
///
///
public void Assign(FailureMechanismParametersMStab failureMechanismParametersMStab)
{
this.ProjectWorkingPath = failureMechanismParametersMStab.ProjectWorkingPath;
this.Location = failureMechanismParametersMStab.Location;
this.SurfaceLine = failureMechanismParametersMStab.SurfaceLine;
this.SoilProfile = failureMechanismParametersMStab.SoilProfile;
this.SoilGeometry2DName = failureMechanismParametersMStab.SoilGeometry2DName;
this.PlLines = failureMechanismParametersMStab.PlLines;
this.RiverLevel = failureMechanismParametersMStab.RiverLevel;
this.DikeTableHeight = failureMechanismParametersMStab.DikeTableHeight;
this.MaxWaterLevel = failureMechanismParametersMStab.MaxWaterLevel;
this.RiverLevelDecimateHeight = failureMechanismParametersMStab.RiverLevelDecimateHeight;
this.RequiredProbabilityOfFailure = failureMechanismParametersMStab.RequiredProbabilityOfFailure;
this.TrafficLoad = failureMechanismParametersMStab.TrafficLoad; ;
this.EmbankmentDesignParameters = failureMechanismParametersMStab.EmbankmentDesignParameters;
this.MStabParameters.Assign(failureMechanismParametersMStab.MStabParameters);
}
///
/// Clones the object.
///
/// FailureMechanismParametersMStab
public FailureMechanismParametersMStab Clone()
{
FailureMechanismParametersMStab failureMechanismParametersMStab = new FailureMechanismParametersMStab();
failureMechanismParametersMStab.MStabParameters = this.MStabParameters.Clone();
failureMechanismParametersMStab.Assign(this);
return failureMechanismParametersMStab;
}
}
}