//保存されている日食データを初期化する private void initPresetEclipseData(string datafilename) { // Assetsフォルダから読み込む string path = Application.dataPath + "/eclipsedata/" + datafilename; StreamReader reader = new StreamReader(path); string jsonstring = reader.ReadToEnd(); EclipseData data = null; try { data = JsonUtility.FromJson <EclipseData>(jsonstring); if (data != null && data.initDateTime()) { currenteclipsedata = data; start = currenteclipsedata.getStartTime(); finish = currenteclipsedata.getFinishTime(); current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc); longitude = data.getInitialMapLongitude(); latitude = data.getInitialMapLatitude(); shadowrenderer.setEclipseData(currenteclipsedata, earthshadow, UmbralShadowRenderer.PLAYMODE); //setCameraPosition(); ready = true; } reader.Close(); } catch (Exception e) { /* Debug.Log("readJson " + e.ToString());*/ } }
/// <summary> 获取单位制 </summary> public static UnitType GetUnitType(string dataFile) { // 不读取INCLUDE部分数据 EclipseData data = new EclipseData(dataFile, null, l => false); //var incs = data.Key.FindAll<INCLUDE>(); //// 设置所有INCLUDE都不生成文件 //incs.ForEach(l => l.IsCreateFile = false); // Todo :释放表格缓存文件 data.Key.SetAllMmfDispose(); // 读到METRIC英制单位 METRIC metric = data.Key.Find <METRIC>(); if (metric != null) { return(UnitType.METRIC); } // 单位类型 FIELD field = data.Key.Find <FIELD>(); if (field != null) { return(UnitType.FIELD); } data.Dispose(); return(UnitType.METRIC); }
/// <summary> 快速获取所有井名(只读取schedule部分的Include关键字) </summary> public static List <string> GetAllWell(string dataFile) { List <string> strs = new List <string>(); EclipseData eclData = null; Thread thread = new Thread(() => eclData = new EclipseData(dataFile, null, l => l.IsMatchParent <SCHEDULE>()), 4194304);// 4mb栈 thread.Start(); while (true) { if (thread.ThreadState == ThreadState.Stopped) { break; } } SCHEDULE sch = eclData.Key.Find <SCHEDULE>(); List <WELSPECS> ws = sch.FindAll <WELSPECS>(); ws.ForEach(l => { l.Items.ForEach(k => { strs.Add(k.jm0); }); }); eclData.Dispose(); return(strs.Distinct().ToList()); }
/// <summary> 获取所有井名 </summary> public static List <WELSPECS> GetAllWellModel(this EclipseData eclData) { SCHEDULE sch = eclData.Key.Find <SCHEDULE>(); List <WELSPECS> ws = sch.FindAll <WELSPECS>(); return(ws); }
/// <summary> 用重启信息生成新重启数据(只包含主文件,初始化文件和生产文件) </summary> public EclipseData ChangeRestartModel(EclipseData mainData, RestartInfoModel model) { // 不读取INCLUDE部分数据 EclipseData data = new EclipseData(mainData.FilePath, null, l => false); var incs = data.Key.FindAll <INCLUDE>(); // 设置所有INCLUDE都不生成文件 incs.ForEach(l => l.IsCreateFile = false); // 保存主文件 SOLUTION sl = data.Key.Find <SOLUTION>(); SCHEDULE sc = data.Key.Find <SCHEDULE>(); // 替换数据 sl.ExChangeData(model.Solution); sc.ExChangeData(model.Schedule); // 设置保存部分数据 List <INCLUDE> slIncludes = sl.FindAll <INCLUDE>(); slIncludes.ForEach(l => l.IsCreateFile = true); List <INCLUDE> scIncludes = sc.FindAll <INCLUDE>(); scIncludes.ForEach(l => l.IsCreateFile = true); // 保存主文件(目前没用) //model.MainData = data; return(data); }
/// <summary> 查找指定重启时间 </summary> public static DATES FindDates(this EclipseData eclData, DateTime pTime) { List <DATES> Dates = eclData.Key.FindAll <DATES>(); DATES findDate = Dates.Find(l => l.DateTime.Date == pTime.Date); return(findDate); }
void SearchFileEclipse() { OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog() == DialogResult.OK) { this.FilePath = dlg.FileName; } if (!File.Exists(this._filePath)) { return; } EclipseData ecl = FileFactoryService.Instance.ThreadLoadResize(this._filePath); //this.EclipseData = SimDataConvertService.Instance.ConvertToSimON(ecl); //SimONData sim = FileFactoryService.Instance.ThreadLoadSimONResize(this._filePath); //this.EclipseData = new EclipseData(); //RunLog = EclipseData.RunLog; //this.EclipseData.Load(this._filePath); //END end= this.EclipseData.Key.Find<END>(); // if(end!=null) // { // end.ClearAllAfter(); // } List <BaseKey> bb = ecl.Key.FindAll <BaseKey>(); var ssr = bb.FindAll(l => l.ParentKey == null); BkSource = ecl.Key.FindAll <BaseKey>(); if (BkSource.Count > 0) { IteamSel = BkSource.FirstOrDefault(); } Total = BkSource.Count.ToString(); List <BaseKey> unKonwKeys = BkSource.FindAll(l => !l.IsUnKnowKey); UnKownTotalType = unKonwKeys.GroupBy(l => l.Name.Split(' ')[0]).Count().ToString(); List <BaseKey> KonwKeys = BkSource.FindAll(l => l.IsUnKnowKey); KownTotalType = KonwKeys.GroupBy(l => l.Name.Split(' ')[0]).Count().ToString(); UnKownTotal = unKonwKeys.Count.ToString(); KownTotal = (int.Parse(Total) - int.Parse(UnKownTotal)).ToString(); }
/// <summary> 增加重启时间 </summary> public static DATES AddSchDates(this EclipseData eclData, DateTime pTime) { SCHEDULE schDate = eclData.Key.Find <SCHEDULE>(); START startDate = eclData.Key.Find <START>(); DateTime nowTime = startDate.StartTime; return(schDate.AddSchDates(nowTime, pTime)); }
public void setEclipseData(EclipseData data, Texture2D tex, int m) { if (m != PLAYMODE & m != RECORDMODE) { return; } mode = m; dataholder = data; dataread = true; init(tex); }
//EclipseDataHolderからデータを読み込む private void initFromEclipseDataHolder() { EclipseData data = EclipseDataHolder.getEclipseData(); if (data != null) { currenteclipsedata = data; start = currenteclipsedata.getStartTime(); finish = currenteclipsedata.getFinishTime(); current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc); ready = true; } }
//日食データをアセットバンドルから初期化する IEnumerator initEclipseDataFromAssetBundle(string datafilename) { string jsonstring = null; if (Application.platform == RuntimePlatform.WindowsEditor) { string path = Application.dataPath + "/StreamingAssets/" + datafileprefix + datafilename; StreamReader reader = new StreamReader(path); jsonstring = reader.ReadToEnd(); reader.Close(); } else if (Application.platform == RuntimePlatform.Android) { string bundleUrl = Path.Combine("jar:file://" + Application.dataPath + "!/assets" + "/", datafileprefix + datafilename); WWW www = new WWW(bundleUrl); yield return(www); while (!www.isDone) { } jsonstring = www.text; //text = "count =" + www.text.Length.ToString(); } try { EclipseData data = JsonUtility.FromJson <EclipseData>(jsonstring); if (data != null && data.initDateTime()) { currenteclipsedata = data; EclipseDataHolder.setEclipseData(currenteclipsedata); start = currenteclipsedata.getStartTime(); finish = currenteclipsedata.getFinishTime(); current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc); shadowrenderer.setEclipseData(currenteclipsedata, earthshadow, UmbralShadowRenderer.PLAYMODE); longitude = data.getInitialCameraLongitude(); latitude = data.getInitialCameraLatitude(); positionUpdated(0.0f, 0.0f); ready = true; } //reader.Close(); } catch (Exception e) { /*Debug.Log("readJson " + e.ToString());*/ } }
/// <summary> 获取所有井名 </summary> public static List <string> GetAllWell(this EclipseData eclData) { SCHEDULE sch = eclData.Key.Find <SCHEDULE>(); List <WELSPECS> ws = sch.FindAll <WELSPECS>(); List <string> strs = new List <string>(); ws.ForEach(l => { l.Items.ForEach(k => { strs.Add(k.jm0); }); }); return(strs.Distinct().ToList()); }
private void setTextAsset(string text, string datafilename) { if (datafilename.IndexOf(".json") != -1) { try { EclipseData data = JsonUtility.FromJson <EclipseData>(text); if (data != null && data.initDateTime()) { EclipseDataHolder.setEclipseData(data); ready = true; } //reader.Close(); } catch (Exception e) { /*Debug.Log("readJson " + e.ToString());*/ } } }
/// <summary> 利用数模文件异步创建指定大小栈的内存模型 </summary> public EclipseData ThreadLoadResize(string fileFullPath, int stactSize = 4194304) { EclipseData eclData = null; Thread thread = new Thread(() => eclData = new EclipseData(fileFullPath), stactSize);// 4mb栈 thread.Start(); while (true) { if (thread.ThreadState == ThreadState.Stopped) { break; } } return(eclData); }
//EclipseDataHolderからデータを読み込む private void initFromEclipseDataHolder() { EclipseData data = EclipseDataHolder.getEclipseData(); if (data != null) { currenteclipsedata = data; start = currenteclipsedata.getStartTime(); finish = currenteclipsedata.getFinishTime(); current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc); longitude = data.getInitialMapLongitude(); latitude = data.getInitialMapLatitude(); shadowrenderer.setEclipseData(currenteclipsedata, earthshadow, UmbralShadowRenderer.PLAYMODE); setCameraPosition(); ready = true; } }
/// <summary> 获取所有井组名 </summary> public static List <string> GetAllWellGroup(this EclipseData eclData) { SCHEDULE sch = eclData.Key.Find <SCHEDULE>(); List <GRUPTREE> ws = sch.FindAll <GRUPTREE>(); List <string> strs = new List <string>(); ws.ForEach(l => { l.Items.ForEach(k => { strs.Add(k.zjzm0); strs.Add(k.fjzm1); }); }); return(strs.Distinct().ToList()); }
/// <summary> 创建初始重启模型 </summary> public MainFileRestart InitRestartInfoModel(EclipseData mainData) { START start = mainData.Key.Find <START>(); if (start == null) { return(null); } MainFileRestart restart = new MainFileRestart(); restart.Parent = null; restart.RestartTime = start.StartTime; restart.FileName = Path.GetFileNameWithoutExtension(mainData.FileName); restart.FilePath = Path.GetDirectoryName(mainData.FilePath); restart.Index = 0; // 把主文件的SCH和SOLU部分传进来 restart.Solution = mainData.Key.Find <SOLUTION>(); restart.Schedule = mainData.Key.Find <SCHEDULE>(); return(restart); }
//空のデータクラスを初期化する private void initEmptyEclipseData() { //時刻はUTCで設定する int[] date = EclipseCalendar.schedule[8]; finish = new DateTime(date[5], date[6], date[7], date[8], date[9], 0, DateTimeKind.Utc); start = new DateTime(date[0], date[1], date[2], date[3], date[4], 0, DateTimeKind.Utc); current = new DateTime(date[0], date[1], date[2], date[3], date[4], 0, DateTimeKind.Utc); currenteclipsedata = new EclipseData(start, finish, 1); EclipseDataHolder.setEclipseData(currenteclipsedata); umbralshadow = new Texture2D(earthshadow.width, earthshadow.height); result = new Texture2D(earthshadow.width, earthshadow.height); clearTexture(earthshadow); clearTexture(umbralshadow); clearTexture(result); shadowrenderer.setEclipseData(currenteclipsedata, earthshadow, umbralshadow, UmbralShadowRenderer.RECORDMODE); ready = true; }
//日食データを初期化する private void initEclipseData(string datafilename) { //Resourceから読み込む TextAsset jsondata = (TextAsset)Resources.Load("20300601", typeof(TextAsset)); //StreamReader reader = new StreamReader(path); string jsonstring = jsondata.text;//reader.ReadToEnd(); EclipseData data = null; try { data = JsonUtility.FromJson <EclipseData>(jsonstring); if (data != null && data.initDateTime()) { currenteclipsedata = data; start = currenteclipsedata.getStartTime(); finish = currenteclipsedata.getFinishTime(); current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc); ready = true; } } catch (Exception e) {} }
/// <summary> 利用数模文件异步创建指定大小栈的内存模型 </summary> public INCLUDE ThreadLoadFromFile(INCLUDE include, string pfilePath, SimKeyType keyType = SimKeyType.Eclipse, int stactSize = 4194304) { include.FileName = Path.GetFileName(pfilePath); include.FilePath = pfilePath; if (include.BaseFile == null) { if (keyType == SimKeyType.Eclipse) { EclipseData ecl = new EclipseData(); include.BaseFile = ecl; } else if (keyType == SimKeyType.SimON) { SimONData simon = new SimONData(); include.BaseFile = simon; } } Thread thread = new Thread(() => include.ReadFromStream(), stactSize);// 4mb栈 thread.Start(); while (true) { if (thread.ThreadState == ThreadState.Stopped) { break; } } return(include); }
/// <summary> 将Eclipse数模文件转换成SimON数模文件 </summary> public SimONData ConvertToSimON(EclipseData ecl) { // Todo :Eclipse里面的修改参数没有解析成SimON中修改参数 ecl.RunModify(); RUNSPEC runspec = ecl.Key.Find <RUNSPEC>(); GRID grid = ecl.Key.Find <GRID>(); SOLUTION solution = ecl.Key.Find <SOLUTION>(); SUMMARY summary = ecl.Key.Find <SUMMARY>(); SCHEDULE schedule = ecl.Key.Find <SCHEDULE>(); REGIONS regions = ecl.Key.Find <REGIONS>(); PROPS props = ecl.Key.Find <PROPS>(); SimONData simon = new SimONData(); simon.FileName = ecl.FileName; simon.FilePath = ecl.FilePath; simon.MmfDirPath = ecl.MmfDirPath; simon.InitConstruct(); simon.X = ecl.X; simon.Y = ecl.Y; simon.Z = ecl.Z; // 模型定义 #region - 起始时间 - SOLVECTRL tuning = new SOLVECTRL("TUNING"); tuning.Date = ecl.Key.Find <START>().StartTime; simon.Key.Add(tuning); #endregion #region - 维数定义 - RSVSIZE rsvsize = new RSVSIZE("RSVSIZE"); DIMENS dimens = ecl.Key.Find <DIMENS>(); rsvsize.X = dimens.X; rsvsize.Y = dimens.Y; rsvsize.Z = dimens.Z; simon.Key.Add(rsvsize); #endregion #region - 单位类型 - UnitType unitType = UnitType.METRIC; // 读到METRIC公制单位 METRIC metric = ecl.Key.Find <METRIC>(); if (metric != null) { simon.Key.Add(metric); unitType = UnitType.METRIC; } // 单位类型 FIELD field = ecl.Key.Find <FIELD>(); if (field != null) { simon.Key.Add(field); unitType = UnitType.FIELD; } #endregion #region - 流体类型 - MODELTYPE modeltype = new MODELTYPE("MODELTYPE"); // 流体类型 OIL oil = runspec.Find <OIL>(); WATER water = runspec.Find <WATER>(); GAS gas = runspec.Find <GAS>(); DISGAS disgas = runspec.Find <DISGAS>(); VAPOIL vapoil = runspec.Find <VAPOIL>(); // 黑油 if (oil != null && water != null && gas != null && disgas != null && vapoil == null) { modeltype.MetricType = MetricType.BLACKOIL; } // 油水 else if (oil != null && water != null && gas == null && disgas == null && vapoil == null) { modeltype.MetricType = MetricType.OILWATER; } // 气水 else if (oil == null && water != null && gas != null && disgas == null && vapoil == null) { modeltype.MetricType = MetricType.GASWATER; } // 挥发油 else if (oil != null && water != null && gas != null && disgas != null && vapoil != null) { modeltype.MetricType = MetricType.HFOIL; } else { modeltype.MetricType = MetricType.BLACKOIL; } simon.Key.Add(modeltype); #endregion #region - 分区维数 - EQUILREG equilreg = new EQUILREG("EQUILREG"); FIPREG fipreg = new FIPREG("FIPREG"); ROCKREG rockreg = new ROCKREG("ROCKREG"); SATREG satreg = new SATREG("SATREG"); PVTREG pvtreg = new PVTREG("PVTREG"); simon.Key.Add(equilreg); simon.Key.Add(fipreg); simon.Key.Add(rockreg); simon.Key.Add(satreg); simon.Key.Add(pvtreg); TABDIMS tabdims = runspec.Find <TABDIMS>(); if (tabdims != null) { fipreg.X = tabdims.Fipfqzds4.ToString(); rockreg.X = tabdims.Yslxgs12.ToString(); satreg.X = tabdims.Bhdbs0.ToString(); pvtreg.X = tabdims.Pvtbs1.ToString(); //fipreg.X = "1"; //rockreg.X = "1"; //satreg.X = "1"; //pvtreg.X = "1"; } EQLDIMS eqldims = runspec.Find <EQLDIMS>(); if (eqldims != null) { //equilreg.X = "1"; equilreg.X = eqldims.Phfqs0.ToString(); } OVERBURD overburd = props.Find <OVERBURD>(); if (overburd != null) { //rockreg.X = overburd.Regions.Count.ToString(); } EQUILMAP equilmap = new EQUILMAP("EQUILMAP"); FIPMAP fipmap = new FIPMAP("FIPMAP"); ROCKMAP rockmap = new ROCKMAP("ROCKMAP"); SATMAP satmap = new SATMAP("SATMAP"); PVTMAP pvtmap = new PVTMAP("PVTMAP"); if (regions != null) { EQLNUM eqlnum = regions.Find <EQLNUM>(); if (eqlnum != null) { equilmap = eqlnum.ToTableKey <EQUILMAP>(); solution.Add(equilmap); eqlnum.Delete(); eqlnum.Dispose(); } // Todo :非平衡初始化压力需要转换 var pressure = solution.Find <PRESSURE>(); if (pressure != null) { POIL poil = pressure.ToTableKey <POIL>(); solution.Add(poil); pressure.Delete(); pressure.Dispose(); } if (regions != null) { FIPNUM fipnum = regions.Find <FIPNUM>(); if (fipnum != null) { fipmap = fipnum.ToTableKey <FIPMAP>(); grid.Add(fipmap); fipnum.Delete(); fipnum.Dispose(); } ROCKNUM rocknum = regions.Find <ROCKNUM>(); if (rocknum != null) { rockmap = rocknum.TransToTableKeyByName("ROCKMAP", true) as ROCKMAP; grid.Add(rockmap); rocknum.Delete(); rocknum.Dispose(); } SATNUM satnum = regions.Find <SATNUM>(); if (satnum != null) { satmap = satnum.ToTableKey <SATMAP>(); grid.Add(satmap); satnum.Delete(); satnum.Dispose(); } PVTNUM pvtnum = regions.Find <PVTNUM>(); if (pvtnum != null) { pvtmap = pvtnum.ToTableKey <PVTMAP>(); grid.Add(pvtmap); pvtnum.Delete(); pvtnum.Dispose(); } } } #endregion #region - 地质模型 - simon.Key.Add(grid); #endregion #region - 断层 - //var eclFaults = grid.FindAll<OPT.Product.SimalorManager.RegisterKeys.Eclipse.FAULTS>(); //foreach (var v in eclFaults) //{ //grid.AddRange(this.ConvertToSimON(v)); //v.Delete(); //} #endregion #region - 水体 - //AQUFETP AQUFETP= // Todo :Fetkovich水体数据转换 var ct = solution.Find <OPT.Product.SimalorManager.RegisterKeys.Eclipse.AQUCT>(); if (ct != null) { var newFetp = this.ConvertToSimON(ct); solution.Add(newFetp); ct.Delete(); } // Todo :Fetkovich水体数据转换 var fetp = solution.Find <OPT.Product.SimalorManager.RegisterKeys.Eclipse.AQUFETP>(); if (fetp != null) { var newFetp = this.ConvertToSimON(fetp); solution.Add(newFetp); fetp.Delete(); } // Todo :水体连接数据转换 var aquancon = solution.Find <OPT.Product.SimalorManager.RegisterKeys.Eclipse.AQUANCON>(); if (aquancon != null) { var newFetp = this.ConvertToSimON(aquancon); solution.Add(newFetp); aquancon.Delete(); } #endregion #region - 流体模型 岩石模型- GRAVITY gravity = ecl.Key.Find <GRAVITY>(); if (gravity != null) { // Todo :SimON只解析绝对密度 DENSITY density = this.ConvertTo(gravity, unitType); gravity.ParentKey.Add(density); gravity.Delete(); } List <IRegionInterface> regSoltionKeys = solution.FindAll <IRegionInterface>(); regSoltionKeys.ForEach(l => l.TransToSimONRegion()); simon.Key.Add(solution); // List <IRegionInterface> regPropsKeys = props.FindAll <IRegionInterface>(); regPropsKeys.ForEach(l => l.TransToSimONRegion()); //// Todo :SGWFN 需要特殊转换为 SWGF //SGWFN sgwfn = props.Find<SGWFN>(); //if (sgwfn != null) //{ // //props.AddRange(sgwfn.ConvertTo()); // simon.Key.AddRange<SWGF>(sgwfn.ConvertTo()); //} simon.Key.Add(props); #endregion #region - 初始化模型 - List <EQUIL> equil = solution.FindAll <EQUIL>(); foreach (var item in equil) { EQUILPAR equilpar = new EQUILPAR("EQUILPAR"); EQUIL.Item it = item.GetSingleRegion().GetSingleItem(); equilpar.Szstzdhs0 = it.cksd0; equilpar.Szstljs1 = it.ckyl1; equilpar.Ctstyxhs2 = it.ysjmsd2; equilpar.Ctstyxzdhs3 = it.ysjmcmgyl3.ToDefalt("0"); //equilpar.Jxstzds4 = it.yqjmsd4; equilpar.E100wgzds5 = it.yqjmsd4; equilpar.E300jxstzds6 = it.yqjmcmgyl5; item.ParentKey.Add(equilpar); item.Delete(); } #endregion #region - 生产模型 - WELL well = new WELL("WELL"); // Todo :添加完井数据 (注意要放到生产模型前面) simon.Key.Add(well); // 生产模型 simon.Key.Add(this.ConvertToSimON(schedule, well, ecl.Key.Find <START>().StartTime, simon.HistoryData)); #endregion // Todo :转换修正关键字 List <ModifyKey> modifys = ecl.Key.FindAll <ModifyKey>(); grid.AddRange(modifys); return(simon); }
/// <summary> 用修正参数获取临时数据 endPosition 碰到此修正参数退出 </summary> public void RefreshCacheTable(EclipseData _eclData, List <ModifyKey> modifys, IModifyModel endPosition = null) { if (!IsModifyChanged) { return; } this.InitCacheTables(); // 查找所有修改关键字 //List<ModifyKey> modifys = _eclData.Key.FindAll<ModifyKey>(); //// 获取当前关键字关联的修改关键字 //List<ModifyKey> thisModify = modifys.FindAll(l => l.ObsoverModel.Exists(k => k.KeyName == this.Name)); DIMENS d = _eclData.Key.Find <DIMENS>(); if (d == null) { return; } IsModifyChanged = false; // 构造全网格范围 RegionParam tempRegion = new RegionParam(); tempRegion.XFrom = 1; tempRegion.XTo = d.X; tempRegion.YFrom = 1; tempRegion.YTo = d.Y; tempRegion.ZFrom = 1; tempRegion.ZTo = d.Z; foreach (ModifyKey m in modifys) { // 是空则用临时范围 if (m.DefautRegion == null) { m.DefautRegion = tempRegion; } else { // 不是空赋值临时范围 tempRegion = m.DefautRegion; } foreach (IModifyModel md in m.ObsoverModel) { // 读取到结束标记处退出 if (endPosition != null && md == endPosition) { return; } // 是空则用临时范围 if (md.Region == null) { md.Region = tempRegion; } else { // 不是空赋值临时范围 tempRegion = md.Region; } if (md.KeyName != this.Name) { continue; } if (md is ModifyApplyModel) { ModifyApplyModel app = md as ModifyApplyModel; app.RunModify(this.CacheTable); } else if (md is ModifyCopyModel) { ModifyCopyModel copy = md as ModifyCopyModel; TableKey copyKey = _eclData.Key.Find <TableKey>(l => l.Name == copy.Value); //// 取到当前位置 //List<ModifyKey> modifysCopyPosition = modifys.TakeWhile(l => l == m).ToList(); //// 取当前model位置 //List<IModifyModel> modelCopyPosition = m.ObsoverModel.TakeWhile(l => l == md).ToList(); //modifysCopyPosition.rem if (copyKey == null) { // 没有则创建关键字 copyKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(copy.Value, this.BaseFile.SimKeyType) as TableKey; m.ParentKey.Add(copyKey); } copyKey.Build(this.Z, this.X, this.Y); copyKey.RefreshCacheTable(_eclData, modifys, copy); copyKey.IsModifyChanged = true; copy.RunModify(this.CacheTable, copyKey.CacheTable); } else if (md is ModifyBoxModel) { ModifyBoxModel app = md as ModifyBoxModel; app.RunModify(this.CacheTable); } } } }
//番号を受け取ってデータを変更する public static void setEclipseData(EclipseData newdata) { data = newdata; }
/// <summary> 对文件格式化 </summary> public static void Standardized(this EclipseData ecl) { var ps = ecl.Key.FindAll <ParentKey>(); ps.ForEach(l => l.Standardized()); }
/// <summary> 对文件执行修改关键字修改 跟DataImportEcl对接方法 </summary> public static void RunModify_bak(this EclipseData ecl) { // 查找所有修改关键字 List <ModifyKey> modify = ecl.Key.FindAll <ModifyKey>(); DIMENS d = ecl.Key.Find <DIMENS>(); if (d == null) { return; } // 构造全网格范围 RegionParam tempRegion = new RegionParam(); tempRegion.XFrom = 1; tempRegion.XTo = d.X; tempRegion.YFrom = 1; tempRegion.YTo = d.Y; tempRegion.ZFrom = 1; tempRegion.ZTo = d.Z; foreach (ModifyKey m in modify) { ParentKey p = m.GetParentKey(); if (p != null && p.Name == "EDIT") { continue; } // 是空则用临时范围 if (m.DefautRegion == null) { m.DefautRegion = tempRegion; } else { // 不是空赋值临时范围 tempRegion = m.DefautRegion; } foreach (IModifyModel md in m.ObsoverModel) { // 是空则用临时范围 if (md.Region == null) { md.Region = tempRegion; } else { // 不是空赋值临时范围 tempRegion = md.Region; } if (md is ModifyApplyModel) { TableKey funKey = ecl.Key.Find <TableKey>(l => l.Name == md.KeyName); if (funKey == null) { // 没有则创建关键字 funKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(md.KeyName) as TableKey; m.ParentKey.Add(funKey); } funKey.Build(d.Z, d.X, d.Y); ModifyApplyModel app = md as ModifyApplyModel; app.RunModify(funKey); } else if (md is ModifyCopyModel) { ModifyCopyModel copy = md as ModifyCopyModel; TableKey copyKey = ecl.Key.Find <TableKey>(l => l.Name == copy.Key); if (copyKey == null) { // 没有则创建关键字 copyKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(copy.Key, ecl.SimKeyType) as TableKey; m.ParentKey.Add(copyKey); } TableKey funKey = ecl.Key.Find <TableKey>(l => l.Name == copy.Value); if (funKey == null) { // 没有则创建关键字 funKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(copy.Value) as TableKey; m.ParentKey.Add(funKey); } funKey.Build(d.Z, d.X, d.Y); copyKey.Build(d.Z, d.X, d.Y); copy.RunModify(copyKey, funKey); } else if (md is ModifyBoxModel) { TableKey funKey = ecl.Key.Find <TableKey>(l => l.Name == md.KeyName); if (funKey == null) { // 没有则创建关键字 funKey = KeyConfigerFactroy.Instance.CreateKey <TableKey>(md.KeyName) as TableKey; m.ParentKey.Add(funKey); } funKey.Build(d.Z, d.X, d.Y); ModifyBoxModel app = md as ModifyBoxModel; app.RunModify(funKey); } } } }