private bool AlertBoundaryTimeChange(ref RiverSimulationProfile.TwoInOne o)
        {
            if (o == null)
            {
                return false;
            }
            if(p.IsConstantFlowType())
            {   //定量流時不檢查
                return true;
            }
            if (p.boundaryTime == null || p.boundaryTime.GetLength(0) != p.boundaryTimeNumber)
            {
                MessageBox.Show("邊界時間尚未輸入完成", "確認", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }

            if (!o.ArrayNull() && o.Array2D().GetLength(1) != p.boundaryTimeNumber)
            {   //邊界時間有輸入,但與邊界時間數目不符合
                if (DialogResult.OK == MessageBox.Show("改變過邊界時間數目需要重新輸入所有流況資料,請確認?", "確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation))
                {
                    RiverSimulationProfile.TwoInOne.Type tp = o.type;
                    RiverSimulationProfile.TwoInOne.ValueType vt = o.valueType;
                    RiverSimulationProfile.TwoInOne.ArrayType at = o.arrayType;
                    o = new RiverSimulationProfile.TwoInOne(vt, at, tp);
                    return true;
                }
                else
                {
                    p.boundaryTimeNumber = o.Array2D().GetLength(1);
                    boundaryTimeNumberTxt.Text = p.boundaryTimeNumber.ToString();
                    return false;
                }
            }

            return true;
        }
Example #2
0
        private void CreateData(object d)
        {
            RiverSimulationProfile.TwoInOne o = d as RiverSimulationProfile.TwoInOne;
            RiverSimulationProfile.TwoInOne _d = null;
            Debug.Assert(o != null);

            if (formType == FormType.FlowQuantity || formType == FormType.WaterLevel)
            {
                _data = new RiverSimulationProfile.TwoInOne(d as RiverSimulationProfile.TwoInOne);
                _d = _data as RiverSimulationProfile.TwoInOne;
                Debug.Assert(_d != null);
                if (o.ValueNull() || o.ArrayNull() ||
                   (o.valueType == RiverSimulationProfile.TwoInOne.ValueType.TwoDim && (o.Value2D().GetLength(0) != colCount || o.Value2D().GetLength(1) != rowCount)) ||
                   (o.valueType == RiverSimulationProfile.TwoInOne.ValueType.ThreeDim && (o.Value3D().GetLength(0) != colCount || o.Value3D().GetLength(1) != rowCount)))
                {   //rowCount : Q1 ~ Q5, colCount : J1 ~ J15
                    //_data = new RiverSimulationProfile.TwoInOne(colCount, rowCount);
                   _d.Create2D(colCount, rowCount);
                   _d.type = RiverSimulationProfile.TwoInOne.Type.UseValue;
                }
            }
            else if (formType == FormType.BottomBedLoadFlux)
            {
                _data = new RiverSimulationProfile.TwoInOne(d as RiverSimulationProfile.TwoInOne);
                _d = _data as RiverSimulationProfile.TwoInOne;
                Debug.Assert(_d != null);
                if (o.ValueNull() || o.ArrayNull())
                {   //rowCount : Q1 ~ Q5, colCount : J1 ~ J15
                    // _data = new RiverSimulationProfile.TwoInOne(p.boundaryTimeNumber, p.sedimentParticlesNumber, p.inputGrid.GetJ); //[T, K, J]
                    //_data = new RiverSimulationProfile.TwoInOne(p.sedimentParticlesNumber, p.inputGrid.GetJ, p.boundaryTimeNumber); //[K, J, T]
                    //_d.Create3D(p.sedimentParticlesNumber, p.inputGrid.GetJ, p.boundaryTimeNumber);
                    _d.Create3D(p.sedimentParticlesNumber, p.inputGrid.GetJ, rowCount);
                    _d.type = RiverSimulationProfile.TwoInOne.Type.UseValue;
               }
            }
            else if (formType == FormType.DepthAverageConcentration)
            {
                _data = new RiverSimulationProfile.TwoInOne(d as RiverSimulationProfile.TwoInOne);
                _d = _data as RiverSimulationProfile.TwoInOne;
                Debug.Assert(_d != null);
                if (o.ValueNull() || o.ArrayNull())
                {   //rowCount : Q1 ~ Q5, colCount : J1 ~ J15
                    _d.Create3D(p.sedimentParticlesNumber, p.inputGrid.GetJ, p.inputGrid.GetI);
                }
            }
        }