Example #1
0
        /// <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 SimONData ChangeRestartModel(string mainFilePath, RestartInfoModelSimON model)
        {
            //  不读取INCLUDE部分数据 只读取SCHEDLE中INCLUDE
            SimONData data = FileFactoryService.Instance.ThreadLoadFunc <SimONData>(() => new SimONData(mainFilePath, null, l => l.GetParentKey() is SCHEDULE));


            // HTodo  :传递输出参数  需要测试
            OUTSCHED rptsched = data.Key.Find <OUTSCHED>();

            RPTSUM rptsum = data.Key.Find <RPTSUM>();

            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>();

            WELLCTRL well = data.Key.Find <WELLCTRL>();

            //  更改起始时间
            SOLVECTRL tuning = data.Key.Find <SOLVECTRL>();

            // Todo :主文件没有在solotion中找
            if (tuning == null)
            {
                tuning = sl.Find <SOLVECTRL>();
            }

            tuning.Date = model.RestartTime;

            model.Solution.Add(tuning);

            //    替换数据
            sl.ExChangeData(model.Solution);
            sc.ExChangeData(model.Schedule);
            well.ExChangeData(model.Well);

            //

            //    设置保存部分数据
            List <INCLUDE> slIncludes = sl.FindAll <INCLUDE>();

            slIncludes.ForEach(l => l.IsCreateFile = true);

            List <INCLUDE> scIncludes = sc.FindAll <INCLUDE>();

            scIncludes.ForEach(l => l.IsCreateFile = true);

            List <INCLUDE> wellIncludes = well.FindAll <INCLUDE>();

            wellIncludes.ForEach(l => l.IsCreateFile = true);

            //  保存主文件(目前没用)
            //model.MainData = data;

            if (rptsched != null)
            {
                data.Key.Add(rptsched);
            }

            if (rptsum != null)
            {
                data.Key.Add(rptsum);
            }


            //// Todo :插入标识到第二个关键字
            //HeBianGu.Product.SimalorManager.RegisterKeys.SimON.STEPRST restart = new HeBianGu.Product.SimalorManager.RegisterKeys.SimON.STEPRST("STEPRST");
            //data.Key.InsertKey(1, restart);

            return(data);
        }