コード例 #1
0
        //---------------------------------------------
        //*********************************************
        public Inv_SRInfoLine copy()
        {
            Inv_SRInfoLine output = new Inv_SRInfoLine();

            output.name       = string.Copy(this.name);
            output.start      = this.start.copy();
            output.end        = this.end.copy();
            output.travelTime = this.travelTime;
            return(output);
        }
コード例 #2
0
        private List <double> TsGenerator2(Inv_SRInfoTable table)
        {
            List <double> output = new List <double>();

            foreach (Inv_SRInfoLine L in table.SRInfoLineList)
            {
                Inv_SRInfoLine ttl = L.copy();
                ttl.TravelTime = (float)Math.Pow(6 * table.F_alpha_d * ttl.TravelTime, 0.5);
                output.Add(ttl.TravelTime);
            }
            return(output);
        }
コード例 #3
0
        //=============================================
        private List <double> TsGenerator1(Inv_SRInfoTable table)
        {
            List <double> output = new List <double>();

            foreach (Inv_SRInfoLine L in table.SRInfoLineList)
            {
                Inv_SRInfoLine ttl = L.copy();
                ttl.TravelTime = ttl.TravelTime;
                output.Add(ttl.TravelTime);
            }
            return(output);
        }
コード例 #4
0
        public List <double> TsGenerator2(Inv_SRInfoTable table)
        {
            List <double> TTL = new List <double>();//--> 经过计算后将用来矩阵计算的TravelTimeList// the vector b used for b=Ax

            foreach (Inv_SRInfoLine L in table.SRInfoLineList)
            {
                Inv_SRInfoLine line = L.copy();
                line.TravelTime = (float)Math.Pow(table.DimFactor * _table.F_alpha_d * line.TravelTime, 0.5);
                TTL.Add(line.TravelTime);
            }
            return(TTL);
        }
コード例 #5
0
        //--------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------
        ///Measured TravelTime
        ///配置TravelTime的向量-->List<double> TTL//set the vector of travel time
        public List <double> TsGenerator1(Inv_SRInfoTable table)
        {
            List <double> TTL = new List <double>();//--> 经过计算后将用来矩阵计算的TravelTimeList// the vector b used for b=Ax

            foreach (Inv_SRInfoLine L in table.SRInfoLineList)
            {
                Inv_SRInfoLine line = L.copy();
                line.TravelTime = line.TravelTime;
                TTL.Add(line.TravelTime);
            }
            return(TTL);
        }
コード例 #6
0
        public void StRayAlgo()//straight ray algorithm
        {
            if (_result.Count == 0)
            {
                _result.Clear();
            }
            int n_d = _initialDiffusivity.Count; //he number of cells, it equals the number of columns of matrix A
            int n_t = _tProcessed.Count;         //the number of travel times, it equals the number of rows of matrix A
            // b=Ax, x->x2
            // consider b as time, A as distance, x as speed
            double          xMax       = 1.0 / (Math.Sqrt(_iP.MinD)); // set the constraint, the max of x, x=1/(root of diffusivity)
            double          xMin       = 1.0 / (Math.Sqrt(_iP.MaxD)); // set the constraint, the min of x, x=1/(root of diffusivity)
            List <double>   estimatedD = _initialDiffusivity.ToList();
            Vector <double> x          = Vector <double> .Build.Dense(n_d, 1);

            for (int i = 0; i < n_d; i++)
            {
                x[i] = 1.0 / (Math.Sqrt(estimatedD[i]));//the speed vector, x=1/(root of diffusivity)
            }

            #region
            int    iter = 0;
            double RMS  = _iP.CriRMS + 1;
            while (iter <_iP.StrRay& RMS> _iP.CriRMS)
            {
                //STEP 1
                SIRT_Result_StraightRay Record = new SIRT_Result_StraightRay();
                Record.Iter          = iter;
                Record.OldProcessedD = x.ToList();
                //====================================================
                //STEP 2 : Set matrix A
                Matrix <double> A = Matrix <double> .Build.Dense(n_t, n_d, 0);

                for (int row = 0; row < n_t; row++)
                {
                    Inv_SRInfoLine infoLine = (Inv_SRInfoLine)_table.SRInfoLineList[row];
                    MathNet.Spatial.Euclidean.Point2D PStart = new MathNet.Spatial.Euclidean.Point2D(infoLine.Start.Coor[0], infoLine.Start.Coor[2]);
                    MathNet.Spatial.Euclidean.Point2D PEnd   = new MathNet.Spatial.Euclidean.Point2D(infoLine.End.Coor[0], infoLine.End.Coor[2]);
                    MathNet.Spatial.Euclidean.Line2D  Traj   = new MathNet.Spatial.Euclidean.Line2D(PStart, PEnd);
                    for (int col = 0; col < n_d; col++)
                    {
                        CohenSutherland coh = new CohenSutherland();
                        List <MathNet.Spatial.Euclidean.Point2D> Ps = coh.CohenSutherlandLineClip(_fRs[col], PStart, PEnd).ToList();
                        if (Ps.Count > 1)
                        {
                            A[row, col] = Ps[0].DistanceTo(Ps[1]);
                        }
                    }
                }
                Record.A             = A.Clone();
                Record.ProcessedTime = (A * x).ToList();
                //====================================================
                //STEP 3 : set the start node and the end node from Record
                foreach (object obj in _table.SRInfoLineList)
                {
                    Inv_SRInfoLine infoLine = (Inv_SRInfoLine)obj;
                    Record.Start.Add(infoLine.Start);
                    Record.End.Add(infoLine.End);
                }
                //====================================================
                //STEP 4 : cimmino calculation
                Vector <double> b = Vector <double> .Build.DenseOfArray(_tProcessed.ToArray());

                SIRT_Options    so = new SIRT_Options(b, A, x, 1);// b=Ax
                Vector <double> x2 = so.XUpdaterDROP(x, 1);
                //====================================================
                //STEP 7 : update x and diffusivity for next iteration
                x = x2.Clone();
                for (int i = 0; i < n_d; i++)
                {
                    if (x[i] < conMinX[i])
                    {
                        x[i] = conMinX[i];
                    }
                    if (x[i] > conMaxX[i])
                    {
                        x[i] = conMaxX[i];
                    }
                }
                Record.NewProcessedD = x.ToList();
                //====================================================
                _result.Add(Record);//output
                iter = iter + 1;
            }
            #endregion
        }