// Copyright (C) Stichting Deltares 2024. 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.Calculators.DikesDesign;
using Deltares.DamEngine.Calculators.KernelWrappers.Common;
using Deltares.DamEngine.Data.Design;
using Deltares.DamEngine.Data.General;
using Deltares.DamEngine.Data.General.Results;
using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Standard.Logging;
namespace Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
///
/// Result of the Prepare method
/// Successful : the input data was created susccesfully
/// Failed : the input data could not be created
/// NotRelevant: the DamKernelInput contains data that is not a relevant input for this mechanism
///
public enum PrepareResult
{
Successful,
Failed,
NotRelevant
}
///
/// The design strategy that has to be followed
///
public enum DesignStrategy
{
///
/// No design is possible
///
NoDesignPossible,
///
/// The surfaceline is discretized with a minimum distance between points and for each point a new design is evaluated
///
ShoulderPerPoint,
///
/// Iterative process.
/// Dependendent on the most recent design iteration a choice between slope adaption or shoulder adaption is for the next iteration
///
OptimizedSlopeAndShoulderAdaption,
///
/// Iterative process.
/// First slope adaption is done then shoulder adaption
///
SlopeAdaptionBeforeShoulderAdaption
}
///
/// Based on DesignEvaluation, the advise for the next design step
///
public enum DesignAdvise
{
None,
ShoulderInwards,
SlopeInwards,
Height,
Abort // The design is not possible (e.g. because of a calculation failure)
}
///
/// Interface to implement external failure mechanisms
///
public interface IKernelWrapper
{
///
/// Prepares the failure mechanism input based on general dam kernel input.
///
/// The dam kernel input.
/// The number of the current iteration
/// The kernel data input.
/// The kernel data output.
///
/// Result of the prepare
///
PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput);
///
/// Validates the kernel data input.
///
/// The kernel data input.
/// The kernel data output.
/// The messages.
///
/// Number of errors that prevent a calculation
///
int Validate(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, out List messages);
///
/// Performs a failure mechanism calculation based on the input.
///
/// The kernel data input.
/// The kernel data output.
/// The messages.
void Execute(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, out List messages);
///
/// Fills the dam result based on the kernel output.
///
/// The dam kernel input.
/// The kernel data output.
/// The design scenario.
/// The result message.
/// The design results
void PostProcess(DamKernelInput damKernelInput, IKernelDataOutput kernelDataOutput, DesignScenario designScenario, string resultMessage, out List designResults);
///
/// Calculates the design at point.
///
/// The dam kernel input.
/// The kernel data input.
/// The kernel data output.
/// The point.
/// The messages.
///
ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, Point2D point, out List messages);
///
/// Evaluates the design (current factor greater than desired factor)
///
/// The dam kernel input.
/// The kernel data input.
/// The kernel data output.
/// The design advise.
/// The evaluation message.
///
/// if the design was succesful
///
bool EvaluateDesign(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput,
out DesignAdvise designAdvise, out string evaluationMessage);
///
/// Prepares the design.
///
/// The kernel data input.
/// The kernel data output.
/// The dam kernel input.
/// Index of the iteration.
/// The embankment design parameters.
void PrepareDesign(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput,
int iterationIndex, out EmbankmentDesignParameters embankmentDesignParameters);
///
/// Gets the design strategy
///
///
///
DesignStrategy GetDesignStrategy(DamKernelInput damKernelInput);
}