Esempio n. 1
0
        private void deleteCellsButton2_Click(object sender, EventArgs e)
        {
            deleteCellsButton2.Visible = false;
            drawCellsButton2.Visible   = true;

            cellsDrawer.deleteCells();
            cellsDrawer = null;
        }
Esempio n. 2
0
        private void drawCellsButton2_Click(object sender, EventArgs e)
        {
            drawCellsButton2.Visible   = false;
            deleteCellsButton2.Visible = true;

            preparationCalculation(accuracyTextBox2, iterationTextBox2, multiplierRadioButton2,
                                   multiplierTextBox2, denominatorTextBox2);


            cellsDrawer = new CellsDrawer(application, body, bodyDrawer);


            if (loopRadioButton2.Checked)
            {
                int start, end, step;
                start = Convert.ToInt16(iterationTextBox2.Text);
                end   = Convert.ToInt16(rowTextBox2.Text);
                //Проверка шага
                if (columnTextBox2.Text == "" || columnTextBox2.Text == "0" || Convert.ToInt16(columnTextBox2.Text) < 0)
                {
                    //шаг по умолчанию ( 1 )
                    step = 1;
                }
                else
                { //заданный шаг
                    step = Convert.ToInt16(columnTextBox2.Text);
                }

                for (int i = start; i <= end; i = i + step)
                {
                    cells.SetIterationNumber(i);
                    cells.KCalculation();
                    cellsDrawer.SetCells(cells);
                    cellsDrawer.drawCells();
                    //задержка
                    Thread.Sleep(2500);
                    if (i != end)
                    {
                        cellsDrawer.deleteCells();
                    }
                }
            }
            else
            {
                cells.KCalculation();
                cellsDrawer.SetCells(cells); cellsDrawer.drawCells();
            }
        }
Esempio n. 3
0
        private void button6_Click(object sender, EventArgs e)
        {
            startResearch4.Visible = false; deleteResearch4.Visible = true;
            diagramButton.Visible  = true;

            dataStress       = null;  dataStress = new List <object[]>();
            dataDisplacement = null; dataDisplacement = new List <object[]>();

            if (!loopRadioButton2.Checked)
            {
                MessageBox.Show("Для циклического исследования необходимо выбрать \"Циклическое построение\"" +
                                " в разделе \"Вычисление и конструирование\"");
                return;
            }

            // подготовка объекта cells
            preparationCalculation(accuracyTextBox2, iterationTextBox2, multiplierRadioButton2,
                                   multiplierTextBox2, denominatorTextBox2);

            cellsDrawer = new CellsDrawer(application, body, bodyDrawer);

            int start, end, step;

            start = Convert.ToInt16(iterationTextBox2.Text); end = Convert.ToInt16(rowTextBox2.Text);
            //Проверка шага
            if (columnTextBox2.Text == "" || columnTextBox2.Text == "0" || Convert.ToInt16(columnTextBox2.Text) < 0)
            { //шаг по умолчанию ( 1 )
                step = 1;
            }
            else
            { //заданный шаг
                step = Convert.ToInt16(columnTextBox2.Text);
            }

            for (int i = start; i <= end; i = i + step)
            {
                //рисуем ячейки
                cells.SetIterationNumber(i); cells.KCalculation();
                cellsDrawer.SetCells(cells); cellsDrawer.drawCells();

                //создаём исследование
                researchLoop = new Research(application, bodyDrawer.GetFacesArray());
                researchLoop.CreateStudy();

                //прикладываем силы или фиксируем грани
                foreach (object[] act in action)
                {
                    if (act[0].Equals("fix"))
                    {
                        researchLoop.BodyParts_Select((int)act[1]);
                        researchLoop.FixFace();
                    }
                    else if (act[0].Equals("force"))
                    {
                        researchLoop.BodyParts_Select((int)act[1]);
                        researchLoop.CreateLoad((double)act[2]);
                    }
                }

                researchLoop.CreateMesh(); researchLoop.MaterialSet();
                researchLoop.RunAnalysis();

                double stress = researchLoop.GetStress(), displacement = researchLoop.GetDisplacement();

                object[] buff1 = new object[2]; //[кол-во ячеек, напряжение]
                buff1[0] = Math.Pow(2, i); buff1[1] = stress;
                dataStress.Add(buff1);

                object[] buff2 = new object[2]; //[кол-во ячеек, перемещение]
                buff2[0] = Math.Pow(2, i); buff2[1] = displacement;
                dataDisplacement.Add(buff2);

                //
                //
                //
                //
                //
                //Create ResearchResult AND Add in DataBase
                ResearchResult researchResult = new ResearchResult(detail.Id, logTextBox4.Text, i, stress, displacement);
                data.AddNewResearchResultAndUpdateDetails(researchResult);
                //Create ResearchResult AND Add in DataBase
                //
                //
                //
                //
                //


                logTextBox4.Text += Environment.NewLine;
                logTextBox4.Text += "Итерация: " + i.ToString(); logTextBox4.Text += Environment.NewLine;
                logTextBox4.Text += "Напряжение(ksi): " + stress.ToString(); logTextBox4.Text += Environment.NewLine;
                logTextBox4.Text += "Смещение(mk): " + displacement.ToString(); logTextBox4.Text += Environment.NewLine;

                // задержка
                Thread.Sleep(2500);

                // Очищаем
                researchLoop.deleteStudy(); researchLoop = null;
                application.swModel.ClearSelection2(true);

                if (i != end)
                {
                    cellsDrawer.deleteCells();
                }
            }
        }