public override bool New(ICancelProgressHandler progress, bool ImportFromExistingModel) { var succ = true; System.IO.Directory.CreateDirectory(GeoSpatialDirectory); System.IO.Directory.CreateDirectory(ProcessingDirectory); System.IO.Directory.CreateDirectory(InputDirectory); System.IO.Directory.CreateDirectory(MFInputDirectory); System.IO.Directory.CreateDirectory(PRMSInputDirectory); System.IO.Directory.CreateDirectory(OutputDirectory); RelativeMapFileName = Name + ".dspx"; FullProjectFileName = Path.Combine(AbsolutePathToProjectFile, Name + ".vhfx"); if (!ImportFromExistingModel) { RelativeControlFileName = Name + ".nam"; var model = new Modflow() { Project = this, WorkDirectory = FullModelWorkDirectory, ControlFileName = RelativeControlFileName }; model.Initialize(); succ = model.New(progress); this.Model = model; } _IsDirty = true; return(true); }
public void Extract(string mfn_file, string fs_file, int lurow, int lucol, int rlrow, int rlcol) { IFeatureSet fs = FeatureSet.Open(fs_file); Modflow mf = new Modflow(); mf.TimeUnit = this.TimeUnit; mf.LengthUnit = this.LengthUnit; MFGrid rawgrid = this.Grid as MFGrid; mf.Grid = rawgrid.Extract(fs, lurow, lucol, rlrow, rlcol); FileInfo finfo = new FileInfo(mfn_file); string mfn = Path.GetFileNameWithoutExtension(mfn_file); foreach (var pckname in this.Packages.Keys) { var pck = this.Packages[pckname] as IExtractMFPackage; if (pck != null) { var newpck = pck.Extract(mf); if (newpck != null) { newpck.FileName = Path.Combine(finfo.DirectoryName, mfn + newpck.PackageInfo.FileExtension); mf.AddInSilence(newpck); } } } foreach (var pck in mf.Packages.Values) { pck.Save(null); } _MFNameManager.Save(ControlFileName); }
public bool Load(IProject project, ICancelProgressHandler progress) { ModelService.WorkDirectory = project.FullModelWorkDirectory; Modflow model = new Modflow(); model.ControlFileName = project.RelativeControlFileName; model.WorkDirectory = project.FullModelWorkDirectory; model.Project = project; project.Model = model; model.Initialize(); var succ = model.Load(progress); if (succ) { var dic = GetExtentSettings(model.ControlFileName + ".ext"); var start = DateTime.Now; if (dic.Keys.Contains("Start")) { DateTime.TryParse(dic["Start"], out start); } model.TimeService.PopulateTimelineFromSP(start); model.TimeService.PopulateIOTimelineFromSP(); } return(succ); }
public override IPackage Extract(Modflow newmf) { DISPackage dis = new DISPackage(); dis.Owner = newmf; dis.LAYCBD = this.LAYCBD; return(dis); }
public override IPackage Extract(Modflow newmf) { BASPackage bas = new BASPackage(); bas.HNOFLO = this.HNOFLO; bas.Owner = newmf; MFGrid newgrid = newmf.Grid as MFGrid; MFGrid rawgrid = Owner.Grid as MFGrid; bas.STRT = new DataCube <float>(newgrid.ActualLayerCount, 1, newgrid.ActiveCellCount); for (int l = 0; l < newgrid.ActualLayerCount; l++) { // bas.STRT[l, MyMath.full] = rawgrid.GetSubSerialArray(this.STRT, newgrid, l).Value; } return(bas); }
public override IPackage Extract(Modflow newmf) { LPFPackage lpf = new LPFPackage(); lpf.Owner = newmf; lpf.ILPFCB = this.ILPFCB; lpf.HDRY = this.HDRY; lpf.NPLPF = this.NPLPF; lpf.IPHDRY = this.IPHDRY; lpf.LAYTYP = this.LAYTYP; lpf.LAYAVG = this.LAYAVG; lpf.CHANI = this.CHANI; lpf.LAYVKA = this.LAYVKA; lpf.LAYWET = this.LAYWET; lpf.WETFCT = this.WETFCT; lpf.IWETIT = this.IWETIT; lpf.IHDWET = this.IHDWET; MFGrid newgrid = newmf.Grid as MFGrid; MFGrid rawgrid = Owner.Grid as MFGrid; lpf.HK = new DataCube <float>(newgrid.ActualLayerCount, 1, newgrid.ActiveCellCount); lpf.HANI = new DataCube <float>(newgrid.ActualLayerCount, 1, newgrid.ActiveCellCount); lpf.VKA = new DataCube <float>(newgrid.ActualLayerCount, 1, newgrid.ActiveCellCount); lpf.SS = new DataCube <float>(newgrid.ActualLayerCount, 1, newgrid.ActiveCellCount); lpf.SY = new DataCube <float>(newgrid.ActualLayerCount, 1, newgrid.ActiveCellCount); lpf.WETDRY = new DataCube <float>(newgrid.ActualLayerCount, 1, newgrid.ActiveCellCount); for (int l = 0; l < newgrid.ActualLayerCount; l++) { //lpf.HK[l, 0] = rawgrid.GetSubSerialArray<float>(this.HK, newgrid, l).Value; //lpf.HANI[l, 0] = rawgrid.GetSubSerialArray<float>(this.HANI, newgrid, l).Value; //lpf.VKA[l, 0] = rawgrid.GetSubSerialArray<float>(this.VKA, newgrid, l).Value; //lpf.SS[l, 0] = rawgrid.GetSubSerialArray<float>(this.SS, newgrid, l).Value; //if (lpf.LAYTYP[l] != 0) // lpf.SY[l, 0] = rawgrid.GetSubSerialArray<float>(this.SY, newgrid, l).Value; //if (LAYTYP[l] != 0 && LAYWET[l] != 0) // lpf.WETDRY[l, 0] = rawgrid.GetSubSerialArray<float>(this.WETDRY, newgrid, l).Value; } return(lpf); }
public MFPackFileNameProvider(Modflow mf) { _Modflow = mf; }
public bool CanImport(IProject project) { Modflow model = new Modflow(); return(model.Exsit(project.RelativeControlFileName)); }
public override IPackage Extract(Modflow newmf) { return(null); }
public virtual IPackage Extract(Modflow newmf) { return(null); }