Esempio n. 1
0
        public void GivenLinear2DInput_InterpolationExact()
        {
            LinearInterpolation2D interpolation = new LinearInterpolation2D(
                new double[] { -4, -3, 0 },
                new double[] { -1, 2, 5 },
                new double[, ] {
                { -5, -2, 1 }, { -4, -1, 2 }, { -1, 2, 5 }
            });

            AssertHelper.AssertApproximatelyEqual(-0.5, interpolation.GetValue(-3.5, 3));
            AssertHelper.AssertApproximatelyEqual(0, interpolation.GetValue(-2, 2));
            AssertHelper.AssertApproximatelyEqual(2, interpolation.GetValue(-1, 3));
            AssertHelper.AssertApproximatelyEqual(0.3, interpolation.GetValue(-2.9, 3.2));
            AssertHelper.AssertApproximatelyEqual(-1.5, interpolation.GetValue(-4, 2.5));
            AssertHelper.AssertApproximatelyEqual(1, interpolation.GetValue(0, 1));
            AssertHelper.AssertApproximatelyEqual(0.6, interpolation.GetValue(-1, 1.6));
            AssertHelper.AssertApproximatelyEqual(-3.1, interpolation.GetValue(-3.2, 0.1));
            AssertHelper.AssertApproximatelyEqual(2.5, interpolation.GetValue(-2, 4.5));
        }
Esempio n. 2
0
        /********************************************************************************************
        * Public members, functions and properties
        ********************************************************************************************/

        public void Advance(
            double newTime
            )
        {
            LinearInterpolation2D interpT  = new LinearInterpolation2D(System.XAxis, System.YAxis, Temperature.GetValues());
            LinearInterpolation2D interpVX = new LinearInterpolation2D(System.XAxis, System.YAxis, VelocityX.GetValues());
            LinearInterpolation2D interpVY = new LinearInterpolation2D(System.XAxis, System.YAxis, VelocityY.GetValues());
            LinearInterpolation2D interpE  = new LinearInterpolation2D(System.XAxis, System.YAxis, ElectricField.GetValues());
            LinearInterpolation2D interpB  = new LinearInterpolation2D(System.XAxis, System.YAxis, MagneticField.GetValues());

            SetValues((xIndex, yIndex, pTIndex, stateIndex) =>
            {
                if (!IsStateAlreadyFormed(pTIndex, stateIndex, newTime))
                {
                    return(0);
                }
                else
                {
                    GetQQStateCoordinates(xIndex, yIndex, pTIndex, stateIndex, newTime,
                                          out double x, out double y);

                    if (!IsInDomainOfCalculation(x, y))
                    {
                        return(0);
                    }
                    else
                    {
                        double vQGP = Math.Sqrt(Math.Pow(interpVX.GetValue(x, y), 2)
                                                + Math.Pow(interpVY.GetValue(x, y), 2));

                        return(GetDecayWidth(
                                   (BottomiumState)stateIndex,
                                   interpT.GetValue(x, y),
                                   GetRelativeVelocityInQQFrame(BetaT[pTIndex, stateIndex], vQGP),
                                   interpE.GetValue(x, y),
                                   interpB.GetValue(x, y)) / GammaT[pTIndex, stateIndex]);
                    }
                }
            });
        }