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 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); }
//============================================= 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); }
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); }
//-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- ///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); }
//----------------------------------------- //----------------------------------------- //**************************************** public Inv_SRInfoTable copy() { Inv_SRInfoTable output = new Inv_SRInfoTable(); foreach (Inv_SRInfoLine line in this.sRInfoLineList) { output.sRInfoLineList.Add(line); } output._dimFactor = this._dimFactor; output.f_alpha_d = this.f_alpha_d; output._p = this._p; output.sset = this.sset.ToList(); output.rset = this.rset.ToList(); return(output); }
//下面的程序适用Dijkstra中的S到R情况,Dij_1b调用了Dij_0b //the following function is for the Dijkstra S to R, Dij_1b uses Dij_0b public List <Dijkstra_output> Dij_1b(List <NodesInversion> input, List <double> D, Inv_SRInfoTable inputTable) { _sbDij_1b.Clear(); //============================================================== //定义输出//define output List <Dijkstra_output> output = new List <Dijkstra_output>(); //将乘以D后变成以根号6ftor4ft为单位的距离输出到Edge中 //D*root(6ftor4ft) as distance and write into Edge List <Edge> _edges_t = Dij_0b(input, D); //============================================================== Dictionary <string, Node> _dictNodes = new Dictionary <string, Node>(); List <Node> _nodes = new List <Node>(); foreach (NodesInversion n in input) { _nodes.Add(new Node(n.Name)); _dictNodes.Add(n.Name, new Node(n.Name)); } //将S和R分别放在ListS和ListR中 //write S and R into ListS and ListR, perspectively List <Node> ListS = new List <Node>(); List <Node> ListR = new List <Node>(); #region foreach (NodesInversion n in input) { switch (n.Type) { case NodesInversion.NodesType.Sender: ListS.Add(new Node(n.Name)); break; case NodesInversion.NodesType.Receiver: ListR.Add(new Node(n.Name)); break; default: break; } } #endregion foreach (Node s in ListS) { // new Dijkstra class Dijkstra d = new Dijkstra(_edges_t, _nodes); // calculate the distance d.calculateDistance(s); foreach (Node r in ListR) { // here need to check if s->r we need??? bool sr = false; foreach (Inv_SRInfoLine line in inputTable.SRInfoLineList) { if (line.Start.Name.Equals(s.Name) && line.End.Name.Equals(r.Name)) { sr = true; break; } } if (sr) { // Pfad zu einem bestimmten Knoten ausgeben List <Node> path = d.getPathTo(r); Dijkstra_output dij = new Dijkstra_output(); dij.Start = s; dij.End = r; dij.Path = path; dij.TravelTime = d.Dist[r.Name]; output.Add(dij); } } } // log file foreach (Dijkstra_output n in output) { _sbDij_1b.Append(n.print()); } return(output); }