Ejemplo n.º 1
0
 private void PopulateEntity(ref FIELD entity)
 {
     entity.NAME        = txtName.Text;
     entity.DESCRIPTION = txtDescription.Text;
     entity.UNITID      = short.Parse(ddlUnit.Value);
     entity.MODIFIEDON  = DateTime.Now;
 }
Ejemplo n.º 2
0
        public void AddParameterTranslatingAclaraXml(Parameter parameter)
        {
            ParameterType typeAclara;

            string nameTypeAclara = parameter.Type.ToString();

            // Translate aclara tag/parameter to app tag
            if (!Enum.TryParse <ParameterType> (nameTypeAclara, out typeAclara) ||
                !IdsAclara.ContainsKey(typeAclara))
            {
                // Allow non-reserved tags
                //AddAdditionalParameter ( nameTypeAclara, parameter.Value, parameter.Port );

                Errors.LogErrorNow(new ProcessingParamsScriptException());
            }
            else
            {
                FIELD typeOwn = IdsAclara[typeAclara];

                // If is for port two, find the correct enum element adding two ( "_2" ) as sufix
                if (parameter.Port == 1)
                {
                    Enum.TryParse <FIELD> (typeOwn.ToString() + PORT_2_SUFIX, out typeOwn);
                }

                this.AddParameter(typeOwn, parameter.Value, parameter.Port);
            }
        }
        /// <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);
        }
Ejemplo n.º 4
0
        public bool SetNumeric(string name, object value, int index = 0)
        {
            FIELD f = GetField(name);

            f.SetNumeric(value, index);
            return(true);
        }
Ejemplo n.º 5
0
        public void AddParameterTranslatingAclaraXml(Parameter parameter)
        {
            ParameterType typeAclara;
            FIELD         typeOwn = FIELD.NOTHING;

            string nameTypeAclara = parameter.Type.ToString();

            // Translate aclara tag/id to us
            if (!Enum.TryParse <ParameterType> (nameTypeAclara, out typeAclara))
            {
                Errors.LogErrorNow(new ProcessingParamsScriptException());
            }
            else
            {
                if (IdsAclara.ContainsKey(typeAclara))
                {
                    typeOwn = IdsAclara[typeAclara];
                }
                else
                {
                    return;
                }

                // If is for port two, find the correct enum element adding two ( "_2" ) as sufix
                if (parameter.Port == 1)
                {
                    Enum.TryParse <FIELD> (typeOwn.ToString() + PORT_2_SUFIX, out typeOwn);
                }
            }

            this.AddParameter(typeOwn, parameter.Value, parameter.Port);
        }
Ejemplo n.º 6
0
 public void UpdateParameter(FIELD fieldType, dynamic value, int port = 0)
 {
     if (this.dictionary.ContainsKey(fieldType))
     {
         this.dictionary[fieldType].Value = value;
     }
 }
Ejemplo n.º 7
0
        /// <summary> 获取单位制 </summary>
        public UnitType GetUnitType(string dataFile)
        {
            //  不读取INCLUDE部分数据
            SimONData data = new SimONData(dataFile, null, l => 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);
        }
Ejemplo n.º 8
0
    private bool CopyFromForm()
    {
        using (var ctx = new Entities())
        {
            try
            {
                var dataSource = new FIELD {
                    NAME       = txtSitename.Text,
                    CREATEDON  = DateTime.Now,
                    MODIFIEDON = DateTime.Now
                };

                ctx.AddToFIELDs(dataSource);

                ctx.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                ExceptionLog.WriteException("Save Site", ex);
            }
        }
        return(false);
    }
Ejemplo n.º 9
0
        public void AddParameter(FIELD fieldType, dynamic value)
        {
            string[]  texts = Texts[fieldType];
            Parameter param = AddParameter(texts[0], texts[1], texts[2], value);          // base method

            this.dictionary.Add(fieldType, param);
        }
        /// <summary>
        /// Ham khoi tao gia tri mac dinh cho cac bien
        /// </summary>
        private void Init()
        {
            FIELD = FIELD.Equals("") ? "" : FIELD;

            ORDER_CLAUSE = ORDER_CLAUSE.Equals("") ? "MAXCNT" : ORDER_CLAUSE;

            SKIP = SKIP != null ? SKIP.Value : 0;

            TAKE = TAKE != null ? TAKE.Value : 100;
        }
Ejemplo n.º 11
0
        public string field_name;               // ASCII name

        public TIFFFieldInfo(TIFFTAG field_tag, short field_readcount, short field_writecount, TIFFDataType field_type,
                             FIELD field_bit, bool field_oktochange, bool field_passcount, string field_name)
        {
            this.field_tag        = field_tag;
            this.field_readcount  = field_readcount;
            this.field_writecount = field_writecount;
            this.field_type       = field_type;
            this.field_bit        = field_bit;
            this.field_oktochange = field_oktochange;
            this.field_passcount  = field_passcount;
            this.field_name       = field_name;
        }
Ejemplo n.º 12
0
        public VOTABLE ConeSearch(DataSet ds)
        {
            try
            {
                //Hashtable ucds = FetchUCDS(ds, cjobs);
                VOTABLE vot = VOTableUtil.DataSet2VOTable(ds);
                vot.DESCRIPTION = new anyTEXT();
                vot.RESOURCE[0].TABLE[0].Items = new object[ds.Tables[0].Columns.Count + 3];
                Hashtable votypes = VOTableUtil.getdataTypeTable();
                PARAM     p       = new PARAM();
                p.name     = "inputRA";
                p.datatype = (dataType)votypes[typeof(System.Single)];
                p.value    = this.ra.ToString();
                p.unit     = "degrees";
                vot.RESOURCE[0].TABLE[0].Items[0] = p;
                p          = new PARAM();
                p.name     = "inputDEC";
                p.datatype = (dataType)votypes[typeof(System.Single)];
                p.unit     = "degrees";
                p.value    = this.dec.ToString();
                vot.RESOURCE[0].TABLE[0].Items[1] = p;
                p          = new PARAM();
                p.name     = "inputSR";
                p.datatype = (dataType)votypes[typeof(System.Single)];
                p.unit     = "degrees";
                p.value    = this.sr.ToString();
                vot.RESOURCE[0].TABLE[0].Items[2] = p;

                vot.DESCRIPTION.Any = new System.Xml.XmlNode[1];
                XmlDocument doc = new XmlDocument();
                vot.DESCRIPTION.Any[0]           = doc.CreateTextNode("DESCRIPTION");
                vot.DESCRIPTION.Any[0].InnerText = "ConeSearch results from the Sloan Digital Sky Survey";
                //vot.RESOURCE[0].Items[ind] = p;

                for (int x = 0; x < ds.Tables[0].Columns.Count; x++)
                {
                    DataColumn col = ds.Tables[0].Columns[x];
                    FIELD      f   = new FIELD();
                    f.datatype = (dataType)votypes[col.DataType];
                    f.ID       = fix(col.ColumnName);
                    //f.ucd = ucds[fix(col.ColumnName)] != null ? ucds[fix(col.ColumnName)].ToString() : "UNKNOWN";
                    vot.RESOURCE[0].TABLE[0].Items[x + 3] = f;
                }

                return(vot);
            }
            catch (Exception exp)
            {
                throw new Exception(exp.Message);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Static method that returns a copy of the board given as parameter
        /// </summary>
        /// <param name="input"> The board that has to  be copied </param>
        /// <returns> The copy of the input </returns>
        public static FIELD[,] CopyBoard(FIELD[,] input)
        {
            FIELD[,] copy = new FIELD[input.GetLength(0), input.GetLength(1)];

            for (int i = 0; i < input.GetLength(0); i++)
            {
                for (int j = 0; j < input.GetLength(1); j++)
                {
                    copy[i, j] = input[i, j];
                }
            }

            return(copy);
        }
Ejemplo n.º 14
0
 public void markField(Player player)
 {
     if (isEmpty())
     {
         if (player.getSign() == 'X')
         {
             fieldState = FIELD.FLD_X;
         }
         else
         {
             fieldState = FIELD.FLD_O;
         }
     }
 }
Ejemplo n.º 15
0
        public void AddParameter(FIELD fieldType, dynamic value, int port = 0)
        {
            string[]  texts = Texts[fieldType];
            Parameter param = AddParameter(texts[0], texts[1], texts[2], value, port);          // base method

            if (!this.dictionary.ContainsKey(fieldType))
            {
                this.dictionary.Add(fieldType, param);
            }
            else
            {
                throw new SameParameterRepeatScriptException();
            }
        }
Ejemplo n.º 16
0
        private FIELD GetField(string name)
        {
            name = name.Trim();
            if (name == "")
            {
                throw new Exception(string.Format("STRUCT::GetNumeric - Missing file name"));
            }

            FIELD f = _fields.Find(x => x.name == name);

            if (f == null)
            {
                throw new Exception(string.Format("STRUCT::GetNumeric - Filed not found: {0}", name));
            }
            return(f);
        }
Ejemplo n.º 17
0
        public bool AddField(string name, TYPE type, int count = 1)
        {
            if (count <= 0)
            {
                return(false);
            }
            name = name.Trim();
            if ((name != "") && (_fields.Exists(x => x.name == name)))
            {
                throw new System.Exception(string.Format("STRUCT::AddField - Filed {0} already exists", name));
            }
            FIELD f = new FIELD(_objAlignment, _fields.Count, size, name, type, count);

            _fields.Add(f);
            // size += f.size;  // for object alignment, the offset can be changed
            size = f.offset + f.size;
            return(true);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Adds a disc to the specified column
 /// </summary>
 /// <param name="col"> The column where the disc will be added </param>
 /// <param name="value"> The disc (FIELD) type that will be added </param>
 public void AddToBoard(int col, FIELD value)
 {
     //Console.WriteLine($"Adding to column {col+1}");
     if (col < Board.GetLength(1))
     {
         for (int i = Board.GetLength(0) - 1; i >= 0; --i)
         {
             if (Board[i, col] == FIELD.EMPTY)
             {
                 Board[i, col] = value;
                 return;
             }
         }
     }
     else
     {
         throw new Exception("Column out of range");
     }
 }
Ejemplo n.º 19
0
        public void Clone(STRUCT source, bool copyValue)
        {
            _objAlignment = source.objAlignment;
            int count = source._fields.Count;

            // For safety, search index instead of foreach to make sure fields are added in sequent
            for (int index = 0; index < count; index++)
            {
                FIELD fSource = source._fields.Find(x => x.index == index);
                if (fSource == null)
                {
                    throw new Exception(string.Format("STRUCT::clone - missinge field with index {0}", index));
                }
                FIELD fNew = new FIELD(_objAlignment, index, size, fSource.name, fSource.type, fSource.count);
                if (copyValue)
                {
                    Array.Copy(fSource.dataBuffer, fNew.dataBuffer, fNew.size);
                }
                _fields.Add(fNew);
                size = fNew.offset + fNew.size;
            }
        }
Ejemplo n.º 20
0
    private bool CopyFromForm()
    {
        using (var ctx = new Entities())
        {
            try
            {
                if (btnFormButtons.EntityID.HasValue)
                {
                    var id         = btnFormButtons.EntityID;
                    var dataSource = ctx.FIELDs.FirstOrDefault(u => u.ID == id);
                    PopulateEntity(ref dataSource);
                    Audit.Log(ctx, AuditType.Edit, this.Page.GetType().FullName,
                              string.Format("Field Edited. ID: {0}", dataSource.ID), LoggedInUser.ID);
                }
                else
                {
                    var dataSource = new FIELD {
                        CREATEDON = DateTime.Now
                    };
                    PopulateEntity(ref dataSource);
                    ctx.AddToFIELDs(dataSource);
                    Audit.Log(ctx, AuditType.Add, this.Page.GetType().FullName,
                              string.Format("Field Added. Name: {0}", txtName.Text), LoggedInUser.ID);
                }

                ctx.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                ExceptionLog.WriteException("Save Field", ex);
                ShowMessage(MessageType.Error, "There was an error saving this record");
            }
        }
        return(false);
    }
Ejemplo n.º 21
0
 public void RemoveParameter(FIELD fieldType)
 {
     base.RemoveParameter(Texts[fieldType][0]);
     this.dictionary.Remove(fieldType);
 }
Ejemplo n.º 22
0
 public bool ContainsParameter(FIELD fieldType)
 {
     return(base.ContainsParameter(Texts[fieldType][0]));
 }
Ejemplo n.º 23
0
 public Parameter FindById(FIELD field_type)
 {
     string[] texts = Texts[field_type];
     return(base.FindParameterById(texts[0]));
 }
Ejemplo n.º 24
0
 static bool TIFFFieldSet(TIFF tif, FIELD field)
 {
     return (tif.tif_dir.td_fieldsset[((int)field)/32]&(1u<<(((int)field)&0x1f)))!=0;
 }
Ejemplo n.º 25
0
 static void TIFFSetFieldBit(TIFF tif, FIELD field)
 {
     tif.tif_dir.td_fieldsset[((int)field)/32]|=(1u<<(((int)field)&0x1f));
 }
Ejemplo n.º 26
0
 static bool FieldSet(uint[] fields, FIELD field)
 {
     return (fields[((int)field)/32]&(1u<<(((int)field)&0x1f)))!=0;
 }
Ejemplo n.º 27
0
        public void SetValue(string name, object value, int index = 0)
        {
            FIELD f = GetField(name);

            f.SetValue(value, index);
        }
Ejemplo n.º 28
0
        public T GetValue <T>(string name, int index = 0)
        {
            FIELD f = GetField(name);

            return(f.GetValue <T>(index));
        }
Ejemplo n.º 29
0
 static bool isUnspecified(TIFF tif, FIELD f)
 {
     return TIFFFieldSet(tif, f)&&tif.tif_dir.td_imagelength==0;
 }
Ejemplo n.º 30
0
        public void SetString(string name, string value)
        {
            FIELD f = GetField(name);

            f.SetString(value);
        }
Ejemplo n.º 31
0
        public string GetString(string name)
        {
            FIELD f = GetField(name);

            return(f.GetString());
        }
Ejemplo n.º 32
0
 static void ResetFieldBit(uint[] fields, FIELD field)
 {
     fields[((int)field)/32]&=~(1u<<(((int)field)&0x1f));
 }
Ejemplo n.º 33
0
        /// <summary>
        /// Inserts all the Field ucds for the table
        /// </summary>
        /// <param name="t"></param>
        public void setupFields(TABLE t)
        {
            int n = FIELDCOUNT;

            t.Items = new object[n];
            n       = 0;

            FIELD f = new FIELD();

            t.Items[n]  = f;
            f.datatype  = dataType.@char;
            f.ID        = "Title";
            f.ucd       = "VOX:Image_Title";
            f.arraysize = "*";
            n++;

            f          = new FIELD();
            t.Items[n] = f;
            f.datatype = dataType.@int;
            f.ID       = "width";
            f.ucd      = "VOX:Image_Pix_Width";
            n++;

            f          = new FIELD();
            t.Items[n] = f;
            f.datatype = dataType.@int;
            f.ID       = "height";
            f.ucd      = "VOX:Image_Pix_Height";
            n++;

            f          = new FIELD();
            t.Items[n] = f;
            f.datatype = dataType.@double;
            f.ID       = "size";
            f.ucd      = "VOX:Image_Size";
            n++;

            f          = new FIELD();
            t.Items[n] = f;
            f.datatype = dataType.@double;
            f.ID       = "RA";
            f.ucd      = "POS_EQ_RA_MAIN";
            n++;

            f          = new FIELD();
            t.Items[n] = f;
            f.datatype = dataType.@double;
            f.ID       = "DEC";
            f.ucd      = "POS_EQ_DEC_MAIN";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@double;
            f.ID        = "scale";
            f.ucd       = "VOX:Image_Scale";
            f.arraysize = "*";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@char;
            f.ID        = "format";
            f.ucd       = "VOX:Image_Format";
            f.arraysize = "*";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@char;
            f.ID        = "url";
            f.ucd       = "VOX:Image_AccessReference";
            f.arraysize = "*";
            n++;

            f          = new FIELD();
            t.Items[n] = f;
            f.datatype = dataType.@double;
            f.ID       = "equinox";
            f.ucd      = "VOX:Image_Equinox";
            n++;

            f          = new FIELD();
            t.Items[n] = f;
            f.datatype = dataType.@int;
            f.ID       = "naxes";
            f.ucd      = "VOX:Image_Naxes";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@int;
            f.ID        = "naxis";
            f.ucd       = "VOX:Image_Naxis";
            f.arraysize = "*";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@char;
            f.ID        = "crtype";
            f.ucd       = "VOX:WCS_CoordProjection";
            f.arraysize = "*";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@double;
            f.ID        = "crpix";
            f.ucd       = "VOX:WCS_CoordRefPixel";
            f.arraysize = "*";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@double;
            f.ID        = "crval";
            f.ucd       = "VOX:WCS_CoordRefValue";
            f.arraysize = "*";
            n++;

            f           = new FIELD();
            t.Items[n]  = f;
            f.datatype  = dataType.@double;
            f.ID        = "cdval";
            f.ucd       = "VOX:WCS_CDMatrix";
            f.arraysize = "*";
            n++;
        }
Ejemplo n.º 34
0
            internal STRUCT(BinaryReader br, int index, int LabelIndex = -1)
                : base(GffFieldType.Struct)
            {
                //Header Info
                br.BaseStream.Seek(8, 0);
                int StructOffset       = br.ReadInt32();
                int StuctCount         = br.ReadInt32();
                int FieldOffset        = br.ReadInt32();
                int FieldCount         = br.ReadInt32();
                int LabelOffset        = br.ReadInt32();
                int LabelCount         = br.ReadInt32();
                int FieldDataOffset    = br.ReadInt32();
                int FieldDataCount     = br.ReadInt32();
                int FieldIndicesOffset = br.ReadInt32();

                //label logic
                if (LabelIndex < 0 || LabelIndex > LabelCount)
                {
                    Label = "";
                }
                else
                {
                    br.BaseStream.Seek(LabelOffset + LabelIndex * 16, 0);
                    Label = new string(br.ReadChars(16)).TrimEnd('\0');
                }

                //Struct Info
                br.BaseStream.Seek(StructOffset + index * 12, 0);
                Struct_Type = br.ReadInt32();
                int DataOrDataOffset = br.ReadInt32();
                int S_FieldCount     = br.ReadInt32();

                //If there is only one field, it pulls it from the field area
                if (S_FieldCount == 1)
                {
                    br.BaseStream.Seek(FieldOffset + DataOrDataOffset * 12, 0);
                    GffFieldType fieldType = (GffFieldType)br.ReadInt32();
                    FIELD        data      = CreateNewField(br, index, FieldOffset, DataOrDataOffset, fieldType);
                    Fields.Add(data);
                }
                //If there is more than one field, a set of Indices are read off, and then those fields are read in
                else if (S_FieldCount > 1)
                {
                    for (int i = 0; i < S_FieldCount; i++)
                    {
                        br.BaseStream.Seek(FieldIndicesOffset + DataOrDataOffset + 4 * i, 0);
                        int f_index = br.ReadInt32();

                        br.BaseStream.Seek(FieldOffset + f_index * 12, 0);
                        GffFieldType fieldType = (GffFieldType)br.ReadInt32();
                        FIELD        data      = CreateNewField(br, index, FieldOffset, f_index, fieldType);
                        Fields.Add(data);
                    }
                }
                else if (S_FieldCount == 0)
                {
                    return;
                }
                else
                {
                    throw new Exception(string.Format("BAD FIELD COUNT \"{0}\", IN STRUCT INDEX \"{1}\"", S_FieldCount, index));
                }
            }
Ejemplo n.º 35
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);
        }
Ejemplo n.º 36
0
        public short field_writecount; // write count/TIFF_VARIABLE

        #endregion Fields

        #region Constructors

        public TIFFFieldInfo(TIFFTAG field_tag, short field_readcount, short field_writecount, TIFFDataType field_type,
            FIELD field_bit, bool field_oktochange, bool field_passcount, string field_name)
        {
            this.field_tag=field_tag;
            this.field_readcount=field_readcount;
            this.field_writecount=field_writecount;
            this.field_type=field_type;
            this.field_bit=field_bit;
            this.field_oktochange=field_oktochange;
            this.field_passcount=field_passcount;
            this.field_name=field_name;
        }