Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillWtiFromDamEngine.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillWtiFromDamEngine.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillWtiFromDamEngine.cs (revision 1987) @@ -0,0 +1,121 @@ +// Copyright (C) Stichting Deltares 2019. 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 Deltares.DamEngine.Data.General; +using Deltares.MacroStability.Kernel; + +namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon.MacroStabilityIo +{ + public class FillWtiFromDamEngine + { + /// Creates the kernel model from dam project data. + /// The DamProjectData object filled with Wti data + /// The KernelModel filled with the Dam Project Data + public static KernelModel CreateKernelModelFromDamProjectData(DamProjectData damProjectData) + { + TransferWtiStabilityModel(); + TransferVersionInfo(); + TransferSoilModel(); + TransferSurfaceLine(); + TransferLocation(); + TransferPreconsolidationStresses(); + TransferUniformLoads(); + TransferConsolidationValues(); + TransferMultiplicationFactorsCPhiForUplift(); + TransferWaternets(); + TransferSpencerSlipPlanes(); + TransferUpliftVanCalculationGrid(); + TransferSlipPlaneConstraints(); + TransferLevenbergMarquardtOptions(); + return null; + } + + private static void TransferWtiStabilityModel() + { + + } + + private static void TransferVersionInfo() + { + + } + + private static void TransferSoilModel() + { + + } + + private static void TransferSurfaceLine() + { + + } + + private static void TransferLocation() + { + + } + + private static void TransferPreconsolidationStresses() + { + + } + + private static void TransferUniformLoads() + { + + } + + private static void TransferConsolidationValues() + { + + } + + private static void TransferMultiplicationFactorsCPhiForUplift() + { + + } + + private static void TransferWaternets() + { + + } + + private static void TransferSpencerSlipPlanes() + { + + } + + private static void TransferUpliftVanCalculationGrid() + { + + } + + private static void TransferSlipPlaneConstraints() + { + + } + + private static void TransferLevenbergMarquardtOptions() + { + + } + } +} Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillDamEngineFromWti.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillDamEngineFromWti.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillDamEngineFromWti.cs (revision 1987) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2019. 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 Deltares.DamEngine.Data.General; +using Deltares.MacroStability.Kernel; + +namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon.MacroStabilityIo +{ + public class FillDamEngineFromWti + { + /// Creates the dam project data from the kernel model. + /// The kernel model. + /// The DamProjectData object filled with Wti data + public static DamProjectData CreateDamProjectDataFromKernelModel(KernelModel kernelModel) + { + return new DamProjectData(); + } + } +} Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj =================================================================== diff -u -r1983 -r1987 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 1983) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 1987) @@ -105,6 +105,8 @@ + + Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs =================================================================== diff -u -r1986 -r1987 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 1986) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 1987) @@ -22,7 +22,10 @@ using System.IO; using NUnit.Framework; using Deltares.MacroStability.Kernel; +using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.TestHelpers; using Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon.MacroStabilityIo; +using KellermanSoftware.CompareNetObjects; namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.MacroStabilityCommon { @@ -49,6 +52,31 @@ Assert.AreEqual(xmlInput, xmlOutput); } + [Test] + [Category(Categories.WorkInProgress)] + public void GivenDamEngineDataModelWhenSerializingAndDeserializingTheDataModelsAreEqual() + { + // Given DamEngine data (DamProjectData) + DamProjectData expectedDamProjectData = CreateExampleDamProjectData(); + KernelModel expectedKernelModel = FillWtiFromDamEngine.CreateKernelModelFromDamProjectData(expectedDamProjectData); + + // When Serializing and Deserializing + string xmlWti = WtiSerializer.Serialize(expectedKernelModel); + const string fileName = "TestInput.wti"; + string fullFileName = Path.Combine(WtiFilesMap, fileName); + File.WriteAllText(fullFileName, xmlWti); + KernelModel actualKernelModel = WtiDeserializer.Deserialize(xmlWti); + DamProjectData actualDamProjectData = FillDamEngineFromWti.CreateDamProjectDataFromKernelModel(actualKernelModel); + + // Then the data models are equal + CompareDamProjectData(actualDamProjectData, expectedDamProjectData); + } + + private DamProjectData CreateExampleDamProjectData() + { + return new DamProjectData(); + } + [TestCase("ValidateOk.xml")] [TestCase("ValidateError.xml")] public void GivenValidationResultFileWhenDeserializingAndSerializingThenTheStringsAreEqual(string fileNameIn) @@ -67,5 +95,14 @@ // Then the strings are equal Assert.AreEqual(xmlInput, xmlOutput); } + + private static void CompareDamProjectData(DamProjectData actual, DamProjectData expected) + { + + var compare = new CompareLogic { Config = { MaxDifferences = 100 } }; + var result = compare.Compare(expected, actual); + Assert.AreEqual(0, result.Differences.Count, "Differences found read/write Input object"); + + } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj =================================================================== diff -u -r1985 -r1987 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1985) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1987) @@ -45,6 +45,10 @@ False ..\..\lib\FailureMechanisms\WbiPipingMerged\Deltares.WTIPiping.Merged.dll + + False + ..\packages\CompareNETObjects.3.09.0.0\lib\net45\KellermanSoftware.Compare-NET-Objects.dll + ..\..\lib\NUnit\nunit.framework.dll