Exemplo n.º 1
0
        void InitConstruct()
        {
            RUNSPEC runspec = new RUNSPEC("RUNSPEC");

            this.Key.Add(runspec);

            GRID grid = new GRID("GRID");

            this.Key.Add(grid);

            EDIT edit = new EDIT("EDIT");

            this.Key.Add(edit);

            PROPS props = new PROPS("PROPS");

            this.Key.Add(props);

            REGIONS regions = new REGIONS("REGIONS");

            this.Key.Add(regions);

            SOLUTION solution = new SOLUTION("SOLUTION");

            this.Key.Add(solution);

            SUMMARY summary = new SUMMARY("SUMMARY");

            this.Key.Add(summary);

            SCHEDULE schedule = new SCHEDULE("SCHEDULE");

            this.Key.Add(schedule);
        }
Exemplo n.º 2
0
 public void BeforeTest()
 {
     grid    = new GRID();
     driver  = grid.getDriver();    // = new ChromeDriver(Environment.CurrentDirectory);
     browser = new WorkWithBrowser(driver, name, email);
     pg      = new PageObject(driver, "https://gmail.com");
 }
Exemplo n.º 3
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GRID.EndEdit();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();     //Creating a file save dialog

            saveFileDialog1.RestoreDirectory = true;
            //read and filter the raw data
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                BinaryFormatter formatter = new BinaryFormatter();
                FileStream      output    = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.Write);
                ;
                int    n      = GRID.RowCount;
                data[] Person = new data[n - 1];     //We have as many records as many rows, rows are added automaticly so we have always one row more than we need, so n is a number of rows -1 empty row
                for (int i = 0; i < n - 1; i++)
                {
                    Person[i] = new data();
                    //GRID has two numbers in"[]" first numer is an index of column, second is a an idnex of row', indexing always starts from 0'
                    Person[i].name    = GRID[0, i].Value.ToString();
                    Person[i].surname = GRID[1, i].Value.ToString();
                    Person[i].city    = GRID[2, i].Value.ToString();
                    Person[i].number  = GRID[3, i].Value.ToString();
                }

                formatter.Serialize(output, Person);

                output.Close();
            }
        }
Exemplo n.º 4
0
        private void zapiszToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GRID.EndEdit();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog(); //utworznie obiektu do zapisywania pliku

            saveFileDialog1.RestoreDirectory = true;               //Okno dialogowe spowoduje przywrócenie bieżącego katalogu do poprzednio wybranego katalogu po zmianie
            //katalogu podczas wyszukiwania plików.
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)   //jeśli okno wyświetli się poprawnie
            {
                BinaryFormatter formatter = new BinaryFormatter(); //obiekt formatowania do zapisu binarnego
                //Udostępnia strumień dla pliku, obsługuje synchroniczne i asynchroniczne operacje odczytu i zapisu.
                FileStream output = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.Write);
                int        n      = GRID.RowCount;   //odczytanie liczby wierszy
                data[]     Osoba  = new data[n - 1]; //utowrzenie tablicy klasy osoba

                //pętla odczytująca wartości pól w tabeli i przekazujaca je do tablicy
                for (int i = 0; i < n - 1; i++)
                {
                    Osoba[i] = new data();

                    Osoba[i].imie     = GRID[0, i].Value.ToString();
                    Osoba[i].nazwisko = GRID[1, i].Value.ToString();
                    Osoba[i].email    = GRID[2, i].Value.ToString();
                }
                formatter.Serialize(output, Osoba); //serializajca wyjścia
                output.Close();                     //zamknięcie wyścia danych
            }
        }
        private void updateWorkbook(Team team, List <Player> players)
        {
            if (GRID.ColumnDefinitions.Count > 0)
            {
                GRID.ColumnDefinitions.RemoveRange(0, GRID.ColumnDefinitions.Count);
                GRID.Children.RemoveRange(0, GRID.Children.Count);
            }

            buildWorksheetLabelColumn();

            TeamLineup lineups = engine.StoredLineups[team.Abrv];
            int        index   = 1;
            int        box     = 1;

            foreach (LineupData lineupData in lineups.Lineups)
            {
                LineupDataObj lineup = new LineupDataObj(lineupData);

                int pitcherArmIndex = lineup.PitcherArm.Equals("L") ? 0 : 1;
                lineup.EstimatedAtBats = calculateAtBatsByLineup(engine.BalanceAtBats[pitcherArmIndex], lineup.getLineupData());

                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.CATCHER, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.FIRSTBASE, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.SECONDBASE, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.THIRDBASE, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.SHORTSTOP, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.LEFTFIELD, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.CENTERFIELD, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.RIGHTFIELD, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.DH, lineup, players, box++));

                createColumn(lineup, index, 160);

                index++;
            }

            GRID.UpdateLayout();
        }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Line"></param>
 /// <param name="g"></param>
 static public void Parse(string Line, out GRID g)
 {
     string[] Parts = SplitNastranLine(Line, 9);
     if (!Parts[0].Equals("GRID"))
     {
         throw new ArgumentException("line must start with GRID", "Line");
     }
     g.ID = int.Parse(Parts[1]);
     g.CP = int.Parse(Parts[2]);
     g.X1 = ParseFloat(Parts[3]);
     g.X2 = ParseFloat(Parts[4]);
     g.X3 = ParseFloat(Parts[5]);
     if (Parts[6].Length > 0)
     {
         g.CD = int.Parse(Parts[6]);
     }
     else
     {
         g.CD = 0;
     }
     if (Parts[7].Length > 0)
     {
         g.PS = int.Parse(Parts[7]);
     }
     else
     {
         g.PS = 0;
     }
     if (Parts[8].Length > 0)
     {
         g.SEID = int.Parse(Parts[8]);
     }
     else
     {
         g.SEID = 0;
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// renames all ID's in <see cref="m_GRID_List"/> (see <see cref="GRID.ID"/>)
        /// to be equal to the index in <see cref="m_GRID_List"/>
        /// and applies that cahnege also to the Grid id's in <see cref="m_CTRIA3_List"/> (
        /// see <see cref="CTRIA3.Grid1"/>, <see cref="CTRIA3.Grid3"/>, <see cref="CTRIA3.Grid3"/>);
        /// </summary>
        private void RenameIds()
        {
            SortedDictionary <int, int> id2index = new SortedDictionary <int, int>();

            for (int i = 0; i < m_GRID_List.Count; i++)
            {
                id2index.Add(m_GRID_List[i].ID, i);
                GRID g = m_GRID_List[i];
                g.ID           = i;
                m_GRID_List[i] = g;
            }



            for (int j = 0; j < m_CTRIA3_List.Count; j++)
            {
                CTRIA3 t = m_CTRIA3_List[j];
                t.Grid1          = id2index[t.Grid1];
                t.Grid2          = id2index[t.Grid2];
                t.Grid3          = id2index[t.Grid3];
                t.ID             = j;
                m_CTRIA3_List[j] = t;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// imports a nastran file
        /// </summary>
        /// <param name="FilePath"></param>
        public NastranFile(string FilePath)
        {
            StreamReader rd = null;

            rd = new StreamReader(FilePath);

            string line = rd.ReadLine();

            while (line != null)
            {
                if (line.StartsWith("GRID"))
                {
                    GRID g;
                    GRID.Parse(line, out g);
                    m_GRID_List.Add(g);
                }

                if (line.StartsWith("CTRIA3"))
                {
                    CTRIA3 t;
                    CTRIA3.Parse(line, out t);
                    m_CTRIA3_List.Add(t);
                }



                line = rd.ReadLine();
            }



            rd.Close();


            RenameIds();
        }
Exemplo n.º 9
0
        /// <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);
        }
Exemplo n.º 10
0
        /// <summary> 格式化文件 </summary>
        public void Format()
        {
            RUNSPEC runspec = this.Key.CreateSingle <RUNSPEC>("RUNSPEC");

            REGIONS region = this.Key.CreateSingle <REGIONS>("REGIONS");

            if (region != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_REG.INC";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                region.Add(include);
            }

            GRID grid = this.Key.CreateSingle <GRID>("GRID");

            var includesOld = grid.FindAll <INCLUDE>();

            if (grid != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOPP.INC";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GGO.INC";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                #region - ggo -
                var echo = this.Key.FindAll <ECHO>();
                if (echo != null)
                {
                    grid.DeleteAll <ECHO>();
                    include.AddRange(echo);
                }

                var mapaxes = this.Key.FindAll <MAPAXES>();
                if (mapaxes != null)
                {
                    grid.DeleteAll <MAPAXES>();
                    include.AddRange(mapaxes);
                }


                var gridunit = this.Key.FindAll <GRIDUNIT>();
                if (gridunit != null)
                {
                    grid.DeleteAll <GRIDUNIT>();
                    include.AddRange(gridunit);
                }

                var coordsys = this.Key.FindAll <COORDSYS>();
                if (coordsys != null)
                {
                    grid.DeleteAll <COORDSYS>();
                    include.AddRange(coordsys);
                }

                var mapunits = this.Key.FindAll <MAPUNITS>();
                if (mapunits != null)
                {
                    grid.DeleteAll <MAPUNITS>();
                    include.AddRange(mapunits);
                }


                var noecho = this.Key.FindAll <NOECHO>();
                if (noecho != null)
                {
                    grid.DeleteAll <NOECHO>();
                    include.AddRange(noecho);
                }



                var coord = this.Key.FindAll <COORD>();
                if (coord != null)
                {
                    grid.DeleteAll <COORD>();
                    include.AddRange(coord);
                }



                var zcorn = this.Key.FindAll <ZCORN>();
                if (zcorn != null)
                {
                    grid.DeleteAll <ZCORN>();
                    include.AddRange(zcorn);
                }
                //  清空原有INCLUDE
                foreach (var v in includesOld)
                {
                    grid.Delete(v);
                }
                #endregion

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GPRO.INC";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOTH.INC";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                ECHO echo1 = grid.Find <ECHO>();
                if (echo1 != null)
                {
                    grid.DeleteAll <ECHO>();
                    include.Add(echo1);
                }

                List <FAULTS> faults = grid.FindAll <FAULTS>();
                if (faults != null)
                {
                    grid.DeleteAll <FAULTS>();
                    foreach (var v in faults)
                    {
                        include.Add(v);
                    }
                }

                MULTFLT multflt = grid.Find <MULTFLT>();
                if (multflt != null)
                {
                    grid.DeleteAll <MULTFLT>();
                    include.Add(multflt);
                }
            }


            END end = this.Key.CreateSingle <END>("END");
        }
Exemplo n.º 11
0
        /// <summary> 清理父节点 </summary>
        public void InitParentKey()
        {
            RUNSPEC runspec = this.Key.CreateSingle <RUNSPEC>("RUNSPEC");

            GRID grid = this.Key.CreateSingle <GRID>("GRID");

            if (grid != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_grid.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                INCLUDE include1 = new INCLUDE("INCLUDE");
                include1.FileName = this.FileName.GetFileNameWithoutExtension() + "_faults.inc";
                include1.FilePath = this.FilePath.GetDirectoryName() + "\\" + include1.FileName;
                grid.Add(include1);

                INCLUDE include2 = new INCLUDE("INCLUDE");
                include2.FileName = this.FileName.GetFileNameWithoutExtension() + "_aquifer.inc";
                include2.FilePath = this.FilePath.GetDirectoryName() + "\\" + include1.FileName;
                grid.Add(include2);
            }

            EDIT edit = this.Key.Find <EDIT>();

            if (edit != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_edit.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                edit.Add(include);
            }



            PROPS props = this.Key.CreateSingle <PROPS>("PROPS");

            if (props != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_pvt.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                props.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_rp.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                props.Add(include);
            }


            SOLUTION solution = this.Key.CreateSingle <SOLUTION>("SOLUTION");

            if (solution != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_init.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                solution.Add(include);
            }



            REGIONS region = this.Key.CreateSingle <REGIONS>("REGIONS");

            if (region != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_regs.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                region.Add(include);
            }

            SUMMARY summary = this.Key.CreateSingle <SUMMARY>("SUMMARY");

            if (summary != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_sum.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                summary.Add(include);

                //if (include.Keys.Count == 0)
                //{
                //    ALL all = new ALL("ALL");
                //    include.Add(all);
                //}
            }

            SCHEDULE schedule = this.Key.CreateSingle <SCHEDULE>("SCHEDULE");

            if (schedule != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_sch.inc";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                schedule.Add(include);
            }


            END end = this.Key.CreateSingle <END>("END");
        }
Exemplo n.º 12
0
        /// <summary> 清理父节点 </summary>
        public void InitParentKey(bool isCoal = false)
        {
            this.Key.Clear();

            this.Key.CreateSingle <SIMSET>("SIMSET");

            GRID grid = this.Key.CreateSingle <GRID>("GRID");

            if (grid != null)
            {
                //  增加屏显
                ECHO_OFF echo_off = new ECHO_OFF("ECHO_OFF");
                grid.Add(echo_off);

                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_REG.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GPRO.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GGO.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOTH.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                grid.Add(include);

                //  关闭屏显
                ECHO_ON echo_on = new ECHO_ON("ECHO_ON");
                grid.Add(echo_on);
            }

            this.Key.CreateSingle <MODIFY>("MODIFY");

            WELL well = this.Key.CreateSingle <WELL>("WELL");

            USE_TF use_tf = new USE_TF("USE_TF");

            if (well != null)
            {
                well.Add(use_tf);

                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_WELL.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                well.Add(include);
            }



            PROPS props = this.Key.CreateSingle <PROPS>("PROPS");

            if (props != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_SAT.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                props.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_PVT.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                props.Add(include);
            }
            if (isCoal)
            {
                ADSORB adsorb = this.Key.CreateSingle <ADSORB>("ADSORB");

                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_ADS.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                adsorb.Add(include);
            }


            SOLUTION solution = this.Key.CreateSingle <SOLUTION>("SOLUTION");

            if (solution != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_INI.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                solution.Add(include);

                include          = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_AQU.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                solution.Add(include);
            }

            TUNESET tuneset = this.Key.CreateSingle <TUNESET>("TUNESET");


            SOLVECTRL solvectrl = new SOLVECTRL("SOLVECTRL");

            tuneset.Add(solvectrl);

            //if (solvectrl != null)
            //{
            //    INCLUDE include = new INCLUDE("INCLUDE");
            //    include.FileName = this.FileName.GetFileNameWithoutExtension() + "_TUN.DAT";
            //    include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
            //    solvectrl.Add(include);
            //}

            //SUMMARY summary = this.Key.CreateSingle<SUMMARY>("SUMMARY");
            //if (summary != null)
            //{
            //    INCLUDE include = new INCLUDE("INCLUDE");
            //    include.FileName = this.FileName.GetFileNameWithoutExtension() + "_sum.inc";
            //    include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
            //    summary.Add(include);

            //    //if (include.Keys.Count == 0)
            //    //{
            //    //    ALL all = new ALL("ALL");
            //    //    include.Add(all);
            //    //}
            //}

            SCHEDULE schedule = this.Key.CreateSingle <SCHEDULE>("SCHEDULE");

            if (schedule != null)
            {
                INCLUDE include = new INCLUDE("INCLUDE");
                include.FileName = this.FileName.GetFileNameWithoutExtension() + "_SCH.DAT";
                include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName;
                schedule.Add(include);
            }


            //END end = this.Key.CreateSingle<END>("END");

            //  输出关键字
            OUTSCHED rptsched = new OUTSCHED("RPTSCHED");

            this.Key.Add(rptsched);
        }
Exemplo n.º 13
0
        /// <summary>
        /// creates some test grid
        /// </summary>
        /// <param name="N">resolution of testgrid</param>
        public NastranFile(int N)
        {
            double[] nodes = GenericBlas.Linspace(-3, 3, N);
            double   dh    = nodes[1] - nodes[0];

            dh *= 0.5;

            int cnt = 0;

            for (int i = 0; i < N; i++)
            {
                double even = 0;
                if (i % 2 == 0)
                {
                    even = dh;
                }

                for (int j = 0; j < N; j++)
                {
                    GRID g = new GRID();

                    g.X1 = (float)(nodes[j] + even);
                    g.X2 = (float)nodes[i];
                    g.ID = cnt;

                    m_GRID_List.Add(g);
                    cnt++;
                }
            }


            cnt = 0;
            for (int k = 0; k < (N - 1); k++)
            {
                int even = 0;
                int odd  = 0;
                if (k % 2 == 0)
                {
                    even = 1;
                }
                else
                {
                    odd = 1;
                }

                for (int i = k * N; i < (k * N + N - 1); i++)
                {
                    CTRIA3 tup = new CTRIA3();
                    tup.Grid1 = i + N + even;
                    tup.Grid2 = i;
                    tup.Grid3 = i + 1;
                    tup.ID    = cnt;
                    cnt       = cnt + 1;
                    m_CTRIA3_List.Add(tup);


                    CTRIA3 tdw = new CTRIA3();
                    tdw.Grid1 = i + odd;
                    tdw.Grid2 = i + N + 1;
                    tdw.Grid3 = i + N;
                    tup.ID    = cnt;
                    cnt       = cnt + 1;
                    m_CTRIA3_List.Add(tdw);
                }
            }
        }
Exemplo n.º 14
0
 void Start()
 {
     Grid = GetComponent <GRID>();
 }
Exemplo n.º 15
0
 void Awake()
 {
     Grid = GetComponent <GRID>();
 }