Exemplo n.º 1
0
        private void ResearchActions()
        {
            double stress, displacement;

            toolStripStatusLabel1.Text = String.Format("Исследование №{0}", stressLists.Count);
            toolStripProgressBar1.Increment(1);

            if (cells is CircleCells)
            {
                circleDrawer.SetCells((CircleCells)cells);
                FreeClass.cells = circleDrawer; circleDrawer.drawCells();
            }
            else if (cells is RectangleCells)
            {
                rectDrawer.SetCells((RectangleCells)cells);
                FreeClass.cells = rectDrawer; rectDrawer.drawCells();
            }
            else if (cells is TriangleCells)
            {
                triangleDrawer.SetCells((TriangleCells)cells);
                FreeClass.cells = triangleDrawer; triangleDrawer.drawCells();
            }
            else
            {
                cellsDraw.SetCells((AbstractRelationAngle)cells);
                FreeClass.cells = cellsDraw;
                cellsDraw.drawCells();
            }

            while (true)
            {
                //создаём исследование
                research = new Research(FreeClass.sldManager, FreeClass.bodyDrawer.GetFacesArray());
                research.CreateStudy();

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

                //research = new Research(FreeClass.sldManager, FreeClass.bodyDrawer.GetFacesArray());
                //research.CreateStudy();

                research.webDensity = Convert.ToDouble(textBox1.Text);
                research.tlCurrent  = Convert.ToDouble(textBox2.Text);
                research.CreateMesh();

                research.MaterialSet();
                research.RunAnalysis();

                nodeList = research.nodeLists;

                stress       = research.GetStress();
                displacement = research.GetDisplacement();

                if (stress != Convert.ToDouble(dataGridView1.Rows[0].Cells[1].Value))
                {
                    break;
                }
                else
                {
                    research.deleteStudy(); research = null;
                    FreeClass.sldManager.swModel.ClearSelection2(true);
                    textBox1.Text = (Convert.ToDouble(textBox1.Text) / 2).ToString();
                    textBox2.Text = (Convert.ToDouble(textBox2.Text) / 2).ToString();
                }
            }

            dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[1].Value = stress;       // Деформация
            dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[2].Value = displacement; // Смещение

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

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

            textBox1.Text = research.webDensity.ToString();
            textBox2.Text = research.tlCurrent.ToString();

            dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[10].Value = research.webDensity; // плотность сетки
            dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[11].Value = research.tlCurrent;  // tl

            //statusStrip1.pro
            FillingStressStrainMass();

            // Очищаем
            research.deleteStudy();
            research = null;
            FreeClass.sldManager.swModel.ClearSelection2(true);

            FreeClass.cells.deleteCells();
        }
Exemplo n.º 2
0
        private void drawButton_Click(object sender, EventArgs e)
        {
            if (cells == null)
            {
                MessageBox.Show("Расчёты не были произведены. Невозможно построить ячеистую структуру");
                return;
            }

            if (FreeClass.bodyDrawer == null)
            {
                MessageBox.Show("Тело не было построенно. Невозможно построить ячеистую структуру");
                return;
            }

            if (!cells.isAvailable())
            {
                MessageBox.Show("Невозможно построить структуру. Проверьте вычисления");
                return;
            }

            if (loopBuildRadioButton.Checked)
            {
                DialogResult dialogResult = MessageBox.Show("Выбрано циклическое построение. Будет выполненно только одно " +
                                                            "построение (самое последнее). Продолжить?",
                                                            "Предупреждение", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }
            }

            int angel = Convert.ToInt16(difflectAngleStartTextBox.Text);

            if (cells is CircleCells)
            {
                circleDrawer = new CircleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, 0);
                circleDrawer.SetCells((CircleCells)cells);
                FreeClass.cells = circleDrawer; circleDrawer.drawCells();
            }
            else if (cells is RectangleCells)
            {
                rectDrawer = new RectangleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer);
                rectDrawer.SetCells((RectangleCells)cells);
                FreeClass.cells = rectDrawer; rectDrawer.drawCells();
            }
            else if (cells is TriangleCells)
            {
                triangleDrawer = new TriangleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer);
                triangleDrawer.SetCells((TriangleCells)cells);
                FreeClass.cells = triangleDrawer; triangleDrawer.drawCells();
            }
            else
            {
                drawer = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, angel);
                drawer.SetCells((AbstractRelationAngle)cells);
                FreeClass.cells = drawer; drawer.drawCells();
            }

            /*if (drawer != null) { FreeClass.cells = drawer; drawer.drawCells(); }
             * else { FreeClass.cells = triangleDrawer; triangleDrawer.drawCells(); }
             * /*drawer = new NAngleCellsDrawer(FreeClass.sldManager, FreeClass.body, FreeClass.bodyDrawer, angel);
             * drawer.SetCells((AbstractRelationAngle)cells);*/

            //FreeClass.cells = drawer; drawer.drawCells();

            //FreeClass.cells = drawer;
            //drawer.SetCells(cells); drawer.drawCells();
        }