// 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 Deltares.DamEngine.Data.Standard.Language; using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Data.General { /// /// Represents the calculation specifications at project level for DAM. /// These are the main choices that specify the calculation /// public class DamProjectCalculationSpecification { private readonly List damCalculationSpecifications; private static AnalysisType selectedAnalysisType = AnalysisType.AdaptGeometry; private ProbabilisticType selectedProbabilisticType; private DamFailureMechanismeCalculationSpecification currentSpecification; private StabilityKernelType selectedStabilityKernelType; public DamProjectCalculationSpecification() { damCalculationSpecifications = new List(); //waterLevelTimeSeriesFileName = @"d:\src\delftgeosystems\trunk\data\Dam\RRD\Groot Salland\DAM UI Testdata\inputshortstart_dam.xml"; } [Validate] public List DamCalculationSpecifications { get { if (currentSpecification != null && currentSpecification.FailureMechanismSystemType != FailureMechanismSystemType.Piping) { selectedProbabilisticType = ProbabilisticType.Deterministic; } return damCalculationSpecifications; } } /// /// Gets or sets the analysis type for serialization purpose only. /// This "dummy" property is and must be only used for serialization/deserialization purposes as the real static property /// SelectedAnalysisType is NOT serialized. This is way its name is deliberately strange. /// /// /// The analysis type for serialization purpose only. /// public AnalysisType AnalysisTypeForSerializationPurposeOnly { get { return selectedAnalysisType; } set { selectedAnalysisType = value; } } /// /// Gets or sets the type of the selected analysis. /// /// /// The type of the selected analysis. /// public static AnalysisType SelectedAnalysisType { get { return selectedAnalysisType; } set { selectedAnalysisType = value; } } public ProbabilisticType SelectedProbabilisticType { get { return selectedProbabilisticType; } set { selectedProbabilisticType = value; DamFailureMechanismeCalculationSpecification.ProbabilisticType = selectedProbabilisticType; } } public DamFailureMechanismeCalculationSpecification CurrentSpecification { get { if (currentSpecification == null && damCalculationSpecifications.Count > 0) { currentSpecification = damCalculationSpecifications[0]; } return currentSpecification; } set { currentSpecification = value; } } public StabilityKernelType SelectedStabilityKernelType { get { return selectedStabilityKernelType; } set { selectedStabilityKernelType = value; if (currentSpecification != null) { currentSpecification.StabilityKernelType = selectedStabilityKernelType; } } } [Validate] public ValidationResult[] Validate() { if (damCalculationSpecifications.Count > 1) { return new[]{ new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "MaxOneCalculationSpecification"), this)}; } else { return new ValidationResult[0]; } } } }