Exemplo n.º 1
0
        private void Computing(GeometryOptions model)
        {
            prevOldArray = new double[param.finalArray.GetLength(0), param.finalArray.GetLength(1)];
            //для проверки на зацикливание
            param.tempOldArray         = new double[param.finalArray.GetLength(0), param.finalArray.GetLength(1)];
            param.sameNodeSimplexCount = new double[param.finalArray.GetLength(0), param.finalArray.GetLength(1)];

            param.oldArray = new double[param.finalArray.GetLength(0), param.finalArray.GetLength(1)];

            int kForNodes = 1;

            while (param.Step > param.getEps())
            {
                if (check.CheckArrayPoints(param.finalArray) == true)
                {
                    param.oldArray = prevOldArray;

                    break;
                }

                var newRow = new NewRow();

                int counterStart = newRow.CheckNewRow(param.finalArray, param.oldArray, param);

                var listOfComputedPoints = new ListOfComputedPoints();

                param.indexOfRestrictions = listOfComputedPoints
                                            .getListOfComputedPoints(param)
                                            .ToDictionary(k => k.Key, v => new Restrictions(v.Value.Filling, v.Value.Force));

                for (int i = counterStart; i < param.finalArray.GetLength(0); i++)
                {
                    var mainFunction = new MainFunction(model, material, add, file, finalReport, genReport,
                                                        rout, cmd, filesForVolume);
                    //выполнение главной функции
                    mainFunction.Compute(param.finalArray, i, kForNodes);

                    param.indexOfRestrictions.Add(i, new Restrictions(model.pctOfDieFilling, model.reactionForceToBlank));

                    kForNodes++;
                }

                var checker = new Checker();

                if (checker.CheckRestrictions(param, funcParam) == false)
                {
                    break;
                }

                //если в новая точка оказалась плохой, то возвращаемся к старому массиву
                //и данынм о заполняемости с индексам точек

                var checkNewCoord = new CheckNewCoordinate();

                if (param.arrayStatus == true && funcParam.Index == funcParam.getFactorsCount())
                {
                    checkNewCoord.CheckingNewCoordinate(param, funcParam);
                }
                else
                {
                    param.badPointsList.Clear();
                    param.badPointsList.Add(funcParam.Index,
                                            new Restrictions(funcParam.IndexFilling, funcParam.IndexForce));
                }

                #region Копия старого симплекса с плохой точкой

                prevOldArray = param.oldArray;

                param.oldIndexOfRestrictions = param.indexOfRestrictions.ToDictionary(k => k.Key,
                                                                                      v => new Restrictions(v.Value.Filling, v.Value.Force));
                param.oldArray = param.finalArray;

                #endregion

                var rewrire = new RewriteArray();

                rewrire.makeRewriteArray(param, funcParam, model);

                param.arrayStatus = true;

                param.Step = 0;
            }
            genReport.folderName = finalReport.finalReportFolder;

            finalReport.makeFinalReport(param.oldArray);

            var charts = new Charts(genReport);

            charts.DrawFrictionChart();
            charts.DrawRadiusChart();

            MessageBox.Show("Computing is complete!");
        }