// Copyright (C) Stichting Deltares 2018. All rights reserved.
//
// This file is part of the application DAM - UI.
//
// DAM - UI is free software: you can redistribute it and/or modify
// it under the terms of the GNU 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 General Public License for more details.
//
// You should have received a copy of the GNU 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 Deltares.Dam.Data;
using NUnit.Framework;
using Deltares.Dam.TestHelper;
namespace Deltares.Dam.Tests
{
[TestFixture, Category("Calculation")]
public class DAMProjectCalculatorDijkring13Test
{
const string cmstabProgramPath = ".\\DGeoStability.exe";
const string cDikeFolder = @"TestData\Dijkring13-Sec1";
[Test, Category("Slow")]
public void Dijkring13NormalStabilityCalculation()
{
const double cTolerance = 0.001;
// Read dikering
using (var damProjectData = new DamProjectData())
{
var project = ProjectLoader.LoadProjectData(cDikeFolder);
var dike = project.WaterBoard.Dikes[0];
damProjectData.WaterBoard.Dikes.Add(dike);
dike.Validate();
Assert.AreEqual(1, dike.Locations.Count);
// Specify calculation
MStabParameters mstabParameters = FactoryForStabilityTests.CreateMStabParameters();
mstabParameters.SoilDatabaseName = dike.SoilDatabaseName;
var damCalculationSpecification = new DamFailureMechanismeCalculationSpecification()
{
FailureMechanismSystemType = FailureMechanismSystemType.StabilityInside,
FailureMechanismeParamatersMStab = new FailureMechanismeParamatersMStab()
{
MStabParameters = mstabParameters
}
};
DamProjectCalculationSpecification.SelectedAnalysisType = AnalysisType.NoAdaption;
damProjectData.DamProjectCalculationSpecification.SelectedProbabilisticType =
ProbabilisticType.Deterministic;
damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Add(damCalculationSpecification);
// Calculate dijkring
// TODO: DAMUI Start
//var damProjectCalculator = new DamProjectCalculator(damProjectData);
//damProjectCalculator.CalculationBaseDirectory = Path.GetFullPath(Path.Combine(cDikeFolder, "CalculationFiles"));
//damProjectCalculator.MStabProgramPath = cmstabProgramPath;
//List> allCalculationresults = damProjectCalculator.Calculate(damProjectData, dike.Scenarios);
List> allCalculationresults = null;
// TODO: DAMUI End
// Following values are just taken from the Geo Stability calculation and not manually calculated
Assert.AreEqual(0.82, allCalculationresults[0][0].StabilitySafetyFactor.Value, cTolerance);
Assert.AreEqual(1.046, allCalculationresults[0][1].StabilitySafetyFactor.Value, cTolerance);
Assert.AreEqual(1.152, allCalculationresults[0][2].StabilitySafetyFactor.Value, cTolerance);
}
}
}
}