/// <summary>Initializes a new instance of the <see cref="HInterpolation"/> class.
            /// </summary>
            /// <param name="gridPointMatrix">The grid point matrix.</param>
            /// <param name="verticalCurveFactory">A factory for grid point curves along vertical direction, i.e. taken into account a specified interpolation, parametrization etc.</param>
            /// <param name="horizontalInterpolator">The interpolation approach along horizontal direction.</param>
            /// <param name="horizontalLeftExtrapolator">The extrapolation approach in horizontal direction on the left side of the grid points.</param>
            /// <param name="horizontalRightExtrapolator">The extrapolation approach in horizontal direction on the right side of the grid points.</param>
            internal HInterpolation(LabelMatrix <THorizontalLabel, TVerticalLabel> gridPointMatrix, Func <THorizontalLabel, IGridPointCurveFactory <TVerticalLabel> > verticalCurveFactory, GridPointCurve.Interpolator horizontalInterpolator, GridPointCurve.Extrapolator horizontalLeftExtrapolator, GridPointCurve.Extrapolator horizontalRightExtrapolator)
                : base(gridPointMatrix, verticalCurveFactory)
            {
                m_HorizontalInterpolatorFactory = horizontalInterpolator ?? throw new NullReferenceException(nameof(horizontalInterpolator));
                m_HorizontalInterpolator        = horizontalInterpolator.Create();

                if (horizontalLeftExtrapolator == null)
                {
                    throw new NullReferenceException(nameof(horizontalLeftExtrapolator));
                }
                if (horizontalLeftExtrapolator.ExtrapolationBuildingDirection != GridPointCurve.Extrapolator.BuildingDirection.FromFirstGridPoint)
                {
                    throw new ArgumentException(String.Format("Invalid building direction of extrapolation on left side of the grid points."), nameof(horizontalLeftExtrapolator));
                }
                m_HorizontalLeftExtrapolatorFactory = horizontalLeftExtrapolator;
                m_HorizontalLeftExtrapolator        = horizontalLeftExtrapolator.Create(m_HorizontalInterpolator);

                if (horizontalRightExtrapolator == null)
                {
                    throw new NullReferenceException(nameof(horizontalRightExtrapolator));
                }
                if (horizontalRightExtrapolator.ExtrapolationBuildingDirection != GridPointCurve.Extrapolator.BuildingDirection.FromLastGridPoint)
                {
                    throw new ArgumentException(String.Format("Invalid building direction of extrapolation on the right side of the grid points."), nameof(horizontalRightExtrapolator));
                }
                m_HorizontalRightExtrapolatorFactory = horizontalRightExtrapolator;
                m_HorizontalRightExtrapolator        = horizontalRightExtrapolator.Create(m_HorizontalInterpolator);

                m_TempValuesForHorizontalEvaluation = new double[m_HorizontalDoubleLabels.Length];
                m_TempHorizontalDoubleLabels        = new double[m_GridPointMatrix.ColumnCount];
            }
예제 #2
0
            /// <summary>Initializes a new instance of the <see cref="VInterpolation"/> class.
            /// </summary>
            /// <param name="gridPointMatrix">The grid point matrix.</param>
            /// <param name="horizontalCurveFactory">A factory for grid point curves along horizontal direction, i.e. taken into account a specified interpolation, parametrization etc.</param>
            /// <param name="verticalInterpolator">The interpolation approach along vertical direction.</param>
            /// <param name="verticalAboveExtrapolator">The extrapolation approach in vertical direction above the grid points.</param>
            /// <param name="verticalBelowExtrapolator">The extrapolation approach in vertical direction below the grid points.</param>
            internal VInterpolation(LabelMatrix <THorizontalLabel, TVerticalLabel> gridPointMatrix, Func <TVerticalLabel, IGridPointCurveFactory <THorizontalLabel> > horizontalCurveFactory, GridPointCurve.Interpolator verticalInterpolator, GridPointCurve.Extrapolator verticalAboveExtrapolator, GridPointCurve.Extrapolator verticalBelowExtrapolator)
                : base(gridPointMatrix, horizontalCurveFactory)
            {
                m_VerticalInterpolatorFactory = verticalInterpolator ?? throw new NullReferenceException(nameof(verticalInterpolator));
                m_VerticalInterpolator        = verticalInterpolator.Create();

                if (verticalAboveExtrapolator == null)
                {
                    throw new NullReferenceException(nameof(verticalAboveExtrapolator));
                }
                if (verticalAboveExtrapolator.ExtrapolationBuildingDirection != GridPointCurve.Extrapolator.BuildingDirection.FromFirstGridPoint)
                {
                    throw new ArgumentException(String.Format("Invalid building direction of extrapolation above grid points."), nameof(verticalAboveExtrapolator));
                }
                m_VerticalAboveExtrapolatorFactory = verticalAboveExtrapolator;
                m_VerticalAboveExtrapolator        = verticalAboveExtrapolator.Create(m_VerticalInterpolator);

                if (verticalBelowExtrapolator == null)
                {
                    throw new NullReferenceException(nameof(verticalBelowExtrapolator));
                }
                if (verticalBelowExtrapolator.ExtrapolationBuildingDirection != GridPointCurve.Extrapolator.BuildingDirection.FromLastGridPoint)
                {
                    throw new ArgumentException(String.Format("Invalid building direction of extrapolation below grid points."), nameof(verticalBelowExtrapolator));
                }
                m_VerticalBelowExtrapolatorFactory = verticalBelowExtrapolator;
                m_VerticalBelowExtrapolator        = verticalBelowExtrapolator.Create(m_VerticalInterpolator);

                m_TempValuesForVerticalEvaluation = new double[m_VerticalDoubleLabels.Length];
                m_TempVerticalDoubleLabels        = new double[m_GridPointMatrix.RowCount];
            }