Ejemplo n.º 1
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;
            }
        }