// Copyright (C) Stichting Deltares 2017. 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.Collections.Generic;
using System.ComponentModel;
using System.IO;
using Deltares.DamEngine.Data.General;
namespace Deltares.DamEngine.Data.RWScenarios
{
public class RWScenariosResult : RWResult
{
private IList rwScenarioResults = new List();
public RWScenariosResult()
{
}
public IList RWScenarioResults
{
get { return rwScenarioResults; }
private set { rwScenarioResults = value; }
}
public RWScenarioResult GetScenarioResult(ScenarioType scenarioType)
{
foreach (RWScenarioResult scenarioResult in this.RWScenarioResults)
{
if (scenarioResult.ScenarioType == scenarioType)
{
return scenarioResult;
}
}
return null;
}
}
public class RWScenarioResult : RWResult
{
private LoadSituation loadSituation = LoadSituation.Wet;
private DikeDrySensitivity _dikeDrySensitivity = DikeDrySensitivity.None;
private HydraulicShortcutType hydraulicShortcutType = HydraulicShortcutType.NoHydraulicShortcut;
private UpliftType upliftType = UpliftType.NoUplift;
private MStabModelType modelOption;
private ScenarioType scenarioType = ScenarioType.Scenario01;
private IList rwScenarioProfileResults = new List();
public RWScenarioResult()
{
}
public IList RWScenarioProfileResults
{
get { return rwScenarioProfileResults; }
private set { rwScenarioProfileResults = value; }
}
public LoadSituation LoadSituation
{
get { return loadSituation; }
set { loadSituation = value; }
}
public DikeDrySensitivity DikeDrySensitivity
{
get { return _dikeDrySensitivity; }
set { _dikeDrySensitivity = value; }
}
public HydraulicShortcutType HydraulicShortcutType
{
get { return hydraulicShortcutType; }
set { hydraulicShortcutType = value; }
}
public UpliftType UpliftType
{
get { return upliftType; }
set { upliftType = value; }
}
public MStabModelType ModelOption
{
get { return modelOption; }
set { modelOption = value; }
}
public ScenarioType ScenarioType
{
get { return scenarioType; }
set { scenarioType = value; }
}
}
public class RWScenarioProfileResult : RWResult
{
private FailureMechanismSystemType failureMechanismType = FailureMechanismSystemType.StabilityInside;
private DikeDrySensitivity _dikeDrySensitivity = DikeDrySensitivity.None;
private HydraulicShortcutType hydraulicShortcutType = HydraulicShortcutType.NoHydraulicShortcut;
private UpliftType upliftType = UpliftType.NoUplift;
private LoadSituation loadSituation = LoadSituation.Wet;
private MStabModelType mstabModelOption;
private PipingModelType pipingModelOption;
private SoilGeometryProbability soilGeometryProbability = null;
private Location location = null;
private ScenarioType scenarioType = ScenarioType.Scenario01;
private string baseFileName = "";
public const string CalculationCategory = "Calculation";
public RWScenarioProfileResult()
{
}
public virtual Location Location
{
get { return location; }
set { location = value; }
}
public string LocationName
{
get { return this.Location.Name; }
}
public double DetrimentFactor
{
get
{
// For Piping, ignore the given detriment factor and use the required safety for Piping
if (scenarioType == ScenarioType.Scenario10 || scenarioType == ScenarioType.Scenario11)
return DamGlobalConstants.RequiredSafetyPipingForAssessment;
return this.Location.DetrimentFactor;
}
}
public string SoilProfileName
{
get
{
var res = "";
if (SoilGeometryProbability != null)
res = SoilGeometryProbability.SoilProfile.Name;
return res;
}
}
public double SoilProfileProbability
{
get
{
var res = 0.0;
if (SoilGeometryProbability != null)
res = SoilGeometryProbability.Probability;
return res;
}
}
public LoadSituation LoadSituation
{
get { return loadSituation; }
set { loadSituation = value; }
}
public DikeDrySensitivity DikeDrySensitivity
{
get { return _dikeDrySensitivity; }
set { _dikeDrySensitivity = value; }
}
public HydraulicShortcutType HydraulicShortcutType
{
get { return hydraulicShortcutType; }
set { hydraulicShortcutType = value; }
}
public UpliftType UpliftType
{
get { return upliftType; }
set { upliftType = value; }
}
public MStabModelType MstabModelOption
{
get { return mstabModelOption; }
set { mstabModelOption = value; }
}
public PipingModelType PipingModelOption
{
get { return pipingModelOption; }
set { pipingModelOption = value; }
}
public MStabParameters MStabParameters { get; set; }
public ScenarioType ScenarioType
{
get { return scenarioType; }
set { scenarioType = value; }
}
public string BaseFileName
{
get { return baseFileName; }
set { baseFileName = value; }
}
public string InputFile
{
get { return DamProjectData.ProjectWorkingPath + Path.DirectorySeparatorChar + baseFileName + ".sti"; }
}
public string ResultFile
{
get
{
const string wmfExtension = ".wmf";
string fullBaseFilename = DamProjectData.ProjectWorkingPath + Path.DirectorySeparatorChar + baseFileName;
string fullFilename = fullBaseFilename + wmfExtension;
if (!File.Exists(fullFilename))
{
fullFilename = fullBaseFilename + "z1" + wmfExtension;
}
if (!File.Exists(fullFilename))
{
fullFilename = fullBaseFilename + "z2" + wmfExtension;
}
return fullFilename;
}
}
public string PipingResultFile
{
get
{
return "leeg";
}
// Note Bka: Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location)
// get { return baseFileName + PipingCalculator.PipingFilenameExtension; } ##Bka: most probably unwanted, replace with other mechanism. Or delete when NOT USED
}
public FailureMechanismSystemType FailureMechanismType
{
get { return failureMechanismType; }
set { failureMechanismType = value; }
}
public SoilGeometryProbability SoilGeometryProbability
{
get { return soilGeometryProbability; }
set { soilGeometryProbability = value; }
}
}
}