Пример #1
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);
                }
            }
        }
Пример #2
0
        private void CreateData(object d)
        {
            RiverSimulationProfile.TwoInOne o  = d as RiverSimulationProfile.TwoInOne;
            RiverSimulationProfile.TwoInOne _d = null;
            switch (_inputFormType)
            {
            case InputFormType.TwoInOneDouble:
            case InputFormType.TwoInOneDoubleGreaterThanZero:
            case InputFormType.TwoInOneDoubleGreaterThanOrEqualZero:
                Debug.Assert(o != null);
                _data = new RiverSimulationProfile.TwoInOne(d as RiverSimulationProfile.TwoInOne);
                _d    = _data as RiverSimulationProfile.TwoInOne;
                Debug.Assert(_d != null);
                if (o.ValueNull() || o.ArrayNull())
                {
                    (_data as RiverSimulationProfile.TwoInOne).CreateDouble2D(colCount, rowCount);
                }
                if (_d.Array2D().GetLength(0) != colCount || _d.Array2D().GetLength(1) != rowCount)
                {
                    Debug.Assert(false);
                }
                break;

            case InputFormType.GenericDouble:
            case InputFormType.GenericDoubleGreaterThanZero:
            case InputFormType.GenericDoubleGreaterThanOrEqualZero:
            case InputFormType.BottomBedParticleSizeRatio:
                if (d == null)
                {
                    _data = new double[colCount, rowCount];
                }
                else
                {
                    _data = (double [, ])(d as double[, ]).Clone();
                }
                break;

            case InputFormType.SeabedThicknessForm:
                if (d == null)
                {
                    _data = new double[rowCount];
                }
                else
                {
                    _data = (double [])(d as double[]).Clone();
                }
                break;

            case InputFormType.SedimentCompositionRatioForm:
                if (d == null)
                {
                    _data = new double[colCount, rowCount];
                }
                else
                {
                    _data = (double [, ])(d as double[, ]).Clone();
                }
                break;

            case InputFormType.SeparateForm:
            case InputFormType.BoundaryTime:
                if (d == null)
                {
                    _data = new double[rowCount];
                }
                else
                {
                    _data = (double [])(d as double[]).Clone();
                }
                break;

            case InputFormType.VerticalVelocityDistributionForm:
                if (d == null)
                {
                    _data = new double[2, rowCount];
                }
                else
                {
                    _data = (double [, ])(d as double[, ]).Clone();
                }
                break;

            case InputFormType.BottomElevationForm:
                if (d == null)
                {
                    _data = new CoorPoint[colCount, rowCount];
                }
                else
                {
                    _data = (CoorPoint[, ])(d as CoorPoint[, ]).Clone();
                }
                break;

            case InputFormType.FlowConditionsSettingConstant:
            case InputFormType.FlowConditionsSettingVariable:
                Debug.Assert(o != null);
                _data = new RiverSimulationProfile.TwoInOne(d as RiverSimulationProfile.TwoInOne);
                _d    = _data as RiverSimulationProfile.TwoInOne;
                if (o.ValueNull() || o.ArrayNull())
                {       //rowCount : Q1 ~ Q5, colCount : J1 ~ J15
                    _d.CreateDouble2D(colCount, rowCount);
                    // (_data as RiverSimulationProfile.TwoInOne).dataValue = new double[colCount, rowCount];
                }
                break;
            }
        }
        private void CreateData(Object d)
        {
            RiverSimulationProfile p = RiverSimulationProfile.profile;

            RiverSimulationProfile.TwoInOne o  = d as RiverSimulationProfile.TwoInOne;
            RiverSimulationProfile.TwoInOne _d = null;
            //第1, 3種:亞臨界流、均一值/逐點給、定量流
            if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow &&
                p.IsConstantFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.TwoDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 2;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type1;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = null;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue2D(colCount, rowCount);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type3;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 2);
                    }
                }
            }
            //第2, 4種:亞臨界流、均一值/逐點給、變量流
            else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SubCriticalFlow &&
                     p.IsVariableFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.ThreeDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 1;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type2;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue3D(colCount, rowCount, 2);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type4;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 2);
                    }
                }
            }
            //第5, 7種:超臨界流、均一值/逐點給、定量流
            else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SuperCriticalFlow &&
                     p.IsConstantFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.TwoDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 3;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type5;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = null;
                    tabPage3.Parent = null;
                    tabPage1.Text   = "";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue2D(colCount, rowCount);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = 1;
                    _inputFormType  = InputFormType.Type7;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = tabControl;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";
                    tabPage3.Text   = "水位(m)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 3);
                    }
                }
            }
            //第6, 8種:超臨界流、均一值/逐點給、變量流
            else if (inputData.criticalFlowType == RiverSimulationProfile.CriticalFlowType.SuperCriticalFlow &&
                     p.IsVariableFlowType())
            {
                if (d == null)
                {
                    _data = new RiverSimulationProfile.TwoInOne(RiverSimulationProfile.TwoInOne.ValueType.ThreeDim, RiverSimulationProfile.TwoInOne.ArrayType.ThreeDim, RiverSimulationProfile.TwoInOne.Type.UseValue);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                else
                {
                    _data = new RiverSimulationProfile.TwoInOne(o);
                    _d    = _data as RiverSimulationProfile.TwoInOne;
                }
                if (_d.type == RiverSimulationProfile.TwoInOne.Type.UseValue)
                {
                    colCount        = 1;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type6;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = tabControl;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";
                    tabPage3.Text   = "水位(m)";

                    if (_d.ValueNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateValue3D(colCount, rowCount, 3);
                    }
                }
                else
                {
                    colCount        = inputData.sideFlowPoints.Count;
                    rowCount        = p.boundaryTime.Length;
                    _inputFormType  = InputFormType.Type8;
                    tabPage1.Parent = tabControl;
                    tabPage2.Parent = tabControl;
                    tabPage3.Parent = tabControl;
                    tabPage1.Text   = "主流方向流量(cms)";
                    tabPage2.Text   = "側方向流量(cms)";
                    tabPage3.Text   = "水位(m)";

                    if (_d.ArrayNull())
                    {
                        (_data as RiverSimulationProfile.TwoInOne).CreateArray3D(colCount, rowCount, 3);
                    }
                }
            }
        }