public void BuilTopology() { var grid = Grid as RegularGrid; _WellTopo = new RegularGridTopology(); int sp = 0; for (int i = 0; i < FluxRates.Size[0]; i++) { if (FluxRates.Flags[i, 0] == TimeVarientFlag.Individual) { sp = i; break; } } _WellTopo.ActiveCell = new int[NWell][]; _WellTopo.ActiveCellIDs = new int[NWell]; _WellTopo.RowCount = grid.RowCount; _WellTopo.ColumnCount = grid.ColumnCount; _WellTopo.ActiveCellCount = NWell; for (int i = 0; i < NWell; i++) { int row = (int)Locations[0, i, 1]; int col = (int)Locations[0, i, 2]; _WellTopo.ActiveCell[i] = new int[] { row - 1, col - 1 }; _WellTopo.ActiveCellIDs[i] = grid.Topology.GetID(row - 1, col - 1); } FluxRates.Topology = _WellTopo; }
public void BuildTopology() { var grid = Grid as RegularGrid; Topology = new RegularGridTopology(); Topology.ActiveCell = new int[NFLW][]; Topology.ActiveCellIDs = new int[NFLW]; Topology.RowCount = grid.RowCount; Topology.ColumnCount = grid.ColumnCount; Topology.ActiveCellCount = NFLW; var mat = FlowRate; for (int i = 0; i < NFLW; i++) { int layer = (int)mat[0, 0, i]; int row = (int)mat[1, 0, i]; int col = (int)mat[2, 0, i]; Topology.ActiveCell[i] = new int[] { row - 1, col - 1 }; Topology.ActiveCellIDs[i] = grid.Topology.GetID(row - 1, col - 1); } FlowRate.Topology = this.Topology; }
public override bool Load(ICancelProgressHandler progresshandler) { if (File.Exists(FileName)) { var grid = (Owner.Grid as MFGrid); Observations.Clear(); StreamReader sr = new StreamReader(FileName); var line = ReadComment(sr); var strs = TypeConverterEx.Split <string>(line, 6); NH = int.Parse(strs[0]); MOBS = int.Parse(strs[1]); MAXM = int.Parse(strs[2]); IUHOBSV = int.Parse(strs[3]); HOBDRY = float.Parse(strs[4]); Option = strs[5]; TOMULTH = TypeConverterEx.Split <float>(sr.ReadLine(), 1)[0]; Topology = new RegularGridTopology(); int i = 0; while (!sr.EndOfStream) { line = sr.ReadLine(); var vv = TypeConverterEx.SkipSplit <float>(line, 1, 8); strs = TypeConverterEx.Split <string>(line); HeadObservation obs = new HeadObservation(i) { Layer = (int)vv[0], Row = (int)vv[1], Column = (int)vv[2], IREFSPFlag = (int)vv[3], Name = strs[0] }; obs.CellID = grid.Topology.GetID(obs.Row - 1, obs.Column - 1); if (obs.IREFSPFlag < 0) { line = sr.ReadLine(); obs.ITT = TypeConverterEx.Split <int>(line, 1)[0]; int nsp = Math.Abs((int)vv[3]); obs.IREFSP = new int[nsp]; obs.TOFFSET = new float[nsp]; obs.HOBS = new float[nsp]; obs.ROFF = vv[5]; obs.COFF = vv[6]; for (int t = 0; t < nsp; t++) { line = sr.ReadLine(); vv = TypeConverterEx.SkipSplit <float>(line, 1, 4); obs.IREFSP[t] = (int)vv[0]; obs.TOFFSET[t] = vv[1]; obs.HOBS[t] = vv[2]; } } else { int nsp = 1; obs.IREFSP = new int[nsp]; obs.TOFFSET = new float[nsp]; obs.HOBS = new float[nsp]; obs.IREFSP[0] = (int)vv[3]; obs.TOFFSET[0] = vv[4]; obs.ROFF = vv[5]; obs.COFF = vv[6]; obs.HOBS[0] = vv[7]; } obs.Elevation = grid.GetElevationAt(obs.Row - 1, obs.Column - 1, obs.Layer - 1); Observations.Add(obs); i++; } if (Observations.Any()) { Topology.ActiveCell = new int[NH][]; Topology.ActiveCellIDs = new int[NH]; Topology.RowCount = grid.RowCount; Topology.ColumnCount = grid.ColumnCount; Topology.ActiveCellCount = NH; var nsp1 = (Observations[0] as HeadObservation).IREFSP.Length; HOBS = new DataCube <float>(1, nsp1, NH); HOBS.Variables = new string[] { "Head Observation" }; for (int t = 0; t < nsp1; t++) { for (int k = 0; k < NH; k++) { var hob = Observations[k] as HeadObservation; HOBS[0, t, k] = hob.HOBS[t]; Topology.ActiveCell[k] = new int[] { hob.Row - 1, hob.Column - 1 }; Topology.ActiveCellIDs[k] = grid.Topology.GetID(hob.Row - 1, hob.Column - 1); } } HOBS.Topology = this.Topology; } sr.Close(); OnLoaded(progresshandler); return(true); } else { OnLoadFailed("Failed to load " + this.Name, progresshandler); return(false); } }