/// <summary>
    /// 放弃卡牌UI
    /// </summary>
    /// <param name="money">Money.</param>
    public void DisPoker(MODELTYPE type)
    {
        ShowPokerNode ();

        switch (type) {

        case MODELTYPE.TWO:
            pokerList[2].gameObject.SetActive(false);
            break;
        case MODELTYPE.THREE:
            pokerList[2].gameObject.SetActive(true);
            break;

        }

        int disx = 60 / pokerList.Count;

        Debug.Log ("DisPoker");

        for (int i = 0; i<pokerList.Count; i++)
        {
            pokerList[i].transform.localRotation = Quaternion.Euler(new Vector3(0,0,0));
            pokerList[i].transform.localPosition = new Vector3(i*disx,0,0);
            pokerList[i].overrideSprite = Resources.Load("Images/Battle/other_poker_Back_2", typeof(Sprite)) as Sprite;
        }
    }
    /// <summary>
    /// 观看卡牌UI
    /// </summary>
    /// <param name="money">Money.</param>
    public void LookedPoker(MODELTYPE type)
    {
        ShowPokerNode ();
        switch (type) {

            case MODELTYPE.TWO:

                pokerList[2].gameObject.SetActive(false);

                pokerList[0].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( 20))) ;
                pokerList[0].transform.localPosition = new Vector3(-15,-5,0);

                pokerList[1].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( -20 ))) ;
                pokerList[1].transform.localPosition = new Vector3(15,-5,0);

            break;
            case MODELTYPE.THREE:

                pokerList[2].gameObject.SetActive(true);

                pokerList[0].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( 20))) ;
                pokerList[0].transform.localPosition = new Vector3(-25,-5,0);

                pokerList[1].transform.localRotation = Quaternion.Euler(new Vector3(0,0,0 ) );
                pokerList[1].transform.localPosition = new Vector3(0,0,0);

                pokerList[2].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( -20 ) ));
                pokerList[2].transform.localPosition = new Vector3(25,-5,0);

            break;

        }

        Debug.Log ("LookedPoker");
    }
示例#3
0
        public dynamic SetDataStream(string name, string timezone, MODELTYPE modelType, string baseTimeUnit = "micros")
        {
            // Check if already exists
            var existStreams = GetDataStreams();
            var exist        = existStreams.Where(p => p.name == name);

            if (exist.Any())
            {
                if (exist.Count() > 1)
                {
                    throw (new ArgumentException($"More than one stream match the name ${name}"));
                }
                return(exist.First());

                /*  TODO: Why does this throw runtime binding exception
                 *  exist.First().id,
                 *  message = "Stream already exists"
                 * };
                 */
            }

            DataStreamSpec spec = new DataStreamSpec()
            {
                name         = name,
                timeZone     = timezone,
                isBatch      = modelType == MODELTYPE.BATCH,
                baseTimeUnit = baseTimeUnit
            };

            try
            {
                var streamResponse = _endpointUri
                                     .AppendPathSegments("accounts", _account, "datastreams")
                                     .WithOAuthBearerToken(_token)
                                     .PostJsonAsync(spec)
                                     .ReceiveJson().Result;
                return(streamResponse);
            }
            catch (Exception e)
            {
                // TODO logging
                // Unwrapping
                if (e is System.AggregateException)
                {
                    foreach (var ie in ((System.AggregateException)e).InnerExceptions)
                    {
                        if (ie is FlurlHttpException)
                        {
                            string msg = ((FlurlHttpException)ie).GetResponseStringAsync().Result;
                            ie.HelpLink = msg;
                        }
                    }
                }
                e.HelpLink = $"failure to create datastream";
                throw (e);
            }
        }
示例#4
0
        public static IProbabilityModel createModel(double[,] dataset, MODELTYPE modelType, double threshold)
        {
            switch (modelType)
            {
            case (MODELTYPE.GAUSSIAN):
                return(new GaussianProbabilityModel(dataset, threshold));

            default:
                throw new NotSupportedException("Model type " + modelType + " not supported");
            }
        }
示例#5
0
文件: RNN.cs 项目: My-Khan/RNNSharp
        public static void CheckModelFileType(string filename, out MODELTYPE modelType, out MODELDIRECTION modelDir)
        {
            using (StreamReader sr = new StreamReader(filename))
            {
                BinaryReader br = new BinaryReader(sr.BaseStream);
                modelType = (MODELTYPE)br.ReadInt32();
                modelDir  = (MODELDIRECTION)br.ReadInt32();
            }

            Logger.WriteLine("Get model type {0} and direction {1}", modelType, modelDir);
        }
示例#6
0
    public void DoChangeModel(int _ChunkIndex, MODELTYPE _ModelType)
    {
        string model = GenerateModelStringFromTemplateSetting(_ChunkIndex, _ModelType);

        Mesh_VoxelChunk Mesh = m_ShareMeshData as Mesh_VoxelChunk;

        if (null != Mesh)
        {
            // GlobalSingleton.DEBUG("ChangeModel : " + _ChunkIndex + "," + model);
            string chunkKey = GenerateChunkKeyFromIndex(_ChunkIndex);
            Mesh.ChangeModel(chunkKey, model);
        }
    }
示例#7
0
        public RNNDecoder(string strModelFileName)
        {
            MODELDIRECTION modelDir = MODELDIRECTION.FORWARD;
            MODELTYPE      modelType;

            RNNHelper.CheckModelFileType(strModelFileName, out modelDir, out modelType);
            if (modelDir == MODELDIRECTION.BI_DIRECTIONAL)
            {
                Logger.WriteLine("Model Structure: Bi-directional RNN");
                rnn = new BiRNN <Sequence>();
            }
            else
            {
                Logger.WriteLine("Model Structure: Simple RNN");
                rnn = new ForwardRNN <Sequence>();
            }
            ModelType = modelType;

            rnn.LoadModel(strModelFileName);
            Logger.WriteLine("CRF Model: {0}", rnn.IsCRFTraining);
        }
示例#8
0
    public void StartMorphingModel(int _ChunkIndex, MODELTYPE _ModelType)
    {
        if (false == m_MorphingData.ContainsKey(_ChunkIndex))
        {
            m_MorphingData.Add(_ChunkIndex, new MorphingStruct());
        }

        MorphingStruct morphData = null;

        morphData = m_MorphingData[_ChunkIndex];
        morphData.isInMorphing = true;


        string modelstr = GenerateModelStringFromTemplateSetting(_ChunkIndex, _ModelType);

        Mesh_VoxelChunk Mesh = m_ShareMeshData as Mesh_VoxelChunk;

        if (null != Mesh)
        {
            string chunkKey = GenerateChunkKeyFromIndex(_ChunkIndex);
            Mesh.StartMorphingModel(chunkKey, modelstr, morphData);
        }
    }
示例#9
0
    private string GenerateModelStringFromTemplateSetting(int _ChunkIndex, MODELTYPE _ModelType)
    {
        string ret = "body_" + _ChunkIndex;

        string[] def_models = { "shield" };
        string[] atk_models = { "axe", "sword" };

        switch (_ModelType)
        {
        case MODELTYPE.E_DEFENSE:
            ret = def_models[Random.Range(0, 100) % def_models.Length];
            break;

        case MODELTYPE.E_ATTACK:
            ret = atk_models[Random.Range(0, 100) % atk_models.Length];
            break;

        case MODELTYPE.E_CONCENTRATE:
            ret = "body_" + _ChunkIndex;
            break;
        }
        return(ret);
    }
示例#10
0
        public RNNDecoder(string strModelFileName, Featurizer featurizer)
        {
            MODELTYPE      modelType = MODELTYPE.SIMPLE;
            MODELDIRECTION modelDir  = MODELDIRECTION.FORWARD;

            RNN.CheckModelFileType(strModelFileName, out modelType, out modelDir);

            if (modelDir == MODELDIRECTION.BI_DIRECTIONAL)
            {
                Logger.WriteLine("Model Structure: Bi-directional RNN");
                if (modelType == MODELTYPE.SIMPLE)
                {
                    m_Rnn = new BiRNN(new SimpleRNN(), new SimpleRNN());
                }
                else
                {
                    m_Rnn = new BiRNN(new LSTMRNN(), new LSTMRNN());
                }
            }
            else
            {
                if (modelType == MODELTYPE.SIMPLE)
                {
                    Logger.WriteLine("Model Structure: Simple RNN");
                    m_Rnn = new SimpleRNN();
                }
                else
                {
                    Logger.WriteLine("Model Structure: LSTM-RNN");
                    m_Rnn = new LSTMRNN();
                }
            }

            m_Rnn.LoadModel(strModelFileName);
            Logger.WriteLine("CRF Model: {0}", m_Rnn.IsCRFTraining);
            m_Featurizer = featurizer;
        }
示例#11
0
        protected override void ItemWriteKey(System.IO.StreamWriter writer)
        {
            MODELTYPE modeltype = this.BaseFile.Key.Find <MODELTYPE>();

            if (modeltype.MetricType == MetricType.BLACKOIL || modeltype.MetricType == MetricType.HFOIL)
            {
                #region - 说明 -

                this.FOPR = true;
                this.FWPR = true;
                this.FGPR = true;
                this.FLPR = true;
                this.FGIP = true;
                this.FWIR = true;
                this.FWCT = true;
                this.FOPT = true;
                this.FWPT = true;
                this.FGPT = true;
                this.FLPT = true;
                this.FGIT = true;
                this.FWIT = true;
                this.POIL = true;
                this.FOIP = true;
                this.FGIP = true;
                this.WOPR = true;
                this.WWPR = true;
                this.WGPR = true;
                this.WLPR = true;
                this.WGIR = true;
                this.WWIR = true;
                this.WWCT = true;
                this.WOPT = true;
                this.WWPT = true;
                this.WGPT = true;
                this.WLPT = true;
                this.WGIT = true;
                this.WWIT = true;
                this.WBHP = true;
                this.WBP  = true;
                this.WBP4 = true;
                this.WBP5 = true;
                this.WBP9 = true;

                #endregion
            }

            else if (modeltype.MetricType == MetricType.GASWATER)
            {
                #region - 说明 -

                this.FWPR = true;
                this.FGPR = true;
                this.FLPR = true;
                this.FGIR = true;
                this.FWIR = true;
                this.FWCT = true;
                this.FWPT = true;
                this.FGPT = true;
                this.FLPT = true;
                this.FGIT = true;
                this.FWIT = true;
                this.PGAS = true;
                this.FGIP = true;
                this.WWPR = true;
                this.WGPR = true;
                this.WLPR = true;
                this.WGIR = true;
                this.WWIR = true;
                this.WWPT = true;
                this.WGPT = true;
                this.WLPT = true;
                this.WGIT = true;
                this.WWIT = true;
                this.WBHP = true;

                this.WBP  = true;
                this.WBP4 = true;
                this.WBP5 = true;
                this.WBP9 = true;

                #endregion
            }

            else if (modeltype.MetricType == MetricType.OILWATER)
            {
                #region - 说明 -
                this.FOPR = true;
                this.FWPR = true;
                this.FLPR = true;
                this.FWIR = true;
                this.FWCT = true;
                this.FOPT = true;
                this.FWPT = true;
                this.FLPT = true;
                this.FWIT = true;
                this.POIL = true;
                this.FOIP = true;
                this.WOPR = true;
                this.WWPR = true;
                this.WLPR = true;
                this.WWIR = true;
                this.WWCT = true;
                this.WOPT = true;
                this.WWPT = true;
                this.WLPT = true;
                this.WWIT = true;
                this.WBHP = true;

                this.WBP  = true;
                this.WBP4 = true;
                this.WBP5 = true;
                this.WBP9 = true;

                #endregion
            }


            this.Lines.Clear();

            writer.WriteLine();
            writer.WriteLine(this.Name);

            for (int i = 0; i < this.Items.Count; i++)
            {
                writer.WriteLine(this.Items[i].ToString());
            }

            writer.WriteLine(KeyConfiger.EndFlag);
        }
    /// <summary>
    ///  己方扑克发完牌
    /// </summary>
    public void SelfSendedPoker(MODELTYPE type)
    {
        ShowSelfPokerNode ();
        switch (type) {

        case MODELTYPE.TWO:
            selfPokerNodeList[2].gameObject.SetActive(false);
            break;
        case MODELTYPE.THREE:
            selfPokerNodeList[2].gameObject.SetActive(true);
            break;

        }

        int disx = 120 / selfPokerNodeList.Count;

        for (int i = 0; i<selfPokerNodeList.Count; i++)
        {
            selfPokerNodeList[i].transform.localRotation = Quaternion.Euler(new Vector3(0,0,0));
            selfPokerNodeList[i].transform.localPosition = new Vector3(i*disx,0,0);
            Image poker = selfPokerNodeList[i].transform.FindByName("Image_Poker").GetComponent<Image>();
            poker.overrideSprite = Resources.Load("Images/Battle/self_poker_Back", typeof(Sprite)) as Sprite;
        }

        Debug.Log ("   Battle_Manager  SelfSendedPoker");
    }
    /// <summary>
    ///  己方扑克看完牌
    /// </summary>
    public void SelfLookedPoker(MODELTYPE type)
    {
        ShowSelfPokerNode ();
        switch (type) {

        case MODELTYPE.TWO:
            selfPokerNodeList[2].gameObject.SetActive(false);

            selfPokerNodeList[0].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( 8))) ;
            selfPokerNodeList[0].transform.localPosition = new Vector3(-60,-10,0);

            selfPokerNodeList[1].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( -8 ))) ;
            selfPokerNodeList[1].transform.localPosition = new Vector3(90,-10,0);

            break;
        case MODELTYPE.THREE:
            selfPokerNodeList[2].gameObject.SetActive(true);

            selfPokerNodeList[0].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( 15))) ;
            selfPokerNodeList[0].transform.localPosition = new Vector3(-95,-8,0);

            selfPokerNodeList[1].transform.localRotation = Quaternion.Euler(new Vector3(0,0,0 ) );
            selfPokerNodeList[1].transform.localPosition = new Vector3(0,0,0);

            selfPokerNodeList[2].transform.localRotation = Quaternion.Euler(new Vector3(0,0,( -15) ));
            selfPokerNodeList[2].transform.localPosition = new Vector3(65,-15,0);
            break;

        }

        //变牌样子
        for (int i = 0; i<selfPokerNodeList.Count; i++)
        {
            Image poker = selfPokerNodeList[i].transform.FindByName("Image_Poker").GetComponent<Image>();
            poker.overrideSprite = Resources.Load("Images/Battle/temple_2", typeof(Sprite)) as Sprite;
        }

        Debug.Log (" Battle_Manager SelfLookedPoker");

        //controlList[1]    localPosition
        FlyMoneyToTable (SelfInfoNode.transform.position);
    }
示例#14
0
    private string GenerateModelStringFromTemplateSetting( int _ChunkIndex, MODELTYPE _ModelType )
    {
        string ret = "body_" + _ChunkIndex;
        string[] def_models = { "shield" };
        string[] atk_models = { "axe", "sword" };

        switch (_ModelType)
        {
        case MODELTYPE.E_DEFENSE:
            ret = def_models[Random.Range(0, 100) % def_models.Length];
            break;

        case MODELTYPE.E_ATTACK:
            ret = atk_models[Random.Range(0, 100) % atk_models.Length];
            break;

        case MODELTYPE.E_CONCENTRATE:
            ret = "body_" + _ChunkIndex;
            break;
        }
        return ret ;
    }
示例#15
0
    public void StartMorphingModel(int _ChunkIndex, MODELTYPE _ModelType)
    {
        if( false == m_MorphingData.ContainsKey( _ChunkIndex ) )
        {
            m_MorphingData.Add( _ChunkIndex , new MorphingStruct() ) ;
        }

        MorphingStruct morphData = null ;
        morphData = m_MorphingData[ _ChunkIndex ] ;
        morphData.isInMorphing = true ;

        string modelstr = GenerateModelStringFromTemplateSetting( _ChunkIndex , _ModelType );

        Mesh_VoxelChunk Mesh = m_ShareMeshData as Mesh_VoxelChunk;
        if (null != Mesh)
        {
            string chunkKey = GenerateChunkKeyFromIndex( _ChunkIndex ) ;
            Mesh.StartMorphingModel( chunkKey , modelstr , morphData );
        }
    }
示例#16
0
    public void DoChangeModel(int _ChunkIndex, MODELTYPE _ModelType)
    {
        string model = GenerateModelStringFromTemplateSetting( _ChunkIndex , _ModelType ) ;

        Mesh_VoxelChunk Mesh = m_ShareMeshData as Mesh_VoxelChunk;
        if (null != Mesh)
        {
            // GlobalSingleton.DEBUG("ChangeModel : " + _ChunkIndex + "," + model);
            string chunkKey = GenerateChunkKeyFromIndex( _ChunkIndex ) ;
            Mesh.ChangeModel( chunkKey , model);
        }
    }
示例#17
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);
        }
示例#18
0
        public static void CheckModelFileType(string filename, out MODELDIRECTION modelDir, out MODELTYPE modelType)
        {
            using (StreamReader sr = new StreamReader(filename))
            {
                BinaryReader br        = new BinaryReader(sr.BaseStream);
                LAYERTYPE    layerType = (LAYERTYPE)br.ReadInt32();
                modelDir  = (MODELDIRECTION)br.ReadInt32();
                modelType = (MODELTYPE)br.ReadInt32();

                Logger.WriteLine("Model information:");
                Logger.WriteLine("File name : '{0}'", filename);
                Logger.WriteLine("Direction: '{0}'", modelDir);
                Logger.WriteLine("Model type: '{0}'", modelType);
                Logger.WriteLine("Layer type: '{0}'", layerType);
            }
        }