public Inv_StraightRayWithConstrain(float[] domain, Inv_SRInfoTable table, List <double> d, InversionParameters inputIP)
        {
            if (domain.Length != 4 || inputIP.NX < 1 || inputIP.NZ < 1)
            {
                MessageBox.Show("input parameter error in Inv_StraightRay!");
                //check if the input
            }
            _domain    = new float[4];
            _domain[0] = domain[0]; _domain[1] = domain[1]; _domain[2] = domain[2]; _domain[3] = domain[3];

            _table = table.copy();
            _iP    = new InversionParameters(inputIP.NX, inputIP.NZ);
            _iP.CopyFrom(inputIP);
            conMinX = Vector <double> .Build.Dense(_iP.NX *_iP.NZ, double.MinValue);

            conMaxX = Vector <double> .Build.Dense(_iP.NX *_iP.NZ, double.MaxValue);

            CreateConValues(_iP);                           // build up conMinValue and conMaxValue
            //MessageBox.Show("After\r\n" + conMaxX.ToString() + "\r\n" + conMinX.ToString());
            _initialDiffusivity = d.ToList();               // these initial D in cells are mightbe different
            _tMeasured          = TsGenerator1(_table);     // initial travel time
            _tProcessed         = TsGenerator2(_table);     // travel time after transition
            _fRs    = DsGenerator(_domain, _iP.NX, _iP.NZ); // construt the elements (rectangles)
            _result = new List <SIRT_Result_StraightRay>();
        }
        public Inv_NetworkWithConstrains(float[] domain, Inv_SRInfoTable table, List <double> d, InversionParameters inputIP)
        {
            _domain    = new float[4];
            _domain[0] = domain[0]; _domain[1] = domain[1]; _domain[2] = domain[2]; _domain[3] = domain[3];
            _nx        = inputIP.NX;
            _nz        = inputIP.NZ;
            _table     = table.copy();

            _iP = new InversionParameters(inputIP.NX, inputIP.NZ);
            _iP.CopyFrom(inputIP);
            conMinX = Vector <double> .Build.Dense(_iP.NX *_iP.NZ, double.MinValue);

            conMaxX = Vector <double> .Build.Dense(_iP.NX *_iP.NZ, double.MaxValue);

            CreateConValues(_iP);// build up conMinValue and conMaxValue

            _diffusivity = d.ToList();
            _tMeasured   = TsGenerator1(_table);
            _tProcessed  = TsGenerator2(_table);//已经乘以系数并开方,也就是说是b项//the vector b
            //MessageBox.Show(_table.F_alpha_d.ToString());

            _fRs      = DsGenerator(_domain, _nx, _nz);
            _nodesInv = NodesGenerator8();
            _sirt_Res = new List <SIRT_Result>();
        }
        private void CreateConValues(InversionParameters inputIP)
        {
            double xMax  = 1.0 / (Math.Sqrt(_iP.MinD));// set the constrain of x, x=1/(root of diffusivity)
            double xMin  = 1.0 / (Math.Sqrt(_iP.MaxD));
            double xBig  = xMax;
            double xSma  = xMin;
            int    index = 0;
            int    rows  = inputIP.ConBoolMatrix.RowCount;
            int    cols  = inputIP.ConBoolMatrix.ColumnCount;

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    index = i * cols + j;
                    // every cell has constrin: >xMin and <xMax
                    conMinX[index] = xMin;
                    conMaxX[index] = xMax;
                    if (inputIP.ConBoolMatrix[i, j] == 1)
                    {
                        // this cell has a extra constrain
                        xBig           = 1.0 / (Math.Sqrt(_iP.ConValueMatrix[i, j]));
                        xSma           = 1.0 / (Math.Sqrt(_iP.ConValueMatrix[i, j]));
                        conMinX[index] = xSma;
                        conMaxX[index] = xBig;
                    }
                    else if (inputIP.ConBoolMatrix[i, j] == 0)
                    {
                        // this cell does not any constrain more
                    }
                    else
                    {
                        MessageBox.Show("Error in CreateConValues in Inv_StraightRayWithConstrins");
                    }
                }
            }
            // check if every value in conMaxX is larger than conMinX
            for (int i = 0; i < conMaxX.Count; i++)
            {
                if (conMaxX[i] < conMinX[i])
                {
                    MessageBox.Show("Error in Check of CreateConValues in Inv_StraightRayWithConstrins");
                }
            }
        }
 public void CopyFrom(InversionParameters IP)
 {
     if (IP.NZ == NZ && IP.NX == NX)
     {
         StrRay         = IP.StrRay;
         CurRay         = IP.CurRay;
         CriRMS         = IP.CriRMS;
         InitialD       = IP.InitialD;
         MinD           = IP.MinD;
         MaxD           = IP.MaxD;
         ConBoolMatrix  = IP.ConBoolMatrix;
         ConValueMatrix = IP.ConValueMatrix;
         SIRTOption     = IP.SIRTOption;
     }
     else
     {
         MessageBox.Show("Dimension of two inversionparameters are not the same!\r\nError in CopyFrom(InversionParameters)");
     }
 }