public void AngleSec_Test()
        {
            SectionDefinition sec = new SectionDefinition(nameof(AngleSec_Test));

            sec.SolutionSettings = new SolutionSettings(0.01);
            sec.Contours.Add(new SectionContour(helper.CreateAngleShape(100, 100, 6, 8, 5, 8), false, defaultMat));
            sec.ShiftPoints(100, 25);
            _solver.Solve(sec);
            Compare(nameof(AngleSec_Test), sec);
        }
        public void CircleSecWithShift_Test()
        {
            SectionDefinition sec = new SectionDefinition(nameof(CircleSecWithShift_Test));

            sec.SolutionSettings = new SolutionSettings(0.01);
            sec.Contours.Add(new SectionContour(helper.CreateCircle(25, 64), false, defaultMat));
            sec.ShiftPoints(100, 50);
            _solver.Solve(sec);
            Compare(nameof(CircleSecWithShift_Test), sec);
        }
Beispiel #3
0
        public void Solve(SectionDefinition sec)
        {
            var mesh = sec.Triangulate();

            GeomAnalysis(sec, mesh);

            //# shift contours such that the origin is at the centroid
            sec.ShiftPoints(-sec.Output.SectionProperties.cx, -sec.Output.SectionProperties.cy);

            /*==============need to triangulate as the section may have been shifted.
             * WARNING: Triangulate is not thread-safe
             * */
            var mesh2 = sec.Triangulate();
            //===============
            var t1 = Task.Run(() =>
            {
                if (sec.SolutionSettings.RunPlasticAnalysis)
                {
                    new PlasticAnalysis().Solve(sec, mesh2);
                }
            });

            var t2 = Task.Run(() =>
            {
                if (sec.SolutionSettings.RunWarpingAnalysis)
                {
                    new WarpingAnalysis().Solve(sec, mesh2);
                }
            });

            t1.Wait();
            t2.Wait();

            // restore contours original location
            sec.ShiftPoints(sec.Output.SectionProperties.cx, sec.Output.SectionProperties.cy);
        }