Exemple #1
0
        private static Complex[] Calculate(NativeEnvelop ne, Complex[,] eta, Action <IntPtr, IntPtr, IntPtr> calc)
        {
            var result = new Complex[ne.length];

            fixed(Complex *etaPtr = &eta[0, 0], resultPtr = &result[0])
            calc(new IntPtr(&ne), new IntPtr(etaPtr), new IntPtr(resultPtr));

            return(result);
        }
Exemple #2
0
        private NativeEnvelop GetNativeEnvelop(AuxContainerFast c)
        {
            var ne = new NativeEnvelop()
            {
                length = c.Eta.GetLength(1),
                r      = c.CorrBackgroundRc,
                s      = c.CorrBackgroundTr,

                r1 = (double)c.Rc.StartingDepth,
                r2 = (double)c.Rc.GetEndDepth(),
                s1 = (double)c.Tr.StartingDepth,
                s2 = (double)c.Tr.GetEndDepth(),
            };

            ne.t   = System.Math.Min(ne.r, ne.s);
            ne.b   = System.Math.Max(ne.r, ne.s);
            ne.dt  = (double)_model.GetLayerDepth(ne.t);
            ne.db1 = (double)_model.GetLayerDepth(ne.b + 1);

            return(ne);
        }
Exemple #3
0
        private Complex[] CalcPsi1RcAndTrMatch(Complex[,] eta, Complex[,] p, Complex[,] q, NativeEnvelop ne)
        {
            var tau = ne.r2 - ne.r1;
            var n   = ne.r;
            var dn1 = (double)(_model.GetLayerDepth(n + 1) - _model.GetLayerDepth(n));

            var psi1 = new Complex[_currentLength];

            for (int i = 0; i < _currentLength; i++)
            {
                var part1 = tau * eta[n, i] - (1 - exp(-eta[n, i] * tau));
                var part2 = p[n, i] * q[n, i] *
                            ((tau * eta[n, i] + 1) * exp(-2 * eta[n, i] * dn1) -
                             exp(-2 * eta[n, i] * dn1 + eta[n, i] * tau));

                psi1[i] = 2 * (part1 - part2);
            }

            return(psi1);
        }
Exemple #4
0
        private Complex[] CalcPsi5RcAndTrMatch(Complex[,] eta, Complex[,] p, Complex[,] q, NativeEnvelop ne, double[] lambdas)
        {
            var n   = ne.r;
            var tau = ne.r2 - ne.r1;
            var ln  = (double)_model.Section1D[n].Thickness;

            var layer = _model.Section1D[n];
            var kk    = new Complex(0, _model.Omega) * layer.Zeta * Mu0;

            var psi5 = new Complex[_currentLength];

            for (int i = 0; i < _currentLength; i++)
            {
                var part1 = -(1 - exp(-eta[n, i] * tau));
                var part2 = p[n, i] * q[n, i] * (exp(-eta[n, i] * (2 * ln - tau)) - exp(-2 * eta[n, i] * ln));
                var part3 = (kk / (lambdas[i] * lambdas[i])) * (1 - p[n, i] * q[n, i] * exp(-2 * eta[n, i] * ln)) * tau * eta[n, i];

                psi5[i] = 2 * (part1 + part2 + part3);
            }

            return(psi5);
        }
Exemple #5
0
        private Complex[] CalcPsi3And4RcBelowTr(Complex[,] eta, Complex[,] p, Complex[,] q, NativeEnvelop ne)
        {
            var cbot = _calcCbot; //UnsafeNativeMethods.CalculateCBot(ne, eta);
            var dbot = _calcDbot; //UnsafeNativeMethods.CalculateDBot(ne, eta);

            var psi3 = new Complex[_currentLength];

            for (int i = 0; i < _currentLength; i++)
            {
                psi3[i] = -cbot[i] + p[ne.t, i] * q[ne.b, i] * dbot[i];
            }

            return(psi3);
        }
Exemple #6
0
        private Complex[] CalcPsi3And4RcAboveTr(Complex[,] eta, Complex[,] p, Complex[,] q, NativeEnvelop ne)
        {
            var ctop = _calcCtop; // UnsafeNativeMethods.CalculateCTop(ne, eta);
            var dtop = _calcDtop; // UnsafeNativeMethods.CalculateDTop(ne, eta);

            var psi3 = new Complex[_currentLength];

            for (int i = 0; i < _currentLength; i++)
            {
                psi3[i] = ctop[i] - p[ne.t, i] * q[ne.b, i] * dtop[i];
            }

            return(psi3);
        }
Exemple #7
0
        private Complex[] CalcPsi3And4RcAndTrMatch(Complex[,] eta, Complex[,] p, Complex[,] q, NativeEnvelop ne)
        {
            var psi = new Complex[ne.length];

            Array.Clear(psi, 0, psi.Length);
            return(psi);
        }
Exemple #8
0
 public static Complex[] CalculateDBot(NativeEnvelop ne, Complex[,] eta)
 => Calculate(ne, eta, CalculateDBot);
Exemple #9
0
 public static Complex[] CalculateCTop(NativeEnvelop ne, Complex[,] eta)
 => Calculate(ne, eta, CalculateCTop);