Example #1
0
        private bool ConvertSedimentParticlesNumber()
        {
            if (!ControllerUtility.CheckConvertInt32(ref p.sedimentParticlesNumber, sedimentParticlesNumberTxt, "請輸入正確的泥砂顆粒數目!", ControllerUtility.CheckType.GreaterThanTwo))
            {
                return(false);
            }

            if (p.sedimentCompositionArray != null && p.sedimentCompositionArray.GetLength(0) != p.sedimentParticlesNumber)
            {
                MessageBox.Show("修改過泥砂顆粒數目,需重新輸入泥砂組成比例!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                p.sedimentCompositionArray = null;
            }

            if (p.sedimentParticleSize != null && p.sedimentParticleSize.GetLength(1) != p.sedimentParticlesNumber)
            {
                MessageBox.Show("修改過泥砂顆粒數目,需重新輸入泥砂粒徑!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                p.sedimentParticleSize = null;
            }

            if (!p.suspendedLoadDepthAvgConcentration.ArrayNull() && p.suspendedLoadDepthAvgConcentration.Array3D().GetLength(0) != p.sedimentParticlesNumber)
            {
                MessageBox.Show("修改過泥砂顆粒數目,需重新輸入懸浮載水深平均濃度!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                p.suspendedLoadDepthAvgConcentration.Clear();
            }
            return(true);
        }
 private bool ConvertVerticalVelocityDistributionNumber()
 {
     if (verticalVelocityDistributionTxt.Enabled && !ControllerUtility.CheckConvertInt32(ref p.verticalVelocityDistributionNumber, verticalVelocityDistributionTxt, "分層數目必須是大於2的整數!", ControllerUtility.CheckType.GreaterThanTwo))
     {
         return(false);
     }
     return(true);
 }
 private bool ConvertBoundaryTimeNumber()
 {
     if (boundaryTimeNumberTxt.Enabled && !ControllerUtility.CheckConvertInt32(ref p.boundaryTimeNumber, boundaryTimeNumberTxt, "邊界時間數目必須是大於1的整數!", ControllerUtility.CheckType.GreaterThanOne))
     {
         return(false);
     }
     return(true);
 }
 private bool DoConvert()
 {
     if (!ControllerUtility.CheckConvertInt32(ref p.maxIterationsNum, maxIterationsNumTxt, "請輸入正確的水理最大疊代次數!", ControllerUtility.CheckType.GreaterThanZero))
     {
         return(false);
     }
     return(true);
 }
        private bool ConvertStructureSetNumber()
        {
            RiverSimulationProfile p = RiverSimulationProfile.profile;
            int n = 0;

            if (p.tBarSet)
            {
                if (!ControllerUtility.CheckConvertInt32(ref n, tBarNumberTxt, "請輸入正確的丁壩數量!", ControllerUtility.CheckType.GreaterThanZero))
                {
                    return(false);
                }
            }
            else
            {
                n = 0;
            }
            p.tBarNumber = n;

            if (p.bridgePierSet)
            {
                if (!ControllerUtility.CheckConvertInt32(ref n, bridgePierNumberTxt, "請輸入正確的橋墩數量!", ControllerUtility.CheckType.GreaterThanZero))
                {
                    return(false);
                }
            }
            else
            {
                n = 0;
            }
            p.bridgePierNumber = n;

            if (p.groundsillWorkSet)
            {
                if (!ControllerUtility.CheckConvertInt32(ref n, groundsillWorkNumberTxt, "請輸入正確的固床工數量!", ControllerUtility.CheckType.GreaterThanZero))
                {
                    return(false);
                }
            }
            else
            {
                n = 0;
            }
            p.groundsillWorkNumber = n;

            if (p.sedimentationWeirSet)
            {
                if (!ControllerUtility.CheckConvertInt32(ref n, sedimentationWeirNumberTxt, "請輸入正確的攔河堰數量!", ControllerUtility.CheckType.GreaterThanZero))
                {
                    return(false);
                }
            }
            else
            {
                n = 0;
            }
            p.sedimentationWeirNumber = n;
            return(true);
        }
Example #6
0
        private bool ConvertVerticalLevelNumber()
        {
            if (!ControllerUtility.CheckConvertInt32(ref p.verticalLevelNumber, verticalLevelNumberTxt, "請輸入正確的垂向格網分層數目!", ControllerUtility.CheckType.GreaterThanTwo))
            {
                return(false);
            }

            if (p.levelProportion != null && p.levelProportion.Length != p.verticalLevelNumber)
            {
                MessageBox.Show("修改過垂向格網分層數目,需重新輸入分層比例!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                p.levelProportion = null;
            }
            return(true);
        }
        private bool ConvertDownVerticalDistributionNumber()
        {
            if (!ControllerUtility.CheckConvertInt32(ref p.boundaryDownVerticalDistributionNum, boundaryDownVerticalDistributionNumTxt, "請輸入正確的下游垂直濃度分布分層數目!", ControllerUtility.CheckType.GreaterThanTwo))
            {
                return(false);
            }

            if ((p.boundaryDownVerticalDistribution.type == RiverSimulationProfile.TwoInOne.Type.UseArray) && !p.boundaryDownVerticalDistribution.ArrayNull() && p.boundaryDownVerticalDistribution.Array2D().GetLength(1) != p.boundaryDownVerticalDistributionNum)
            {
                MessageBox.Show("修改過上游垂直濃度分布分層數目,需重新輸入下游垂直濃度分布比例!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                p.boundaryDownVerticalDistribution.Clear();
                p.boundaryDownVerticalDistribution.CreateDouble2D(0, 0);
            }
            return(true);
        }
Example #8
0
        private bool ConvertBottomLevelNumber()
        {
            if (!ControllerUtility.CheckConvertInt32(ref p.bottomLevelNumber, bottomLevelNumberTxt, "請輸入正確的底床分層數目!", ControllerUtility.CheckType.GreaterThanThree))
            {
                return(false);
            }

            if ((p.bottomLevelArray != null && p.bottomLevelArray.Length != p.bottomLevelNumber) ||
                (p.sedimentCompositionArray != null && p.sedimentCompositionArray.GetLength(1) != p.bottomLevelNumber))
            {
                MessageBox.Show("修改過底床分層數目,需重新輸入底床分層厚度和泥砂組成比例!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                p.bottomLevelArray         = null;
                p.sedimentCompositionArray = null;
            }
            return(true);
        }
        private bool ConvertValueParam()
        {
            if (!ControllerUtility.CheckConvertDouble(ref p.totalSimulationTime, totalSimulationTimeTxt, "請輸入正確的總模擬時間!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertDouble(ref p.timeSpan2d, timeSpan2dTxt, "請輸入正確的二維時間間距!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertInt32(ref p.outputFrequency, outputFrequencyTxt, "請輸入正確的輸出頻率!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertInt32(ref p.steppingTimesInVertVslcTime, steppingTimesInVertVslcTimeTxt, "請輸入正確的垂直方向計算時間步進次數!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertDouble(ref p.waterModelingConvergenceCriteria2d, waterModelingConvergenceCriteria2dTxt, "請輸入正確的二維水理收斂標準!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }
            if (!ControllerUtility.CheckConvertDouble(ref p.waterModelingConvergenceCriteria3d, waterModelingConvergenceCriteria3dTxt, "請輸入正確的三維水理收斂標準!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertDouble(ref p.minWaterDeoth, minWaterDeothTxt, "請輸入正確的最小水深!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }
            if (!ControllerUtility.CheckConvertDouble(ref p.viscosityFactorAdditionInMainstream, viscosityFactorAdditionInMainstreamTxt, "請輸入正確的主流方向黏滯係數加成比例!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }
            if (!ControllerUtility.CheckConvertDouble(ref p.viscosityFactorAdditionInSideDirection, viscosityFactorAdditionInSideDirectionTxt, "請輸入正確的側方向黏滯係數加成比例!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }
            return(true);
        }
Example #10
0
        private bool ConvertValueParam()
        {
            if (!ControllerUtility.CheckConvertDouble(ref p.waterTimeSpan, waterTimeSpanTxt, "請輸入正確的時間間距!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertInt32(ref p.waterOutputFrequency, waterOutputFrequencyTxt, "請輸入正確的輸出頻率!", ControllerUtility.CheckType.GreaterThanZero))
            {
                return(false);
            }

            if (p.diffusionFormulaUse)
            {
                if (p.diffusionFormula == RiverSimulationProfile.DiffusionFormulaType.None)
                {
                    MessageBox.Show("請選擇數值參數-擴散公式 !", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
            }

            if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInMainstream, diffusionBonusProportionalInMainstreamTxt, "請輸入正確的主流方向擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInSideflow, diffusionBonusProportionalInSideflowTxt, "請輸入正確的側方向擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
            {
                return(false);
            }
            if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInSurface, diffusionBonusProportionalInSurfaceTxt, "請輸入正確的水面擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
            {
                return(false);
            }

            if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInBottom, diffusionBonusProportionalInBottomTxt, "請輸入正確的底床擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
            {
                return(false);
            }


            return(true);
        }